emptysoal / TensorRT-YOLOv8

Based on tensorrt v8.0+, deploy detect, pose, segment, tracking of YOLOv8 with C++ and python api.
MIT License
49 stars 10 forks source link

在clion中运行mian.cpp #2

Closed XianYang2547 closed 1 month ago

XianYang2547 commented 2 months ago

大佬你好,我使用c++中detect的readme步骤,运行良好。 我想在clion中直接运行main.cpp(方便调试),传入相关参数,在 std::string trtFile = "/home/xianyang/Desktop/TensorRT-YOLOv8-main/C++/detect/build/yolov8s.plan"; 在对应的infer.cpp这里if (engine == nullptr) { std::cout << "Failed loading engine!" << std::endl; return; } 报错为 “Succeeded getting serialized engine! ERROR: 1: [stdArchiveReader.cpp::StdArchiveReader::32] Error Code 1: Serialization (Serialization assertion magicTagRead == kMAGIC_TAG failed.Magic tag does not match) ERROR: 4: [runtime.cpp::deserializeCudaEngine::66] Error Code 4: Internal Error (Engine deserialization failed.) Failed loading engine! 信号: SIGSEGV (Segmentation fault)” 我使用的自定义的模型,修改了config.h中的kNumClass,vClassNames这些。你知道怎么解决吗 另外,我通过上述步骤得到的引擎文件在track.py中使用,出现AttributeError: 'NoneType' object has no attribute 'create_execution_context',而通过py这边生成的引擎文件可以使用,都是使用同一台设备得到的引擎文件,这种水土不符的现象是因为tensorrt的c++和python不同导致的吗 //今天上午我亲眼看到你提交了draw.cu,太有缘了//

emptysoal commented 2 months ago

clion我从来没用过,抱歉提供不了什么建议

然后C++和python api得到的引擎文件应该是通用的,我也测试过的,出错原因可能是路径之类的吧

XianYang2547 commented 2 months ago

对于这个仓库,我可以加你个联系方式进行诚心的有偿学习吗 我的微信 Darling2547