I train a convolutional neural network on compressed jpeg images. I noticed that my code takes pretty much the same amount of space in memory whether I use high quality jpeg images or the same jpeg images but compressed. I know that processing a jpeg image starts by decoding it, so my question is: does 'decoding' a jpeg image uncompresses it? In other words, does a compressed image regain its original size (in bytes) when decoded?
Image processing is mostly done on frames. The digital image frame is a rectangular raster of pixels, either in an RGB color space or a color space such as YCbCr. So, as you noticed, you can be sure that your compressed images are decoded to rectangular rasters in your application. Each encoded image file stores with its data the source bitmap size (width and height) and the source color space (pixel format and bitness). When decoding, these parameters are restored. So, irrespective of what lossless/lossy algorithms are used, the sizes (in bytes) of recovered raster rectangles are identical, if both lo-res and hi-res compressed image files are received by encoding the same source bitmap data.
EDIT: A "multiresolution" comment fairly corrects my answer, and there is the other explanation why the application may not allocate in CPU memory the entire memory occupied by a source raster: a decoder can use GPU memory. But OP notices that decompressed images take "pretty much the same amount of space in memory" irrespective of encoded image quality. Even with multiresolution, the application can decode the image to source dimensions. Also, code performance dependence on image quality is not part of the question.
Still, the "multiresolution" comment is absolutely necessary for completeness.
Decoding is sometimes another word for uncompressing. Compression used to be called "source coding" (in comparison to channel coding).
For images compressed at a single resolution, like in the baseline JPEG, finally-decompressed images have the same size as the original, as already answered. This might not be the case with multiresolution coder like JPEG2000.
Moreover, highly compressed images (ie with poorer quality) may be a bit faster to decode than high-quality ones, because there is less information to decode.
A jpeg compressed image contains (in byte) the upper bound for unique «information» that can reliably be extracted from that image. Decoding will increase the file size, but not knowledge about the true scene. Further, jpeg is «fairly good» but far from perfect in judging what details matters for a human viewer.
With that in mind, what about training on the compressed jpeg data? No need to expand a couple of dct coefficients to 8x8 pixels of «smooth» data?