I am training a FCNN using tensorflow with Keras and I currently use RMSE for validation as:
import tensorflow
from tensorflow.python.keras import backend
def rmse(y_true, y_pred):
return backend.sqrt(backend.mean(backend.square(y_pred - y_true)))
but instead of pixel by pixel comparison I would like to compute the RMSE incorporating neighboring pixels, meaning for each pixel the error would be calculated considering the same corresponding pixel in the y_true plus it's 3x3 or 5x5 neighboring pixels.
How do I implement this in keras?