Tensorflow 对象检测 API 不能正确检测对象/根本不检测对象 [英] Tensorflow Object Detection API does not detect objects correctly/does not detect objects at all

查看:80
本文介绍了Tensorflow 对象检测 API 不能正确检测对象/根本不检测对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了代码的整个步骤/格式(多次交叉检查以 100% 确定它们是正确的)以及在 Tensorflow 对象检测 API 上训练自定义对象所需的数据.我尝试使用 ssd_mobilenet_v1_coco、faster_rcnn_resnet101_coco 以及 fast_rcnn_inception_v2_coco 模型,但仍然没有得到任何好的结果.我得到的只是对象分类错误或根本没有边界框.

I have followed the entire steps/format of codes(cross checked multiple times to be 100% sure they are correct) and the required data for training custom objects on Tensorflow Object Detection API. I tried using ssd_mobilenet_v1_coco, faster_rcnn_resnet101_coco as well as faster_rcnn_inception_v2_coco models and still haven't got any sort of good result. All I get is misclassification of objects or no bounding box at all.

我正在训练检测单个类对象,其中训练图像数量约为 250,验证图像数量为 63;并且每个大小不一的图像大多在 300 x 300 像素或更小.我正在训练模型直到它们收敛(不完全).我通过查看 eval 性能(步长超过 15000 步)来了解这一点,随着时间的推移,损失逐渐减少(至 <0.04),但也会波动.我停止训练并导出图表.我的问题是:

I am training to detect a single class object with number of training images around 250 and number of validation images 63; and each image of varying size mostly around 300 x 300 pixels or lesser. I am training the models till they sort of converge(not fully). I know this by seeing the eval performance which shows at steps over 15000, the loss gradually decreases(to < 0.04) over time but also fluctuates. I stop my training and export the graph. My question is:

我对用于解决物体检测的测试视频有很大的疑问.视频帧的尺寸为 1370 x 786 像素,其中我需要检测的对象与帧大小相比非常小.这是否会导致问题?因为我的训练图像很小(300 x 300 或更小),而与训练图像相比,我的测试视频帧如此之大?我尝试了几次训练,但每次都失败了,我坚持到了想放弃这个的地步.

I have a solid doubt about the test video that I have been given to solve the object detection for. The video frames are quite large of the dimension 1370 x 786 pixels in which the object I need to detect is quite small compared to the frame size. Is this causing the problem?, since my training images are small(300 x 300 and smaller), whereas my test video frames are so large compared to the training images? I tried training several times but failed each time with each model and I am stuck to a point where I want to give up on this.

有人可以了解这里发生的事情吗?我应该训练更多的步骤吗?或者我也应该训练与测试帧中相似尺寸的图像进行训练?这会有帮助吗?

Can somebody put a light on what is happening here? Should I train for more steps? Or should I train similar dimension images as in test frames for training as well? Will this help?

以下是我使用的配置文件和labelmap.pbtxt的代码.

Following is the code of the config file and labelmap.pbtxt I used.

配置文件:

    fine_tune_checkpoint: ".../ssd_mobilenet_v1_coco_2017_11_17/model.ckpt"
  from_detection_checkpoint: true
  num_steps: 200000
  data_augmentation_options {
    random_horizontal_flip {
    }
  }
  data_augmentation_options {
    ssd_random_crop {
    }
  }
}

train_input_reader: {
  tf_record_input_reader {
    input_path: ".../train.record"
  }
  label_map_path: ".../labelmap.pbtxt"
}

eval_config: {
  num_examples: 63

labelmap.pbtxt:

item {
  id: 1
  name: 'tomato'
}

推荐答案

或者我也应该训练与测试帧中相似尺寸的图像进行训练?这会有帮助吗?

Or should I train similar dimension images as in test frames for training as well? Will this help?

鉴于您的解释,这正是您需要做的.

This is exactly what you need to do, given what you explained.

您不应期望在 300x300 图像上训练的网络在 1370x786 图像上按预期工作.特别是如果对象在大图像中已经很小.

You should not expect a network trained on 300x300 images to work as intended on 1370x786 images. Specially if the object is already small in the big images.

您的火车数据必须与您的评估数据尽可能相似,不要进入危险的过拟合区域.至少图像必须具有相似的大小和纵横比并且来自同一域

Your train data has to be as similar as possible to your eval data, without enterning in the dangerous overfit zone. At least the images have to be of similar size and aspect ratio and from the same domain

一旦你解决了这个问题,请记住,小物体真的很难被检测到,所以你可能需要修改默认的模型配置.

Once you have solved this, have in mind that small objects are really hard to detect so you will probably need to modify the default model configuration.

如果您没有实时约束,我建议您首先尝试使用 Faster-RCNN,将 output_stride 参数设置为 8 而不是 16.

If you don't have real-time constraints I would recommend you to start by trying a Faster-RCNN setting the output_stride parameter to 8 instead of 16.

这篇关于Tensorflow 对象检测 API 不能正确检测对象/根本不检测对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆