guoyilin / caffe

some new implementation of caffe
Other
24 stars 8 forks source link

Test the triplet-loss accuracy! #1

Open getengqing opened 8 years ago

getengqing commented 8 years ago

Hello! I see your cifar-10 using the triplet loss replacing the softmax. If we want to test the triplet the accuracy, what can I do?

marker68 commented 8 years ago

First, in train_test.prototxt, add the following layer before the "sampling" layer.

layer {
  name: "accuracy"
  type: "Accuracy"
  bottom: "ip1"
  bottom: "label"
  top: "accuracy"
  include {
    phase: TEST
  }
}

Then in solver file, just change test interval to 100 and you will see test output,

# Carry out testing every training iterations.
test_interval: 100

I also set the batch_size's of both TRAIN and TEST to 100, and the output like as follows:

I0520 02:33:18.689152 22927 solver.cpp:454] Snapshotting to binary proto file examples/cifar10/triplet_loss/cifar10_quick_iter_5000.caffemodel
I0520 02:33:18.733136 22927 sgd_solver.cpp:273] Snapshotting solver state to binary proto file examples/cifar10/triplet_loss/cifar10_quick_iter_5000.solverstate
I0520 02:33:18.734175 22927 solver.cpp:337] Iteration 5000, Testing net (#0)
I0520 02:33:22.881525 22927 solver.cpp:404]     Test net output #0: accuracy = 0.0057
I0520 02:33:22.881626 22927 solver.cpp:404]     Test net output #1: loss = 0.299064 (* 1 = 0.299064 loss)
getengqing commented 8 years ago

Very very Thaks ! I have a try!

wuhuaming2006 commented 8 years ago

这个accuracy为什么这么小,caffe里的accuracy层直接用应该不对吧?