Meaning of caffe.TEST or caffe.TRAIN in a trained net

455 views
Skip to first unread message

madapawa

unread,
Sep 29, 2017, 7:47:57 AM9/29/17
to Caffe Users
Hi:
I'm using a trained net and i'm obtaining different results if i change the caffe.TEST and caffe.TRAIN param in the caffe.Net() function:
net = caffe.Net('../models/deploy.prototxt', caffe.TEST, weights='../models/fcnsigmoidcrossentropy_iter_40000.caffemodel')

¿anyone knows what does?
I tried to go to the caffe.NET class's declaration but its a bit obscure.

Thanks in advance,
Madapawa

Przemek D

unread,
Sep 29, 2017, 9:00:22 AM9/29/17
to Caffe Users
This controls which network configuration are you loading: for training or testing. In a prototxt you can define different structures of your network - most notable use of this is excluding the Accuracy layer from training network. Read more here.

madapawa

unread,
Sep 29, 2017, 12:09:51 PM9/29/17
to Caffe Users
Yes indeed, but i'm using mi deploy net excluding
caffe.TEST and caffe.TRAIN phase.
the question is what changes if i write caffe.TRAIN instead of caffe.TEST when loading mi caffemodel.

Thanks and regards,
Madapawa
deploy.prototxt

Thomio Watanabe

unread,
Sep 30, 2017, 9:43:59 AM9/30/17
to Caffe Users
I guess caffe.TRAIN will run the backpropagation (backward computation).
It will compute the diffs and try to update the weights based on the error signal.
If you just wanna test the network you certainly don't need to run these steps.

Alex Ter-Sarkisov

unread,
Oct 2, 2017, 7:52:42 AM10/2/17
to Caffe Users
The difference is quite visible if you use batch normalization. During training phase,  use_global_stats is set to false, and during testing to true.  Have a look here:

Reply all
Reply to author
Forward
0 new messages