-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Can Detectron model be converted to Caffe model? #600
Description
I want to run Keypoint RCNN on an embedded board(not TX1 or 2, but another powerful DSP board that can run RFCN or Faster RCNN model in real time) after model quantization and some optimization. Unfortunately it supports only Caffe 1.
After merging PR #372 and #449, I'm struggling to convert Keypoint-R-CNN example model to Caffe.
By default, Detectron divides the model into "base" part and "head" part, but I made a new Caffe prototxt including both keypoint net and net(base net) after extracting detectron_net.pbtxt and detectron_keypoint_net_pbtxt together and manually changed each name of items.
Also, I found it's possible to convert all of Caffe2's weight/bias to numpy arrays and then those to Caffe using FetchBlob("weight name").
But now, I feel confused that it seems like, there would be no matching CUDA/cuDNN implementation in Caffe2 for Caffe's "Deconvolution(gpu)" code( Does "ConvTranspose" work same as "Deconvolution"?)
Should I port each newly implemented gpu operators in Caffe2 to Caffe's layer? BatchPermutation gpu operator in Caffe2 also doesn't exist in Caffe. Oh, I don't want to open Hell Gate.
Plus, some of Caffe's hyper parameters in prototxt are gone in Caffe2's pbtxt such as " num_output" or "lr_mult" in convolution_param. How can I infer num_output values? or how can I apply lr_mult /decay_mult? Can I just ignore those old version parameters?
Not only that, Detectron's convert_pkl_to_pb.py converts the example weight file(.pkl, arond 480MB) to so small 2 .pb files(less than 200KB in total) with fusing AffineTransform option. If I apply this fusing option, it merge some blobs, so the original network structure is changed and reduced. As there is no AffineTransform layer in Caffe, I need to turn on this option.
So, I would like someone to tell me that Caffe2 can be translated to Caffe or not.
Is there anybody who succeed in converting Caffe2 model to Caffe?
I'm also considering ONNX or MMdnn, but it seems like, those converting tools insert too many interface layers that make it run so slowly! So, I want to convert directly from Detectron/Caffe2 to Caffe using numpy!
Thank you in advance!
System information
-
Operating system: ubuntu 16.04
-
Compiler version: gcc 5.4.0
-
CUDA version: 9.2
-
cuDNN version: 7.1.4
-
NVIDIA driver version: 396.45
-
GPU models (for all devices if they are not all the same): GTX 1080
-
PYTHONPATHenvironment variable: /home/lee/caffe2-pytorch/build:/usr/local:/usr/local/lib/python3.5/site-packages:/usr/local/lib/python3.5/dist-packages:/home/lee/Downloads/light_head_rcnn/lib:/home/lee/Downloads/pyRFCN/py-R-FCN/lib:/home/lee/Downloads/pyRFCN/py-R-FCN/caffe/python: -
python --versionoutput: python3.5