花卉大识别之崭露头角

之所以写这个文章,主要还是由于有2段经历,一次是有个去**实习的机会,就是要做一个对花卉分类的桌面应用。另一个耿是在一次GPU的培训会上,旁边一个童鞋的公司就是做手机端的花卉识别。当然现在市场上也有好多这方面比较成熟的应用。

 

 

进入正题,论文为,Automated flowerclassification over a large number of classes,核心思想主要就是用AlexNet和VGG进行了分类的训练,也算是属于fine-grained classification的范畴。

git  clone  https://github.com/greatnorman1102/Flower-fine-grained-classification.git

下载图片数据集(Oxford 102category flower dataset)和预训练模型,执行,

python  bootstrap.py

执行完毕后,将会在当前目录下生成data文件夹,里面存放图片数据。


制作LMDB数据

../../build/tools/convert_imageset --resize_height=256 --resize_width=256 /home/caffe/examples/Flower-fine-grained-classification/data/jpg/ train_.txt ./img_train_lmdb

../../build/tools/convert_imageset --resize_height=256 --resize_width=256 /home/caffe/examples/Flower-fine-grained-classification/data/jpg/ valid_.txt ./img_valid_lmdb

修改AlexNet 用于训练的prototxt

finetune  AlexNet

../../build/tools/caffe train -solver solver.prototxt -weights pretrained-weights.caffemodel -gpu 0

修改VGG_S用于训练的prototxt

finetune  VGG_S

../../build/tools/caffe train -solver solver.prototxt -weights pretrained-weights.caffemodel -gpu 1

修改GOOGLENET用于训练的prototxt


finetune  GOOGLENET

../../build/tools/caffe train -solver solver.prototxt -weights pretrained-weights.caffemodel -gpu 2

训练完毕后曲线如下所示,按理说,googlenet的层数最多,应该性能最好,实际却不是,可能的原因应该就是googlenet训练需要一些trick,不是那么好finetune,这也许也是好多检测框架使用VGG的原因吧。

制作synset_words.txt

43_alpine sea holly
105_anthurium
78_artichoke
96_azalea
46_ball moss
49_balloon flower
127_barbeton daisy
54_bearded iris
66_bee balm
85_bird of paradise
109_bishop of llandaff
54_black-eyed susan
48_blackberry lily
49_blanket flower
40_bolero deep blue
128_bougainvillea
63_bromelia
49_king protea
67_lenten rose
137_lotus
46_love in the mist
63_magnolia
66_mallow
67_marigold
40_mexican aster
82_mexican petunia
46_monkshood
40_moon orchid
107_morning glory
67_orange dahlia
61_osteospermum
49_oxeye daisy
251_passion flower
71_pelargonium
71_buttercup
102_californian poppy
91_camellia
82_canna lily
40_canterbury bells
108_cape flower
52_carnation
50_cautleya spicata
112_clematis
87_colt's foot
86_columbine
92_common dandelion
41_corn poppy
154_cyclamen
59_daffodil
63_desert-rose
65_english marigold
82_peruvian lily
258_petunia
59_pincushion flower
40_pink primrose
109_pink-yellow dahlia
93_poinsettia
93_primula
40_prince of wales feathers
85_purple coneflower
42_red ginger
171_rose
75_ruby-lipped cattleya
41_siam tulip
52_silverbush
87_snapdragon
48_spear thistle
42_spring crocus
40_fire lily
162_foxglove
166_frangipani
91_fritillary
45_garden phlox
67_gaura
78_gazania	
114_geranium	
56_giant white arum lily
45_globe thistle
41_globe-flower
41_grape hyacinth
56_great masterwort
60_hard-leaved pocket orchid	
131_hibiscus	
76_hippeastrum
55_japanese anemone	
66_stemless gentian	
61_sunflower	
56_sweet pea
85_sweet william
130_sword lily
120_thorn apple	
45_tiger lily	
41_toad lily	
58_tree mallow
62_tree poppy
58_trumpet creeper
196_wallflower	
194_water lily
184_watercress	
85_wild pansy
54_windflower
49_yellow iris

制作一个测试的sh脚本

#!/bin/bash  
#AlexNet
../../build/examples/cpp_classification/classification.bin\
 AlexNet/deploy.prototxt\
 AlexNet/caffe_alexnet_train_iter_50000.caffemodel\
 imagenet_mean.binaryproto\
 synset_words.txt\
 data/jpg/image_00256.jpg
#VGG-S
../../build/examples/cpp_classification/classification.bin\
 VGG-S/VGG_CNN_S_deploy.prototxt\
 VGG-S/caffe_vgg_train_iter_20000.caffemodel\
 VGG-S/VGG_mean.binaryproto\
 synset_words.txt\
 data/jpg/image_00256.jpg
#GoogleNet
../../build/examples/cpp_classification/classification.bin\
 googlenet/deploy.prototxt\
 googlenet/caffe_googlenet_train_iter_50000.caffemodel\
 imagenet_mean.binaryproto\
 synset_words.txt\
 data/jpg/image_00256.jpg

运行上述脚本,输出结果,

references:

https://github.com/greatnorman1102/Flower-fine-grained-classification

http://www.robots.ox.ac.uk/~vgg/data/flowers/102/index.html




  • 6
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值