photosynthesis-team / piq

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

Add `crop_border` parameter to all metrics (and possibly losses). #280

Closed zakajd closed 2 years ago

zakajd commented 2 years ago

Is your feature request related to a problem? Please describe. When evaluating performance of image2image models it's a common practice to not include border pixels into similarity computation. This is done, because on edges due to incorrect padding or model architecture appear strong artefacts, which do not influence overall image perceptual quality, but can decrease metric values.

Describe the solution you'd like Add a parameter like crop_border: int = 0 which crops an image boundary by integer number of pixels from all sides (top, bottom, left and right) before metric computation.

Describe alternatives you've considered Leave everything as is, so that anyone interested in this implements it by himself.

snk4tr commented 2 years ago

As discussed offline, all pre-processing that is not a part of any given metric should not be implemented within it.