bad accuracy in multi-task learning

47 views
Skip to first unread message

包青平

unread,
Nov 25, 2015, 9:36:47 PM11/25/15
to Caffe Users
Hello all. I try to learn a multi-task CNN model. During training iterations, loss_1 and loss_2 decrease, accuracy_1 increases, but accuracy_2  changes a little. i.e. label_2 has 5 categories, accuracy_2 is around 0.2. Actually accuracy_2 decrease from 0.2 to 0.18 after 20000 iterations.
train_val.prototxt : I make two lmdb datasets with the same images but different labels.  loss_weight of loss_1 and loss_2 are both set 1.0.  Is there any errors in the prototxt?
layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TRAIN
  }
  transform_param {
    mirror: true
    crop_size: 227
    mean_file: "/home/percy/caffe/data/clothing_multilabel/imagenet_mean.binaryproto"
  }
  data_param {
    source: "/home/percy/caffe/data/clothing_multilabel/clothing_train1_lmdb"
    batch_size: 50
    backend: LMDB
  }
}
layer {
  name: "data2"
  type: "Data"
  top: "data2"
  top: "label2"
  include {
    phase: TRAIN
  }
  transform_param {
    mirror: true
    crop_size: 227
    mean_file: "/home/percy/caffe/data/clothing_multilabel/imagenet_mean.binaryproto"
  }
  data_param {
    source: "/home/percy/caffe/data/clothing_multilabel/clothing_train2_lmdb"
    batch_size: 50
    backend: LMDB
  }
}
layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TEST
  }
  transform_param {
    mirror: true
    crop_size: 227
    mean_file: "/home/percy/caffe/data/clothing_multilabel/imagenet_mean.binaryproto"
  }
  data_param {
    source: "/home/percy/caffe/data/clothing_multilabel/clothing_val1_lmdb"
    batch_size: 50
    backend: LMDB
  }
}
layer {
  name: "data2"
  type: "Data"
  top: "data2"
  top: "label2"
  include {
    phase: TEST
  }
  transform_param {
    mirror: true
    crop_size: 227
    mean_file: "/home/percy/caffe/data/clothing_multilabel/imagenet_mean.binaryproto"
  }
  data_param {
    source: "/home/percy/caffe/data/clothing_multilabel/clothing_val2_lmdb"
    batch_size: 50
    backend: LMDB
  }
}
……
……
layer {
  name: "accuracy_1"
  type: "Accuracy"
  bottom: "fc8"
  bottom: "label"
  top: "accuracy_1"
  include {
    phase: TEST
  }
}
layer {
  name: "loss_1"
  type: "SoftmaxWithLoss"
  bottom: "fc8"
  bottom: "label"
  top: "loss_1"
  loss_weight:1
}
layer {
  name: "loss2_1"
  type: "SoftmaxWithLoss"
  bottom: "fc2_6"
  bottom: "label2"
  top: "loss2_1"
  loss_weight:0.0
}
……
……
layer {
  name: "accuracy_2"
  type: "Accuracy"
  bottom: "fc11"
  bottom: "label2"
  top: "accuracy_2"
  include {
    phase: TEST
  }
}
layer {
  name: "loss_2"
  type: "SoftmaxWithLoss"
  bottom: "fc11"
  bottom: "label2"
  top: "loss_2"
  loss_weight:1
}
Reply all
Reply to author
Forward
0 new messages