I need SSIM as a loss function in my network, but my network has 2 outputs. I need to use SSIM for first output and cross-entropy
for the next. The loss function is a combination of them. However, I need to have a higher SSIM and lower cross-entropy
, so I think the combination of them isn't true. Another problem is that I could not find an implementation of SSIM in keras.
Tensorflow has tf.image.ssim
, but it accepts the image and I do not think I can use it in loss function, right? Could you please tell me what should I do? I am a beginner in keras and deep learning and I do not know how can I make SSIM as a custom loss function in keras.
Have a look here for SSIM loss in Keras. You can write a custom loss function and create SSIM loss for one prediction and cross-entropy for another. You can return a weighted sum of the two losses as the final loss.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With