Clarification on Euclidean Loss

74 views
Skip to first unread message

Guru Pradhan

unread,
Nov 24, 2015, 12:47:41 PM11/24/15
to Caffe Users
A very simple question, I am reading the documentation on Euclidean Loss http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1EuclideanLossLayer.html#details and wanted to understand something. Supposing that the output of your CNN is a 2x2 image and your loss function is Euclidean (a regression task), how exactly is the loss computed? For example, if my testing net has a batch size of 2 with sample output as below:

Network Output = array([[[2, 3],
                                    [4, 5]],

                                   [[6, 7],
                                   [8, 9]]])

Target = array([[[2, 4],
                       [5, 3]],

                       [[6, 8],
                       [9, 9]]])

Will the loss be = (1/(2*2)) * [((2-2)**2 + (3-4)**2 + (4-5)**2 + (5-3)**2) + ((6-6)**2 + (7-8)**2 + (8-9)**2 + (9-9)**2)]
                       = (1/4) * [(0 + 1 + 1 + 4) + (0 + 1 + 1 + 0)]
                       = (1/4)* [6 + 2]
                       = 2?


  
Reply all
Reply to author
Forward
0 new messages