Encoding and decoding method and apparatus
An encoding method includes: first obtaining to-be-encoded data, and then inputting the to-be-encoded data into a first encoding network to obtain a target parameter; then constructing a second encoding network based on the target parameter; next inputting the to-be-encoded data into the second encoding network to obtain a first feature; and finally encoding the first feature to obtain an encoded bitstream.
1 . An encoding method, comprising:
obtaining, by an encoding device, to-be-encoded data;
inputting, by the encoding device, the to-be-encoded data into a first encoding network to obtain a target parameter, wherein the target parameter comprises a parameter weight for convolution and non-linear activation of a second encoding network;
constructing, by the encoding device, the second encoding network based on the target parameter;
inputting, by the encoding device, the to-be-encoded data into the second encoding network to obtain a first feature; and
encoding, by the encoding device, the first feature to obtain an encoded bitstream;
wherein the method further comprises:
rounding the first feature y to obtain an integer value ŷ of the first feature; and
performing probability estimation on the integer value ŷ of the first feature to obtain an estimated probability distribution p(ŷ) of the integer value ŷ of the first feature;
wherein p(ŷ) satisfies p(ŷ)=h(γ; θ h ), where h(ŷ; θ h ) is an entropy estimation network.
2 . The method according to claim 1 , wherein encoding the first feature comprises:
performing entropy encoding on the integer value of the first feature based on the estimated probability distribution of the integer value of the first feature to obtain the encoded bitstream.
3 . The method according to claim 1 , wherein the first encoding network comprises a convolution kernel generator.
4 . The method according to claim 1 , wherein the first feature is a three-dimensional feature map of the to-be-encoded data.
5 . The method according to claim 1 , wherein the first feature is y, and y satisfies y=g a (x; θ g ), where the target parameter is θ g , the to-be-encoded data is x, and the second encoding network is g a (x; θ g ).
6 . The method according to claim 1 , wherein the encoded data corresponds to a compressed version of the to-be-encoded data.
7 . The method according to claim 1 , wherein performing probability estimation on the integer value of the first feature is based on first information comprising at least one of context information or side information.
8 . The method according to claim 1 , further comprising:
inputting the integer value ŷ of the first feature into a decoding network g s (ŷ; φ) to obtain decoded data {circumflex over (x)}, where the decoded data {circumflex over (x)} satisfies {circumflex over (x)}=g s (ŷ; φ), where φ comprises one or more parameter weights for convolution and non-linear activation of the second encoding network.
9 . A decoding method, comprising:
obtaining, by a decoding device, a to-be-decoded bitstream;
decoding, by the decoding device, the to-be-decoded bitstream to obtain an integer value of a first feature, wherein the integer value of the first feature is for obtaining decoded data and a target parameter;
inputting, by the decoding device, the integer value of the first feature into a first decoding network to obtain the target parameter, wherein the target parameter comprises a parameter weight for convolution and non-linear activation of a second encoding network;
constructing, by the decoding device, the second decoding network based on the target parameter; and
inputting, by the decoding device, the integer value of the first feature into the second decoding network to obtain the decoded data,
wherein the method further comprises: performing probability estimation on an integer value ŷ of the first feature in the to-be-decoded bitstream to obtain an estimated probability distribution p(ŷ) of the integer value ŷ of the first feature, wherein p(ŷ) satisfies p(ŷ)=h(ŷ; θ h ), where h(ŷ; θ h ) is an entropy estimation network.
10 . The method according to claim 9 , wherein decoding the to-be-decoded bitstream comprises:
performing entropy decoding on the to-be-decoded bitstream based on the estimated probability distribution of the integer value of the first feature to obtain the integer value of the first feature.
11 . The method according to claim 9 , wherein the first feature is y, and y satisfies y=g a (x; θ g ), where the target parameter is θ g , the to-be-encoded data is x, and the second encoding network is g a (x; θ g ).
12 . The method according to claim 9 , wherein performing probability estimation on the integer value of the first feature in the to-be-decoded bitstream is based on first information comprising at least one of context information or side information.
13 . A non-transitory computer-readable medium having processor-executable instructions stored thereon for encoding, wherein the processor-executable instructions, when executed, facilitate performance of the following:
obtaining, by an encoding device, to-be-encoded data;
inputting, by the encoding device, the to-be-encoded data into a first encoding network to obtain a target parameter, wherein the target parameter comprises a parameter weight for convolution and non-linear activation of a second encoding network;
constructing, by the encoding device, the second encoding network based on the target parameter;
inputting, by the encoding device, the to-be-encoded data into the second encoding network to obtain a first feature; and
encoding, by the encoding device, the first feature to obtain an encoded bitstream;
wherein the processor-executable instructions, when executed, further facilitate performance of the following:
rounding the first feature y to obtain an integer value ŷ of the first feature; and
performing probability estimation on the integer value ŷ of the first feature to obtain an estimated probability distribution p(ŷ) of the integer value ŷ of the first feature;
wherein p(ŷ) satisfies p(ŷ)=h(ŷ; θ h ), where h(ŷ; θ h ) is an entropy estimation network.
14 . The non-transitory computer-readable medium according to claim 13 , wherein encoding the first feature comprises:
performing entropy encoding on the integer value of the first feature based on the estimated probability distribution of the integer value of the first feature to obtain the encoded bitstream.
15 . The non-transitory computer-readable medium according to claim 14 , wherein performing probability estimation on the integer value of the first feature is based on first information comprising at least one of context information or side information.
16 . The non-transitory computer-readable medium according to claim 13 , wherein the first encoding network comprises a convolution kernel generator.
17 . The non-transitory computer-readable medium according to claim 13 , wherein the first feature is a three-dimensional feature map of the to-be-encoded data.
18 . The non-transitory computer-readable medium according to claim 13 , wherein the first feature is y, and y satisfies y=g a (x; θ g ), where the target parameter is θ g , the to-be-encoded data is x, and the second encoding network is g a (x; θ g ).
19 . The non-transitory computer-readable medium according to claim 13 , wherein the processor-executable instructions, when executed, further facilitate performance of the following:
inputting the integer value ŷ of the first feature into a decoding network g s (ŷ; φ) to obtain decoded data {circumflex over (X)}, where the decoded data {circumflex over (x)} satisfies {circumflex over (x)}=g s (ŷ; φ), where φ comprises one or more parameter weights for convolution and non-linear activation of the second encoding network.
20 . The non-transitory computer-readable medium according to claim 13 , wherein the encoded data corresponds to a compressed version of the to-be-encoded data.