yolov7
yolov7 copied to clipboard
TensorRT error while inference
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
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 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?
@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
https://github.com/Linaom1214/tensorrt-python/issues/26 i tried it but was not able to do inference, I'm getting this error

您好,请问此问题您解决了嘛?能否告知怎么解决的
Linaom1214/TensorRT-For-YOLO-Series#26 i tried it but was not able to do inference, I'm getting this error
![]()
I create a docker container and run this and it work. Docker container help you to avoid environmental conflicts