[Help]: 求大老995 Could not deserialize engine. See log for details.
Closed this issue · 6 comments
yeh111w commented
[I] Loading bytes from YoloS4000img.engine
[E] 1: [runtime.cpp::nvinfer1::Runtime::parsePlan::314] Error Code 1: Serialization (Serialization assertion plan->header.magicTag == rt::kPLAN_MAGIC_TAG failed.)
[!] Could not deserialize engine. See log for details.
Traceback (most recent call last):
File "D:\python test\yolov10\model\inferTest.py", line 80, in <module>
main()
File "C:\Users\admin\anaconda3\envs\yolov10\lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "C:\Users\admin\anaconda3\envs\yolov10\lib\site-packages\rich_click\rich_command.py", line 152, in main
rv = self.invoke(ctx)
File "C:\Users\admin\anaconda3\envs\yolov10\lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\admin\anaconda3\envs\yolov10\lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "D:\python test\yolov10\model\inferTest.py", line 45, in main
model = TRTYOLO(engine)
File "C:\Users\admin\anaconda3\envs\yolov10\lib\site-packages\tensorrt_yolo\infer\yolo.py", line 103, in __init__
self._engine, _ = invoke_if_callable(EngineFromBytes(BytesFromPath(engine_path)))
File "C:\Users\admin\anaconda3\envs\yolov10\lib\site-packages\polygraphy\util\util.py", line 678, in invoke_if_callable
ret = func(*args, **kwargs)
File "C:\Users\admin\anaconda3\envs\yolov10\lib\site-packages\polygraphy\backend\base\loader.py", line 40, in __call__
return self.call_impl(*args, **kwargs)
File "C:\Users\admin\anaconda3\envs\yolov10\lib\site-packages\polygraphy\util\util.py", line 710, in wrapped
return func(*args, **kwargs)
File "C:\Users\admin\anaconda3\envs\yolov10\lib\site-packages\polygraphy\backend\trt\loader.py", line 665, in call_impl
G_LOGGER.critical("Could not deserialize engine. See log for details.")
File "C:\Users\admin\anaconda3\envs\yolov10\lib\site-packages\polygraphy\logger\logger.py", line 605, in critical
raise ExceptionType(message) from None
polygraphy.exception.exception.PolygraphyException: Could not deserialize engine. See log for details.
laugh12321 commented
- 这个是使用
ptq_calibration.py
量化出现的问题吗? - 有没有详细的日志?
- 模型是否已经使用
trtyolo
导出为带插件的ONNX?
yeh111w commented
laugh12321 commented
-
首先,整个项目的推理都是建立在已经加载NMS插件且导出为engine的基础上的,没有NMS插件的模型是无法使用项目代码推理的。
-
其次,YOLOv10导出在其他issue中已经回答,可参考 #28 (comment) 进行操作。
yeh111w commented
很感谢你 我马上试试
yeh111w commented
很感谢你我成功了
我想知道有没有办法把推论改成用webcam
laugh12321 commented
你可以参考demo/detect
中的例子进行修改。
- 如果你使用的是Python 则读取摄像头数据转为
np.array
后再进行前处理 (参考batcher.py#L153), 然后将相关参数传递给infer
方法。 - 如果你使用的是C++ 则读取摄像头数据转为
deploy::Image
结构体类型的数据后将相关参数传递给模型的predict
方法。
建议使用C++实现,Python版本比C++慢两倍左右。且C++版本支持硬解码数据作为输入推理。