在自己的数据集上微调Light CNN
来源:互联网 发布:nginx 反向代理 403 编辑:程序博客网 时间:2024/05/17 05:16
遇到的坑
light cnn 加载的是灰度图,所以在 data 层要添加参数:
is_color:false
示例如下:
layer { name: "data" type: "ImageData" top: "data" top: "label" image_data_param{ source: "/home/code/caffe-master/lightCNNFace/val.txt" batch_size: 20 is_color:false } transform_param { scale: 0.00390625 crop_size: 128 mirror: false } include: { phase: TEST }}
1.编写微调的网络结构lightcnn_train_test.prototxt
2.准备训练图像数据,分成训练集和验证集合
注意 要将图像灰度化
3.运行训练脚本文件
code/caffe-master/build/tools/caffe train \ --solver=code/caffe-master/lightCNNFace/LCNN_solver.prototxt \ --weights=code/caffe-master/lightCNNFace/LightenedCNN_B.caffemodel -gpu=0
4.微调时报错
Cannot copy param 0 weights from layer 'conv1'; shape mismatch. Source param shape is 96 1 5 5 (2400); target param shape is 96 3 5 5 (7200). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer
5.附 lightcnn_train_test.prototxt
有过微调light cnn的网友吗?求解决方案,另外 如何进一步减小模型大小?
name: "DeepFace_set003_net"layer { name: "data" type:"ImageData" top: "data" top: "label" image_data_param{ source: "/home/himon/code/caffe-master/lightCNNFace/train.txt" batch_size: 20 shuffle: true } transform_param { scale: 0.00390625 crop_size: 128 mirror: true } include: { phase: TRAIN }}layer { name: "data" type: "ImageData" top: "data" top: "label" image_data_param{ source: "/home/himon/code/caffe-master/lightCNNFace/val.txt" batch_size: 20 } transform_param { scale: 0.00390625 crop_size: 128 mirror: false } include: { phase: TEST }}layer{ name: "conv1" type: "Convolution" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 96 kernel_size: 5 stride: 1 pad: 2 weight_filler { type: "xavier" } bias_filler { type: "constant" value: 0.1 } } bottom: "data" top: "conv1"}layer{ name: "slice1" type:"Slice" slice_param { slice_dim: 1 } bottom: "conv1" top: "slice1_1" top: "slice1_2"}layer{ name: "etlwise1" type: "Eltwise" bottom: "slice1_1" bottom: "slice1_2" top: "eltwise1" eltwise_param { operation: MAX }}layer{ name: "pool1" type: "Pooling" pooling_param { pool: MAX kernel_size: 2 stride: 2 } bottom: "eltwise1" top: "pool1"}layer{ name: "conv2a" type: "Convolution" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 96 kernel_size: 1 stride: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" value: 0.1 } } bottom: "pool1" top: "conv2a"}layer{ name: "slice2a" type:"Slice" slice_param { slice_dim: 1 } bottom: "conv2a" top: "slice2a_1" top: "slice2a_2"}layer{ name: "etlwise2a" type: "Eltwise" bottom: "slice2a_1" bottom: "slice2a_2" top: "eltwise2a" eltwise_param { operation: MAX }}layer{ name: "conv2" type: "Convolution" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 192 kernel_size: 3 stride: 1 pad: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" value: 0.1 } } bottom: "eltwise2a" top: "conv2"}layer{ name: "slice2" type:"Slice" slice_param { slice_dim: 1 } bottom: "conv2" top: "slice2_1" top: "slice2_2"}layer{ name: "etlwise2" type: "Eltwise" bottom: "slice2_1" bottom: "slice2_2" top: "eltwise2" eltwise_param { operation: MAX }}layer{ name: "pool2" type: "Pooling" pooling_param { pool: MAX kernel_size: 2 stride: 2 } bottom: "eltwise2" top: "pool2"}layer{ name: "conv3a" type: "Convolution" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 192 kernel_size: 1 stride: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" value: 0.1 } } bottom: "pool2" top: "conv3a"}layer{ name: "slice3a" type:"Slice" slice_param { slice_dim: 1 } bottom: "conv3a" top: "slice3a_1" top: "slice3a_2"}layer{ name: "etlwise3a" type: "Eltwise" bottom: "slice3a_1" bottom: "slice3a_2" top: "eltwise3a" eltwise_param { operation: MAX }}layer{ name: "conv3" type: "Convolution" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param { num_output: 384 kernel_size: 3 stride: 1 pad: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" value: 0.1 } } bottom: "eltwise3a" top: "conv3"}layer{ name: "slice3" type:"Slice" slice_param { slice_dim: 1 } bottom: "conv3" top: "slice3_1" top: "slice3_2"}layer{ name: "etlwise3" type: "Eltwise" bottom: "slice3_1" bottom: "slice3_2" top: "eltwise3" eltwise_param { operation: MAX }}layer{ name: "pool3" type: "Pooling" pooling_param { pool: MAX kernel_size: 2 stride: 2 } bottom: "eltwise3" top: "pool3"}layer{ name: "conv4a" type: "Convolution" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param{ num_output: 384 kernel_size: 1 stride: 1 weight_filler{ type:"xavier" } bias_filler{ type: "constant" value: 0.1 } } bottom: "pool3" top: "conv4a"}layer{ name: "slice4a" type:"Slice" slice_param { slice_dim: 1 } bottom: "conv4a" top: "slice4a_1" top: "slice4a_2"}layer{ name: "etlwise4a" type: "Eltwise" bottom: "slice4a_1" bottom: "slice4a_2" top: "eltwise4a" eltwise_param { operation: MAX }}layer{ name: "conv4" type: "Convolution" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param{ num_output: 256 kernel_size: 3 stride: 1 pad: 1 weight_filler{ type:"xavier" } bias_filler{ type: "constant" value: 0.1 } } bottom: "eltwise4a" top: "conv4"}layer{ name: "slice4" type:"Slice" slice_param { slice_dim: 1 } bottom: "conv4" top: "slice4_1" top: "slice4_2"}layer{ name: "etlwise4" type: "Eltwise" bottom: "slice4_1" bottom: "slice4_2" top: "eltwise4" eltwise_param { operation: MAX }}layer{ name: "conv5a" type: "Convolution" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param{ num_output: 256 kernel_size: 1 stride: 1 weight_filler{ type:"xavier" } bias_filler{ type: "constant" value: 0.1 } } bottom: "eltwise4" top: "conv5a"}layer{ name: "slice5a" type:"Slice" slice_param { slice_dim: 1 } bottom: "conv5a" top: "slice5a_1" top: "slice5a_2"}layer{ name: "etlwise5a" type: "Eltwise" bottom: "slice5a_1" bottom: "slice5a_2" top: "eltwise5a" eltwise_param { operation: MAX }}layer{ name: "conv5" type: "Convolution" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } convolution_param{ num_output: 256 kernel_size: 3 stride: 1 pad: 1 weight_filler{ type:"xavier" } bias_filler{ type: "constant" value: 0.1 } } bottom: "eltwise5a" top: "conv5"}layer{ name: "slice5" type:"Slice" slice_param { slice_dim: 1 } bottom: "conv5" top: "slice5_1" top: "slice5_2"}layer{ name: "etlwise5" type: "Eltwise" bottom: "slice5_1" bottom: "slice5_2" top: "eltwise5" eltwise_param { operation: MAX }}layer{ name: "pool4" type: "Pooling" pooling_param { pool: MAX kernel_size: 2 stride: 2 } bottom: "eltwise5" top: "pool4"}layer{ name: "fc1" type: "InnerProduct" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } inner_product_param { num_output: 512 weight_filler { type: "xavier" } bias_filler { type: "constant" value: 0.1 } } bottom: "pool4" top: "fc1"}layer{ name: "slice_fc1" type:"Slice" slice_param { slice_dim: 1 } bottom: "fc1" top: "slice_fc1_1" top: "slice_fc1_2"}layer{ name: "etlwise_fc1" type: "Eltwise" bottom: "slice_fc1_1" bottom: "slice_fc1_2" top: "eltwise_fc1" eltwise_param { operation: MAX }}layer{ name: "drop1" type: "Dropout" dropout_param{ dropout_ratio: 0.7 } bottom: "eltwise_fc1" top: "eltwise_fc1"}layer{ name: "fnc2" type: "InnerProduct" inner_product_param{ num_output: 50 weight_filler { type: "xavier" } bias_filler { type: "constant" value: 0.1 } } bottom: "eltwise_fc1" top: "fnc2"}layer { name: "accuracy" type: "Accuracy" bottom: "fnc2" bottom: "label" top: "accuracy" include: { phase: TEST }}layer { name: "softmaxloss" type: "SoftmaxWithLoss" bottom: "fnc2" bottom: "label" top: "loss"}
阅读全文
0 0
- 在自己的数据集上微调Light CNN
- 在Caffe上利用自己的数据集进行微调
- Cafffe入门-win7上训练自己的数据和微调
- 利用自己的数据微调caffenet
- 如何将别人训练好的model用到自己的数据上----微调模型
- CNN学习----创建自己的数据集
- py-faster-rcnn用自己的数据集微调用到的资料
- [人脸识别]使用VGG Face Model微调(Fine tune)自己的数据集
- 训练自己的数据,微调faster Rcnn模型
- windows 训练、微调caffenet 训练测试自己的数据
- caffe示例实现之6微调CaffeNet用于Flickr Style数据集上的风格识别
- 用CNN工具箱对自己的数据集分类
- theano下CNN网络验证测试自己的数据集
- 在Faster RCNN上运行自己的数据集
- faster rcnn在自己的数据集上训练
- 在caffe上跑自己的数据
- 在caffe上跑自己的数据
- 在caffe上跑自己的数据
- Microsoft OneNote
- ARP原理、利用、防御(链路层)
- C 语言 define 变参__VA_ARGS__使用
- ELK第五篇:mapping的创建和中文模糊查询
- Java中的String为什么是不可变的?
- 在自己的数据集上微调Light CNN
- RecyclerView的基本用法与四种数据展示(listview,griderview,单行,多行)
- Android_ButterKnife入门
- 提升方法Adaboost
- scala实现YARN中ResourceManager与NodeManager的主从关系模型
- 2.3.3 理解复合类型的声明
- mybatis的增删查改之通用Mapper
- 彻底解决mysql中文乱码
- 作业5.3