A method in which a compressed image is reconstructed through a decoding process, the method comprising: obtaining a bitstream generated by encoding a first image, wherein the first image is generated by downsampling an original image by using a downsampling deep neural network, DNN; reconstructing a second image by decoding the bitstream, the second image corresponding to the first image; and obtaining a third image from the second image by using an upsampling deep neural network, DNN, based on upsampling target information indicating a conversion degree of resolution of the first image, wherein the downsampling DNN is trained based on minimizing a weighted sum of first lossy information, second lossy information and fourth lossy information, wherein the upsampling DNN is trained based on minimizing a weighted sum of third lossy information and the fourth lossy information, wherein the first lossy information indicates a norm of a difference between a spatially decreased image from an original image for training and a downsampled image from the original image for training by the downsampling DNN, wherein the spatially decreased image is generated by using structural characteristics of the original image for training, wherein the second lossy information indicates spatial complexity included in the downsampled image, wherein the third lossy information indicates L1-norm value corresponding to a difference between the original image for training and an upsampled image from the downsampled image by the upsampling DNN, and wherein the fourth lossy information indicates L2-norm value corresponding to a difference between the original image for training and the upsampled image. obtaining a bitstream generated by encoding a first image, wherein the first image is generated by downsampling an original image by using a downsampling deep neural network, DNN; reconstructing a second image by decoding the bitstream, the second image corresponding to the first image; and obtaining a third image from the second image by using an upsampling deep neural network, DNN, based on upsampling target information indicating a conversion degree of resolution of the first image, wherein the downsampling DNN is trained based on minimizing a weighted sum of first lossy information, second lossy information and fourth lossy information, wherein the upsampling DNN is trained based on minimizing a weighted sum of third lossy information and the fourth lossy information, wherein the first lossy information indicates a norm of a difference between a spatially decreased image from an original image for training and a downsampled image from the original image for training by the downsampling DNN, wherein the spatially decreased image is generated by using structural characteristics of the original image for training, wherein the second lossy information indicates spatial complexity included in the downsampled image, wherein the third lossy information indicates L1-norm value corresponding to a difference between the original image for training and an upsampled image from the downsampled image by the upsampling DNN, and wherein the fourth lossy information indicates L2-norm value corresponding to a difference between the original image for training and the upsampled image.