Exporting detectron2 model to pkl file
I am trying to use the convert_d2.py script to convert my detectron2 model to tensorpack. I have saved my config as a .yaml file, but I am unsure how to properly create the .pkl file so that I can load it into the convert_d2.py script. Right now my neural network weights are in a .pth file. I tried loading this instead of the .pkl file to convert_d2.py but this gave an error.
Hi, solarflarefx did you try it using the pretrained file from the modelzoo: https://dl.fbaipublicfiles.com/detectron2/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl. This file.
To add to this discussion, I was able to convert the pretrained mask rcnn R50 FPN 3x to a .pd file using the code in this repository. However, is there a way to also convert custom weights after I used transfer learning with the backbone on a custom dataset?
the pkl files were created by torch.load the pth file and dumping the dict of weights with pkl.dump. You can open the files in both format to see their format, and write a simple conversion script with no more than 10 lines of code.