参考文献:https://blog.csdn.net/woshicao11/article/details/82055449
https://blog.csdn.net/cc__cc__/article/details/103896815
https://blog.csdn.net/u014696804/article/details/103817245
训练自己的数据集时出现的错误:
这个问题困绕我半天时间,找各种资料最后终于解决
首先要保证生成的annationns中的xml文件里面的名字(names)不能有大写和空格及其它,只能有小些字母。
还要保证在tf-faster-rcnn/lib/datasets/pascal_voc.py中的self._classes中的名字和xml里的一样
我就是这里的habor写成了harbor,与xml中habor不一样,出现上面的错误。
改过之后就能运行。
参考博客:https://blog.csdn.net/duanyajun987/article/details/83790384
https://blog.csdn.net/Lemon_Rain/article/details/89002104
https://github.com/rbgirshick/py-faster-rcnn/issues/316
人家说的问题解决方法:
demo自己的模型检测结果如何,测试自己图片时出现的问题:
报错:RuntimeError:
demo.py中的class没有改
solution:
注意demo文件中也需要修改模型要识别的类名
①CLASSES = (‘background’, ‘car’, ‘person’ ),如 pytorch-faster-rcnn-master/lib/datasets/pascal_voc.py一样
②# load network
if demonet == ‘vgg16’:
net = vgg16()
elif demonet == ‘res101’:
net = resnetv1(num_layers=101)
else:
raise NotImplementedError
net.create_architecture(3, tag=‘default’, anchor_scales=[8, 16, 32]) 由原来的21类改成11类
再重新输入类似命令:
python demo.py --net vgg16 --checksession 1 --checkepoch 20 --checkpoint 1291 --cuda --load_dir models