yolov7 icon indicating copy to clipboard operation
yolov7 copied to clipboard

TensorRT error while inference

Open Dhiaeddine-Oussayed opened this issue 2 years ago • 3 comments

I've followed the tutorial on the yolov7 repo to export the .pt model to .trt model. The I triend inference with it; python3 detect.py --source ../pic.jpg --weights best.trt But I got this error which I couldn't figure how to solve it: Traceback (most recent call last):

File "detect.py", line 199, in <module>
  detect()
File "detect.py", line 34, in detect
  model = attempt_load(weights, map_location=device)  # load FP32 model
File "/home/trabotyx/yolov7/models/experimental.py", line 242, in attempt_load
  ckpt = torch.load(w, map_location=map_location)  # load
File "/home/trabotyx/.local/lib/python3.8/site-packages/torch/serialization.py", line 713, in load
  return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/home/trabotyx/.local/lib/python3.8/site-packages/torch/serialization.py", line 920, in _legacy_load
  magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: unpickling stack underflow

Dhiaeddine-Oussayed avatar Aug 04 '22 14:08 Dhiaeddine-Oussayed

If you use ––end2end flag for tensorrt export, you should see https://github.com/WongKinYiu/yolov7/blob/main/tools/YOLOv7-Dynamic-Batch-TENSORRT.ipynb for infer example

triple-Mu avatar Aug 04 '22 16:08 triple-Mu

@triple-Mu https://colab.research.google.com/github/WongKinYiu/yolov7/blob/main/tools/YOLOv7trt.ipynb i used thi method & im also getting same issue, also do we have script on doing inference on video?

akashAD98 avatar Aug 05 '22 07:08 akashAD98

@triple-Mu https://colab.research.google.com/github/WongKinYiu/yolov7/blob/main/tools/YOLOv7trt.ipynb i used thi method & im also getting same issue, also do we have script on doing inference on video?

Python script may be easy to write. You can use opencv-python and pytorch for video infer

triple-Mu avatar Aug 05 '22 11:08 triple-Mu

https://github.com/Linaom1214/tensorrt-python/issues/26 i tried it but was not able to do inference, I'm getting this error

image

akashAD98 avatar Aug 10 '22 08:08 akashAD98

您好,请问此问题您解决了嘛?能否告知怎么解决的

God-song avatar Mar 06 '23 02:03 God-song

Linaom1214/TensorRT-For-YOLO-Series#26 我试过了但无法进行推理,出现此错误

图像

您好,请问这个问题您解决了嘛?能不能告诉知道怎么解决的

God-song avatar Mar 06 '23 02:03 God-song

Linaom1214/TensorRT-For-YOLO-Series#26 i tried it but was not able to do inference, I'm getting this error

image

I create a docker container and run this and it work. Docker container help you to avoid environmental conflicts

viethoang303 avatar Nov 13 '23 03:11 viethoang303