WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.4k stars 4.23k forks source link

trained model export to trt error #2099

Open Chang558 opened 1 week ago

Chang558 commented 1 week ago

I’m trying to export a trained PyTorch model (.pt) to a TensorRT (.trt) file.

I'm following the guide yolov7-export

the error is

ty@ubuntu:~/yolo/tensorrt-python$ sudo python3 trt.py -e /home/ty/models/engine/best.engine -v /home/ty/mp4/1.mp4 --end2end Namespace(end2end=True, engine='/home/ty/models/engine/best.engine', image=None, output=None, video='/home/ty/mp4/1.mp4') WARNING:utils.utils:Dynamic tensor detected: 'output' with shape (-1, 7). Skipping size validation at init. Traceback (most recent call last): File "trt.py", line 26, in pred = Predictor(engine_path=args.engine) File "trt.py", line 11, in init super(Predictor, self).init(engine_path) File "/home/ty/yolo/tensorrt-python/utils/utils.py", line 50, in init allocation = common.cuda_call(cudart.cudaMalloc(size)) File "/home/ty/yolo/tensorrt-python/utils/common.py", line 47, in cuda_call check_cuda_err(err) File "/home/ty/yolo/tensorrt-python/utils/common.py", line 41, in check_cuda_err raise RuntimeError("Cuda Runtime Error: {}".format(err)) RuntimeError: Cuda Runtime Error: 1

onnx is excuting well but engine is fail so I want to ask about this error.