0

Is there a loss function that calculates the euclidean distance between a prediction pixel and the nearest groundtruth pixel? Specifically, this is the location distance, not the intensity distance.

This would be on binary predictions and binary groundtruth.

user135237
  • 389
  • 1
  • 3
  • 12

1 Answers1

0

That's the root of mean square error (RMSE), for example:

model.compile(loss='rmse', optimizer='adagrad')

But it might be better to use mean squared error instead because of what is discussed here https://github.com/fchollet/keras/issues/1170:

i.e. Keras computes the loss batch by batch. To avoid inconsistencies I recommend using MSE instead.

As in:

model.compile(loss='rmse', optimizer='adagrad')

But since your data has only binary predictions I would advise the binary_crossentropy instead (https://keras.io/losses/#binary_crossentropy):

model.compile(loss='binary_crossentropy', optimizer='adagrad')
maz
  • 1,980
  • 14
  • 17
  • Sorry, I should clarify -- I meant to say the location distance, not the intensity distance. ie. if I have a prediciton pixel at (1,1) and a groundtruth pixel at (2,3), then the loss would be 2.24. – user135237 Jun 26 '17 at 05:48
  • Check that example with the root of mean squared error objective. – maz Jun 26 '17 at 05:53