I made C++ implementation of Mask R-CNN with PyTorch C++ frontend. The code is based on PyTorch implementations from multimodallearning and Keras implementation from Matterport . Project was made for educational purposes and can be used as comprehensive example of PyTorch C++ frontend API. Besides regular API you will find how to: load data from MSCoco dataset, create custom layers, manage weights across language boundaries(Python to C++). Feel free to ask a questions.
Can not believe no-one commented on this. It is one of the most comprehensive examples of torchlib.
could you please tell me which weights do you use for the inference (demo) and where can one get them?
Can we use the HDF5 file (.h5) as weights or do we need to convert the weights to a format accepted by c++ implementation? More info on this would be appreciated.
Hi, please find the instructions how to run demo on the page https://github.com/Kolkir/mlcpp/blob/master/mask_rcnn_pytorch/README.md, there is also a link to parameters.
@kolkir Thank you for the response. I tried that but got some issue with the compilation. Could you provide some inputs on how to convert the model to be read in C++? Was it using ‘jit’ torchvision?
Please, take a look at this thread How to copy network parameters in libtorch c++ API
@kolkir okay, thank you for link.
Hi, Kirill - on your note that it’s only possible to train using cocoa dataset. Are you talking about format of data? Or in principle it’s only possible to train using a fixed, predefined number of datasets? What if I create my own dataset representing a particular segmentation problem and will convert it to cocoa format, will that work?
Hi @Pavel_Skribtsov, yes you can use your own data, just convert it into the MS Coco format.
Hi Kirill, what running time did you obtain for the C++ version?
Hi, there is no visible performance difference, because python API of PyTorch uses the same internal C++ implementation. The use of C++ makes sense when you need to deploy your model to some specific device, or you can get some benefits from a data pipeline (for example to eliminate marshaling or use some system specific high-performance data-processing library)