Cw-zero / TensorRT_yolo3_module

You can import this module directly
55 stars 19 forks source link

Error with yolo-v3(416*416) #1

Open joinany opened 5 years ago

joinany commented 5 years ago

Did you test the project with yolo-v3(416*416)?

$ python3 trt_yolo3_module_1batch.py Reading engine from file yolov3-608.trt Traceback (most recent call last): File "trt_yolo3_module_1batch.py", line 214, in output_dic_list = alpha_yolo3_unit.process_frame_batch(input_dic_list) File "trt_yolo3_module_1batch.py", line 185, in process_frame_batch (class_list_all,box_list_all,conf_list_all) = self.detection(procession_tuple) File "trt_yolo3_module_1batch.py", line 99, in detection output = output.reshape(shape) ValueError: cannot reshape array of size 3042 into shape (1,255,13,13)

joinany commented 5 years ago

I found that the filters of 255 should be changed to 18 in my case. Thanks.

Hanlos commented 5 years ago

Did you test the project with yolo-v3(416*416)?

$ python3 trt_yolo3_module_1batch.py Reading engine from file yolov3-608.trt Traceback (most recent call last): File "trt_yolo3_module_1batch.py", line 214, in output_dic_list = alpha_yolo3_unit.process_frame_batch(input_dic_list) File "trt_yolo3_module_1batch.py", line 185, in process_frame_batch (class_list_all,box_list_all,conf_list_all) = self.detection(procession_tuple) File "trt_yolo3_module_1batch.py", line 99, in detection output = output.reshape(shape) ValueError: cannot reshape array of size 3042 into shape (1,255,13,13)

you must generate yolov3-416.onnx by change the cfg file and yolov3_to_onnx.py file ,the height and width and the out shape 19,38,76 to 13,26,52, I change this, and success!

JWSunny commented 5 years ago

@Hanlos hello, thanks for you sharing, but how can i change the yolov3_to_onnx.py file? can you provide guidance, thanks.

liguoyu666 commented 4 years ago

I found that the filters of 255 should be changed to 18 in my case. Thanks.

Hello,I have a similar problem when I convert my weight, I changed the cfg and trt_yolo3_module_1batch.py

`[convolutional] size=1 stride=1 pad=1 filters=21 activation=linear

[yolo] mask = 3,4,5 anchors = 15,17, 23,26, 30,34, 37,43, 47,52, 66,75, 97,109, 196,233, 576,713 classes=2 num=9 jitter=.3 ignore_thresh = .7 truth_thresh = 1 random=1`

self.num_classes = 2 in trt_yolo3_module_1batch.py

Traceback (most recent call last): File "/home/lgy/PycharmProjects/TensorRT_yolo3_module/trt_yolo3_module_1batch.py", line 216, in <module> output_dic_list = alpha_yolo3_unit.process_frame_batch(input_dic_list) File "/home/lgy/PycharmProjects/TensorRT_yolo3_module/trt_yolo3_module_1batch.py", line 187, in process_frame_batch (class_list_all,box_list_all,conf_list_all) = self.detection(procession_tuple) File "/home/lgy/PycharmProjects/TensorRT_yolo3_module/trt_yolo3_module_1batch.py", line 101, in detection output = output.reshape(shape) ValueError: cannot reshape array of size 3549 into shape (1,255,13,13)