Caffe_Windows学习笔记(七)细粒度图像分类
2017-10-10 21:19
525 查看
0、参考文献
[1]https://github.com/ouceduxzk/Fine_Grained_Classification/tree/master/codes[2]http://blog.csdn.net/lynnandwei/article/details/44458033
1.
install caffedownload bvlc_googlenet.caffemodel
http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel
download images into the cars_train and cars_test folder under the prepare folder
http://ai.stanford.edu/~jkrause/cars/car_dataset.html
2.
in the prepare folder, change the directory of train_path and test_path to your own pathrun : python preprocessing.py, which will generate the crop_train and crop_test
train_path = 'D:/caffe_test/caffe-master/fine_grained/cars_train/' train_files = os.listdir(train_path) train_files = [ f for f in train_files if f.endswith('jpg')] test_path = 'D:/caffe_test/caffe-master/fine_grained/cars_test/' test_files = os.listdir(test_path)
遇到unindent的报错的话,用Notepad解决,具体参考https://www.crifan.com/python_syntax_error_indentationerror/
结果:
3.
sh pre.sh , which will call caffe to save the images into a database#!/bin/bash D:/caffe_test/caffe-master/Build/x64/Release/convert_imageset D:/caffe_test/caffe-master/fine-grained/crop_train/ train2.txt ./train -resize_width=227 -resize_height=227 -check_size -shuffle true D:/caffe_test/caffe-master/Build/x64/Release/convert_imageset D:/caffe_test/caffe-master/fine-grained/crop_test/ test2.txt ./test -resize_width=227 -resize_height=227 -check_size -shuffle true
结果:
4.
change the path in the models/finetuen_car/train_val.prototxt into the path of your dblayer { name: "data" type: "Data" top: "data" top: "label" include { phase: TRAIN } transform_param { mirror: true crop_size: 224 mean_value: 104 mean_value: 117 mean_value: 123 } data_param { source: "D:/caffe_test/caffe-master/fine-grained/train/" batch_size: 32 backend: LMDB } } layer { name: "data" type: "Data" top: "data" top: "label" include { phase: TEST } transform_param { mirror: false crop_size: 224 mean_value: 104 mean_value: 117 mean_value: 123 } data_param { source: "D:/caffe_test/caffe-master/fine-grained/test/" batch_size: 50 backend: LMDB } }
5.
sh run.sh, the models will be saved in the models directorysolver.prototxt:
net: "D:/caffe_test/caffe-master/fine-grained/train_val.prototxt" test_iter: 100 test_interval: 400 test_initialization: false display: 20 base_lr: 0.001 lr_policy: "step" stepsize: 10000 gamma: 0.1 max_iter: 50000 momentum: 0.9 weight_decay: 0.0005 snapshot: 1000 snapshot_prefix: "D:/caffe_test/caffe-master/fine-grained/car_googlenet" solver_mode: GPU
run.sh:
#!/bin/bash D:/caffe_test/caffe-master/Build/x64/Release/caffe train --solver D:/caffe_test/caffe-master/fine-grained/solver.prototxt --weights D:/caffe_test/caffe-master/fine-grained/bvlc_googlenet.caffemodel --gpu 0
结果:
一直遇到*** Check failure stack trace: ***的问题,但是路径都没错啊,目前没解决。
不知道是不是Windows不好跑的原因,我放到Linux上就通过了,汗……
6.
hyper parameters are in solver.prototxt file and you can play with that .相关文章推荐
- Caffe_Linux学习笔记(二)细粒度图像分类
- Caffe_Windows学习笔记(四)逐层可视化图像特征
- 【深度学习】【caffe实用工具2】笔记24 Windows下【Caffe实用工具】之【计算图像均值】compute_image_mean的用法
- Caffe_Windows学习笔记(五)用训练好的caffemodel来进行分类
- 【深度学习】【caffe实用工具3】笔记25 Windows下caffe中将图像数据集合转换为DB(LMDB/LEVELDB)文件格式之convert_imageset
- 【学习笔记】caffe for windows 安装配置
- [caffe]深度学习之图像分类模型AlexNet解读
- [caffe]深度学习之图像分类模型AlexNet解读
- 【深度学习】【caffe实用工具5】笔记27 windows下SSD网络中的get_image_size工具的使用
- 【转】[caffe]深度学习之图像分类模型AlexNet解读
- 【深度学习】笔记16 windows下SSD网络在caffe中的配置(CPU版本)【笔记2】
- caffe学习笔记3:使用caffe对自己的图像数据进行训练和测试
- 深度学习Caffe实战笔记(21)Windows平台 Faster-RCNN 训练好的模型测试数据
- caffe学习笔记-数据库制作及计算均值文件命令格式(windows版)
- Windows驱动开发工具 WDK 学习笔记(1) 分类: windows驱动程序WDM 2013-08-01 11:08 566人阅读 评论(0) 收藏
- Tensorflow学习笔记--使用迁移学习做自己的图像分类器(Inception v3)
- caffe学习笔记18-image1000test200数据集分类与检索完整过程
- [caffe]深度学习之图像分类模型AlexNe(各层feature map)解读
- [caffe]深度学习之图像分类模型VGG解读
- Windows Caffe 学习笔记(零)CIFAR-10数据的格式转换