问题描述
设置:
- ubuntu 16.04 LTS,4 个 vCPU + 30gb 内存
- nvidia K80 GPU,带 12GB 内存
- CUDNN 8.0 x64
- TF 1.3 版
目标:使用 TF 对象检测 API 检测人脸、人、手枪、步枪、automatic_rifle
Objective: using TF object detection API to detect face, person, pistol, rifle, automatic_rifle
采取的步骤:
1) 准备图像和边界框- 人脸:使用更广泛的人脸数据集- 人:使用 COCO 数据集- 枪支:使用 Image-Net
1) Prepare images and bounding boxes- face: used WIDER face dataset- person: used COCO dataset- guns: used Image-Net
没有.枪的数量远不及面部和面部的数据集大小.人,所以我通过限制人脸/人物图像的数量来确保每个类别的图像数量相似.
No. of guns is nowhere near the dataset size for face & person, so I made sure that # of image per each class was similar by limiting the # of face/people images.
90% 用于训练,10% 用于测试
90% set to train, and 10% to test
每个类的图像数量看起来像这样
So number of images per class looked like this
train - 参见 csv
- 步枪 401
- 左轮手枪 389
- assault_rifle 532
- 面对 407
- 人 389
测试 - 参见 csv
- 步枪 45
- 左轮手枪 44
- assault_rifle 60
- 面对 126
- 第 44 个人
2) 生成 TF 记录(查看代码)
# see pastebin
- 使用的模型:faster_rcnn_resnet101_coco
- 配置:与宠物自定义检测器配置非常相似,查看代码
- pbtxt 文件:查看代码
==> 小注:最后一行有nb_epoch".我注意到这个值在带有 TF 对象检测 API 的其他模型配置文件中不存在(即在文件夹中)
==> Minor Note: There's "nb_epoch" in last line. I noticed this value doesn't exist in other model config files shipped w/TF object detection API (i.e. in folder )
3) 训练跑了超过 20 万步.
3) TrainRan over 200k steps.
问题
我训练的 5 个课程并不总是显示出来,即使是在训练过的图像上也是如此.似乎人或脸都在检测,很少同时检测.
The 5 classes that I trained for do NOT always show up, even on trained images. It seems like either the person OR face is detecting, rarely both.
作为参考框架,这是 TF 对象检测 API 附带的 fast_rcnn_inception_resnet_v2_atrous_coco 模型的结果.我知道这不是苹果对苹果的比较,但至少你可以看到人物检测:
As a frame of reference, this was the result of the faster_rcnn_inception_resnet_v2_atrous_coco model that comes shipped with TF object detection API. I know it's not apple to apples comparison, but at least you can see the person detection:
自定义数据集训练模型的工作方式如下:
Here's how the custom dataset trained model did:
1) 有什么想法我哪里出错了吗?
1) Any ideas where I'm going wrong?
这个 SO 用户遇到了同样的问题(TensorFlow Object Detection API Weird Behaviour),但声称他通过裁剪/调整输入图像的大小解决了这个问题.
This SO user had a same problem (TensorFlow Object Detection API Weird Behaviour), but claimed he solved it by cropping / resizing input image.
训练数据需要调整大小吗?我不记得在 自定义宠物中看到任何调整大小检测器教程但我确实问b/ci是否在配置文件中看到min_和max_dimension
Does the training data need to be resized? I don't recall seeing any resizing in the custom pet detector tutorial but i do ask b/c i do see min_ and max_dimension in the config file
推荐答案
在您的配置文件中设置 num_examples: 8000 是 8000,将该数字设置为您要添加的测试图像的数量.例如,您在测试文件夹中拍摄 200 张图像,然后num_examples:200:
In your config file you set the num_examples: 8000 is 8000, set that number to how many test images you are tacking. for example your are taking 200 images in test folder, then "num_examples:200:
这篇关于TF 对象检测 API - 并非所有类都被检测到行为古怪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!