How can I try FCN example in Windows, VS2013 environment

181 views
Skip to first unread message

Kim Han-eol

unread,
Oct 10, 2016, 7:50:20 AM10/10/16
to Caffe Users
Hello, I have started to study caffe recently.
I tested on Windows + Visual Studio 2013 + CUDA 7.5 environment.
Based on studying on MNIST and ImageNet examples, I am able to test my learning model using AlexNet, GoogleNet, LeNet, and so forth.

However, there are problems when I am trying to implement FCN example,



The problems are as below:

1) I don't know how to make lmdb data set

From my knowledge, I made a list of training data which containing filename of images and label number.
and execute "convert_imageset.exe" to make them into lmdb format with appropriate size.

[train.txt]
f01.jpg 0
f02.jpg 0
g01.jpg 1
g02.jpg 1
...
(comment: there are 7 labels totally)
 
[command]
%CAFFE_BIN%convert_imageset.exe -resize_height=256 -resize_width=256 -shuffle %TRAIN_DATA_ROOT% %TRAIN_DATA_TXT% train_lmdb -gray=true


In this case, I am not sure that I can define lmdb like image classification examples.
I hope that there are appropriate way to define lmdb for FCN example.


2) I don't understand an error message

When I tried to run my training model using caffe.exe
In this experiment, I use a set of files as below:

[Training mode]

I changed num_output parameter of two last layers, "score_fr" and "upscore", from 21 to 7.
Number 7 means the number of labels of my model
Moreover, I replaced "data" layer with mine

name: "SkyNet"
layer {
 name: "sky"
 type: "Data"
 top: "data"
 top: "label"
 include {
   phase: TRAIN
 }
 data_param {
   source: "../data/train_lmdb"
   batch_size: 1
   backend: LMDB
 }
}
layer {
 name: "sky"
 type: "Data"
 top: "data"
 top: "label"
 include {
   phase: TEST
 }
 data_param {
   source: "../data/test_lmdb"
   batch_size: 1
   backend: LMDB
 }
}

...

layer {
 name: "score_fr"
 type: "Convolution"
 bottom: "fc7"
 top: "score_fr"
 param {
   lr_mult: 1
   decay_mult: 1
 }
 param {
   lr_mult: 2
   decay_mult: 0
 }
 convolution_param {
   num_output: 7
   pad: 0
   kernel_size: 1
 }
}
layer {
 name: "upscore"
 type: "Deconvolution"
 bottom: "score_fr"
 top: "upscore"
 param {
   lr_mult: 0
 }
 convolution_param {
   num_output: 7
   bias_term: false
   kernel_size: 64
   stride: 32
 }
}
layer {
 name: "score"
 type: "Crop"
 bottom: "upscore"
 bottom: "data"
 top: "score"
 crop_param {
   axis: 2
   offset: 19
 }
}
layer {
 name: "loss"
 type: "SoftmaxWithLoss"
 bottom: "score"
 bottom: "label"
 top: "loss"
 loss_param {
   ignore_label: 255
   normalize: false
 }
}


[Solver]

However, when I run a command %CAFFE_BIN%caffe.exe train -solver=solver.prototxt, 
I faced to an error as below:

I1010 20:26:53.162600 30112 layer_factory.hpp:77] Creating layer upscore
I1010 20:26:53.162600 30112 net.cpp:100] Creating Layer upscore
I1010 20:26:53.163599 30112 net.cpp:444] upscore <- score_fr
I1010 20:26:53.163599 30112 net.cpp:418] upscore -> upscore
I1010 20:26:53.163599 30112 net.cpp:150] Setting up upscore
I1010 20:26:53.163599 30112 net.cpp:157] Top shape: 1 7 64 64 (28672)
I1010 20:26:53.163599 30112 net.cpp:165] Memory required for data: 110689996
I1010 20:26:53.164597 30112 layer_factory.hpp:77] Creating layer score
I1010 20:26:53.164597 30112 net.cpp:100] Creating Layer score
I1010 20:26:53.164597 30112 net.cpp:444] score <- upscore
I1010 20:26:53.164597 30112 net.cpp:444] score <- data_sky_0_split_1
I1010 20:26:53.164597 30112 net.cpp:418] score -> score
I1010 20:26:53.164597 30112 net.cpp:150] Setting up score
I1010 20:26:53.164597 30112 net.cpp:157] Top shape: 1 7 21 21 (3087)
I1010 20:26:53.164597 30112 net.cpp:165] Memory required for data: 110702344
I1010 20:26:53.164597 30112 layer_factory.hpp:77] Creating layer loss
I1010 20:26:53.164597 30112 net.cpp:100] Creating Layer loss
I1010 20:26:53.164597 30112 net.cpp:444] loss <- score
I1010 20:26:53.165596 30112 net.cpp:444] loss <- label
I1010 20:26:53.165596 30112 net.cpp:418] loss -> loss
I1010 20:26:53.165596 30112 layer_factory.hpp:77] Creating layer loss
F1010 20:26:53.165596 30112 softmax_loss_layer.cpp:47] Check failed: outer_num_
* inner_num_ == bottom[1]->count() (441 vs. 1) Number of labels must match numbe
r of predictions; e.g., if softmax axis == 1 and prediction shape is (N, C, H, W
), label count (number of labels) must be N*H*W, with integer values in {0, 1, .
.., C-1}.
*** Check failure stack trace: ***



How can I solve these problems?
Please give me any comments.

Thanks in advance.


-Sky Kim

zhe...@gmail.com

unread,
Mar 2, 2017, 11:04:42 PM3/2/17
to Caffe Users
Hi Kim:
      Your problems have been solved? I also meet some problems when I try to duplicate this FCN experiment. What my problems are:
              1.python.exe stops work; 
              2.when I run the solve.py on jupyter notebook,it shows the error: caffe_device(int(sys.argv[1])):list index out of range. 
      Those problems have trouble me 1 week..........
      Do U succeed? Can U give me some suggestions about it or show me the tutorial about FCN in caffe on windows. I am a new man......
      Thanks.
                                                     ____zhengvh
                                  

在 2016年10月10日星期一 UTC+8下午7:50:20,Kim Han-eol写道:
Reply all
Reply to author
Forward
0 new messages