0
$\begingroup$

Can anyone please help me understand how to use this SSIM function (https://www.tensorflow.org/api_docs/python/tf/image/ssim)? The filter_size parameter has a default value of 11, according to the documentation information, "the image sizes must be at least 11x11 because of the filter size." If I then use an image of size 8x11, how should I adjust this, and if applicable, other function parameters? Thanks.

$\endgroup$

1 Answer 1

1
$\begingroup$

The filter_size parameter in the tf.image.ssim function determines the size of the Gaussian filter used to smooth the image before calculating the SSIM.

Option 1: Adjust Filter Parameters

When using this function with an image smaller than 11x11 pixels (the default filter size), adjust the filter_size parameter to a smaller value. For an 8x11 image, a filter size of 3 or 5 would be appropriate.

While you don't necessarily need to adjust the filter_sigma parameter, it's worth experimenting with slightly smaller or larger values than the default (1.5) to see how it affects the results. Generally, a smaller filter size might work better with a slightly smaller sigma to avoid over-smoothing.

The best approach is to try different combinations of filter_size and filter_sigma to find the optimal values that balance accuracy and detail preservation for your specific image.

Option 2: Pad the Image

  • Padding to your image, bringing it to a size of at least 11x11 pixels.
  • Be aware that the added padding will be included in the SSIM calculation, potentially affecting the results.

Choosing the Best Option:

  • Simplicity: If you prefer a straightforward approach and don't mind the potential impact of padding on the SSIM results, padding the image is a good choice.

  • Control and Detail Preservation: If you want more control over the calculation and need to prioritize detail preservation in small images, adjusting the filter parameters might be a better option.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged .