Method for encoding/decoding image and device therefor

An image compression method, and an image compression device for performing the image compression method. A method of compressing an image according to an embodiment of the invention comprises the steps of: performing sub-sampling by means of a DNN with respect to an image and thereby determining a compressed image; perform a prediction based on the compressed image and thereby determine a prediction signal; determining a residual signal based on the compressed image and the prediction signal; and generating a bit stream containing information relating to the residual signal, the DNN having a network structure determined by learning a subsampling process using information generated in an oversampling process. Also provided is an image recovery method for restoring a compressed image, which is compressed by an image compression method, using a DNN for oversampling, and an image recovery device. image to execute the image restoration process.