Models: Successfully trained with SSD_MobileNets but can't detect anything ?

Created on 12 Sep 2017  路  11Comments  路  Source: tensorflow/models

Hello guys, I am trying to train my own object detection with 2 classes. I followed this guide https://medium.com/towards-data-science/how-to-train-your-own-object-detector-with-tensorflows-object-detector-api-bec72ecfe1d9 to make my own training and testing record. I used SSD-Mobilenets for training and as predicted, the loss goes well after 20k step training. This is my config :

model {
ssd {
num_classes: 2
box_coder {
faster_rcnn_box_coder {
y_scale: 10.0
x_scale: 10.0
height_scale: 5.0
width_scale: 5.0
}
}
...I DONT CHANGE ANYTHING HERE
fine_tune_checkpoint: "/home/phong/Checkpoints/ssd_mobilenet_v1_coco_11_06_2017/model.ckpt"
from_detection_checkpoint: true

num_steps: 20000
data_augmentation_options {
random_horizontal_flip {
}
}
}

train_input_reader: {
tf_record_input_reader {
input_path: "/home/phong/models-master/object_detection/data/train.record"
}
label_map_path: "/home/phong/models-master/object_detection/data/marker_label_map.pbtxt"
}

eval_config: {
num_examples: 10

max_evals: 10
}

eval_input_reader: {
tf_record_input_reader {
input_path: "/home/phong/models-master/object_detection/data/test.record"
}
label_map_path: "/home/phong/models-master/object_detection/data/marker_label_map.pbtxt"
shuffle: true
num_readers: 1
}

Label file:
item {
id: 1
name: 'farMarker'
}

item {
id: 2
name: 'closeMarker'
}

Training command:

python object_detection/train.py --logtostderr --pipeline_config_path=object_detection/data/ssd_mobilenet_v1_marker.config --train_dir=object_detection/model/train

mobilenetsssd

Evaluation command:

python object_detection/eval.py --logtostderr --pipeline_config_path=object_detection/samples/configs/ssd_mobilenet_v1_marker.config --checkpoint_dir=object_detection/model/train --eval_dir=object_detection/model/eval

However,after 20k iteration, I run the eval.py and receive no result.

eval

I tried to export frozen graph and tried detection the exported graph but receives no detection.

exported

My question is that: I dont know if I am making any mistake making this dataset because if I do then the training should goes crazy and the nice total loss curve can not be obtained. Please help me because I dont know what I did wrong !

P/s: This is the link to download my record files for further investigation. I made this by myself, though.
https://www.dropbox.com/s/k9z60wce6sajw0r/record.zip?dl=0

Most helpful comment

All 11 comments

can you tell us more about what type of code u have used for converting data set into tfrecord and what it's format?

@saghiralfasly Well basically, I just follow all the code from the tutorial I mentioned above. However, I fixed the problem by using the provided python script from VOC Pascal dataset and everything works for me now. I think I will close the issue but i hope to investigate this in the future.

@phongnhhn92 actually this happened to me too. due to the code for preparing data set where in that mentioned tutorial he has developed a script to create tfrecord where each example contains only one bounding box. i have modified the code so each examples contains more than one bounding box after that it works well for detecting more than one object on image. However, that tutorial and scripts designed to train and test images that contain only one object with one bounding box on each image.

@saghiralfasly Would you mind sharing the code. I think it would help lots of people.

That's awesome mate !

@phongnhhn92 I face same problem. you said you fixed by using python script from VOC Pascal Dataset. So, can you provide link for this script?

@phongnhhn92 did this solution work for you? I trained my model using this and I didn't get any detections at all.

Hi guys,
It has been a while since I worked on this project and basically I solved this by organizing my custom dataset to be in exactly the same structure with Pascal VOC dataset. Therefore, I can use the provided script by tensorflow object detection api to generate the required tf records files. As @saghiralfasly said above the script in the tutorial only works in case of single bounding box so the easiest way is the method I mentioned above.

@saghiralfasly that code worked well for the detection of single class. When i created the TF records for the 4 classes same error persists. Will you please elaborate how to customize that code for generating TF records for four classes

@phongnhhn92 @saghiralfasly is it correct way, suggest me modificaion. Stuck in this problem for about two weeks :(

Screenshot (257)

Was this page helpful?
0 / 5 - 0 ratings