When I test Deeplab-ver2 on PASCAL VOC 2012 dataset, the test net generates only log files of huge size with an output [see the below log] but it doesn't generate any .mat files in features/deeplab_largeFOV/val/fc8 folder. My network runs without any errors and does'nt terminate even when I left it running for more than 24 hours. Any help would be highly appreciated.
PS. I looked into the test_val.prototxt file generated by run_pascal.sh script and all paths and everything looks fine.
`Log file created at: 2016/09/20 12:57:35
Running on machine: CECS50P7PJ1
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
I0920 12:57:35.378067 12793 caffe.cpp:237] Use GPU with device ID 0
I0920 12:57:35.460089 12793 caffe.cpp:241] GPU device name: GeForce GTX TITAN X
I0920 12:57:35.947268 12793 net.cpp:49] Initializing net from parameters:
name: "deeplab_largeFOV"
state {
phase: TEST
}
layer {
name: "data"
type: "ImageSegData"
top: "data"
top: "label"
include {
phase: TEST
}
transform_param {
mirror: false
crop_size: 513
mean_value: 104.008
mean_value: 116.669
mean_value: 122.675
}
image_data_param {
source: "voc12/list/val.txt"
batch_size: 1
root_folder: "/home/aisha/VOCdevkit/VOC2012"
label_type: NONE
}
}
layer {
name: "conv1_1"
type: "Convolution"
bottom: "data"
top: "conv1_1"
convolution_param {
num_output: 64
pad: 1
kernel_size: 3
}
}
layer {
name: "relu1_1"
type: "ReLU"
bottom: "conv1_1"
top: "conv1_1"
}
layer {
name: "conv1_2"
type: "Convolution"
bottom: "conv1_1"
top: "conv1_2"
convolution_param {
num_output: 64
pad: 1
kernel_size: 3
}
}
layer {
name: "relu1_2"
type: "ReLU"
bottom: "conv1_2"
top: "conv1_2"
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1_2"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
pad: 1
}
}
layer {
name: "conv2_1"
type: "Convolution"
bottom: "pool1"
top: "conv2_1"
convolution_param {
num_output: 128
pad: 1
kernel_size: 3
}
}
layer {
name: "relu2_1"
type: "ReLU"
bottom: "conv2_1"
top: "conv2_1"
}
layer {
name: "conv2_2"
type: "Convolution"
bottom: "conv2_1"
top: "conv2_2"
convolution_param {
num_output: 128
pad: 1
kernel_size: 3
}
}
layer {
name: "relu2_2"
type: "ReLU"
bottom: "conv2_2"
top: "conv2_2"
}
layer {
name: "pool2"
type: "Pooling"
bottom: "conv2_2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
pad: 1
}
}
layer {
name: "conv3_1"
type: "Convolution"
bottom: "pool2"
top: "conv3_1"
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layer {
name: "relu3_1"
type: "ReLU"
bottom: "conv3_1"
top: "conv3_1"
}
layer {
name: "conv3_2"
type: "Convolution"
bottom: "conv3_1"
top: "conv3_2"
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layer {
name: "relu3_2"
type: "ReLU"
bottom: "conv3_2"
top: "conv3_2"
}
layer {
name: "conv3_3"
type: "Convolution"
bottom: "conv3_2"
top: "conv3_3"
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layer {
name: "relu3_3"
type: "ReLU"
bottom: "conv3_3"
top: "conv3_3"
}
layer {
name: "pool3"
type: "Pooling"
bottom: "conv3_3"
top: "pool3"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
pad: 1
}
}
layer {
name: "conv4_1"
type: "Convolution"
bottom: "pool3"
top: "conv4_1"
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layer {
name: "relu4_1"
type: "ReLU"
bottom: "conv4_1"
top: "conv4_1"
}
layer {
name: "conv4_2"
type: "Convolution"
bottom: "conv4_1"
top: "conv4_2"
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layer {
name: "relu4_2"
type: "ReLU"
bottom: "conv4_2"
top: "conv4_2"
}
layer {
name: "conv4_3"
type: "Convolution"
bottom: "conv4_2"
top: "conv4_3"
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layer {
name: "relu4_3"
type: "ReLU"
bottom: "conv4_3"
top: "conv4_3"
}
layer {
name: "pool4"
type: "Pooling"
bottom: "conv4_3"
top: "pool4"
pooling_param {
pool: MAX
kernel_size: 3
stride: 1
pad: 1
}
}
layer {
name: "conv5_1"
type: "Convolution"
bottom: "pool4"
top: "conv5_1"
convolution_param {
num_output: 512
pad: 2
kernel_size: 3
dilation: 2
}
}
layer {
name: "relu5_1"
type: "ReLU"
bottom: "conv5_1"
top: "conv5_1"
}
layer {
name: "conv5_2"
type: "Convolution"
bottom: "conv5_1"
top: "conv5_2"
convolution_param {
num_output: 512
pad: 2
kernel_size: 3
dilation: 2
}
}
layer {
name: "relu5_2"
type: "ReLU"
bottom: "conv5_2"
top: "conv5_2"
}
layer {
name: "conv5_3"
type: "Convolution"
bottom: "conv5_2"
top: "conv5_3"
convolution_param {
num_output: 512
pad: 2
kernel_size: 3
dilation: 2
}
}
layer {
name: "relu5_3"
type: "ReLU"
bottom: "conv5_3"
top: "conv5_3"
}
layer {
name: "pool5"
type: "Pooling"
bottom: "conv5_3"
top: "pool5"
pooling_param {
pool: MAX
kernel_size: 3
stride: 1
pad: 1
}
}
layer {
name: "pool5a"
type: "Pooling"
bottom: "pool5"
top: "pool5a"
pooling_param {
pool: AVE
kernel_size: 3
stride: 1
pad: 1
}
}
layer {
name: "fc6"
type: "Convolution"
bottom: "pool5a"
top: "fc6"
param {
name: "fc6_w"
lr_mult: 1
decay_mult: 1
}
param {
name: "fc6_b"
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 1024
pad: 12
kernel_size: 3
dilation: 12
}
}
layer {
name: "relu6"
type: "ReLU"
bottom: "fc6"
top: "fc6"
}
layer {
name: "drop6"
type: "Dropout"
bottom: "fc6"
top: "fc6"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc7"
type: "Convolution"
bottom: "fc6"
top: "fc7"
param {
name: "fc7_w"
lr_mult: 1
decay_mult: 1
}
param {
name: "fc7_b"
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 1024
kernel_size: 1
}
}
layer {
name: "relu7"
type: "ReLU"
bottom: "fc7"
top: "fc7"
}
layer {
name: "drop7"
type: "Dropout"
bottom: "fc7"
top: "fc7"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc8_voc12"
type: "Convolution"
bottom: "fc7"
top: "fc8_voc12"
param {
name: "fc8_w"
lr_mult: 10
decay_mult: 1
}
param {
name: "fc8_b"
lr_mult: 20
decay_mult: 0
}
convolution_param {
num_output: 21
kernel_size: 1
}
}
layer {
name: "fc8_interp"
type: "Interp"
bottom: "fc8_voc12"
top: "fc8_interp"
interp_param {
zoom_factor: 8
}
}
layer {
name: "fc8_mat"
type: "MatWrite"
include {
phase: TEST
}
mat_write_param {
prefix: "voc12/features/deeplab_largeFOV/val/fc8/"
source: "voc12/list/val_id.txt"
strip: 0
period: 1
}
}
layer {
name: "silence"
type: "Silence"
bottom: "label"
include {
phase: TEST
}
}
I0920 12:57:35.947854 12793 layer_factory.hpp:77] Creating layer data
I0920 12:57:35.947927 12793 net.cpp:106] Creating Layer data
I0920 12:57:35.947945 12793 net.cpp:411] data -> data
I0920 12:57:35.947999 12793 net.cpp:411] data -> label
I0920 12:57:35.948024 12793 net.cpp:411] data -> (automatic)
I0920 12:57:35.948052 12793 image_seg_data_layer.cpp:46] Opening file voc12/list/val.txt
I0920 12:57:35.950197 12793 image_seg_data_layer.cpp:68] A total of 1449 images.
I0920 12:57:35.971616 12793 image_seg_data_layer.cpp:137] output data size: 1,3,513,513
I0920 12:57:35.971668 12793 image_seg_data_layer.cpp:141] output label size: 1,1,513,513
`
I figured out the problem. My MatWrite layer in prototxt file didn't have any input from previous layers. I added line bottom: "fc8_interp" and now it works fine.
layer {
name: "fc8_mat"
type: "MatWrite"
bottom: "fc8_interp"
mat_write_param {
prefix: "${FEATURE_DIR}/${TEST_SET}/fc8/"
source: "${EXP}/list/${TEST_SET}_id.txt"
strip: 0
period: 1
}
include: { phase: TEST }
}
Here is the rest of the log file:
I0920 12:57:35.971684 12793 image_seg_data_layer.cpp:145] output data_dim size: 1,1,1,2
I0920 12:57:35.997220 12793 net.cpp:150] Setting up data
I0920 12:57:35.997285 12793 net.cpp:157] Top shape: 1 3 513 513 (789507)
I0920 12:57:35.997301 12793 net.cpp:157] Top shape: 1 1 513 513 (263169)
I0920 12:57:35.997314 12793 net.cpp:157] Top shape: 1 1 1 2 (2)
I0920 12:57:35.997325 12793 net.cpp:165] Memory required for data: 4210712
I0920 12:57:35.997349 12793 layer_factory.hpp:77] Creating layer conv1_1
I0920 12:57:35.997405 12793 net.cpp:106] Creating Layer conv1_1
I0920 12:57:35.997421 12793 net.cpp:454] conv1_1 <- data
I0920 12:57:35.997447 12793 net.cpp:411] conv1_1 -> conv1_1
I0920 12:57:35.999809 12793 net.cpp:150] Setting up conv1_1
I0920 12:57:35.999832 12793 net.cpp:157] Top shape: 1 64 513 513 (16842816)
I0920 12:57:35.999840 12793 net.cpp:165] Memory required for data: 71581976
I0920 12:57:35.999869 12793 layer_factory.hpp:77] Creating layer relu1_1
I0920 12:57:35.999887 12793 net.cpp:106] Creating Layer relu1_1
I0920 12:57:35.999897 12793 net.cpp:454] relu1_1 <- conv1_1
I0920 12:57:35.999908 12793 net.cpp:397] relu1_1 -> conv1_1 (in-place)
I0920 12:57:35.999977 12793 net.cpp:150] Setting up relu1_1
I0920 12:57:35.999989 12793 net.cpp:157] Top shape: 1 64 513 513 (16842816)
I0920 12:57:35.999995 12793 net.cpp:165] Memory required for data: 138953240
I0920 12:57:36.000003 12793 layer_factory.hpp:77] Creating layer conv1_2
I0920 12:57:36.000018 12793 net.cpp:106] Creating Layer conv1_2
I0920 12:57:36.000026 12793 net.cpp:454] conv1_2 <- conv1_1
I0920 12:57:36.000038 12793 net.cpp:411] conv1_2 -> conv1_2
I0920 12:57:36.002727 12793 net.cpp:150] Setting up conv1_2
I0920 12:57:36.002753 12793 net.cpp:157] Top shape: 1 64 513 513 (16842816)
I0920 12:57:36.002763 12793 net.cpp:165] Memory required for data: 206324504
I0920 12:57:36.002785 12793 layer_factory.hpp:77] Creating layer relu1_2
I0920 12:57:36.002810 12793 net.cpp:106] Creating Layer relu1_2
I0920 12:57:36.002821 12793 net.cpp:454] relu1_2 <- conv1_2
I0920 12:57:36.002835 12793 net.cpp:397] relu1_2 -> conv1_2 (in-place)
I0920 12:57:36.002851 12793 net.cpp:150] Setting up relu1_2
I0920 12:57:36.002866 12793 net.cpp:157] Top shape: 1 64 513 513 (16842816)
I0920 12:57:36.002876 12793 net.cpp:165] Memory required for data: 273695768
I0920 12:57:36.002887 12793 layer_factory.hpp:77] Creating layer pool1
I0920 12:57:36.002904 12793 net.cpp:106] Creating Layer pool1
I0920 12:57:36.002920 12793 net.cpp:454] pool1 <- conv1_2
I0920 12:57:36.002934 12793 net.cpp:411] pool1 -> pool1
I0920 12:57:36.003037 12793 net.cpp:150] Setting up pool1
I0920 12:57:36.003053 12793 net.cpp:157] Top shape: 1 64 257 257 (4227136)
I0920 12:57:36.003063 12793 net.cpp:165] Memory required for data: 290604312
I0920 12:57:36.003074 12793 layer_factory.hpp:77] Creating layer conv2_1
I0920 12:57:36.003092 12793 net.cpp:106] Creating Layer conv2_1
I0920 12:57:36.003101 12793 net.cpp:454] conv2_1 <- pool1
I0920 12:57:36.003121 12793 net.cpp:411] conv2_1 -> conv2_1
I0920 12:57:36.004442 12793 net.cpp:150] Setting up conv2_1
I0920 12:57:36.004462 12793 net.cpp:157] Top shape: 1 128 257 257 (8454272)
I0920 12:57:36.004472 12793 net.cpp:165] Memory required for data: 324421400
I0920 12:57:36.004490 12793 layer_factory.hpp:77] Creating layer relu2_1
I0920 12:57:36.004505 12793 net.cpp:106] Creating Layer relu2_1
I0920 12:57:36.004516 12793 net.cpp:454] relu2_1 <- conv2_1
I0920 12:57:36.004528 12793 net.cpp:397] relu2_1 -> conv2_1 (in-place)
I0920 12:57:36.004541 12793 net.cpp:150] Setting up relu2_1
I0920 12:57:36.004551 12793 net.cpp:157] Top shape: 1 128 257 257 (8454272)
I0920 12:57:36.004559 12793 net.cpp:165] Memory required for data: 358238488
I0920 12:57:36.004570 12793 layer_factory.hpp:77] Creating layer conv2_2
I0920 12:57:36.004586 12793 net.cpp:106] Creating Layer conv2_2
I0920 12:57:36.004595 12793 net.cpp:454] conv2_2 <- conv2_1
I0920 12:57:36.004608 12793 net.cpp:411] conv2_2 -> conv2_2
I0920 12:57:36.006110 12793 net.cpp:150] Setting up conv2_2
I0920 12:57:36.006130 12793 net.cpp:157] Top shape: 1 128 257 257 (8454272)
I0920 12:57:36.006141 12793 net.cpp:165] Memory required for data: 392055576
I0920 12:57:36.006157 12793 layer_factory.hpp:77] Creating layer relu2_2
I0920 12:57:36.006172 12793 net.cpp:106] Creating Layer relu2_2
I0920 12:57:36.006184 12793 net.cpp:454] relu2_2 <- conv2_2
I0920 12:57:36.006196 12793 net.cpp:397] relu2_2 -> conv2_2 (in-place)
I0920 12:57:36.006208 12793 net.cpp:150] Setting up relu2_2
I0920 12:57:36.006218 12793 net.cpp:157] Top shape: 1 128 257 257 (8454272)
I0920 12:57:36.006225 12793 net.cpp:165] Memory required for data: 425872664
I0920 12:57:36.006233 12793 layer_factory.hpp:77] Creating layer pool2
I0920 12:57:36.006245 12793 net.cpp:106] Creating Layer pool2
I0920 12:57:36.006253 12793 net.cpp:454] pool2 <- conv2_2
I0920 12:57:36.006264 12793 net.cpp:411] pool2 -> pool2
I0920 12:57:36.006325 12793 net.cpp:150] Setting up pool2
I0920 12:57:36.006337 12793 net.cpp:157] Top shape: 1 128 129 129 (2130048)
I0920 12:57:36.006345 12793 net.cpp:165] Memory required for data: 434392856
I0920 12:57:36.006352 12793 layer_factory.hpp:77] Creating layer conv3_1
I0920 12:57:36.006367 12793 net.cpp:106] Creating Layer conv3_1
I0920 12:57:36.006410 12793 net.cpp:454] conv3_1 <- pool2
I0920 12:57:36.006423 12793 net.cpp:411] conv3_1 -> conv3_1
I0920 12:57:36.008404 12793 net.cpp:150] Setting up conv3_1
I0920 12:57:36.008435 12793 net.cpp:157] Top shape: 1 256 129 129 (4260096)
I0920 12:57:36.008452 12793 net.cpp:165] Memory required for data: 451433240
I0920 12:57:36.008476 12793 layer_factory.hpp:77] Creating layer relu3_1
I0920 12:57:36.008492 12793 net.cpp:106] Creating Layer relu3_1
I0920 12:57:36.008502 12793 net.cpp:454] relu3_1 <- conv3_1
I0920 12:57:36.008517 12793 net.cpp:397] relu3_1 -> conv3_1 (in-place)
I0920 12:57:36.008533 12793 net.cpp:150] Setting up relu3_1
I0920 12:57:36.008543 12793 net.cpp:157] Top shape: 1 256 129 129 (4260096)
I0920 12:57:36.008551 12793 net.cpp:165] Memory required for data: 468473624
I0920 12:57:36.008560 12793 layer_factory.hpp:77] Creating layer conv3_2
I0920 12:57:36.008579 12793 net.cpp:106] Creating Layer conv3_2
I0920 12:57:36.008589 12793 net.cpp:454] conv3_2 <- conv3_1
I0920 12:57:36.008602 12793 net.cpp:411] conv3_2 -> conv3_2
I0920 12:57:36.011996 12793 net.cpp:150] Setting up conv3_2
I0920 12:57:36.012034 12793 net.cpp:157] Top shape: 1 256 129 129 (4260096)
I0920 12:57:36.012044 12793 net.cpp:165] Memory required for data: 485514008
I0920 12:57:36.012060 12793 layer_factory.hpp:77] Creating layer relu3_2
I0920 12:57:36.012079 12793 net.cpp:106] Creating Layer relu3_2
I0920 12:57:36.012089 12793 net.cpp:454] relu3_2 <- conv3_2
I0920 12:57:36.012102 12793 net.cpp:397] relu3_2 -> conv3_2 (in-place)
I0920 12:57:36.012120 12793 net.cpp:150] Setting up relu3_2
I0920 12:57:36.012130 12793 net.cpp:157] Top shape: 1 256 129 129 (4260096)
I0920 12:57:36.012137 12793 net.cpp:165] Memory required for data: 502554392
I0920 12:57:36.012145 12793 layer_factory.hpp:77] Creating layer conv3_3
I0920 12:57:36.012161 12793 net.cpp:106] Creating Layer conv3_3
I0920 12:57:36.012169 12793 net.cpp:454] conv3_3 <- conv3_2
I0920 12:57:36.012182 12793 net.cpp:411] conv3_3 -> conv3_3
I0920 12:57:36.015485 12793 net.cpp:150] Setting up conv3_3
I0920 12:57:36.015522 12793 net.cpp:157] Top shape: 1 256 129 129 (4260096)
I0920 12:57:36.015532 12793 net.cpp:165] Memory required for data: 519594776
I0920 12:57:36.015548 12793 layer_factory.hpp:77] Creating layer relu3_3
I0920 12:57:36.015584 12793 net.cpp:106] Creating Layer relu3_3
I0920 12:57:36.015596 12793 net.cpp:454] relu3_3 <- conv3_3
I0920 12:57:36.015611 12793 net.cpp:397] relu3_3 -> conv3_3 (in-place)
I0920 12:57:36.015630 12793 net.cpp:150] Setting up relu3_3
I0920 12:57:36.015641 12793 net.cpp:157] Top shape: 1 256 129 129 (4260096)
I0920 12:57:36.015651 12793 net.cpp:165] Memory required for data: 536635160
I0920 12:57:36.015664 12793 layer_factory.hpp:77] Creating layer pool3
I0920 12:57:36.015681 12793 net.cpp:106] Creating Layer pool3
I0920 12:57:36.015691 12793 net.cpp:454] pool3 <- conv3_3
I0920 12:57:36.015714 12793 net.cpp:411] pool3 -> pool3
I0920 12:57:36.015780 12793 net.cpp:150] Setting up pool3
I0920 12:57:36.015799 12793 net.cpp:157] Top shape: 1 256 65 65 (1081600)
I0920 12:57:36.015807 12793 net.cpp:165] Memory required for data: 540961560
I0920 12:57:36.015820 12793 layer_factory.hpp:77] Creating layer conv4_1
I0920 12:57:36.015841 12793 net.cpp:106] Creating Layer conv4_1
I0920 12:57:36.015853 12793 net.cpp:454] conv4_1 <- pool3
I0920 12:57:36.015868 12793 net.cpp:411] conv4_1 -> conv4_1
I0920 12:57:36.023669 12793 net.cpp:150] Setting up conv4_1
I0920 12:57:36.023726 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.023739 12793 net.cpp:165] Memory required for data: 549614360
I0920 12:57:36.023766 12793 layer_factory.hpp:77] Creating layer relu4_1
I0920 12:57:36.023789 12793 net.cpp:106] Creating Layer relu4_1
I0920 12:57:36.023802 12793 net.cpp:454] relu4_1 <- conv4_1
I0920 12:57:36.023825 12793 net.cpp:397] relu4_1 -> conv4_1 (in-place)
I0920 12:57:36.023850 12793 net.cpp:150] Setting up relu4_1
I0920 12:57:36.023866 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.023924 12793 net.cpp:165] Memory required for data: 558267160
I0920 12:57:36.023941 12793 layer_factory.hpp:77] Creating layer conv4_2
I0920 12:57:36.023962 12793 net.cpp:106] Creating Layer conv4_2
I0920 12:57:36.023973 12793 net.cpp:454] conv4_2 <- conv4_1
I0920 12:57:36.023996 12793 net.cpp:411] conv4_2 -> conv4_2
I0920 12:57:36.039988 12793 net.cpp:150] Setting up conv4_2
I0920 12:57:36.040055 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.040066 12793 net.cpp:165] Memory required for data: 566919960
I0920 12:57:36.040099 12793 layer_factory.hpp:77] Creating layer relu4_2
I0920 12:57:36.040125 12793 net.cpp:106] Creating Layer relu4_2
I0920 12:57:36.040136 12793 net.cpp:454] relu4_2 <- conv4_2
I0920 12:57:36.040153 12793 net.cpp:397] relu4_2 -> conv4_2 (in-place)
I0920 12:57:36.040172 12793 net.cpp:150] Setting up relu4_2
I0920 12:57:36.040182 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.040190 12793 net.cpp:165] Memory required for data: 575572760
I0920 12:57:36.040199 12793 layer_factory.hpp:77] Creating layer conv4_3
I0920 12:57:36.040236 12793 net.cpp:106] Creating Layer conv4_3
I0920 12:57:36.040251 12793 net.cpp:454] conv4_3 <- conv4_2
I0920 12:57:36.040277 12793 net.cpp:411] conv4_3 -> conv4_3
I0920 12:57:36.056390 12793 net.cpp:150] Setting up conv4_3
I0920 12:57:36.056465 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.056478 12793 net.cpp:165] Memory required for data: 584225560
I0920 12:57:36.056500 12793 layer_factory.hpp:77] Creating layer relu4_3
I0920 12:57:36.056524 12793 net.cpp:106] Creating Layer relu4_3
I0920 12:57:36.056540 12793 net.cpp:454] relu4_3 <- conv4_3
I0920 12:57:36.056557 12793 net.cpp:397] relu4_3 -> conv4_3 (in-place)
I0920 12:57:36.056579 12793 net.cpp:150] Setting up relu4_3
I0920 12:57:36.056591 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.056602 12793 net.cpp:165] Memory required for data: 592878360
I0920 12:57:36.056612 12793 layer_factory.hpp:77] Creating layer pool4
I0920 12:57:36.056628 12793 net.cpp:106] Creating Layer pool4
I0920 12:57:36.056639 12793 net.cpp:454] pool4 <- conv4_3
I0920 12:57:36.056654 12793 net.cpp:411] pool4 -> pool4
I0920 12:57:36.056733 12793 net.cpp:150] Setting up pool4
I0920 12:57:36.056751 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.056761 12793 net.cpp:165] Memory required for data: 601531160
I0920 12:57:36.056772 12793 layer_factory.hpp:77] Creating layer conv5_1
I0920 12:57:36.056793 12793 net.cpp:106] Creating Layer conv5_1
I0920 12:57:36.056804 12793 net.cpp:454] conv5_1 <- pool4
I0920 12:57:36.056818 12793 net.cpp:411] conv5_1 -> conv5_1
I0920 12:57:36.075142 12793 net.cpp:150] Setting up conv5_1
I0920 12:57:36.075218 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.075232 12793 net.cpp:165] Memory required for data: 610183960
I0920 12:57:36.075259 12793 layer_factory.hpp:77] Creating layer relu5_1
I0920 12:57:36.075287 12793 net.cpp:106] Creating Layer relu5_1
I0920 12:57:36.075302 12793 net.cpp:454] relu5_1 <- conv5_1
I0920 12:57:36.075322 12793 net.cpp:397] relu5_1 -> conv5_1 (in-place)
I0920 12:57:36.075348 12793 net.cpp:150] Setting up relu5_1
I0920 12:57:36.075361 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.075371 12793 net.cpp:165] Memory required for data: 618836760
I0920 12:57:36.075381 12793 layer_factory.hpp:77] Creating layer conv5_2
I0920 12:57:36.075403 12793 net.cpp:106] Creating Layer conv5_2
I0920 12:57:36.075415 12793 net.cpp:454] conv5_2 <- conv5_1
I0920 12:57:36.075430 12793 net.cpp:411] conv5_2 -> conv5_2
I0920 12:57:36.093725 12793 net.cpp:150] Setting up conv5_2
I0920 12:57:36.093797 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.093812 12793 net.cpp:165] Memory required for data: 627489560
I0920 12:57:36.093837 12793 layer_factory.hpp:77] Creating layer relu5_2
I0920 12:57:36.093863 12793 net.cpp:106] Creating Layer relu5_2
I0920 12:57:36.093881 12793 net.cpp:454] relu5_2 <- conv5_2
I0920 12:57:36.093902 12793 net.cpp:397] relu5_2 -> conv5_2 (in-place)
I0920 12:57:36.094008 12793 net.cpp:150] Setting up relu5_2
I0920 12:57:36.094022 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.094033 12793 net.cpp:165] Memory required for data: 636142360
I0920 12:57:36.094043 12793 layer_factory.hpp:77] Creating layer conv5_3
I0920 12:57:36.094066 12793 net.cpp:106] Creating Layer conv5_3
I0920 12:57:36.094077 12793 net.cpp:454] conv5_3 <- conv5_2
I0920 12:57:36.094094 12793 net.cpp:411] conv5_3 -> conv5_3
I0920 12:57:36.116233 12793 net.cpp:150] Setting up conv5_3
I0920 12:57:36.116317 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.116329 12793 net.cpp:165] Memory required for data: 644795160
I0920 12:57:36.116353 12793 layer_factory.hpp:77] Creating layer relu5_3
I0920 12:57:36.116377 12793 net.cpp:106] Creating Layer relu5_3
I0920 12:57:36.116392 12793 net.cpp:454] relu5_3 <- conv5_3
I0920 12:57:36.116410 12793 net.cpp:397] relu5_3 -> conv5_3 (in-place)
I0920 12:57:36.116432 12793 net.cpp:150] Setting up relu5_3
I0920 12:57:36.116444 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.116457 12793 net.cpp:165] Memory required for data: 653447960
I0920 12:57:36.116467 12793 layer_factory.hpp:77] Creating layer pool5
I0920 12:57:36.116499 12793 net.cpp:106] Creating Layer pool5
I0920 12:57:36.116518 12793 net.cpp:454] pool5 <- conv5_3
I0920 12:57:36.116539 12793 net.cpp:411] pool5 -> pool5
I0920 12:57:36.116619 12793 net.cpp:150] Setting up pool5
I0920 12:57:36.116634 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.116647 12793 net.cpp:165] Memory required for data: 662100760
I0920 12:57:36.116658 12793 layer_factory.hpp:77] Creating layer pool5a
I0920 12:57:36.116695 12793 net.cpp:106] Creating Layer pool5a
I0920 12:57:36.116706 12793 net.cpp:454] pool5a <- pool5
I0920 12:57:36.116720 12793 net.cpp:411] pool5a -> pool5a
I0920 12:57:36.116766 12793 net.cpp:150] Setting up pool5a
I0920 12:57:36.116781 12793 net.cpp:157] Top shape: 1 512 65 65 (2163200)
I0920 12:57:36.116788 12793 net.cpp:165] Memory required for data: 670753560
I0920 12:57:36.116804 12793 layer_factory.hpp:77] Creating layer fc6
I0920 12:57:36.116832 12793 net.cpp:106] Creating Layer fc6
I0920 12:57:36.116840 12793 net.cpp:454] fc6 <- pool5a
I0920 12:57:36.116852 12793 net.cpp:411] fc6 -> fc6
I0920 12:57:36.156725 12793 net.cpp:150] Setting up fc6
I0920 12:57:36.156795 12793 net.cpp:157] Top shape: 1 1024 65 65 (4326400)
I0920 12:57:36.156808 12793 net.cpp:165] Memory required for data: 688059160
I0920 12:57:36.156838 12793 layer_factory.hpp:77] Creating layer relu6
I0920 12:57:36.156864 12793 net.cpp:106] Creating Layer relu6
I0920 12:57:36.156878 12793 net.cpp:454] relu6 <- fc6
I0920 12:57:36.156900 12793 net.cpp:397] relu6 -> fc6 (in-place)
I0920 12:57:36.157707 12793 net.cpp:150] Setting up relu6
I0920 12:57:36.157738 12793 net.cpp:157] Top shape: 1 1024 65 65 (4326400)
I0920 12:57:36.157749 12793 net.cpp:165] Memory required for data: 705364760
I0920 12:57:36.157763 12793 layer_factory.hpp:77] Creating layer drop6
I0920 12:57:36.157820 12793 net.cpp:106] Creating Layer drop6
I0920 12:57:36.157836 12793 net.cpp:454] drop6 <- fc6
I0920 12:57:36.157852 12793 net.cpp:397] drop6 -> fc6 (in-place)
I0920 12:57:36.157995 12793 net.cpp:150] Setting up drop6
I0920 12:57:36.158010 12793 net.cpp:157] Top shape: 1 1024 65 65 (4326400)
I0920 12:57:36.158020 12793 net.cpp:165] Memory required for data: 722670360
I0920 12:57:36.158031 12793 layer_factory.hpp:77] Creating layer fc7
I0920 12:57:36.158071 12793 net.cpp:106] Creating Layer fc7
I0920 12:57:36.158084 12793 net.cpp:454] fc7 <- fc6
I0920 12:57:36.158099 12793 net.cpp:411] fc7 -> fc7
I0920 12:57:36.167103 12793 net.cpp:150] Setting up fc7
I0920 12:57:36.167170 12793 net.cpp:157] Top shape: 1 1024 65 65 (4326400)
I0920 12:57:36.167181 12793 net.cpp:165] Memory required for data: 739975960
I0920 12:57:36.167203 12793 layer_factory.hpp:77] Creating layer relu7
I0920 12:57:36.167227 12793 net.cpp:106] Creating Layer relu7
I0920 12:57:36.167240 12793 net.cpp:454] relu7 <- fc7
I0920 12:57:36.167269 12793 net.cpp:397] relu7 -> fc7 (in-place)
I0920 12:57:36.168635 12793 net.cpp:150] Setting up relu7
I0920 12:57:36.168705 12793 net.cpp:157] Top shape: 1 1024 65 65 (4326400)
I0920 12:57:36.168717 12793 net.cpp:165] Memory required for data: 757281560
I0920 12:57:36.168732 12793 layer_factory.hpp:77] Creating layer drop7
I0920 12:57:36.168759 12793 net.cpp:106] Creating Layer drop7
I0920 12:57:36.168773 12793 net.cpp:454] drop7 <- fc7
I0920 12:57:36.168793 12793 net.cpp:397] drop7 -> fc7 (in-place)
I0920 12:57:36.168932 12793 net.cpp:150] Setting up drop7
I0920 12:57:36.168947 12793 net.cpp:157] Top shape: 1 1024 65 65 (4326400)
I0920 12:57:36.168957 12793 net.cpp:165] Memory required for data: 774587160
I0920 12:57:36.168967 12793 layer_factory.hpp:77] Creating layer fc8_voc12
I0920 12:57:36.168993 12793 net.cpp:106] Creating Layer fc8_voc12
I0920 12:57:36.169016 12793 net.cpp:454] fc8_voc12 <- fc7
I0920 12:57:36.169034 12793 net.cpp:411] fc8_voc12 -> fc8_voc12
I0920 12:57:36.170449 12793 net.cpp:150] Setting up fc8_voc12
I0920 12:57:36.170548 12793 net.cpp:157] Top shape: 1 21 65 65 (88725)
I0920 12:57:36.170564 12793 net.cpp:165] Memory required for data: 774942060
I0920 12:57:36.170589 12793 layer_factory.hpp:77] Creating layer fc8_interp
I0920 12:57:36.170630 12793 net.cpp:106] Creating Layer fc8_interp
I0920 12:57:36.170644 12793 net.cpp:454] fc8_interp <- fc8_voc12
I0920 12:57:36.170668 12793 net.cpp:411] fc8_interp -> fc8_interp
I0920 12:57:36.170732 12793 net.cpp:150] Setting up fc8_interp
I0920 12:57:36.170747 12793 net.cpp:157] Top shape: 1 21 513 513 (5526549)
I0920 12:57:36.170760 12793 net.cpp:165] Memory required for data: 797048256
I0920 12:57:36.170770 12793 layer_factory.hpp:77] Creating layer fc8_mat
I0920 12:57:36.170790 12793 net.cpp:106] Creating Layer fc8_mat
I0920 12:57:36.173951 12793 mat_write_layer.cpp:30] MatWrite will save a maximum of 1449 files.
I0920 12:57:36.174042 12793 net.cpp:150] Setting up fc8_mat
I0920 12:57:36.174057 12793 net.cpp:165] Memory required for data: 797048256
I0920 12:57:36.174078 12793 layer_factory.hpp:77] Creating layer silence
I0920 12:57:36.174113 12793 net.cpp:106] Creating Layer silence
I0920 12:57:36.174132 12793 net.cpp:454] silence <- label
I0920 12:57:36.174155 12793 net.cpp:150] Setting up silence
I0920 12:57:36.174166 12793 net.cpp:165] Memory required for data: 797048256
I0920 12:57:36.174178 12793 net.cpp:228] silence does not need backward computation.
I0920 12:57:36.174191 12793 net.cpp:228] fc8_mat does not need backward computation.
I0920 12:57:36.174202 12793 net.cpp:228] fc8_interp does not need backward computation.
I0920 12:57:36.174214 12793 net.cpp:228] fc8_voc12 does not need backward computation.
I0920 12:57:36.174232 12793 net.cpp:228] drop7 does not need backward computation.
I0920 12:57:36.174244 12793 net.cpp:228] relu7 does not need backward computation.
I0920 12:57:36.174257 12793 net.cpp:228] fc7 does not need backward computation.
I0920 12:57:36.174273 12793 net.cpp:228] drop6 does not need backward computation.
I0920 12:57:36.174285 12793 net.cpp:228] relu6 does not need backward computation.
I0920 12:57:36.174299 12793 net.cpp:228] fc6 does not need backward computation.
I0920 12:57:36.174310 12793 net.cpp:228] pool5a does not need backward computation.
I0920 12:57:36.174326 12793 net.cpp:228] pool5 does not need backward computation.
I0920 12:57:36.174340 12793 net.cpp:228] relu5_3 does not need backward computation.
I0920 12:57:36.174352 12793 net.cpp:228] conv5_3 does not need backward computation.
I0920 12:57:36.174363 12793 net.cpp:228] relu5_2 does not need backward computation.
I0920 12:57:36.174376 12793 net.cpp:228] conv5_2 does not need backward computation.
I0920 12:57:36.174392 12793 net.cpp:228] relu5_1 does not need backward computation.
I0920 12:57:36.174406 12793 net.cpp:228] conv5_1 does not need backward computation.
I0920 12:57:36.174418 12793 net.cpp:228] pool4 does not need backward computation.
I0920 12:57:36.174432 12793 net.cpp:228] relu4_3 does not need backward computation.
I0920 12:57:36.174444 12793 net.cpp:228] conv4_3 does not need backward computation.
I0920 12:57:36.174568 12793 net.cpp:228] relu4_2 does not need backward computation.
I0920 12:57:36.174582 12793 net.cpp:228] conv4_2 does not need backward computation.
I0920 12:57:36.174593 12793 net.cpp:228] relu4_1 does not need backward computation.
I0920 12:57:36.174607 12793 net.cpp:228] conv4_1 does not need backward computation.
I0920 12:57:36.174618 12793 net.cpp:228] pool3 does not need backward computation.
I0920 12:57:36.174631 12793 net.cpp:228] relu3_3 does not need backward computation.
I0920 12:57:36.174643 12793 net.cpp:228] conv3_3 does not need backward computation.
I0920 12:57:36.174655 12793 net.cpp:228] relu3_2 does not need backward computation.
I0920 12:57:36.174666 12793 net.cpp:228] conv3_2 does not need backward computation.
I0920 12:57:36.174677 12793 net.cpp:228] relu3_1 does not need backward computation.
I0920 12:57:36.174690 12793 net.cpp:228] conv3_1 does not need backward computation.
I0920 12:57:36.174705 12793 net.cpp:228] pool2 does not need backward computation.
I0920 12:57:36.174716 12793 net.cpp:228] relu2_2 does not need backward computation.
I0920 12:57:36.174728 12793 net.cpp:228] conv2_2 does not need backward computation.
I0920 12:57:36.174741 12793 net.cpp:228] relu2_1 does not need backward computation.
I0920 12:57:36.174751 12793 net.cpp:228] conv2_1 does not need backward computation.
I0920 12:57:36.174763 12793 net.cpp:228] pool1 does not need backward computation.
I0920 12:57:36.174775 12793 net.cpp:228] relu1_2 does not need backward computation.
I0920 12:57:36.174787 12793 net.cpp:228] conv1_2 does not need backward computation.
I0920 12:57:36.174798 12793 net.cpp:228] relu1_1 does not need backward computation.
I0920 12:57:36.174820 12793 net.cpp:228] conv1_1 does not need backward computation.
I0920 12:57:36.174836 12793 net.cpp:228] data does not need backward computation.
I0920 12:57:36.174847 12793 net.cpp:270] This network produces output fc8_interp
I0920 12:57:36.174891 12793 net.cpp:283] Network initialization done.
I0920 12:57:36.685827 12793 upgrade_proto.cpp:51] Attempting to upgrade input file specified using deprecated V1LayerParameter: voc12/model/deeplab_largeFOV/train_iter_8000.caffemodel
I0920 12:57:37.033308 12793 upgrade_proto.cpp:59] Successfully upgraded file specified using deprecated V1LayerParameter
I0920 12:57:37.099608 12793 net.cpp:816] Ignoring source layer fc8_voc12_fc8_voc12_0_split
I0920 12:57:37.099673 12793 net.cpp:816] Ignoring source layer label_shrink
I0920 12:57:37.099685 12793 net.cpp:816] Ignoring source layer label_shrink_label_shrink_0_split
I0920 12:57:37.099701 12793 net.cpp:816] Ignoring source layer loss
I0920 12:57:37.099715 12793 net.cpp:816] Ignoring source layer accuracy
I0920 12:57:37.120515 12793 caffe.cpp:252] Running for 1449 iterations.
I0920 12:57:37.247792 12793 caffe.cpp:276] Batch 0, fc8_interp = 13.2258
I0920 12:57:37.247889 12793 caffe.cpp:276] Batch 0, fc8_interp = 13.3482
I0920 12:57:37.247908 12793 caffe.cpp:276] Batch 0, fc8_interp = 13.4705
I0920 12:57:37.247921 12793 caffe.cpp:276] Batch 0, fc8_interp = 13.5928
I0920 12:57:37.247934 12793 caffe.cpp:276] Batch 0, fc8_interp = 13.7151
I0920 12:57:37.247947 12793 caffe.cpp:276] Batch 0, fc8_interp = 13.8374
I0920 12:57:37.247967 12793 caffe.cpp:276] Batch 0, fc8_interp = 13.9597
I0920 12:57:37.247987 12793 caffe.cpp:276] Batch 0, fc8_interp = 14.0821
I0920 12:57:37.248010 12793 caffe.cpp:276] Batch 0, fc8_interp = 14.2044
I0920 12:57:37.248025 12793 caffe.cpp:276] Batch 0, fc8_interp = 14.2195
I0920 12:57:37.248037 12793 caffe.cpp:276] Batch 0, fc8_interp = 14.2346
Related
My intention is to speed up training process using Weights from previous trained models to similar layers in new model training.
Say I have two models 1st model and 2nd model.
1st model is train from scratch.
2nd model has two additional layers (conv_1_1 and relu_1_1) difference from 1st model. The rest of layers are same.
So I like to back-propagate only those layers they are different layers from 1st model and those same layers as 1st model are not retrained. Then intention is to speed up training the 2nd model.
For that what I do is I set lr_mult and decay_mult to 0.
But found out that training time of 2nd model is still as long as that of 1st model.
I think they are still multiplying with 0, so even though weights are not updated, computation is still there.
How can I skip backpropagation at all in those same layers?
I checked log file and found as
I0830 13:40:26.546422 10580 net.cpp:226] mbox_loss needs backward computation.
I0830 13:40:26.546432 10580 net.cpp:228] mbox_priorbox does not need backward computation.
I0830 13:40:26.546437 10580 net.cpp:226] mbox_conf needs backward computation.
I0830 13:40:26.546440 10580 net.cpp:226] mbox_loc needs backward computation.
I0830 13:40:26.546444 10580 net.cpp:228] conv_6_norm_mbox_priorbox does not need backward computation.
I0830 13:40:26.546448 10580 net.cpp:226] conv_6_norm_mbox_conf_flat needs backward computation.
I0830 13:40:26.546452 10580 net.cpp:226] conv_6_norm_mbox_conf_perm needs backward computation.
I0830 13:40:26.546455 10580 net.cpp:226] conv_6_norm_mbox_conf needs backward computation.
I0830 13:40:26.546460 10580 net.cpp:226] conv_6_norm_mbox_loc_flat needs backward computation.
I0830 13:40:26.546464 10580 net.cpp:226] conv_6_norm_mbox_loc_perm needs backward computation.
I0830 13:40:26.546468 10580 net.cpp:226] conv_6_norm_mbox_loc needs backward computation.
I0830 13:40:26.546471 10580 net.cpp:226] conv_6_norm_conv_6_norm_0_split needs backward computation.
I0830 13:40:26.546475 10580 net.cpp:226] conv_6_norm needs backward computation.
I0830 13:40:26.546478 10580 net.cpp:226] relu_6 needs backward computation.
I0830 13:40:26.546481 10580 net.cpp:226] conv_6 needs backward computation.
I0830 13:40:26.546485 10580 net.cpp:226] pool_5 needs backward computation.
I0830 13:40:26.546489 10580 net.cpp:226] relu_5 needs backward computation.
I0830 13:40:26.546492 10580 net.cpp:226] conv_5 needs backward computation.
I0830 13:40:26.546495 10580 net.cpp:226] pool_4 needs backward computation.
I0830 13:40:26.546499 10580 net.cpp:226] relu_4 needs backward computation.
I0830 13:40:26.546502 10580 net.cpp:226] conv_4 needs backward computation.
I0830 13:40:26.546505 10580 net.cpp:226] pool_3 needs backward computation.
I0830 13:40:26.546509 10580 net.cpp:226] relu_3 needs backward computation.
I0830 13:40:26.546512 10580 net.cpp:226] conv_3 needs backward computation.
I0830 13:40:26.546515 10580 net.cpp:226] pool_2 needs backward computation.
I0830 13:40:26.546519 10580 net.cpp:226] relu_2 needs backward computation.
I0830 13:40:26.546522 10580 net.cpp:226] conv_2 needs backward computation.
I0830 13:40:26.546525 10580 net.cpp:226] pool_1 needs backward computation.
I0830 13:40:26.546530 10580 net.cpp:226] relu_1_1 needs backward computation.
I0830 13:40:26.546532 10580 net.cpp:226] conv_1_1 needs backward computation.
I0830 13:40:26.546536 10580 net.cpp:228] relu_1 does not need backward computation.
I0830 13:40:26.546540 10580 net.cpp:228] conv_1 does not need backward computation.
I0830 13:40:26.546545 10580 net.cpp:228] data_data_0_split does not need backward computation.
I0830 13:40:26.546548 10580 net.cpp:228] data does not need backward computation.
So only conv_1 and relu_1 are not back propagated. But other layers are still back propagated.
How can I switch off back propagation in the following layers
conv_6_norm_conv_6_norm_0_split, conv_6_norm, relu_6, conv_6, pool_5, relu_5, conv_5, pool_4, relu_4, conv_4,pool_3, relu_3, conv_3, pool_2, relu_2, conv_2
Train.prototxt file is as follow.
name: "RegNet_train_0"
layer {
name: "data"
type: "AnnotatedData"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mirror: true
mean_value: 104.0
mean_value: 117.0
mean_value: 123.0
resize_param {
prob: 1.0
resize_mode: WARP
height: 480
width: 480
interp_mode: LINEAR
interp_mode: AREA
interp_mode: NEAREST
interp_mode: CUBIC
interp_mode: LANCZOS4
height_scale: 480
width_scale: 480
}
emit_constraint {
emit_type: CENTER
}
distort_param {
brightness_prob: 0.5
brightness_delta: 32.0
contrast_prob: 0.5
contrast_lower: 0.5
contrast_upper: 1.5
hue_prob: 0.5
hue_delta: 18.0
saturation_prob: 0.5
saturation_lower: 0.5
saturation_upper: 1.5
random_order_prob: 0.0
}
expand_param {
prob: 0.5
max_expand_ratio: 4.0
}
}
data_param {
source: "/home/coie/data/NumberPlate/lmdb/Nextan_trainval_lmdb"
batch_size: 16
backend: LMDB
}
annotated_data_param {
batch_sampler {
max_sample: 1
max_trials: 1
}
batch_sampler {
sampler {
min_scale: 0.300000011921
max_scale: 1.0
min_aspect_ratio: 0.5
max_aspect_ratio: 2.0
}
sample_constraint {
min_jaccard_overlap: 0.10000000149
}
max_sample: 1
max_trials: 50
}
batch_sampler {
sampler {
min_scale: 0.300000011921
max_scale: 1.0
min_aspect_ratio: 0.5
max_aspect_ratio: 2.0
}
sample_constraint {
min_jaccard_overlap: 0.300000011921
}
max_sample: 1
max_trials: 50
}
batch_sampler {
sampler {
min_scale: 0.300000011921
max_scale: 1.0
min_aspect_ratio: 0.5
max_aspect_ratio: 2.0
}
sample_constraint {
min_jaccard_overlap: 0.5
}
max_sample: 1
max_trials: 50
}
batch_sampler {
sampler {
min_scale: 0.300000011921
max_scale: 1.0
min_aspect_ratio: 0.5
max_aspect_ratio: 2.0
}
sample_constraint {
min_jaccard_overlap: 0.699999988079
}
max_sample: 1
max_trials: 50
}
batch_sampler {
sampler {
min_scale: 0.300000011921
max_scale: 1.0
min_aspect_ratio: 0.5
max_aspect_ratio: 2.0
}
sample_constraint {
min_jaccard_overlap: 0.899999976158
}
max_sample: 1
max_trials: 50
}
batch_sampler {
sampler {
min_scale: 0.300000011921
max_scale: 1.0
min_aspect_ratio: 0.5
max_aspect_ratio: 2.0
}
sample_constraint {
max_jaccard_overlap: 1.0
}
max_sample: 1
max_trials: 50
}
label_map_file: "/home/coie/data/NumberPlate/labelmap_NumberPlate.prototxt"
}
}
layer {
name: "conv_1"
type: "Convolution"
bottom: "data"
top: "conv_1"
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
convolution_param {
num_output: 8
pad: 1
kernel_size: 3
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "relu_1"
type: "ReLU"
bottom: "conv_1"
top: "conv_1"
}
layer {
name: "conv_1_1"
type: "Convolution"
bottom: "conv_1"
top: "conv_1_1"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 8
pad: 1
kernel_size: 3
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "relu_1_1"
type: "ReLU"
bottom: "conv_1_1"
top: "conv_1_1"
}
layer {
name: "pool_1"
type: "Pooling"
bottom: "conv_1_1"
top: "pool_1"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layer {
name: "conv_2"
type: "Convolution"
bottom: "pool_1"
top: "conv_2"
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
convolution_param {
num_output: 8
pad: 1
kernel_size: 3
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "relu_2"
type: "ReLU"
bottom: "conv_2"
top: "conv_2"
}
layer {
name: "pool_2"
type: "Pooling"
bottom: "conv_2"
top: "pool_2"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layer {
name: "conv_3"
type: "Convolution"
bottom: "pool_2"
top: "conv_3"
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
convolution_param {
num_output: 16
pad: 1
kernel_size: 3
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "relu_3"
type: "ReLU"
bottom: "conv_3"
top: "conv_3"
}
layer {
name: "pool_3"
type: "Pooling"
bottom: "conv_3"
top: "pool_3"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layer {
name: "conv_4"
type: "Convolution"
bottom: "pool_3"
top: "conv_4"
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
convolution_param {
num_output: 16
pad: 1
kernel_size: 3
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "relu_4"
type: "ReLU"
bottom: "conv_4"
top: "conv_4"
}
layer {
name: "pool_4"
type: "Pooling"
bottom: "conv_4"
top: "pool_4"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layer {
name: "conv_5"
type: "Convolution"
bottom: "pool_4"
top: "conv_5"
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
convolution_param {
num_output: 32
pad: 1
kernel_size: 3
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "relu_5"
type: "ReLU"
bottom: "conv_5"
top: "conv_5"
}
layer {
name: "pool_5"
type: "Pooling"
bottom: "conv_5"
top: "pool_5"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layer {
name: "conv_6"
type: "Convolution"
bottom: "pool_5"
top: "conv_6"
param {
lr_mult: 0.0
decay_mult: 0.0
}
param {
lr_mult: 0.0
decay_mult: 0.0
}
convolution_param {
num_output: 32
pad: 1
kernel_size: 3
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "relu_6"
type: "ReLU"
bottom: "conv_6"
top: "conv_6"
}
layer {
name: "conv_6_norm"
type: "Normalize"
bottom: "conv_6"
top: "conv_6_norm"
norm_param {
across_spatial: false
scale_filler {
type: "constant"
value: 20.0
}
channel_shared: false
}
}
layer {
name: "conv_6_norm_mbox_loc"
type: "Convolution"
bottom: "conv_6_norm"
top: "conv_6_norm_mbox_loc"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 12
pad: 1
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "conv_6_norm_mbox_loc_perm"
type: "Permute"
bottom: "conv_6_norm_mbox_loc"
top: "conv_6_norm_mbox_loc_perm"
permute_param {
order: 0
order: 2
order: 3
order: 1
}
}
layer {
name: "conv_6_norm_mbox_loc_flat"
type: "Flatten"
bottom: "conv_6_norm_mbox_loc_perm"
top: "conv_6_norm_mbox_loc_flat"
flatten_param {
axis: 1
}
}
layer {
name: "conv_6_norm_mbox_conf"
type: "Convolution"
bottom: "conv_6_norm"
top: "conv_6_norm_mbox_conf"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 6
pad: 1
kernel_size: 3
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "conv_6_norm_mbox_conf_perm"
type: "Permute"
bottom: "conv_6_norm_mbox_conf"
top: "conv_6_norm_mbox_conf_perm"
permute_param {
order: 0
order: 2
order: 3
order: 1
}
}
layer {
name: "conv_6_norm_mbox_conf_flat"
type: "Flatten"
bottom: "conv_6_norm_mbox_conf_perm"
top: "conv_6_norm_mbox_conf_flat"
flatten_param {
axis: 1
}
}
layer {
name: "conv_6_norm_mbox_priorbox"
type: "PriorBox"
bottom: "conv_6_norm"
bottom: "data"
top: "conv_6_norm_mbox_priorbox"
prior_box_param {
min_size: 25.6000003815
max_size: 48.0
aspect_ratio: 3.0
flip: false
clip: false
variance: 0.10000000149
variance: 0.10000000149
variance: 0.20000000298
variance: 0.20000000298
img_size: 480
step: 32.0
offset: 0.5
}
}
layer {
name: "mbox_loc"
type: "Concat"
bottom: "conv_6_norm_mbox_loc_flat"
top: "mbox_loc"
concat_param {
axis: 1
}
}
layer {
name: "mbox_conf"
type: "Concat"
bottom: "conv_6_norm_mbox_conf_flat"
top: "mbox_conf"
concat_param {
axis: 1
}
}
layer {
name: "mbox_priorbox"
type: "Concat"
bottom: "conv_6_norm_mbox_priorbox"
top: "mbox_priorbox"
concat_param {
axis: 2
}
}
layer {
name: "mbox_loss"
type: "MultiBoxLoss"
bottom: "mbox_loc"
bottom: "mbox_conf"
bottom: "mbox_priorbox"
bottom: "label"
top: "mbox_loss"
include {
phase: TRAIN
}
propagate_down: true
propagate_down: true
propagate_down: false
propagate_down: false
loss_param {
normalization: VALID
}
multibox_loss_param {
loc_loss_type: SMOOTH_L1
conf_loss_type: SOFTMAX
loc_weight: 1.0
num_classes: 2
share_location: true
match_type: PER_PREDICTION
overlap_threshold: 0.5
use_prior_for_matching: true
background_label_id: 1
use_difficult_gt: true
neg_pos_ratio: 3.0
neg_overlap: 0.5
code_type: CENTER_SIZE
ignore_cross_boundary_bbox: false
mining_type: MAX_NEGATIVE
}
}
Caffe library has param_need_backward, layer_need_backward_ and blob_need_backward_.
param_need_backward controls weights update and if lr_mult is set 0, array element for that layer in the param_need_backward array has false. Then inside weight is not updated in Conv_layer.cpp since param_propagate_down_ is false.
if (this->param_propagate_down_[0] || propagate_down[i]) {
for (int n = 0; n < this->num_; ++n) {
// gradient w.r.t. weight. Note that we will accumulate diffs.
if (this->param_propagate_down_[0]) {
this->weight_cpu_gemm(bottom_data + n * this->bottom_dim_,
top_diff + n * this->top_dim_, weight_diff);
}
// gradient w.r.t. bottom data, if necessary.
if (propagate_down[i]) {
this->backward_cpu_gemm(top_diff + n * this->top_dim_, weight,
bottom_diff + n * this->bottom_dim_);
}
}
}
layer_need_backward_ and blob_need_backward_ are for layers and they are controlled in Net init according to Network architecture.
I have trained a model using Caffe and NVIDIA's DIGITS. Testing it on DIGITS for the following images results in the following:
When I download the model from DIGITS I get a snapshot_iter_24240.caffemodel along with deploy.prototxt, mean.binaryproto and labels.txt. (and solver.prototxt and train_val.prototxt which I think is not relevant)
I use coremltools to convert the caffemodel to mlmodel running the following:
import coremltools
# Convert a caffe model to a classifier in Core ML
coreml_model = coremltools.converters.caffe.convert(('snapshot_iter_24240.caffemodel',
'deploy.prototxt',
'mean.binaryproto'),
image_input_names = 'data',
class_labels = 'labels.txt')
# Now save the model
coreml_model.save('food.mlmodel')
The code outputs the following:
(/anaconda/envs/coreml) bash-3.2$ python run.py
================= Starting Conversion from Caffe to CoreML ======================
Layer 0: Type: 'Input', Name: 'input'. Output(s): 'data'.
Ignoring batch size and retaining only the trailing 3 dimensions for conversion.
Layer 1: Type: 'Convolution', Name: 'conv1'. Input(s): 'data'. Output(s): 'conv1'.
Layer 2: Type: 'ReLU', Name: 'relu1'. Input(s): 'conv1'. Output(s): 'conv1'.
Layer 3: Type: 'LRN', Name: 'norm1'. Input(s): 'conv1'. Output(s): 'norm1'.
Layer 4: Type: 'Pooling', Name: 'pool1'. Input(s): 'norm1'. Output(s): 'pool1'.
Layer 5: Type: 'Convolution', Name: 'conv2'. Input(s): 'pool1'. Output(s): 'conv2'.
Layer 6: Type: 'ReLU', Name: 'relu2'. Input(s): 'conv2'. Output(s): 'conv2'.
Layer 7: Type: 'LRN', Name: 'norm2'. Input(s): 'conv2'. Output(s): 'norm2'.
Layer 8: Type: 'Pooling', Name: 'pool2'. Input(s): 'norm2'. Output(s): 'pool2'.
Layer 9: Type: 'Convolution', Name: 'conv3'. Input(s): 'pool2'. Output(s): 'conv3'.
Layer 10: Type: 'ReLU', Name: 'relu3'. Input(s): 'conv3'. Output(s): 'conv3'.
Layer 11: Type: 'Convolution', Name: 'conv4'. Input(s): 'conv3'. Output(s): 'conv4'.
Layer 12: Type: 'ReLU', Name: 'relu4'. Input(s): 'conv4'. Output(s): 'conv4'.
Layer 13: Type: 'Convolution', Name: 'conv5'. Input(s): 'conv4'. Output(s): 'conv5'.
Layer 14: Type: 'ReLU', Name: 'relu5'. Input(s): 'conv5'. Output(s): 'conv5'.
Layer 15: Type: 'Pooling', Name: 'pool5'. Input(s): 'conv5'. Output(s): 'pool5'.
Layer 16: Type: 'InnerProduct', Name: 'fc6'. Input(s): 'pool5'. Output(s): 'fc6'.
Layer 17: Type: 'ReLU', Name: 'relu6'. Input(s): 'fc6'. Output(s): 'fc6'.
Layer 18: Type: 'Dropout', Name: 'drop6'. Input(s): 'fc6'. Output(s): 'fc6'.
WARNING: Skipping training related layer 'drop6' of type 'Dropout'.
Layer 19: Type: 'InnerProduct', Name: 'fc7'. Input(s): 'fc6'. Output(s): 'fc7'.
Layer 20: Type: 'ReLU', Name: 'relu7'. Input(s): 'fc7'. Output(s): 'fc7'.
Layer 21: Type: 'Dropout', Name: 'drop7'. Input(s): 'fc7'. Output(s): 'fc7'.
WARNING: Skipping training related layer 'drop7' of type 'Dropout'.
Layer 22: Type: 'InnerProduct', Name: 'fc8_food'. Input(s): 'fc7'. Output(s): 'fc8_food'.
Layer 23: Type: 'Softmax', Name: 'prob'. Input(s): 'fc8_food'. Output(s): 'prob'.
================= Summary of the conversion: ===================================
Detected input(s) and shape(s) (ignoring batch size):
'data' : 3, 227, 227
Size of mean image: (H,W) = (256, 256) is greater than input image size: (H,W) = (227, 227). Mean image will be center cropped to match the input image dimensions.
Network Input name(s): 'data'.
Network Output name(s): 'prob'.
(/anaconda/envs/coreml) bash-3.2$
After about 45 seconds food.mlmodel is generated. I import it into an iOS project using Xcode Version 9.0 beta 3 (9M174d) and run the following the code in a single view iOS project.
//
// ViewController.swift
// SeeFood
//
// Created by Reza Shirazian on 7/23/17.
// Copyright © 2017 Reza Shirazian. All rights reserved.
//
import UIKit
import CoreML
import Vision
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
var images = [CIImage]()
// guard let ciImage = CIImage(image: #imageLiteral(resourceName: "pizza")) else {
// fatalError("couldn't convert UIImage to CIImage")
// }
images.append(CIImage(image: #imageLiteral(resourceName: "pizza"))!)
images.append(CIImage(image: #imageLiteral(resourceName: "spaghetti"))!)
images.append(CIImage(image: #imageLiteral(resourceName: "burger"))!)
images.append(CIImage(image: #imageLiteral(resourceName: "sushi"))!)
images.forEach{detectScene(image: $0)}
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func detectScene(image: CIImage) {
guard let model = try? VNCoreMLModel(for: food().model) else {
fatalError()
}
// Create a Vision request with completion handler
let request = VNCoreMLRequest(model: model) { [weak self] request, error in
guard let results = request.results as? [VNClassificationObservation],
let topResult = results.first else {
fatalError("unexpected result type from VNCoreMLRequest")
}
// Update UI on main queue
//let article = (self?.vowels.contains(topResult.identifier.first!))! ? "an" : "a"
DispatchQueue.main.async { [weak self] in
results.forEach({ (result) in
if Int(result.confidence * 100) > 1 {
print("\(Int(result.confidence * 100))% it's \(result.identifier)")
}
})
print("********************************")
}
}
let handler = VNImageRequestHandler(ciImage: image)
DispatchQueue.global(qos: .userInteractive).async {
do {
try handler.perform([request])
} catch {
print(error)
}
}
}
}
which outputs the following:
22% it's cup cakes
8% it's ice cream
5% it's falafel
5% it's macarons
3% it's churros
3% it's gyoza
3% it's donuts
2% it's tacos
2% it's cannoli
********************************
35% it's cup cakes
22% it's frozen yogurt
8% it's chocolate cake
7% it's chocolate mousse
6% it's ice cream
2% it's donuts
********************************
38% it's gyoza
7% it's falafel
6% it's tacos
4% it's hamburger
3% it's oysters
2% it's peking duck
2% it's hot dog
2% it's baby back ribs
2% it's cannoli
********************************
7% it's hamburger
6% it's pork chop
6% it's steak
6% it's peking duck
5% it's pho
5% it's prime rib
5% it's baby back ribs
4% it's mussels
4% it's grilled salmon
2% it's filet mignon
2% it's foie gras
2% it's pulled pork sandwich
********************************
this is completely off and inconsistent with how the model was performing on DIGITS. I'm not sure what I'm doing wrong or if I've missed a step. I tried creating the model without mean.binaryproto but that made no difference.
If it helps here is the deploy.prototxt
input: "data"
input_shape {
dim: 1
dim: 3
dim: 227
dim: 227
}
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 96
kernel_size: 11
stride: 4
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "relu1"
type: "ReLU"
bottom: "conv1"
top: "conv1"
}
layer {
name: "norm1"
type: "LRN"
bottom: "conv1"
top: "norm1"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "pool1"
type: "Pooling"
bottom: "norm1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv2"
type: "Convolution"
bottom: "pool1"
top: "conv2"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 256
pad: 2
kernel_size: 5
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu2"
type: "ReLU"
bottom: "conv2"
top: "conv2"
}
layer {
name: "norm2"
type: "LRN"
bottom: "conv2"
top: "norm2"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "pool2"
type: "Pooling"
bottom: "norm2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv3"
type: "Convolution"
bottom: "pool2"
top: "conv3"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "relu3"
type: "ReLU"
bottom: "conv3"
top: "conv3"
}
layer {
name: "conv4"
type: "Convolution"
bottom: "conv3"
top: "conv4"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu4"
type: "ReLU"
bottom: "conv4"
top: "conv4"
}
layer {
name: "conv5"
type: "Convolution"
bottom: "conv4"
top: "conv5"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu5"
type: "ReLU"
bottom: "conv5"
top: "conv5"
}
layer {
name: "pool5"
type: "Pooling"
bottom: "conv5"
top: "pool5"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "fc6"
type: "InnerProduct"
bottom: "pool5"
top: "fc6"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
inner_product_param {
num_output: 4096
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu6"
type: "ReLU"
bottom: "fc6"
top: "fc6"
}
layer {
name: "drop6"
type: "Dropout"
bottom: "fc6"
top: "fc6"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc7"
type: "InnerProduct"
bottom: "fc6"
top: "fc7"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
inner_product_param {
num_output: 4096
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu7"
type: "ReLU"
bottom: "fc7"
top: "fc7"
}
layer {
name: "drop7"
type: "Dropout"
bottom: "fc7"
top: "fc7"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc8_food"
type: "InnerProduct"
bottom: "fc7"
top: "fc8_food"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
inner_product_param {
num_output: 101
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "prob"
type: "Softmax"
bottom: "fc8_food"
top: "prob"
}
The discrepancy between the predictions on DIGITS using CaffeModel and CoreML was due to the fact that CoreML was interpreting the input data differently that DIGITS. Changing the call to convert with the following parameters resolved the issue
coreml_model = coremltools.converters.caffe.convert(('snapshot_iter_24240.caffemodel',
'deploy.prototxt',
'mean.binaryproto'),
image_input_names = 'data',
class_labels = 'labels.txt',
is_bgr=True, image_scale=255.)
http://pythonhosted.org/coremltools/generated/coremltools.converters.caffe.convert.html#coremltools.converters.caffe.convert
99% it's spaghetti bolognese
********************************
73% it's pizza
10% it's lasagna
7% it's spaghetti bolognese
2% it's spaghetti carbonara
********************************
97% it's sushi
********************************
97% it's hamburger
********************************
In its current form, coremltools has a tendency to change the input/output types and value ranges to suite its own internal optimizations. I highly recommend reimporting your newly-created .mlmodel file into your Python code and verify what data types it expects.
For example: it will convert Int values into Float (uses Double type in Swift) and Bool values to Int (True:1, False:0)
While training the dataset. I am getting the following error:
I0614 19:07:11.271327 30865 layer_factory.hpp:77] Creating layer data
I0614 19:07:11.271596 30865 net.cpp:84] Creating Layer data
I0614 19:07:11.271848 30865 net.cpp:380] data -> data
I0614 19:07:11.271896 30865 net.cpp:380] data -> label
I0614 19:07:11.271941 30865 data_transformer.cpp:25] Loading mean file from: train_mean
I0614 19:07:11.275465 30865 image_data_layer.cpp:38] Opening file
F0614 19:07:11.275923 30865 image_data_layer.cpp:49] Check failed: !lines_.empty() File is empty
*** Check failure stack trace: ***
# 0x7fba518d25cd google::LogMessage::Fail()
# 0x7fba518d4433 google::LogMessage::SendToLog()
# 0x7fba518d215b google::LogMessage::Flush()
# 0x7fba518d4e1e google::LogMessageFatal::~LogMessageFatal()
# 0x7fba51ce9509 caffe::ImageDataLayer<>::DataLayerSetUp()
# 0x7fba51d1f62e caffe::BasePrefetchingDataLayer<>::LayerSetUp()
# 0x7fba51de7897 caffe::Net<>::Init()
# 0x7fba51de9fde caffe::Net<>::Net()
# 0x7fba51df24e5 caffe::Solver<>::InitTrainNet()
# 0x7fba51df3925 caffe::Solver<>::Init()
# 0x7fba51df3c4f caffe::Solver<>::Solver()
# 0x7fba51dc8bb1 caffe::Creator_SGDSolver<>()
# 0x40a4b8 train()
# 0x406fa0 main
# 0x7fba50843830 __libc_start_main
# 0x4077c9 _start
# (nil) (unknown)
Aborted (core dumped)
I used the template from the github repo of Caffe after installing it.
I have created a subdirectory under the Caffe Root directory named playground.
I am attaching the complete folder for reproducibility.
GitHub Link
The commands that I successfully executed:
../build/tools/convert_imageset -resize_height 256 -resize_width 256 train_raw_img/ train_files.txt train_lmdb
../build/tools/convert_imageset -resize_height 256 -resize_width 256 test_raw_img/ test_files.txt test_lmdb
../build/tools/compute_image_mean train_lmdb train_mean
../build/tools/compute_image_mean train_lmdb test_mean
However, when I proceed to train the network I receive the above error:
../build/tools/caffe train --solver=my_solver_val.prototxt
Complete log of error:
I0614 19:32:54.634418 31048 caffe.cpp:211] Use CPU.
I0614 19:32:54.635144 31048 solver.cpp:44] Initializing solver from parameters:
test_iter: 1000
test_interval: 1000
base_lr: 0.01
display: 20
max_iter: 50000
lr_policy: "step"
gamma: 0.1
momentum: 0.9
weight_decay: 0.0005
stepsize: 10000
snapshot: 10000
snapshot_prefix: "models/mymodel/caffenet_train"
solver_mode: CPU
net: "my_train_val.prototxt"
train_state {
level: 0
stage: ""
}
I0614 19:32:54.639066 31048 solver.cpp:87] Creating training net from net file: my_train_val.prototxt
I0614 19:32:54.640214 31048 net.cpp:294] The NetState phase (0) differed from the phase (1) specified by a rule in layer data
I0614 19:32:54.640645 31048 net.cpp:294] The NetState phase (0) differed from the phase (1) specified by a rule in layer accuracy
I0614 19:32:54.641345 31048 net.cpp:51] Initializing net from parameters:
name: "CaffeNet"
state {
phase: TRAIN
level: 0
stage: ""
}
layer {
name: "data"
type: "ImageData"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mirror: true
crop_size: 256
mean_file: "train_mean"
}
data_param {
source: "train_files.txt"
batch_size: 2
backend: LMDB
}
}
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 96
kernel_size: 11
stride: 4
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "relu1"
type: "ReLU"
bottom: "conv1"
top: "conv1"
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "norm1"
type: "LRN"
bottom: "pool1"
top: "norm1"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "conv2"
type: "Convolution"
bottom: "norm1"
top: "conv2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 256
pad: 2
kernel_size: 5
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu2"
type: "ReLU"
bottom: "conv2"
top: "conv2"
}
layer {
name: "pool2"
type: "Pooling"
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "norm2"
type: "LRN"
bottom: "pool2"
top: "norm2"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "conv3"
type: "Convolution"
bottom: "norm2"
top: "conv3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "relu3"
type: "ReLU"
bottom: "conv3"
top: "conv3"
}
layer {
name: "conv4"
type: "Convolution"
bottom: "conv3"
top: "conv4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu4"
type: "ReLU"
bottom: "conv4"
top: "conv4"
}
layer {
name: "conv5"
type: "Convolution"
bottom: "conv4"
top: "conv5"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu5"
type: "ReLU"
bottom: "conv5"
top: "conv5"
}
layer {
name: "pool5"
type: "Pooling"
bottom: "conv5"
top: "pool5"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "fc6"
type: "InnerProduct"
bottom: "pool5"
top: "fc6"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 4096
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu6"
type: "ReLU"
bottom: "fc6"
top: "fc6"
}
layer {
name: "drop6"
type: "Dropout"
bottom: "fc6"
top: "fc6"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc7"
type: "InnerProduct"
bottom: "fc6"
top: "fc7"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 4096
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu7"
type: "ReLU"
bottom: "fc7"
top: "fc7"
}
layer {
name: "drop7"
type: "Dropout"
bottom: "fc7"
top: "fc7"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc8"
type: "InnerProduct"
bottom: "fc7"
top: "fc8"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "fc8"
bottom: "label"
top: "loss"
}
I0614 19:32:54.644022 31048 layer_factory.hpp:77] Creating layer data
I0614 19:32:54.644239 31048 net.cpp:84] Creating Layer data
I0614 19:32:54.644256 31048 net.cpp:380] data -> data
I0614 19:32:54.644280 31048 net.cpp:380] data -> label
I0614 19:32:54.644448 31048 data_transformer.cpp:25] Loading mean file from: train_mean
I0614 19:32:54.646653 31048 image_data_layer.cpp:38] Opening file
F0614 19:32:54.646975 31048 image_data_layer.cpp:49] Check failed: !lines_.empty() File is empty
*** Check failure stack trace: ***
# 0x7f83c21c95cd google::LogMessage::Fail()
# 0x7f83c21cb433 google::LogMessage::SendToLog()
# 0x7f83c21c915b google::LogMessage::Flush()
# 0x7f83c21cbe1e google::LogMessageFatal::~LogMessageFatal()
# 0x7f83c25e0509 caffe::ImageDataLayer<>::DataLayerSetUp()
# 0x7f83c261662e caffe::BasePrefetchingDataLayer<>::LayerSetUp()
# 0x7f83c26de897 caffe::Net<>::Init()
# 0x7f83c26e0fde caffe::Net<>::Net()
# 0x7f83c26e94e5 caffe::Solver<>::InitTrainNet()
# 0x7f83c26ea925 caffe::Solver<>::Init()
# 0x7f83c26eac4f caffe::Solver<>::Solver()
# 0x7f83c26bfbb1 caffe::Creator_SGDSolver<>()
# 0x40a4b8 train()
# 0x406fa0 main
# 0x7f83c113a830 __libc_start_main
# 0x4077c9 _start
# (nil) (unknown)
Aborted (core dumped)
You are using "ImageData" input layer. The layer takes a text file (in your case source: "train_files.txt") and expects each line of the file to contain a path to an image file and the classification label for that image.
It seems like this file ('train_files.txt') is empty in your case.
1. Verify that 'train_files.txt' lists image file names.
2. Verify that the listed image files do exist on your machine and you have reading permission for these files.
BTW,
If you already went through all the trouble of creating train_lmdb why not use an input "Data" layer that directly reads the lmdb?
I am using the Alexnet and try to deploy my network. But when I do so I get the following error:
I0109 15:16:56.645679 4240 net.cpp:100] Creating Layer fc6
I0109 15:16:56.645681 4240 net.cpp:434] fc6 <- pool5
I0109 15:16:56.645684 4240 net.cpp:408] fc6 -> fc6
I0109 15:16:56.712829 4240 net.cpp:150] Setting up fc6
I0109 15:16:56.712869 4240 net.cpp:157] Top shape: 1 4096 (4096)
I0109 15:16:56.712873 4240 net.cpp:165] Memory required for data: 6778220
I0109 15:16:56.712882 4240 layer_factory.hpp:77] Creating layer relu6
I0109 15:16:56.712890 4240 net.cpp:100] Creating Layer relu6
I0109 15:16:56.712893 4240 net.cpp:434] relu6 <- fc6
I0109 15:16:56.712915 4240 net.cpp:395] relu6 -> fc6 (in-place)
F0109 15:16:56.713158 4240 blob.hpp:122] Check failed: axis_index < num_axes() (2 vs. 2) axis 2 out of range for 2-D Blob with shape 1 4096 (4096)
*** Check failure stack trace: ***
I have no clue why. It has always been working for me and now this error occurs.
EDIT
layer {
name: "data"
type: "Input"
top: "data"
input_param { shape: { dim: 1 dim: 3 dim: 227 dim: 227 } }
}
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 96
kernel_size: 11
stride: 4
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "relu1"
type: "ReLU"
bottom: "conv1"
top: "conv1"
}
layer {
name: "norm1"
type: "LRN"
bottom: "conv1"
top: "norm1"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "pool1"
type: "Pooling"
bottom: "norm1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv2"
type: "Convolution"
bottom: "pool1"
top: "conv2"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 256
pad: 2
kernel_size: 5
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu2"
type: "ReLU"
bottom: "conv2"
top: "conv2"
}
layer {
name: "norm2"
type: "LRN"
bottom: "conv2"
top: "norm2"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "pool2"
type: "Pooling"
bottom: "norm2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv3"
type: "Convolution"
bottom: "pool2"
top: "conv3"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "relu3"
type: "ReLU"
bottom: "conv3"
top: "conv3"
}
layer {
name: "conv4"
type: "Convolution"
bottom: "conv3"
top: "conv4"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu4"
type: "ReLU"
bottom: "conv4"
top: "conv4"
}
layer {
name: "conv5"
type: "Convolution"
bottom: "conv4"
top: "conv5"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu5"
type: "ReLU"
bottom: "conv5"
top: "conv5"
}
layer {
name: "pool5"
type: "Pooling"
bottom: "conv5"
top: "pool5"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "fc6"
type: "InnerProduct"
bottom: "pool5"
top: "fc6"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
inner_product_param {
num_output: 4096
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu6"
type: "ReLU"
bottom: "fc6"
top: "fc6l"
}
layer {
name: "drop6"
type: "Dropout"
bottom: "fc6l"
top: "fc6d"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc7"
type: "InnerProduct"
bottom: "fc6d"
top: "fc7"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
inner_product_param {
num_output: 4096
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu7"
type: "ReLU"
bottom: "fc7"
top: "fc7"
}
layer {
name: "drop7"
type: "Dropout"
bottom: "fc7"
top: "fc7"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc8"
type: "InnerProduct"
bottom: "fc7"
top: "fc8"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 2.0
decay_mult: 0.0
}
inner_product_param {
num_output: 612
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.0
}
}
}
layer {
name: "softmax"
type: "Softmax"
bottom: "fc8"
top: "softmax"
}
Above is my .prototxt (Should be the same as Alexnet)
Check failed: axis_index < num_axes() (2 vs. 2) axis 2 out of range for 2-D Blob with shape 1 4096 (4096)
*** Check failure stack trace: ***
# 0x7f8b8e3125cd google::LogMessage::Fail()
# 0x7f8b8e314433 google::LogMessage::SendToLog()
# 0x7f8b8e31215b google::LogMessage::Flush()
# 0x7f8b8e314e1e google::LogMessageFatal::~LogMessageFatal()
# 0x7f8b8e92c86a caffe::Blob<>::CanonicalAxisIndex()
# 0x7f8b8eaa09c2 caffe::CuDNNReLULayer<>::Reshape()
# 0x7f8b8e97f481 caffe::Net<>::Init()
# 0x7f8b8e980d01 caffe::Net<>::Net()
# 0x7f8b8eac7c5a caffe::Solver<>::InitTrainNet()
# 0x7f8b8eac8fc7 caffe::Solver<>::Init()
# 0x7f8b8eac936a caffe::Solver<>::Solver()
# 0x7f8b8e960c53 caffe::Creator_SGDSolver<>()
# 0x40ac89 train()
# 0x407590 main
# 0x7f8b8d283830 __libc_start_main
# 0x407db9 _start
# (nil) (unknown)
Aborted (core dumped)
Example 2:
I0228 13:03:22.875816 4395 layer_factory.hpp:77] Creating layer relu6
I0228 13:03:22.875828 4395 net.cpp:100] Creating Layer relu6
I0228 13:03:22.875831 4395 net.cpp:434] relu6 <- fc-main
I0228 13:03:22.875855 4395 net.cpp:395] relu6 -> fc-main (in-place)
F0228 13:03:22.876565 4395 blob.hpp:122] Check failed: axis_index < num_axes() (2 vs. 2) axis 2 out of range for 2-D Blob with shape 4 4096 (16384)
*** Check failure stack trace: ***
# 0x7fe1271d85cd google::LogMessage::Fail()
# 0x7fe1271da433 google::LogMessage::SendToLog()
# 0x7fe1271d815b google::LogMessage::Flush()
# 0x7fe1271dae1e google::LogMessageFatal::~LogMessageFatal()
# 0x7fe1277f286a caffe::Blob<>::CanonicalAxisIndex()
# 0x7fe1279669c2 caffe::CuDNNReLULayer<>::Reshape()
# 0x7fe127845481 caffe::Net<>::Init()
# 0x7fe127846d01 caffe::Net<>::Net()
# 0x7fe12798dc5a caffe::Solver<>::InitTrainNet()
# 0x7fe12798efc7 caffe::Solver<>::Init()
# 0x7fe12798f36a caffe::Solver<>::Solver()
# 0x7fe127826c53 caffe::Creator_SGDSolver<>()
# 0x40ac89 train()
# 0x407590 main
# 0x7fe126149830 __libc_start_main
# 0x407db9 _start
# (nil) (unknown)
Aborted (core dumped)
layer {
name: "fc-main"
type: "InnerProduct"
bottom: "pool5"
top: "fc-main"
param {
decay_mult: 1
}
param {
decay_mult: 0
}
inner_product_param {
num_output: 4096
weight_filler {
type: "xavier"
std: 0.005
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "relu6"
type: "ReLU"
bottom: "fc-main"
top: "fc-main"
}
layer {
name: "drop6"
type: "Dropout"
bottom: "fc-main"
top: "fc-main"
dropout_param {
dropout_ratio: 0.5
}
}
Assuming we have a layer like this:
layer {
name: "fully-connected"
type: "InnerProduct"
bottom: "bottom"
top: "top"
inner_product_param {
num_output: 1
}
}
The output is batch_size x 1. In several papers (for exmaple link1 page 3 picture on the top, or link2 page 4 on top)I have seen that they used such a layer in the end to come up with a 2D image for pixel-wise prediction. How is it possible to transform this into a 2D image? I was thinking of reshape or deconvolution, but I cannot figure out how that would work. A simple example would be helpful
UPDATE: My input images are 304x228 and my ground_truth (depth images) are 75x55.
################# Main net ##################
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 96
kernel_size: 11
stride: 4
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "relu1"
type: "ReLU"
bottom: "conv1"
top: "conv1"
}
layer {
name: "norm1"
type: "LRN"
bottom: "conv1"
top: "norm1"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "pool1"
type: "Pooling"
bottom: "norm1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv2"
type: "Convolution"
bottom: "pool1"
top: "conv2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 256
pad: 2
kernel_size: 5
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu2"
type: "ReLU"
bottom: "conv2"
top: "conv2"
}
layer {
name: "norm2"
type: "LRN"
bottom: "conv2"
top: "norm2"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "pool2"
type: "Pooling"
bottom: "norm2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "conv3"
type: "Convolution"
bottom: "pool2"
top: "conv3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "relu3"
type: "ReLU"
bottom: "conv3"
top: "conv3"
}
layer {
name: "conv4"
type: "Convolution"
bottom: "conv3"
top: "conv4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu4"
type: "ReLU"
bottom: "conv4"
top: "conv4"
}
layer {
name: "conv5"
type: "Convolution"
bottom: "conv4"
top: "conv5"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relu5"
type: "ReLU"
bottom: "conv5"
top: "conv5"
}
layer {
name: "pool5"
type: "Pooling"
bottom: "conv5"
top: "pool5"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "fc6"
type: "InnerProduct"
bottom: "pool5"
top: "fc6"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 4096
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "relufc6"
type: "ReLU"
bottom: "fc6"
top: "fc6"
}
layer {
name: "drop6"
type: "Dropout"
bottom: "fc6"
top: "fc6"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc7"
type: "InnerProduct"
bottom: "fc6"
top: "fc7"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 4070
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
type: "Reshape"
name: "reshape"
bottom: "fc7"
top: "fc7_reshaped"
reshape_param {
shape { dim: 1 dim: 1 dim: 55 dim: 74 }
}
}
layer {
name: "deconv1"
type: "Deconvolution"
bottom: "fc7_reshaped"
top: "deconv1"
convolution_param {
num_output: 64
kernel_size: 5
pad: 2
stride: 1
#group: 256
weight_filler {
type: "bilinear"
}
bias_term: false
}
}
#########################
layer {
name: "conv6"
type: "Convolution"
bottom: "data"
top: "conv6"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 63
kernel_size: 9
stride: 2
pad: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "relu6"
type: "ReLU"
bottom: "conv6"
top: "conv6"
}
layer {
name: "pool6"
type: "Pooling"
bottom: "conv6"
top: "pool6"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
########################
layer {
name: "concat"
type: "Concat"
bottom: "deconv1"
bottom: "pool6"
top: "concat"
concat_param {
concat_dim: 1
}
}
layer {
name: "conv7"
type: "Convolution"
bottom: "concat"
top: "conv7"
convolution_param {
num_output: 64
kernel_size: 5
pad: 2
stride: 1
weight_filler {
type: "gaussian"
std: 0.011
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "relu7"
type: "ReLU"
bottom: "conv7"
top: "conv7"
relu_param{
negative_slope: 0.01
engine: CUDNN
}
}
layer {
name: "conv8"
type: "Convolution"
bottom: "conv7"
top: "conv8"
convolution_param {
num_output: 64
kernel_size: 5
pad: 2
stride: 1
weight_filler {
type: "gaussian"
std: 0.011
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "relu8"
type: "ReLU"
bottom: "conv8"
top: "conv8"
relu_param{
negative_slope: 0.01
engine: CUDNN
}
}
layer {
name: "conv9"
type: "Convolution"
bottom: "conv8"
top: "conv9"
convolution_param {
num_output: 1
kernel_size: 5
pad: 2
stride: 1
weight_filler {
type: "gaussian"
std: 0.011
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "relu9"
type: "ReLU"
bottom: "conv9"
top: "result"
relu_param{
negative_slope: 0.01
engine: CUDNN
}
}
log:
I1108 19:34:57.239722 4277 data_layer.cpp:41] output data size: 1,1,228,304
I1108 19:34:57.243340 4277 data_layer.cpp:41] output data size: 1,1,55,74
I1108 19:34:57.247392 4277 net.cpp:150] Setting up conv1
I1108 19:34:57.247407 4277 net.cpp:157] Top shape: 1 96 55 74 (390720)
I1108 19:34:57.248191 4277 net.cpp:150] Setting up pool1
I1108 19:34:57.248196 4277 net.cpp:157] Top shape: 1 96 27 37 (95904)
I1108 19:34:57.253263 4277 net.cpp:150] Setting up conv2
I1108 19:34:57.253276 4277 net.cpp:157] Top shape: 1 256 27 37 (255744)
I1108 19:34:57.254202 4277 net.cpp:150] Setting up pool2
I1108 19:34:57.254220 4277 net.cpp:157] Top shape: 1 256 13 18 (59904)
I1108 19:34:57.269943 4277 net.cpp:150] Setting up conv3
I1108 19:34:57.269961 4277 net.cpp:157] Top shape: 1 384 13 18 (89856)
I1108 19:34:57.285303 4277 net.cpp:150] Setting up conv4
I1108 19:34:57.285338 4277 net.cpp:157] Top shape: 1 384 13 18 (89856)
I1108 19:34:57.294801 4277 net.cpp:150] Setting up conv5
I1108 19:34:57.294841 4277 net.cpp:157] Top shape: 1 256 13 18 (59904)
I1108 19:34:57.295207 4277 net.cpp:150] Setting up pool5
I1108 19:34:57.295210 4277 net.cpp:157] Top shape: 1 256 6 9 (13824)
I1108 19:34:57.743222 4277 net.cpp:150] Setting up fc6
I1108 19:34:57.743259 4277 net.cpp:157] Top shape: 1 4096 (4096)
I1108 19:34:57.881680 4277 net.cpp:150] Setting up fc7
I1108 19:34:57.881718 4277 net.cpp:157] Top shape: 1 4070 (4070)
I1108 19:34:57.881826 4277 net.cpp:150] Setting up reshape
I1108 19:34:57.881846 4277 net.cpp:157] Top shape: 1 1 55 74 (4070)
I1108 19:34:57.884768 4277 net.cpp:150] Setting up conv6
I1108 19:34:57.885309 4277 net.cpp:150] Setting up pool6
I1108 19:34:57.885327 4277 net.cpp:157] Top shape: 1 63 55 74 (256410)
I1108 19:34:57.885395 4277 net.cpp:150] Setting up concat
I1108 19:34:57.885412 4277 net.cpp:157] Top shape: 1 64 55 74 (260480)
I1108 19:34:57.886759 4277 net.cpp:150] Setting up conv7
I1108 19:34:57.886786 4277 net.cpp:157] Top shape: 1 64 55 74 (260480)
I1108 19:34:57.897269 4277 net.cpp:150] Setting up conv8
I1108 19:34:57.897303 4277 net.cpp:157] Top shape: 1 64 55 74 (260480)
I1108 19:34:57.899129 4277 net.cpp:150] Setting up conv9
I1108 19:34:57.899138 4277 net.cpp:157] Top shape: 1 1 55 74 (4070)
The value of num_output of the last fully connected layer will not be 1 for pixel wise prediction. It will be equal to w*h of the input image.
What made you feel that the value will be 1?
Edit 1:
Below are the dimensions of each layer mentioned in link1 page 3 figure:
LAYER OUTPUT DIM [c*h*w]
course1 96*h1*w1 conv layer
course2 256*h2*w2 conv layer
course3 384*h3*w3 conv layer
course4 384*h4*w4 conv layer
course5 256*h5*w5 conv layer
course6 4096*1*1 fc layer
course7 X*1*1 fc layer where 'X' could be interpreted as w*h
To understand this further, lets assume we have a network to predict the pixels of the image. The images are of size 10*10. Thus, the final output of the fc layer too will be having the dimension 100*1*1(like in course7). This could be interpreted as 10*10.
Now the question will be, how can the 1d array predict a 2d image correctly. For this, you have to note that the loss is calculated for this output, using the labels which could be corresponding to the pixel data. Thus during training, the weights will learn to predict the pixel data.
EDIT 2:
Trying to draw the net using draw_net.py in caffe, gives you this:
The relu layer connected with conv6 and fc6 has the same name, leading to a complicated connectivity in the drawn image. I am not sure on whether this will cause some issues during training, but I would suggest you to rename one of the relu layers to a unique name to avoid some unforseen issues.
Coming back to your question, there doesn't seem to be an upsampling happening after fully connected layers. As seen in the log:
I1108 19:34:57.881680 4277 net.cpp:150] Setting up fc7
I1108 19:34:57.881718 4277 net.cpp:157] Top shape: 1 4070 (4070)
I1108 19:34:57.881826 4277 net.cpp:150] Setting up reshape
I1108 19:34:57.881846 4277 net.cpp:157] Top shape: 1 1 55 74 (4070)
I1108 19:34:57.884768 4277 net.cpp:150] Setting up conv6
I1108 19:34:57.885309 4277 net.cpp:150] Setting up pool6
I1108 19:34:57.885327 4277 net.cpp:157] Top shape: 1 63 55 74 (256410)
fc7 has output dimension of 4070*1*1. This is being reshaped to 1*55*74 to be passed as an input to conv6 layer.
The output of the whole network is produced in conv9, which has an output dimension of 1*55*74, which is exactly similar to the dimension of the labels (depth data).
Please do pinpoint on where you feel the upsample is happening, if my answer is still not clear.
if you simply need fully-connected networks like the conventional multi-layer perceptron, use 2D blobs (shape (N, D)) and call the InnerProductLayer.