[Feature Request]: tiff compression of saved predictions
Author: oceanitesCreated Sep 16, 2026Updated Sep 16, 2026
Labelsenhancement
I use nnUnet for prediction of 2D-EM images. They are very large with edge lengths of between 30-40.000 pixels. Therefore, the resulting prediction tif files are also huge (ca. 2GB), but very sparse. Using a simple compression like PACKBITS compresses these files to ca. 20-40MB.
- Is there already a flag to have nnunet write compressed tif outputs?
- If not, would you welcome a PR implementing this? Having a short look, I think that the 2D tif writes are done using scikit image, which doesn't allow setting tiff settings seperately https://github.com/MIC-DKFZ/nnUNet/blob/ded2aa3a4c81a9caae37054224d8ebac2d19a061/nnunetv2/imageio/natural_image_reader_writer.py#L65 Importing tifffile in that file (which is already used in the project) and having a switch based on "output_fname ends with tif/tiff" would be the most simple implementation. But also putting all of the 2D tif handling into a seperate ReaderWrite would be possible.
Source: MIC-DKFZ/nnUNet