CenterNet
CenterNet copied to clipboard
How to deploy to C++ project, thank you!怎么部署到C++工程,谢谢!
Now there is a pytorch model. The CenterNet code is python. My project needs c++. How to deploy it? Note: My Python code ability is weak
现在已经有pytorch的模型,CenterNet代码都是python的,我的工程需要c++,怎么布署呢? 注:本人python代码能力弱
一种解决方案是python做服务器,c++通过socket发送检测请求。 还是希望能c++推断
Because there are not only detection modules in my project, but also other modules, so I need C++, look forward to guidance! 因为我的工程里不只有检测模块,还有其它模块,所以需要C++,望指导!
I honestly have no experience in c++ deployment ...
@xingyizhou Thank you anyway.
Convert model to caffe. And run it in caffe
@Markusgami This is OK, mainly forward-propagating code needs to be converted to c++, is there any available c++ code? Thank you! 这样是可以,主要是前向传播的代码需要转成c++,有可用的c++代码吗?谢谢!
持续关注,有好的解决方案吗, 用libtorch?
Wait online, it's urgent! 在线等,挺急的!
@zoufangyu1987 @kunyao2015 实现步骤: 1、把模型转成caffemodel; 2、前后处理自己c++实现; 3、Done! 亲测可以,祝你好运!
@jnulzl Can you share your c++ code? Thank you! 可以分享你的c++代码吗?谢谢!
@zoufangyu1987 不好意思,暂时不行
@jnulzl I want to cry! 好想哭!
用trace转模型,再用libtorch部署吧,亲测可用
@zoufangyu1987 @kunyao2015 实现步骤: 1、把模型转成caffemodel; 2、前后处理自己c++实现; 3、Done! 亲测可以,祝你好运!
转caffe时候的DCNV2怎么办?caffe又不是天然支持
我把没有dcn层的dlav0_34的pytorch模型已经转成caffemodel,这两天理了下centernet的demo的前处理和后处理相关python代码,还是蛮繁琐的,有搞好的朋友分享下C++代码啊,万分感谢! I have converted the pytorch model of dlav0_34 without DCN layer into caffe model. These two days, I have handled the Python code related to the pre-processing and post-processing of the demo in the CenterNet. It is Difficult. Who can share the C++ code well? Thank you very much!
用trace转模型,再用libtorch部署吧,亲测可用
trace 可以成功么?你训练的什么arch的模型? @BokyLiu
用trace转模型,再用libtorch部署吧,亲测可用
trace 可以成功么?你训练的什么arch的模型? @BokyLiu
res18的
@zoufangyu1987 @kunyao2015 实现步骤: 1、把模型转成caffemodel; 2、前后处理自己c++实现; 3、Done! 亲测可以,祝你好运!
转caffe时候的DCNV2怎么办?caffe又不是天然支持
请问,你解决了DCNv2的部署问题么?
@Fighting-JJ 没有,没有找到pytorch转caffemodel支持DCNV2层的代码,现在用dlav0_34,放弃dcn,caffemodel已经验证输出的output参数完全一致,不过是在python上验证的,C++还没有搞,工作量有点大,坑有点多,发现有好些朋友已经成功,但不分享源码也没办法,只能一步一步搞 No, I haven't found the code of pytorch to caffemodel to support DCNV2 layer. Now I use dlav0_34, give up dcn, caffemodel to verify that the output parameters of output are exactly the same. However, it's verified on python. C++ hasn't been done yet, the workload is a bit heavy, the pit is a bit too many. I find that some friends have succeeded, but they don't share the source code. There's no way to do it. We can only do it step by step.
等我成功在C++上部署,一定分享给大家源码 When I successfully deploy on C++, I will share the source code with you.
我已经把pytorch全部剥离,在python上依赖numpy正常跑通了,下一步转C++,发现numpy有C++版本——"numcpp",搞得身心疲惫,希望后面少点坑! I've stripped all pytorch and relied on numpy to run normally on python. Next, I turn to C++. I find that numpy has a version of C++ - "numcpp", which makes me tired physically and mentally. I hope there are fewer pits behind it.
我已经把pytorch全部剥离,在python上依赖numpy正常跑通了,下一步转C++,发现numpy有C++版本——"numcpp",搞得身心疲惫,希望后面少点坑! I've stripped all pytorch and relied on numpy to run normally on python. Next, I turn to C++. I find that numpy has a version of C++ - "numcpp", which makes me tired physically and mentally. I hope there are fewer pits behind it.
You can use jit.trace to trace the model then deploy it with c++ by libtorch which is a c++ library. then only the post-process is left.
我已经把pytorch全部剥离,在python上依赖numpy正常跑通了,下一步转C++,发现numpy有C++版本——"numcpp",搞得身心疲惫,希望后面少点坑! I've stripped all pytorch and relied on numpy to run normally on python. Next, I turn to C++. I find that numpy has a version of C++ - "numcpp", which makes me tired physically and mentally. I hope there are fewer pits behind it.
It's no need to use numcpp. You can read the image to CV::Mat by opencv in C++ version, and convert the Mat to caffe::Blob.
@chenjx1005 我也认为仅仅用OpenCV是可以的,不过我已经在用NumCpp和OpenCV结合,我先试试,如果不行再去掉NumCpp I also think it's possible to use OpenCV only.But I've combined NumCpp with OpenCV. I'll try it first, and if I can't, I'll remove NumCpp.
https://github.com/hexiangquan/CenterNetCPP
@hexiangquan 感激不尽 Be deeply grateful
基于numcpp的C++版本加载caffemodel已经成功了,结果一致,谢谢大家!
基于numcpp的C++版本加载caffemodel已经成功了,结果一致,谢谢大家!
期待您的分享
@BokyLiu 这几天上班事情有点多,这两天空下来我就把整个流程和相关文件整理一下分享给大家 上面@hexiangquan也已经分享预处理、forward、后处理的c++代码,感谢他!
我已经把pytorch全部剥离,在python上依赖numpy正常跑通了,下一步转C++,发现numpy有C++版本——"numcpp",搞得身心疲惫,希望后面少点坑! I've stripped all pytorch and relied on numpy to run normally on python. Next, I turn to C++. I find that numpy has a version of C++ - "numcpp", which makes me tired physically and mentally. I hope there are fewer pits behind it. You can use jit.trace to trace the model then deploy it with c++ by libtorch which is a c++ library. then only the post-process is left.
您trace的时候dcn_v2部分有没有trace成功? @Fighting-JJ
我没有使用DCN的,用的DLA034或者是resnet