laugh12321/TensorRT-YOLO

[Bug]: Engine Deserialization Failed when using YOLOv8 exported engine in detect.py

Closed this issue · 0 comments

when attempting to run the detect.py script using the YOLOv8 engine exported by python/export/yolov8/export.py. The specific error message is as follows:

[01/30/2024-10:28:15] [TRT] [E] 1: [stdArchiveReader.cpp::nvinfer1::rt::StdArchiveReader::StdArchiveReader::30] Error Code 1: Serialization (Serialization assertion magicTagRead == kMAGIC_TAG failed.Magic tag does not match)
[01/30/2024-10:28:15] [TRT] [E] 4: [runtime.cpp::nvinfer1::Runtime::deserializeCudaEngine::50] Error Code 4: Internal Error (Engine deserialization failed.)
Traceback (most recent call last):
  File "E:\Projects\Cpp\TensorRT-YOLO\detect.py", line 67, in <module>
    model = YOLO(opt.weights, reduce(mul, opt.max_image_size))
  File "E:\Projects\Cpp\TensorRT-YOLO\python\infer\yolo.py", line 55, in __init__
    self._init_model(engine_path)
  File "E:\Projects\Cpp\TensorRT-YOLO\python\infer\yolo.py", line 80, in _init_model
    assert engine
AssertionError