opencv - Caffe detection_evaluate_layer.cpp:56] 检查失败:bottom[1]->num() == 1 (8 vs. 1)
问题描述
我对 Caffe 很陌生。这是我第一次尝试 Caffe。
环境:
- Ubuntu 20.04 LTS 64 位
- Caffe 源码:https ://github.com/weiliu89/caffe
- 开放CV:4.2
- 显卡:无
- CUDNN:无
数据集:
- 班级编号:7(我的数据集中有 7 个班级)
我的 train.txt 和 test.txt 如下所示:
id03_018258_h.jpg ./annotations/vid03_018258_h.xml
vid03_121777_h.jpg ./annotations/vid03_121777_h.xml
vid03_118674_h.jpg ./annotations/vid03_118674_h.xml
标签 xml 文件如下所示:
<annotation>
<folder>jpegimages</folder>
<filename>vid03_230595_h.jpg</filename>
<path>/home/alexji/caffe-workspace/dataset/jpegimages/vid03_230595_h.jpg</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>800</width>
<height>480</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<name>car</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>509</xmin>
<ymin>271</ymin>
<xmax>581</xmax>
<ymax>321</ymax>
</bndbox>
</object>
<object>
<name>car</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>376</xmin>
<ymin>269</ymin>
<xmax>410</xmax>
<ymax>305</ymax>
</bndbox>
</object>
<object>
<name>car</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>175</xmin>
<ymin>267</ymin>
<xmax>220</xmax>
<ymax>302</ymax>
</bndbox>
</object>
</annotation>
准备训练和测试数据:
convert_imageset --shuffle --resize_height 300 --resize_width 300 ../dataset/jpegimages/ ../dataset/imagesets/trainval.txt ../dataset/train_lmdb
convert_imageset --shuffle --resize_height 300 --resize_width 300 ../dataset/jpegimages/ ../dataset/imagesets/test.txt ../dataset/test_lmdb
执行命令:
gen_model.sh 7
caffe train -solver solver_train.prototxt -weights mobilenet_iter_73000.caffemodel
example/MobileNetSSD_train.prototxt
输入的类型MobileNetSSD_test.prototxt
已从“AnnotatedData”更改为“data”
错误输出:
0908 06:22:46.163384 469 net.cpp:100] Creating Layer detection_out
I0908 06:22:46.163388 469 net.cpp:434] detection_out <- mbox_loc
I0908 06:22:46.163391 469 net.cpp:434] detection_out <- mbox_conf_flatten
I0908 06:22:46.163395 469 net.cpp:434] detection_out <- mbox_priorbox
I0908 06:22:46.163400 469 net.cpp:408] detection_out -> detection_out
I0908 06:22:46.163425 469 net.cpp:150] Setting up detection_out
I0908 06:22:46.163432 469 net.cpp:157] Top shape: 1 1 1 7 (7)
I0908 06:22:46.163435 469 net.cpp:165] Memory required for data: 1293206652
I0908 06:22:46.163439 469 layer_factory.hpp:77] Creating layer detection_eval
I0908 06:22:46.163444 469 net.cpp:100] Creating Layer detection_eval
I0908 06:22:46.163447 469 net.cpp:434] detection_eval <- detection_out
I0908 06:22:46.163451 469 net.cpp:434] detection_eval <- label
I0908 06:22:46.163457 469 net.cpp:408] detection_eval -> detection_eval
F0908 06:22:46.163471 469 detection_evaluate_layer.cpp:56] Check failed: bottom[1]->num() == 1 (8 vs. 1)
*** Check failure stack trace: ***
@ 0x7f3ac479cdaa (unknown)
@ 0x7f3ac479cce4 (unknown)
@ 0x7f3ac479c6e6 (unknown)
@ 0x7f3ac479f687 (unknown)
@ 0x7f3ac4f7c3ab caffe::DetectionEvaluateLayer<>::Reshape()
@ 0x7f3ac4fa153c caffe::Net<>::Init()
@ 0x7f3ac4fa23b5 caffe::Net<>::Net()
@ 0x7f3ac504d042 caffe::Solver<>::InitTestNets()
@ 0x7f3ac504d89d caffe::Solver<>::Init()
@ 0x7f3ac504db8a caffe::Solver<>::Solver()
@ 0x7f3ac4fcb0c6 caffe::Creator_RMSPropSolver<>()
@ 0x40fbee caffe::SolverRegistry<>::CreateSolver()
@ 0x408c44 train()
@ 0x4065ac main
@ 0x7f3ac2ff3f45 (unknown)
@ 0x406eb3 (unknown)
@ (nil) (unknown)
Aborted (core dumped)
如何解决上述错误?谢谢
解决方案
推荐阅读
- python - 如何从Python数据框中行的前一个密集等级中读取一个值
- python - 复杂的django查询,我不知道怎么做
- javascript - 对象不支持“for”属性或方法
- c++ - 如何修复 C++ 中向量的重载变量错误
- excel - 获得最佳全能选手
- swift - 在领域模型中存储列表或数组?[ 斯威夫特 ]
- r - data.table 和 dplyr 兼容性
- git - 如何将本地计算机中的文件添加到已克隆的本地 git 存储库?
- c++ - 有没有办法在没有括号的情况下在 C++ 中调用成员的 getter/setter?
- android - Android Studio 不想打开项目 (macOS)