ssim_loss#

ivy.ssim_loss(true, pred, out=None)[source]#

Calculate the Structural Similarity Index (SSIM) loss between two images.

Parameters:
  • true (A 4D image array of shape (batch_size, channels, height, width).) –

  • pred (A 4D image array of shape (batch_size, channels, height, width).) –

Return type:

Array

Returns:

ivy.Array: The SSIM loss measure similarity between the two images.

Examples

With ivy.Array input: >>> import ivy >>> x = ivy.ones((5, 3, 28, 28)) >>> y = ivy.zeros((5, 3, 28, 28)) >>> ivy.ssim_loss(x, y) ivy.array(0.99989986)