Caffe_Windows学习笔记(七)细粒度图像分类
来源:互联网 发布:c语言左移和右移 编辑:程序博客网 时间:2024/06/05 00:07
0、参考文献
[1]https://github.com/ouceduxzk/Fine_Grained_Classification/tree/master/codes
[2]http://blog.csdn.net/lynnandwei/article/details/44458033
1.
install caffe
download 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 path
run : 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/bashD:/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 trueD:/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 db
layer { 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 directory
solver.prototxt:
net: "D:/caffe_test/caffe-master/fine-grained/train_val.prototxt"test_iter: 100test_interval: 400test_initialization: falsedisplay: 20base_lr: 0.001lr_policy: "step"stepsize: 10000gamma: 0.1max_iter: 50000momentum: 0.9weight_decay: 0.0005snapshot: 1000snapshot_prefix: "D:/caffe_test/caffe-master/fine-grained/car_googlenet"solver_mode: GPU
run.sh:
#!/bin/bashD:/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_Windows学习笔记(七)细粒度图像分类
- Caffe_Linux学习笔记(二)细粒度图像分类
- Caffe_Windows学习笔记(四)逐层可视化图像特征
- 论文阅读笔记(二)细粒度图像分类
- Caffe_Windows学习笔记(五)用训练好的caffemodel来进行分类
- 图像分类——细粒度的概念
- 论文阅读笔记(三)细粒度图像检索
- Caffe_Windows学习笔记(二)用自己的数据训练和测试CaffeNet
- Caffe_Windows学习笔记(六)图形化操作工具digits的安装与运行
- 【OpenCV学习笔记】【函数学习】七(改变图像尺寸)
- Caffe_Windows学习笔记(三)搭建自己的网络mnist在caffe上进行训练与学习
- 学习笔记:粒度设计 粗粒度与细粒度 (-)
- Caffe_Windows学习笔记(一)基于Win10 x64+VS2013+GPU加速+Python2.7+Matlab2016b环境下的Caffe配置
- GDI+学习笔记(七)保存简单图像
- opencv2.x学习笔记(七)图像滤波操作
- Matlab图像处理学习笔记(七):surf特征点
- OpenCV学习笔记(七) 图像金字塔 阈值 边界
- MATLAB学习笔记七(关于图像处理)
- 好好准备找工作
- this关键字的应用
- 【图论】有向无环图的拓扑排序
- 前端之ajax解析
- Double Patience UVA
- Caffe_Windows学习笔记(七)细粒度图像分类
- continue和break
- 类与对象第五题
- 输出一个某种编码的字符串
- 2017 乌鲁木齐赛区网络赛 Coconut(【模拟题目】)
- 209. Minimum Size Subarray Sum解题报告
- Noip 2016 蚯蚓
- a2dp
- 循环队列的实现