基于caffe的人脸关键点检测技术—回归

几点注意事项:

1:标签是一个向量,不是一个值,因此数据格式为HDF5;

2:损失函数采用的做回归经常用到的平方差函数。caffe中定义的为




网络结构图如下:


最后几层的网络定义如下:

layers {
  name: "ip1"
  type: INNER_PRODUCT  //全连接网络
  bottom: "conv4"
  top: "ip1"
  blobs_lr: 1
  blobs_lr: 2
  weight_decay: 250
  weight_decay: 0
  inner_product_param { //全连接层参数
    num_output: 120  /输出120维
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant" //常数偏移量
    }
  }
}

layers {
  name: "ip2"
  type: INNER_PRODUCT
  bottom: "ip1"
  top: "ip2"
  blobs_lr: 1
  blobs_lr: 2
  weight_decay: 250
  weight_decay: 0
  inner_product_param {
    num_output: 10   //10
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
    }
  }
}

layers {
  name: "accuracy"
  type: EUCLIDEAN_LOSS
  bottom: "ip2"
  bottom: "label"
  top: "accuracy"
  include: { phase: TEST }
}
layers {
  name: "loss"    
  type: EUCLIDEAN_LOSS
  bottom: "ip2"
  bottom: "label"
  top: "loss"
}
© 2018 GitHub, Inc.

这个脚本也很简单:给caffe这个可执行文件传递了一些参数

#!/usr/bin/env sh
TOOLS=/home/crw/caffe-local/build/tools
$TOOLS/caffe train \
  --solver=solver.prototxt  #\
  #--snapshot=/media/crw/MyBook/Model/FaceAlignment/try1_1/snapshot_iter_20000.solverstate



猜你喜欢

转载自blog.csdn.net/runner668/article/details/80411895