photosynthesis-team / piq

Measures and metrics for image2image tasks. PyTorch.
Apache License 2.0
1.32k stars 114 forks source link

16 bit grayscale image support #373

Open narbhar opened 9 months ago

narbhar commented 9 months ago

Is your feature request related to a problem? Please describe. The image metrics implemented all seem to be restricted to consume 8 bit images as indicated by the data_range values. Could this be extended to native 16-bit grayscale images?

Describe the solution you'd like Extending computation to 16-bit grayscale images by amending the metric implementation

Describe alternatives you've considered The way to process 16 bit grayscale images alternatively would be to convert them into 8bit images although this would mean compressed images.

zakajd commented 5 months ago

Hi! Thanks for the proposal. Indeed, most of the metrics only work with 8 bit images, because that's how original authors implementation was written. It's actually not straightforward to port all metrics to higher bit depth, because many of them contain fine-tuned weights / parameters that were estimated with 8 bit RGB.

The easiest way of using the current code would be to manually specify the data range, e.g. set it to 65536 when passing 16 bit images.