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

Help in converting pkl to pb file (FPN not supported) #134

Open vvrmahendra opened 6 years ago

vvrmahendra commented 6 years ago

I tried to convert mask r-cnn pkl file to caffe2 pb file with the convert_pkl_to_pb.py script. I am confused what to pass in for --cfg option. There are several yaml files that are in config directory, but it looks like these are for train, test etc. The documentation in the convert_pkl_to_pb.py says to copy / create a new yaml based of lib/core/config.py but I am not sure what options would go in this yaml file. Is there a sample yaml config file available?

groupbox-dev commented 6 years ago

you should take a look at this :https://github.com/facebookresearch/Detectron/blob/master/tools/convert_pkl_to_pb.py

obendidi commented 6 years ago

in here it says that FPN is not supported , so actually most models can't be converted , or is there a hack I don't know of ?

blateyang commented 6 years ago

I think assert not cfg.FPN.FPN_ON, "FPN not supported." means if cfg.FPN.PFN_ON is set to False, then it will print "FPN not supported". Actually FPN is supported except that the flag is set to False. @bendidi

obendidi commented 6 years ago

Actually assert not cfg.FPN.FPN_ON, "FPN not supported." means exactly the opposite of what you said :)

my first try was with FPN_on set on True

'FPN': {'COARSEST_STRIDE': 32,
         'DIM': 256,
         'EXTRA_CONV_LEVELS': False,
         'FPN_ON': True,
         'MULTILEVEL_ROIS': True,
         'MULTILEVEL_RPN': True,
         'ROI_CANONICAL_LEVEL': 4,
         'ROI_CANONICAL_SCALE': 224,
         'ROI_MAX_LEVEL': 5,
         'ROI_MIN_LEVEL': 2,
         'RPN_ANCHOR_START_SIZE': 32,
         'RPN_ASPECT_RATIOS': (0.5, 1, 2),
         'RPN_MAX_LEVEL': 6,
         'RPN_MIN_LEVEL': 2,
         'ZERO_INIT_LATERAL': False},

and I still get the assertion error :

Traceback (most recent call last):
  File "tools/convert_pkl_to_pb.py", line 571, in <module>
    main()
  File "tools/convert_pkl_to_pb.py", line 525, in main
    assert not cfg.FPN.FPN_ON, "FPN not supported."
AssertionError: FPN not supported.
blateyang commented 6 years ago

Sorry, I misunderstood the code. You are right.@bendidi Hope someone else can explain it.

orionr commented 6 years ago

We are working on FPN support (the CollectAndDistributeFpnRpnProposals operator) with standard Caffe2 C++, so stay tuned.

ChengshuLi commented 6 years ago

@orionr

Do you have a rough estimation of the timeline about this FPN support with standard Caffe2 c++? Thanks a ton!

Luyang1125 commented 6 years ago

I'm also interested in transfer the pkl file to pb. Want to know what is the current status on this. Thanks!

gadcam commented 6 years ago

If #372 is merged it should close this issue.

Gautam1121 commented 5 years ago

I am facing issue in getting mask, lost mask in the conversion. I have used " Detectron/tools/convert_pkl_to_pb.py " file to convert my model.

How can i get mask as well?

Help appreciated, thanks :)

ashuGulati commented 3 years ago

how to convert a .pb to .pkl format?