基于darkflow:https://github.com/thtrieu/darkflow
但是按照原文步骤训练VOC数据集似乎有点问题
AssertionError: labels.txt and cfg/yolo-new.cfg indicate inconsistent class numbers
1)下载VOC数据集
# Download the Pascal VOC dataset:
curl -O https://pjreddie.com/media/files/VOCtest_06-Nov-2007.tar
tar xf VOCtest_06-Nov-2007.tar
# An example of the Pascal VOC annotation format:
vim VOCdevkit/VOC2007/Annotations/000001.xml
2)复制yolo.cfg,重命名为yolotest1.cfg
3)打开yolotest1.cfg,修改 [region] layer (the last layer) to the number of classes you are going to train for. In our case, classes are set to 20:
...
[region]
anchors = 1.08,1.19, 3.42,4.41, 6.63,11.38, 9.42,5.11, 16.62,10.52
bias_match=1
classes=20###!!!
coords=4
num=5
softmax=1
...
4)仍然在yolotest1.cfg中,change filters in the [convolutional] layer (the second to last layer(倒数第二层?)) to num * (classes + 5). In our case, num is 5 and classes are 3 so 5 * (3 + 5) = 40 therefore filters are set to 40.
对于VOC是5*(20+5)=125
...
[convolutional]
size=1
stride=1
pad=1
filters=125
activation=linear
[region]
anchors = 1.08,1.19, 3.42,4.41, 6.63,11.38, 9.42,5.11, 16.62,10.52
...
5)修改labels.txt ,列出20类(VOC)标签
person
bird
cat
cow
dog
horse
sheep
aeroplane
bicycle
boat
bus
car
motorbike
train
bottle
chair
dining table
potted plant
sofa
tv/monitor
person
bird
cat
cow
dog
horse
sheep
aeroplane
bicycle
boat
bus
car
motorbike
train
bottle
chair
dining table
potted plant
sofa
tv/monitor
6)运行flow --model cfg/yolotest1.cfg --train --dataset "/Users/sisyphus/darkflow/VOCdevkit/VOC2007/JPEGImages" --annotation "/Users/sisyphus/darkflow/VOCdevkit/VOC2007/Annotations"
(注意需要绝对路径!)
运行一步后报错killed9,可能是内存不够。下来在GPU电脑上试试看。
没有评论:
发表评论