facebookresearch / Detectron

FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.
Apache License 2.0
26.22k stars 5.45k forks source link

Detectron and Caffe2 Inference result are not same for same model and input image . We are Using convert_pkl_to_pb.py #921

Open RahulDas-dev opened 5 years ago

RahulDas-dev commented 5 years ago

I trained a Detectron model with my custom dataset. Model Name - e2e_faster_rcnn_R-101-FPN.yaml number of class in Dataset - 56 It worked completely fine.

Then I convert the model in caffe2 using the script "convert_pkl_to_pb.py -- device 'cpu' " it generates 3 file

  1. model_init.pb
  2. model.pb
  3. param_init_net.pbtxt

then I go for inference with caffe2. The script for inference is given bellow

start of the script

caffe2_inference.txt

End of scripts of script

There is a mismatch in the result of Caffe2 and Detectron inference.

Caffe2 Result

20180412_104410_caffe2

Detectron Result

20180412_104410_detecton

Another way of looking into the issue is while model conversation if we pass any input Image then also Model conversion failed due to a mismatch in the result.

Script for Model conversation

python tools/convert_pkl_to_pb.py --cfg configs/getting_started/DEO_e2e_faster_rcnn_R-101-FPN.yaml \ --device cpu --out_dir /home/rahdas/temp/model/deo/cpu --test_img /datagpu/Detectron_dataset/DEO/testData/20180412_104410.jpg

Why Caffe2 And Detectron Result are not exactly Equal? Is there anything I am missing ?? Kindly help me to resolve the issue.