Caffe accuracy always 0.5 and loss ~0.69

440 views
Skip to first unread message

Robmosh

unread,
Jul 1, 2016, 8:42:46 AM7/1/16
to Caffe Users
Hey there,

i'm training the AlexNet with  some little changes to perform a classification and later an object detection on images.

Since i use this net i suffer from the problem that the accuracy stays at 0.5 and the loss at 0.69.
I already googled the problem and have done some of the suggestions, e.g. set bias_filler to 0.5-0.7 instead of 1, shuffle the data again and check wether it is correct or not.

I build the lmdb for training and testing with the convert_imageset from ./build/tools without error with shuffling and resizing.

The net looks like:
layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  transform_param {
    scale: 0.00392156862745
  }
  data_param {
    source: "/home/rkoch/Bilderkennung/bumper_vs_door/train_lmdb"
    batch_size: 200
    backend: LMDB
  }
}
layer {
  name: "conv1"
  type: "Convolution"
  bottom: "data"
  top: "conv1"
  convolution_param {
    num_output: 32
    pad: 2
    kernel_size: 5
    weight_filler {
      type: "gaussian"
      std: 0.0001
    }
    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: 3
    alpha: 0.0001
    beta: 0.75
  }
}
layer {
  name: "conv2"
  type: "Convolution"
  bottom: "norm1"
  top: "conv2"
  convolution_param {
    num_output: 256
    kernel_size: 5
    weight_filler {
      type: "gaussian"
      std: 0.1
    }
    bias_filler {
      type: "constant"
      value: 0.7
    }
  }
}
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"
  convolution_param {
    num_output: 384
    pad: 1
    kernel_size: 3
    weight_filler {
      type: "gaussian"
      std: 0.1
    }
    bias_filler {
      type: "constant"
      value: 0.5
    }
  }
}
layer {
  name: "relu3"
  type: "ReLU"
  bottom: "conv3"
  top: "conv3"
}
layer {
  name: "conv4"
  type: "Convolution"
  bottom: "conv3"
  top: "conv4"
  convolution_param {
    num_output: 384
    pad: 1
    kernel_size: 3
    group: 2
    weight_filler {
      type: "gaussian"
      std: 0.1
    }
    bias_filler {
      type: "constant"
      value: 0.5
    }
  }
}
layer {
  name: "relu4"
  type: "ReLU"
  bottom: "conv4"
  top: "conv4"
}
layer {
  name: "conv5"
  type: "Convolution"
  bottom: "conv4"
  top: "conv5"
  convolution_param {
    num_output: 256
    pad: 1
    kernel_size: 3
    weight_filler {
      type: "gaussian"
      std: 0.1
    }
    bias_filler {
      type: "constant"
      value: 0.5
    }
  }
}
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: "full6"
  type: "InnerProduct"
  bottom: "pool5"
  top: "full6"
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "gaussian"
      std: 0.001
    }
    bias_filler {
      type: "constant"
      value: 1
    }
  }
}
layer {
  name: "relu6"
  type: "ReLU"
  bottom: "full6"
  top: "full6"
}
layer {
  name: "full8"
  type: "InnerProduct"
  bottom: "full6"
  top: "full8"
  inner_product_param {
    num_output: 1000
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0.5
    }
  }
}
layer {
  name: "score"
  type: "InnerProduct"
  bottom: "full8"
  top: "score"
  inner_product_param {
    num_output: 2
    weight_filler {
      type: "xavier"
    }
  }
}
layer {
  name: "loss"
  type: "SoftmaxWithLoss"
  bottom: "score"
  bottom: "label"
  top: "loss"
}

Can somebody help me with this problem?

Thanks,

Robert

Shahmi

unread,
Feb 27, 2017, 11:19:04 AM2/27/17
to Caffe Users
Did you resolve the problem anyway? I'm stuck with the similar problem and curious how you went about it.

Thank you.
Message has been deleted

sayad yaghoobi

unread,
Apr 27, 2017, 9:36:15 AM4/27/17
to Caffe Users
i'm stuck in the same issue too. i checked two network, both alexnet and nin. but both of them give me the same loss and accuracy. 
if anyone has solved this issue, please confirm me to. i'll be grateful 

Guofeng Hu

unread,
May 3, 2017, 9:51:55 PM5/3/17
to Caffe Users
Hi,

My model's accuracy is something like you. My train acccuracy is about 0.90, but the test accuracy is about 0.55. When I increase the dropout from 0.5 to 0.6, it does little work. I don't know why this happens.

在 2016年7月1日星期五 UTC+8下午8:42:46,Robmosh写道:
Reply all
Reply to author
Forward
0 new messages