YOLOv3-Torch2TRT icon indicating copy to clipboard operation
YOLOv3-Torch2TRT copied to clipboard

Issue with tensor dimension

Open Kmarconi opened this issue 4 years ago • 5 comments

HI, thanks for your repo, the performance seems to be amazing ! I'm trying to run it on my Jetson Xavier but I'm not able to find out why I have this issue, any guess ? Thanks ! Start test speed Fp16 Backbone Speed: 30.478746582707416 Hz Fp16 TensorRT Backbone Speed: 54.729440987240245 Hz Traceback (most recent call last): File "detect.py", line 148, in <module> Speed(TensorRT, Half) File "detect.py", line 59, in Speed detections = non_max_suppression(detections, opt.conf_thres, opt.nms_thres, method=1) File "/xavier_ssd/recherche/YOLOv3-Torch2TRT/utils/utils.py", line 255, in non_max_suppression class_confs, class_preds = image_pred[:, 5:].max(1, keepdim=True) IndexError: too many indices for tensor of dimension 1

Kmarconi avatar Mar 19 '20 13:03 Kmarconi

Have you tested it on the PC?

DocF avatar Apr 01 '20 08:04 DocF

Not for the moment, my only test station is the xavier for the moment

Kmarconi avatar Apr 01 '20 08:04 Kmarconi

Hi Richard,

I had the same problem. Do you have any tips for how to deal with this?

Here is my software version: ubuntu 18.04 cuda 10.2 cudnn 7.6.5.32 gcc 4.8.5

torch 1.3.0 (pip install) torch2trt 0.0.3 (pip install) torchstat 0.0.7 (pip install) torchvision 0.4.1 (pip install)

Here is my log: Start test speed Fp16 Backbone Speed: 86.47705537649853 Hz Fp16 TensorRT Backbone Speed: 163.76313367912937 Hz Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/user/torch2trt_build_ext/YOLOv3Torch2TRT/detect.py", line 154, in Speed(TensorRT, Half) File "/home/user/torch2trt_build_ext/YOLOv3Torch2TRT/detect.py", line 60, in Speed detections = non_max_suppression(detections, opt.conf_thres, opt.nms_thres, method=1) File "/home/user/torch2trt_build_ext/YOLOv3Torch2TRT/utils/utils.py", line 255, in non_max_suppression class_confs, class_preds = image_pred[:, 5:].max(1, keepdim=True) IndexError: too many indices for tensor of dimension 1

kdeltak avatar May 22 '20 05:05 kdeltak

I got the same error, do anyone have any tips for how to deal with this?

lgl603 avatar Jun 15 '20 07:06 lgl603

I got the error like that when I run the code at Jetson TX2. Can you help me?

Traceback (most recent call last): File "/home/tx2wry/PycharmProjects/yolov3_torch2trt/detect.py", line 190, in detections = non_max_suppression(detections, opt.conf_thres, opt.nms_thres, method=2) File "/home/tx2wry/PycharmProjects/yolov3_torch2trt/utils/utils.py", line 254, in non_max_suppression image_pred = image_pred[(-score).argsort()] IndexError: too many indices for tensor of dimension 2

my setting: torch 1.4.0 tensorrt: 7.1.0.16 torch2trt: 0.1.0 numpy: 1.19.0

yilawu avatar Jul 11 '20 03:07 yilawu