mmocr icon indicating copy to clipboard operation
mmocr copied to clipboard

Deploy the model to C++

Open Whatsetsthisend opened this issue 3 years ago • 7 comments

Can I deploy the pre training model of "segocr simple baseline." to C + +, such as libtorch, but because of your good encapsulation, I can't simply restore the network structure, so I can't convert. The onnx conversion tool in tool seems to only support crnn network, Can you give us the network structure of the pytorch version of segocr simple baseline or some other useful information,thank you.

Whatsetsthisend avatar Jun 24 '21 07:06 Whatsetsthisend

because of your good encapsulation

More details would be great

innerlee avatar Jun 24 '21 08:06 innerlee

because of your good encapsulation

More details would be great

Because I haven't touched the use of mmcv before, I don't see a Class similar to the model defined in Pytorch

Whatsetsthisend avatar Jun 24 '21 08:06 Whatsetsthisend

Learning mmcv is rewarding since, all mm-series share the same architectural design. You will master pose/segmentation/detection/action/super-resulution/... for free once you know it.

The heart of mmcv is the registry system https://mmcv.readthedocs.io/en/latest/registry.html. Each component is registered and defined independently, so you can combine them at will in the config.

innerlee avatar Jun 24 '21 09:06 innerlee

Learning mmcv is rewarding since, all mm-series share the same architectural design. You will master pose/segmentation/detection/action/super-resulution/... for free once you know it.

The heart of mmcv is the registry system https://mmcv.readthedocs.io/en/latest/registry.html. Each component is registered and defined independently, so you can combine them at will in the config.

Thank you. I'm still working on converting the .pth model to libtorch. I've made progress. Now there should be the last bug. It should be that the forward() function of the default layer in mmocr uses the parameter “img_metas”, But the transform function torch.jit.trace (model, data) in Python can't parse "img_metas”。 I'll modify the forward function later to get the job done, and then I'll be willing to launch a push to contribute to the git.thank you

Whatsetsthisend avatar Jun 25 '21 08:06 Whatsetsthisend

First of all, I would like to thank the author for his free and open source, and the efforts of relevant personnel to maintain and answer me carefully. I have completed the C + + transformation of segocr model, but modified the data structure of prediction, so I don't think my current method is particularly good. I will submit the push after I improve it

Whatsetsthisend avatar Jun 28 '21 02:06 Whatsetsthisend

@Whatsetsthisend Thanks for your contribution! Sure please make the pull request so that it could help more people

innerlee avatar Jun 28 '21 02:06 innerlee

First of all, I would like to thank the author for his free and open source, and the efforts of relevant personnel to maintain and answer me carefully. I have completed the C + + transformation of segocr model, but modified the data structure of prediction, so I don't think my current method is particularly good. I will submit the push after I improve it

how about the C++ version? Could share to us?

xinsuinizhuan avatar Sep 13 '21 10:09 xinsuinizhuan