[docs] fix contrastive loss eq
authorEvan Shelhamer <shelhamer@imaginarynumber.net>
Thu, 30 Jul 2015 00:20:31 +0000 (17:20 -0700)
committerEvan Shelhamer <shelhamer@imaginarynumber.net>
Thu, 30 Jul 2015 00:20:31 +0000 (17:20 -0700)
make documented equation match the correct implementation of the
`max(margin - d, 0)^2` term in the loss. see #2321

include/caffe/loss_layers.hpp

index 86c3424..5282663 100644 (file)
@@ -128,9 +128,9 @@ class LossLayer : public Layer<Dtype> {
 /**
  * @brief Computes the contrastive loss @f$
  *          E = \frac{1}{2N} \sum\limits_{n=1}^N \left(y\right) d +
- *              \left(1-y\right) \max \left(margin-d, 0\right)
+ *              \left(1-y\right) \max \left(margin-d, 0\right)^2
  *          @f$ where @f$
- *          d = \left| \left| a_n - b_n \right| \right|_2^2 @f$. This can be
+ *          d = \left| \left| a_n - b_n \right| \right|_2 @f$. This can be
  *          used to train siamese networks.
  *
  * @param bottom input Blob vector (length 3)
@@ -144,9 +144,9 @@ class LossLayer : public Layer<Dtype> {
  *   -# @f$ (1 \times 1 \times 1 \times 1) @f$
  *      the computed contrastive loss: @f$ E =
  *          \frac{1}{2N} \sum\limits_{n=1}^N \left(y\right) d +
- *          \left(1-y\right) \max \left(margin-d, 0\right)
+ *          \left(1-y\right) \max \left(margin-d, 0\right)^2
  *          @f$ where @f$
- *          d = \left| \left| a_n - b_n \right| \right|_2^2 @f$.
+ *          d = \left| \left| a_n - b_n \right| \right|_2 @f$.
  * This can be used to train siamese networks.
  */
 template <typename Dtype>