如何解决准确率为1/num_类别的问题?

我是在vgg_face这个训练好的人脸模型上进行finetune. 最开始在原始图像数据上跑的时候不存在准确率为1/num_class的情况,类别数为5,准确率为75%。后来因为类别不平衡,我用smote算法增加了一些数据和对应的Label。我将原始数据和后来增加的数据放在一起的时候进行训练就出现了准确率为1/num_class的情况。我不清楚原因, 然后我又把增加的数据删除,用以前的数据再训练的时候,准确率从开始到结束却一直为1/5左右。这搞得我一头雾水,请问各位,这种情况是怎么造成的?谢谢。
已邀请:

Haoran95

赞同来自:

name: "vgg_face_train_test.prototxt"
layer {
name: "data"
type: "ImageMultilabelData"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mean_value: 116
mean_value: 116
mean_value: 116
}
image_multilabel_data_param {
mirror: true
source: "/home/haoran/caffe/vgg_face/new_data/train_labels"
root_folder: "/home/haoran/caffe/vgg_face/new_data/train_data/"
new_height: 224
new_width: 224
batch_size: 1
shuffle: true
label_dim: 2
#is_color:false
}
}
layer {
name: "data"
type: "ImageMultilabelData"
top: "data"
top: "label"
include {
phase: TEST
}
transform_param {
mean_value: 116
mean_value: 116
mean_value: 116
}
image_multilabel_data_param {
mirror: false
source: "/home/haoran/caffe/vgg_face/new_data/val_labels"
root_folder: "/home/haoran/caffe/vgg_face/new_data/val_data/"
new_height: 224
new_width: 224
batch_size: 1
shuffle: false
label_dim: 2
#is_color:false
}
}
layer {
bottom: "data"
top: "conv1_1"
name: "conv1_1"
type: "Convolution"
convolution_param {
num_output: 64
pad: 1
kernel_size: 3
}
}
layer {
bottom: "conv1_1"
top: "conv1_1"
name: "relu1_1"
type: "ReLU"
}
layer {
bottom: "conv1_1"
top: "conv1_2"
name: "conv1_2"
type: "Convolution"
convolution_param {
num_output: 64
pad: 1
kernel_size: 3
}
}
layer {
bottom: "conv1_2"
top: "conv1_2"
name: "relu1_2"
type: "ReLU"
}
layer {
bottom: "conv1_2"
top: "pool1"
name: "pool1"
type: "Pooling"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layer {
bottom: "pool1"
top: "conv2_1"
name: "conv2_1"
type: "Convolution"
convolution_param {
num_output: 128
pad: 1
kernel_size: 3
}
}
layer {
bottom: "conv2_1"
top: "conv2_1"
name: "relu2_1"
type: "ReLU"
}
layer {
bottom: "conv2_1"
top: "conv2_2"
name: "conv2_2"
type: "Convolution"
convolution_param {
num_output: 128
pad: 1
kernel_size: 3
}
}
layer {
bottom: "conv2_2"
top: "conv2_2"
name: "relu2_2"
type: "ReLU"
}
layer {
bottom: "conv2_2"
top: "pool2"
name: "pool2"
type: "Pooling"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layer {
bottom: "pool2"
top: "conv3_1"
name: "conv3_1"
type: "Convolution"
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layer {
bottom: "conv3_1"
top: "conv3_1"
name: "relu3_1"
type: "ReLU"
}
layer {
bottom: "conv3_1"
top: "conv3_2"
name: "conv3_2"
type: "Convolution"
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layer {
bottom: "conv3_2"
top: "conv3_2"
name: "relu3_2"
type: "ReLU"
}
layer {
bottom: "conv3_2"
top: "conv3_3"
name: "conv3_3"
type: "Convolution"
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layer {
bottom: "conv3_3"
top: "conv3_3"
name: "relu3_3"
type: "ReLU"
}
layer {
bottom: "conv3_3"
top: "pool3"
name: "pool3"
type: "Pooling"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layer {
bottom: "pool3"
top: "conv4_1"
name: "conv4_1"
type: "Convolution"
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layer {
bottom: "conv4_1"
top: "conv4_1"
name: "relu4_1"
type: "ReLU"
}
layer {
bottom: "conv4_1"
top: "conv4_2"
name: "conv4_2"
type: "Convolution"
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layer {
bottom: "conv4_2"
top: "conv4_2"
name: "relu4_2"
type: "ReLU"
}
layer {
bottom: "conv4_2"
top: "conv4_3"
name: "conv4_3"
type: "Convolution"
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layer {
bottom: "conv4_3"
top: "conv4_3"
name: "relu4_3"
type: "ReLU"
}
layer {
bottom: "conv4_3"
top: "pool4"
name: "pool4"
type: "Pooling"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layer {
bottom: "pool4"
top: "conv5_1"
name: "conv5_1"
type: "Convolution"
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layer {
bottom: "conv5_1"
top: "conv5_1"
name: "relu5_1"
type: "ReLU"
}
layer {
bottom: "conv5_1"
top: "conv5_2"
name: "conv5_2"
type: "Convolution"
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layer{
bottom: "conv5_2"
top: "conv5_2"
name: "relu5_2"
type: "ReLU"
}
layer {
bottom: "conv5_2"
top: "conv5_3"
name: "conv5_3"
type: "Convolution"
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layer {
bottom: "conv5_3"
top: "conv5_3"
name: "relu5_3"
type: "ReLU"
}
layer {
bottom: "conv5_3"
top: "pool5"
name: "pool5"
type: "Pooling"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layer {
bottom: "pool5"
top: "fc6"
name: "fc6"
type: "InnerProduct"
inner_product_param {
num_output: 4096
}
}
layer {
bottom: "fc6"
top: "fc6"
name: "relu6"
type: "ReLU"
}
layer {
bottom: "fc6"
top: "fc6"
name: "drop6"
type: "Dropout"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
bottom: "fc6"
top: "fc7"
name: "fc7"
type: "InnerProduct"
inner_product_param {
num_output: 4096
}
}
layer {
bottom: "fc7"
top: "fc7"
name: "relu7"
type: "ReLU"
}
layer {
bottom: "fc7"
top: "fc7"
name: "drop7"
type: "Dropout"
dropout_param {
dropout_ratio: 0.5
}
}
#### labels ##################
layer {
name: "slice"
type: "Slice"
bottom: "label"
top: "label1"
top: "label2"
slice_param {
axis: 1
slice_point:1
}
}

#### label1 #################
layer {
bottom: "fc7"
top: "fc8_label1"
name: "fc8_label1"
type: "InnerProduct"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 5 # label1 包含的类别数
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "accuracy_label1"
type: "Accuracy"
bottom: "fc8_label1"
bottom: "label1"
top: "accuracy_label1"
accuracy_param {
top_k: 1
ignore_label: 0
}
include {
phase: TEST
}
}
layer {
bottom: "fc8_label1"
bottom: "label1"
top: "loss_label1"
name: "loss_label1"
type: "SoftmaxWithLoss"
loss_param{
ignore_label: 0
}
}
layer {
bottom: "fc7"
top: "fc8_label2"
name: "fc8_label2"
type: "InnerProduct"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output:5 # label2 包含的类别数
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 0.1
}
}
}
layer {
name: "accuracy_label2"
type: "Accuracy"
bottom: "fc8_label2"
bottom: "label2"
top: "accuracy_label2"
accuracy_param {
top_k: 1
ignore_label: 0
}
include {
phase: TEST
}
}
layer {
bottom: "fc8_label2"
bottom: "label2"
top: "loss_label2"
name: "loss_label2"
type: "SoftmaxWithLoss"
loss_param{
ignore_label: 0
}
}
这是vgg_face的prototxt文件,说明一下,我做的是多标签分类任务,所以增加了新的一类数据层。

要回复问题请先登录注册