Iteration loss is always 0

23 views
Skip to first unread message

Konrad Mikuła

unread,
Nov 19, 2017, 7:28:20 AM11/19/17
to Caffe Users
Hello, I'm new to caffe and to CNNs at all. I have a problem with the iteration loss = at every iteration, it's 0, which is wrong. I've created small net from start, here is my model:



name: "CaffeNet"
layer {
 name: "data"
 type: "Data"
 top: "data"
 top: "label"
 include {
   phase: TRAIN
 }
 data_param {
   source: "/home/konrad/inz/examples/new_train_lmdb"
   batch_size: 1
   backend: LMDB
 }
}
layer {
 name: "data"
 type: "Data"
 top: "data"
 top: "label"
 include {
   phase: TEST
 }
 data_param {
   source: "/home/konrad/inz/examples/new_val_lmdb"
   batch_size: 1
   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: 20
   kernel_size: 3
   stride: 1
   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: "inner1"
 type: "InnerProduct"
 bottom: "pool1"
 top: "inner1"
 param {
   lr_mult: 1
   decay_mult: 0
 }
 param {
   lr_mult: 3
   decay_mult: 0
 }
 inner_product_param {
   num_output: 20
   weight_filler {
     type: "gaussian"
     std: 0.01
   }
   bias_filler {
     type: "constant"
     value: 0
   }
 }
}
layer {
 name: "inner2"
 type: "InnerProduct"
 bottom: "inner1"
 top: "inner2"
 param {
   lr_mult: 1
   decay_mult: 1
 }
 param {
   lr_mult: 2
   decay_mult: 0
 }
 inner_product_param {
   num_output: 5
   weight_filler {
     type: "gaussian"
     std: 0.01
   }
   bias_filler {
     type: "constant"
     value: 0
   }
 }
}
layer {
 name: "output"
 type: "ArgMax"
 bottom: "inner2"
 top: "output"
}
layer {
name: "accuracy"
type: "Accuracy"
bottom: "inner2"
bottom: "label"
top: "accuracy"
include: { phase: TEST }
}


I have 5 classes labeled from 0 to 4 in  the LMDB data. At first  I thought that my net is wrong and tried to use VGG16, but it still says 0 during training. Does someone know what might be the problem? My solver:

net: "conv.prototxt"
test_iter: 1000
test_interval: 2000
base_lr: 0.001
lr_policy: "step"
gamma: 0.1
stepsize: 1000
display: 10
max_iter: 10000
momentum: 0.6
weight_decay: 0.0005
snapshot: 10000
snapshot_prefix: "snapshot_prefix"
solver_mode: CPU
type: "SGD"


Przemek D

unread,
Nov 21, 2017, 4:55:56 AM11/21/17
to Caffe Users
Try to debug your network using the Python interface. See what comes in and what comes out, inspect each blob to see what's going on on each layer. You can read about how to do those things in the examples, you could start with the one on net surgery.
Reply all
Reply to author
Forward
0 new messages