-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recommendations for compression of satellite images that will be read by machines (not humans) #1137
Comments
At the moment, the VarDCT mode is really optimized for 3-channel images for human perception. I'm not sure how well it works if you basically want to optimize for PSNR instead of human perception - you'd indeed need to disable the XYB color transform (so yes, One alternative you can try is to use Modular mode in a lossy way. This mode doesn't use the DCT at all but a modified Haar transform, and at least at the moment it doesn't do perceptual optimization but just optimizes for PSNR. That is, if you set uses_original_profile to true; when using XYB it will optimize for PSNR in XYB. You should consider compressing all 12 channels at a time, as extra channels. In the regular RGB or Grayscale channel you can either put 1 (or 3) of the channels if they make some kind of visual sense, or else you could put some kind of stub image there with some text or icon indicating "this is satellite imagery, you need a special viewer application for this!" so that people who accidentally open the file in a regular viewer know what to do. In principle, jxl can to some extent exploit correlations between the channels. In this case, you could set |
Ooh, thank you so much for this speedy and very informative reply! This is super-useful! Cool, I'll try the ideas you suggested, thank you. (I'm especially excited about using using lossless compression with all 12 channels in a single jxl file). Please may I ask one more quick question: Our dataset is a timeseries: The satellite takes an image every five minutes. Consecutive frames for a given channel are pretty darn similar. Would I get even better lossless compression if I put multiple timesteps of a single channel into a single JXL file? (Although, if I go that route, would I be better off using a video compression algorithm like AV1 lossless?) |
Video codecs are designed for time series so I expect them to be better at it than JXL, at least for lossy. For lossless, things are different, since inter-frame techniques tend to be less effective for lossless than for lossy. AV1 lossless is not very effective. If you're dealing with sensor data, a lot of the entropy is in the noise, which is different in every frame. While inter-frame coding tools like motion estimation (or just subtracting the previous frame from the current one, which is something JXL can do) will be able to significantly reduce the average amplitudes of the residuals, most of the entropy is in the least significant bits. The problem is that you end up combining two or more entropy sources, which can actually end up being worse than just using intra frame only. Note that residuals either have twice the data range (e.g. if frame values are in 0..255, then subtracting the previous frame leads to frame values in -255..255), or you have to do something like modulo arithmetic or XORing the bits but that introduces discontinuities or weirdness that will mess with prediction. If the data is not very noisy, like in synthetic data or data obtained with higher precision than what is actually stored, then it might help to subtract the previous frame from the current one. The libjxl encoder doesn't attempt to do anything other than just storing the frames as-is, though I think you can manually subtract the previous frame from the current one and tell the encoder to signal the |
ooh, this is really useful stuff, thank you! (The satellite's sensor is 10-bits-per-channel and we're experimenting with storing 8-bits-per-channel, so maybe there's some hope that our images will be fairly clean). I hope to run some compression experiments tomorrow. I'll report back. |
Is there a way to enable Modular mode in the |
Actually, sorry, nevermind! I did a few quick experiments at the command line using |
@JackKelly if you pass I'm intreseted to see how the satelite images would fare with lossy modular. |
Closing the issue to reduce the pile of open issues — feel free to reopen if there are any additional questions or action items related to this. |
Thank you so much for developing JPEG-XL! In my tests it looks like it'll be an excellent compression algorithm for satellite imagery. Thank you!
I appreciate that lossy JPEG-XL compression (like most lossy image compression) is designed primarily for compressing images that will be consumed by humans. As such, the algorithm preferentially throws away information that the human visual system won't notice is gone.
My question is: Which settings should I use when using JPEG-XL compression for monochrome satellite images that will be consumed by machines, not by humans? We want the numerical values of each pixel in the compressed image to remain as close as possible to the original numerical values.
Or is that simply out-of-scope for JPEG-XL?
Somes specific questions might be:
basic_info.uses_original_profile = JXL_TRUE
when doing lossy compression, if we want the numerical values in the compressed image to be as close as possible to the original values?cjxl -m -c 0 -q 90
), which is a 'stupid' (non-perceptual) form of lossy compression that treats the input numbers as just numbers without any perceptual interpretation." Is that the setting I should be using for satellite imagery? If so, how do we enable those settings using the C++ API instead ofcjxl
?Additional context
This is for work that I'm doing at my non-profit, Open Climate Fix, on using satellite images and machine learning to improve near-term predictions of solar electricity power generation (here's a good Wired article explaining our work). We use Zarr to save multiple TBytes of satellite imagery to disk. We're investigating using JPEG-XL as a "Zarr compressor" to compress each image chunk. We use the excellent imagecodecs library as a bridge between Python and JPEG-XL.
Related to issue #314
The text was updated successfully, but these errors were encountered: