问题
Setup:
- ubuntu 16.04 LTS, 4 vCPU + 30gb ram
- nvidia K80 GPU w/12gb memory
- CUDNN 8.0 x64
- 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