Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Caffe: Drawing CNN Net

Tags:

python

caffe

I used python code to draw Net defined in prototext file as:

 python draw_net.py test.protxt test.png

It fails to draw. It does not show any error but the results test.png file is white blank image file. Can anyone please help me in fixing it? It would really help to design new nets quickly.

like image 366
thetna Avatar asked Jun 23 '15 16:06

thetna


2 Answers

I had same problem. Based on this thread, I've managed to solve this by using older Proto syntax as suggested. For instance I had to do this:

Rename layers definition from layers to layer. All layer type rename by caffe documentation (or by example proto files) - i.e. layer type: CONVOLUTION to type: "Convolution", etc. Substitute newer syntax:

blobs_lr: 1         
blobs_lr: 1         
weight_decay: 1
weight_decay: 0

for

param {
    name: "conv1_w"
    lr_mult: 1              
    decay_mult: 1
}
param {
    name: "conv1_b"
    lr_mult: 2              
    decay_mult: 0
}

Now parsing and new-drawing works just fine. Refer to example .prototxt files in caffe package to get better intuition, how working proto syntax looks like.

like image 86
m1lhaus Avatar answered Oct 10 '22 19:10

m1lhaus


Somwhere in mid 2014, Caffe changed their proto definition for extensibility which causes this problem. As a result of this change, all the proto files have to be updated to the newer definition.

To do this, Caffe provides the following tools in the distribute/bin/ or .build_release/tools directory:

  1. upgrade_net_proto_binary.bin
  2. upgrade_net_proto_text.bin

Here is a simple example of how to convert your proto text file to a newer format:

./upgrade_net_proto_text.bin /path/to/older_proto_file /path/to/newer_ouput_proto_file
like image 38
Sandeep Raju Prabhakar Avatar answered Oct 10 '22 19:10

Sandeep Raju Prabhakar