Tianxiaomo / pytorch-YOLOv4

PyTorch ,ONNX and TensorRT implementation of YOLOv4
Apache License 2.0
4.46k stars 1.49k forks source link

ValueError: cannot reshape array of size 25992 into shape (1,newaxis,80) #524

Open TaoF02 opened 2 years ago

TaoF02 commented 2 years ago

First of all, thanks for the great work! I use this repo to convert darknet weights to onnx and then later to TensorRT version using trtexec. Then, when I use demo_trt to run the demo, I got the below error. I am not able to resolve it. Can you help me to find out the problem.

` ubuntu@ubuntu-desktop:~/Tao/pytorch-YOLOv4$ python3 demo_trt.py YOLOV4_prune aircraft608.jpg 608 608

Reading engine from file YOLOV4_prune

Shape of the network input: (1, 3, 608, 608)

Length of inputs: 1

Len of outputs: 3

Traceback (most recent call last):

File "demo_trt.py", line 201, in main(engine_path, image_path, image_size)

File "demo_trt.py", line 132, in main boxes = detect(context, buffers, image_src, image_size, num_classes)

File "demo_trt.py", line 176, in detect trt_outputs[1] = trt_outputs[1].reshape(1, -1, num_classes)

ValueError: cannot reshape array of size 25992 into shape (1,newaxis,80) `