Object Detection API: can't train ssd_mobilenet_v1 on PETS
System information
- What is the top-level directory of the model you are using: object_detection
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): no
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
- TensorFlow installed from (source or binary): binary
- TensorFlow version (use command below): 1.4.0
- Bazel version (if compiling from source):
- CUDA/cuDNN version: cuDNN v6.0
- GPU model and memory:
- Exact command to reproduce:
Describe the problem
Starting October 31, 2017 Release ssd_mobilenet_v1 is not working for me. I'm trying to train it on Oxford-IIIT Pets dataset. Config template: ssd_mobilenet_v1_pets.config. Pretrained checkpoint: ssd_mobilenet_v1_coco (from Zoo). After 200k iterations mAP on validation set is about 0.05. Last working commit: edcd29f2dbb4b3eaed387fe17cb5270f867aec42
I've encountered this as well. Training behavior with SSD mobilenet (on any dataset) seems very weird with a recent checkout. Loss goes down quickly, but accuracy stays terrible. Seems like it's only ever proposing 1 box, even when multiple objects are in-scene?
Can you provide an exact command + code and output to recreate your issues? Thanks!
Literally just working through the Pets tutorial with ssd+mobilenet rather than faster-rcnn+resnet should reveal the issue (mAP not improving in any meaningful way).
Here's another person who may be running into the same thing: https://stackoverflow.com/questions/47086760/expected-accuracy-of-the-pet-example-using-ssd-model-in-tensorflow-object-detect
I'm currently testing rolling back to the "last working" commit above, will report back with results.
Since we're triaging so many issues, you can help us out immensely by streamlining the replication process -- including the exact code + commands you're using, even if it's just from a tutorial, makes it much easier for us and for others to verify problems.
Untested, but I think the steps are basically:
<from research directory>:
wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/images.tar.gz
wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/annotations.tar.gz
tar -xvf images.tar.gz
tar -xvf annotations.tar.gz
python object_detection/create_pet_tf_record.py --label_map_path=object_detection/data/pet_label_map.pbtxt --data_dir=`pwd` --output_dir=`pwd`
mkdir junk_pets
cd junk_pets
cp ../object_detection/data/pet_label_map.pbtxt .
wget http://storage.googleapis.com/download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_coco_11_06_2017.tar.gz
tar -xzf ssd_mobilenet_v1_coco_11_06_2017.tar.gz
cp ../object_detection/samples/configs/ssd_mobilenet_v1_pets.config .
<edit config>:
143c143
< batch_size: 24
---
> batch_size: 8
149,150c149,150
< decay_steps: 800720
< decay_factor: 0.95
---
> decay_steps: 15000
> decay_factor: 0.70
158c158
< fine_tune_checkpoint: "PATH_TO_BE_CONFIGURED/model.ckpt"
---
> fine_tune_checkpoint: "/home/sclark/tf-models/research/junk_pets/ssd_mobilenet_v1_coco_11_06_2017/model.ckpt"
177c177
< input_path: "PATH_TO_BE_CONFIGURED/pet_train.record"
---
> input_path: "/home/sclark/tf-models/research/junk_pets/pet_train.record"
179c179
< label_map_path: "PATH_TO_BE_CONFIGURED/pet_label_map.pbtxt"
---
> label_map_path: "/home/sclark/tf-models/research/junk_pets/pet_label_map.pbtxt"
186c186
< max_evals: 10
---
> max_evals: 1
191c191
< input_path: "PATH_TO_BE_CONFIGURED/pet_val.record"
---
> input_path: "/home/sclark/tf-models/research/junk_pets/pet_val.record"
193c193
< label_map_path: "PATH_TO_BE_CONFIGURED/pet_label_map.pbtxt"
---
> label_map_path: "/home/sclark/tf-models/research/junk_pets/pet_label_map.pbtxt"
python ../object_detection/train.py --train_dir train --pipeline_config_path ssd_mobilenet_v1_pets.config
python ../object_detection/eval.py --checkpoint_dir train --eval_dir eval --pipeline_config_path ssd_mobilenet_v1_pets.config
This is probably a clue: Orange = recent checkout, bad SSD behavior. Purple = older checkout, good SSD behavior.

I can confirm that reverting to commit edcd29f as mentioned above fixes the issue of poor mAP. current: <10% mAP after 80K iterations edcd29f: >52% mAP after 8K iterations
@Denisandrik, @stevenpclark Could you try with the latest code using the updated models from the object detection zoo ?
Looks fixed! Fresh checkout + new models, train from scratch, >66% mAP after 13K iterations. Thank you!
@stevenpclark Great! Thanks for confirming. I will go ahead and close this issue now
Problem still exists for my case. Did the new model solved number of positives and number of negatives issues in the plots above? see #2761
@starwars110 Can you confirm that you used the latest commit and the new models from the detection zoo?
Yes I did
On Nov 9, 2017 7:30 PM, "vivek rathod" [email protected] wrote:
@starwars110 https://github.com/starwars110 Can you confirm that you used the latest commit and the new models from the detection zoo?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/2749#issuecomment-343365105, or mute the thread https://github.com/notifications/unsubscribe-auth/AdlcGh8Gqbsi2-gpme1RYYg0KVt8Vjmmks5s08NrgaJpZM4QXpEZ .
@starwars110 . With tensorflow version 1.4, latest object detection code, fine_tune_checkpoint set to ssd_mobilenet_v1_coco I am able to fine tune on pets dataset and observe proper num positives, num negatives in Hard example miner. I can't reproduce the problem you are reporting. Perhaps you missed one of the steps ? Here's a screenshot of the tensorboard that matches @stevenpclark 's

Thanks. I will check again tomorrow. One question in the meantime, are the tf records unchanged? I am still using the tf records that I have generated using the previous version.
On Nov 9, 2017 10:21 PM, "vivek rathod" [email protected] wrote:
@starwars110 https://github.com/starwars110 . With tensorflow version 1.4, latest object detection code, fine_tune_checkpoint set to ssd_mobilenet_v1_coco http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_coco_2017_11_08.tar.gz I am able to fine tune on pets dataset and observe proper num positives, num negatives in Hard example miner. I can't reproduce the problem you are reporting. Perhaps you missed one of the steps ? Here's a screenshot of the tensorboard that matches @stevenpclark https://github.com/stevenpclark 's
[image: image] https://user-images.githubusercontent.com/126883/32645455-34660bbe-c59c-11e7-9bac-707176993b06.png
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/2749#issuecomment-343385271, or mute the thread https://github.com/notifications/unsubscribe-auth/AdlcGjSIXCAY5BxNAGgD0yE-_JTQ6c-3ks5s0-tfgaJpZM4QXpEZ .
@starwars110 AFAIK, no. But I followed the procedure to reproduce by @stevenpclark above. Let's track this in #2761 instead since the original issue reported by @stevenpclark is fixed.
Looks fixed, thanks.
It seems fixed for both ssd_mobile and ssd_inception, great!