open-mmlab / mmocr

OpenMMLab Text Detection, Recognition and Understanding Toolbox
https://mmocr.readthedocs.io/en/dev-1.x/
Apache License 2.0
4.28k stars 743 forks source link

Deploy the model to C++ #322

Open Whatsetsthisend opened 3 years ago

Whatsetsthisend commented 3 years ago

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.

innerlee commented 3 years ago

because of your good encapsulation

More details would be great

Whatsetsthisend commented 3 years ago

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

innerlee commented 3 years ago

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.

Whatsetsthisend commented 3 years ago

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 commented 3 years ago

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

innerlee commented 3 years ago

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

xinsuinizhuan commented 3 years ago

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?