Caffe – Deprecation warning

Depending upon application, you may find that Caffe is showing following warning:

W1119 09:42:45.634932 11888 _caffe.cpp:139] DEPRECATION WARNING - deprecated use of Python interface
W1119 09:42:45.634954 11888 _caffe.cpp:140] Use this instead (with the named "weights" parameter):
W1119 09:42:45.634958 11888 _caffe.cpp:142] Net('deploy.prototxt', 1, weights='bvlc_reference_caffenet.caffemodel')
I1119 09:42:45.636143 11888 net.cpp:53] Initializing net from parameters:

At the time writing this text, Caffe ( sample applications are also showing this warning.

It happens because caffe.Net interface parameters are not passed correctly:

net = caffe.Net(prototxt_file, weight_file, caffe.TEST)

To fix this warning, parameters passed to caffe.Net needs shuffling

net = caffe.Net(prototxt_file, caffe.TEST, weights=weight_file)


Control Caffe console output in python

If you are using Caffe framework in Python, you will find that its prints a lot of information on console. You can control this output by setting up an environment variable in python application:

os.environ['GLOG_minloglevel'] = '2'
import caffe

Following levels are available:

- Debug => 0
- Info => 1
- Warnings => 2
- Errors => 3

NOTE: ‘GLOG_minloglevel‘ must be set before `import caffe` statement otherwise it will not work.

FYI: Caffe uses Google logging module ( for logging output.