TF Object Detection API - Not ALL classes are being detected & behaving oddly

帅比萌擦擦* 提交于 2019-12-19 04:12:30

问题


Setup:

  1. ubuntu 16.04 LTS, 4 vCPU + 30gb ram
  2. nvidia K80 GPU w/12gb memory
  3. CUDNN 8.0 x64
  4. TF version 1.3

Objective: using TF object detection API to detect face, person, pistol, rifle, automatic_rifle

Steps taken:

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% set to train, and 10% to test

So number of images per class looked like this

train - see csv

  • rifle 401
  • revolver 389
  • assault_rifle 532
  • face 407
  • person 389

test - see csv

  • rifle 45
  • revolver 44
  • assault_rifle 60
  • face 126
  • person 44

2) Generate TF records (see code)

# see pastebin
  • Model used: faster_rcnn_resnet101_coco
  • Config: Pretty similar to the pet custom detector config, see code
  • pbtxt file: see code

==> 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) Train Ran over 200k steps.

Problem

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.

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:

See pictures

Here's how the custom dataset trained model did:

See pictures

1) Any ideas where I'm going wrong?

This SO user had a same problem (TensorFlow Object Detection API Weird Behaviour), but claimed he solved it by cropping / resizing input image.

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


回答1:


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:



来源:https://stackoverflow.com/questions/47129078/tf-object-detection-api-not-all-classes-are-being-detected-behaving-oddly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!