Get a very poor detection accuracy after freezing ssd-mobilenet-v2 model
System information
- What is the top-level directory of the model you are using: object_detetion
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): yes
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): win10
- TensorFlow installed from (source or binary): binary
- TensorFlow version (use command below): 1.10.0
- Bazel version (if compiling from source):
- CUDA/cuDNN version: 9.2
- GPU model and memory 1080ti:
- Exact command to reproduce:
Describe the problem
I get a very poor accuracy after using export_inference_graph.py to freeze model and use that frozen model to do detect.
But if i evaluate dataset using unfrozen checkpoint file, accuracy is good. No idea how to fix this.
Also tried ssd-mobilenet-v1, same problem. I will try some other not mobilenet model to see if problem exists.
Here is my reproduction steps:
step 1. download ssd_mobilenet_v2_coco_2018_03_29 pretrained model to object_detection and use that model and detection script to detect a dog picture to ensure both model and script are correct.
step 2. use samples/configs/ssd_mobilenet_v2_coco.config and data/mscoco_label_map.pbtxt to start training for 0 step.
python legacy/train.py --logtostderr --train_dir=training --pipeline_config_path=training/ssd_mobilenet_v2_coco.config
after that, i get model.ckpt-0.* files. Since i only care about step 0 model so i use other dataset instead of
coco datatset to avoid downloading coco dataset. model.ckpt-0.* should be the same as pretrained ssd_mobilenet_v2_coco_2018_03_29 model, if i am correct.
step 3. freeze model
python export_inference_graph.py --input_type image_tensor --pipeline_config_path training/ssd_mobilenet_v2_coco.config --trained_checkpoint_prefix training/model.ckpt-0 --output_directory inference_graph
step 4. detection test on a dog picture
use the same script from step 1 to detect a dog picture with new frozen model. Result is bad.
My fault. My train images is rgb channel order, but test image data is bgr.
@huchhong what do you mean by rgb and bgr channel order? Can you explain much further? I'm experiencing the same issue on ssd mobilenet v1
@huchhong what do you mean by rgb and bgr channel order? Can you explain much further? I'm experiencing the same issue on ssd mobilenet v1 For example OpenCV reads image in BGR channel but PIL.Image reads in RGB channel
I exported pb and got pbtxt files, but when I try to open using dnn module in opencv it says memory problem... Please help!
Hi, how did you get the training and validation accuracies? thanks