【深度学习】caffe下人脸表情训练

直接进入主题吧。

数据集:fer2013,密码:c14c

1、制作lmdb文件,这个网上有很多,自己去找

2、制作train、val文件,参考论文Emotion Recognition using Deep Convolutional Neural Networks

layer {
  name: "Convolution1"
  type: "Convolution"
  bottom: "Data1"
  top: "Convolution1"
  convolution_param {
    num_output: 64
    pad: 0
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
  }
}
layer {
  name: "ReLU1"
  type: "ReLU"
  bottom: "Convolution1"
  top: "Convolution1"
}
layer {
  name: "Pooling1"
  type: "Pooling"
  bottom: "Convolution1"
  top: "Pooling1"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}
layer {
  name: "Convolution2"
  type: "Convolution"
  bottom: "Pooling1"
  top: "Convolution2"
  convolution_param {
    num_output: 64
    pad: 0
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
  }
}
layer {
  name: "ReLU2"
  type: "ReLU"
  bottom: "Convolution2"
  top: "Convolution2"
}
layer {
  name: "Pooling2"
  type: "Pooling"
  bottom: "Convolution2"
  top: "Pooling2"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}
layer {
  name: "Convolution3"
  type: "Convolution"
  bottom: "Pooling2"
  top: "Convolution3"
  convolution_param {
    num_output: 128
    pad: 0
    kernel_size: 4
    stride: 1
    weight_filler {
      type: "xavier"
    }
  }
}
layer {
  name: "ReLU3"
  type: "ReLU"
  bottom: "Convolution3"
  top: "Convolution3"
}
layer {
  name: "Dropout1"
  type: "Dropout"
  bottom: "Convolution3"
  top: "Convolution3"
}
layer {
  name: "InnerProduct1"
  type: "InnerProduct"
  bottom: "Convolution3"
  top: "InnerProduct1"
  inner_product_param {
    num_output: 3072
    weight_filler {
      type: "xavier"
    }
  }
}
layer {
  name: "ReLU4"
  type: "ReLU"
  bottom: "InnerProduct1"
  top: "InnerProduct1"
}
layer {
  name: "InnerProduct2"
  type: "InnerProduct"
  bottom: "InnerProduct1"
  top: "InnerProduct2"
  inner_product_param {
    num_output: 7
    weight_filler {
      type: "xavier"
    }
  }
}
layer {
  name: "SoftmaxWithLoss1"
  type: "SoftmaxWithLoss"
  bottom: "InnerProduct2"
  bottom: "Data2"
  top: "SoftmaxWithLoss1"
}

3、训练

未完待续……

你可能感兴趣的:(机器视觉)