Muti-task learning using 5 different binary classifiers

67 views
Skip to first unread message

Belhassen Bayar

unread,
Sep 17, 2016, 10:12:41 AM9/17/16
to Caffe Users
I am trying to implement a multi-task learning in caffe where I would like to have the last fully-connected layer to be fed to 5 different softmax layers with 2 neurons. Each softmax layer does a binary classification task.
To do that I created separate LMDB data for the labels. The prototxt file that I used is below however I am getting a constant and equal classification accuracy for all the five classifiers.
Any help in how I should change my prototxt file would be more than appreciated.

name: "CaffeNet"
layer {
  name: "data"
  type: "Data"
  top: "data"
  #top: "label"
  include {
    phase: TRAIN
  }
transform_param {
    crop_size: 256
}
  data_param {
    source: "data/fc_expression/train_lmdb"
    batch_size: 128
    backend: LMDB
  }
}
layer {
  name: "data"
  type: "Data"
  top: "data"
  #top: "label"
  include {
    phase: TEST
  }
transform_param {
    crop_size: 256
}
  data_param {
    source: "data/fc_expression/val_lmdb"
    batch_size: 32
    backend: LMDB
  }
}
layer {
  name: "labelEM"
  type: "Data"
  #top: "data"
  top: "labelEM"
  include {
    phase: TRAIN
  }
  data_param {
    source: "data/fc_expression/train_lmdbEM"
    batch_size: 128
    backend: LMDB
  }
}
layer {
  name: "labelEM"
  type: "Data"
  #top: "data"
  top: "labelEM"
  include {
    phase: TEST
  }
  data_param {
    source: "data/fc_expression/val_lmdbEM"
    batch_size: 32
    backend: LMDB
  }
}
layer {
  name: "labelAG"
  type: "Data"
  #top: "data"
  top: "labelAG"
  include {
    phase: TRAIN
  }
  data_param {
    source: "data/fc_expression/train_lmdbAG"
    batch_size: 128
    backend: LMDB
  }
}
layer {
  name: "labelAG"
  type: "Data"
  #top: "data"
  top: "labelAG"
  include {
    phase: TEST
  }
  data_param {
    source: "data/fc_expression/val_lmdbAG"
    batch_size: 32
    backend: LMDB
  }
}
layer {
  name: "labelSX"
  type: "Data"
  #top: "data"
  top: "labelSX"
  include {
    phase: TRAIN
  }
  data_param {
    source: "data/fc_expression/train_lmdbSX"
    batch_size: 128
    backend: LMDB
  }
}
layer {
  name: "labelSX"
  type: "Data"
  #top: "data"
  top: "labelSX"
  include {
    phase: TEST
  }
  data_param {
    source: "data/fc_expression/val_lmdbSX"
    batch_size: 32
    backend: LMDB
  }
}
layer {
  name: "labelBG"
  type: "Data"
  #top: "data"
  top: "labelBG"
  include {
    phase: TRAIN
  }
  data_param {
    source: "data/fc_expression/train_lmdbBG"
    batch_size: 128
    backend: LMDB
  }
}
layer {
  name: "labelBG"
  type: "Data"
  #top: "data"
  top: "labelBG"
  include {
    phase: TEST
  }
  data_param {
    source: "data/fc_expression/val_lmdbBG"
    batch_size: 32
    backend: LMDB
  }
}
layer {
  name: "labelSZ"
  type: "Data"
  #top: "data"
  top: "labelSZ"
  include {
    phase: TRAIN
  }
  data_param {
    source: "data/fc_expression/train_lmdbSZ"
    batch_size: 128
    backend: LMDB
  }
}
layer {
  name: "labelSZ"
  type: "Data"
  #top: "data"
  top: "labelSZ"
  include {
    phase: TEST
  }
  data_param {
    source: "data/fc_expression/val_lmdbSZ"
    batch_size: 32
    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: 3
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}
.
.
.
.
.
.
.
.
.
.
.
.
.
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: "xavier"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layer {
  name: "layer1"
  bottom: "fc8"
  top: "fc8_1"
  type: "Power"
  power_param {
    power: 1
    scale: 1
    shift: 0
  }
}
layer {
  name: "layer2"
  bottom: "fc8"
  top: "fc8_2"
  type: "Power"
  power_param {
    power: 1
    scale: 1
    shift: 0
  }
}
layer {
  name: "layer3"
  bottom: "fc8"
  top: "fc8_3"
  type: "Power"
  power_param {
    power: 1
    scale: 1
    shift: 0
  }
}
layer {
  name: "layer4"
  bottom: "fc8"
  top: "fc8_4"
  type: "Power"
  power_param {
    power: 1
    scale: 1
    shift: 0
  }
}
layer {
  name: "layer5"
  bottom: "fc8"
  top: "fc8_5"
  type: "Power"
  power_param {
    power: 1
    scale: 1
    shift: 0
  }
}
layer {
  name: "accuracy1"
  type: "Accuracy"
  bottom: "fc8_1"
  bottom: "labelEM"
  top: "accuracy1"
  include {
    phase: TEST
  }
}
layer {
  name: "accuracy2"
  type: "Accuracy"
  bottom: "fc8_2"
  bottom: "labelAG"
  top: "accuracy2"
  include {
    phase: TEST
  }
}
layer {
  name: "accuracy3"
  type: "Accuracy"
  bottom: "fc8_3"
  bottom: "labelSX"
  top: "accuracy3"
  include {
    phase: TEST
  }
}
layer {
  name: "accuracy4"
  type: "Accuracy"
  bottom: "fc8_4"
  bottom: "labelBG"
  top: "accuracy4"
  include {
    phase: TEST
  }
}
layer {
  name: "accuracy5"
  type: "Accuracy"
  bottom: "fc8_5"
  bottom: "labelSZ"
  top: "accuracy5"
  include {
    phase: TEST
  }
}
layer {
  name: "loss1"
  type: "SoftmaxWithLoss"
  bottom: "fc8_1"
  bottom: "labelEM"
  top: "loss1"
}
layer {
  name: "loss2"
  type: "SoftmaxWithLoss"
  bottom: "fc8_2"
  bottom: "labelAG"
  top: "loss2"
}
layer {
  name: "loss3"
  type: "SoftmaxWithLoss"
  bottom: "fc8_3"
  bottom: "labelSX"
  top: "loss3"
}
layer {
  name: "loss4"
  type: "SoftmaxWithLoss"
  bottom: "fc8_4"
  bottom: "labelBG"
  top: "loss4"
}
layer {
  name: "loss5"
  type: "SoftmaxWithLoss"
  bottom: "fc8_5"
  bottom: "labelSZ"
  top: "loss5"
}

Reply all
Reply to author
Forward
Message has been deleted
0 new messages