2

I have trained a regression network with caffe. I use "EuclideanLoss" layer in both the train and test phase. I have plotted these and the results look promising.

Now I want to deploy the model and use it. I know that if SoftmaxLoss is used, the final layer must be Softmax in the deploy file. What should this be in the case of Euclidean loss?

Shai
  • 111,146
  • 38
  • 238
  • 371
Cassie
  • 362
  • 4
  • 15

1 Answers1

2

For deploy you only need to discard the loss layer, in your case the "EuclideanLoss" layer. The output of your net is the "bottom" you fed the loss layer.

For "SoftmaxWithLoss" layer (and "SigmoidCrossEntropy") you need to replace the loss layer, since the loss layer includes an extra layer inside it (for computational reasons).

Shai
  • 111,146
  • 38
  • 238
  • 371
  • Thanks for the quick reply! I ran the deploy and I have a small question: is it possible for caffenet to adjust labels? I use floats of values 40, 80 and 120 (and expect data in between these values), but I get predictions of 6, 7, 8, 9 and 10. Could caffenet simply divide these values by 10? – Cassie Aug 18 '16 at 12:33
  • @user4039874 I don't suppose caffe is scaling data without you explicitly knowing about it/controling it. – Shai Aug 18 '16 at 12:39
  • Alright, then there is most likely a problem somewhere. Thanks for the help! – Cassie Aug 18 '16 at 12:58
  • @user4039874 Euclidean loss can be tricky sometimes, especially when large numbers are invloved. Try [smooth L1 loss](https://github.com/rbgirshick/caffe-fast-rcnn/blob/bcd9b4eadc7d8fbc433aeefd564e82ec63aaf69c/src/caffe/layers/smooth_L1_loss_layer.cu) – Shai Aug 18 '16 at 13:00