AIpakchoi / yolov5_tensorrt

This is the implementation that supports yolov5s, yolov5m, yolov5l, yolov5x.
34 stars 6 forks source link

yolov5s v1.0 序列化报错 #3

Open hoxcape opened 4 years ago

hoxcape commented 4 years ago

我使用yolov5 v1.0训练了yolov5s模型,然后进行序列化,得到以下信息:

Loading weights: ../yolov5s.wts
[07/31/2020-11:37:13] [E] [TRT] (Unnamed Layer* 173) [Convolution]: kernel weights has count 2304 but 32640 was expected
[07/31/2020-11:37:13] [E] [TRT] (Unnamed Layer* 173) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
[07/31/2020-11:37:13] [E] [TRT] (Unnamed Layer* 173) [Convolution]: kernel weights has count 2304 but 32640 was expected
[07/31/2020-11:37:13] [E] [TRT] (Unnamed Layer* 173) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
[07/31/2020-11:37:13] [E] [TRT] (Unnamed Layer* 173) [Convolution]: kernel weights has count 2304 but 32640 was expected
[07/31/2020-11:37:13] [E] [TRT] (Unnamed Layer* 173) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
[07/31/2020-11:37:13] [E] [TRT] (Unnamed Layer* 173) [Convolution]: kernel weights has count 2304 but 32640 was expected
[07/31/2020-11:37:13] [E] [TRT] (Unnamed Layer* 173) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
Building engine, please wait for a while...
[07/31/2020-11:37:13] [E] [TRT] (Unnamed Layer* 173) [Convolution]: kernel weights has count 2304 but 32640 was expected
[07/31/2020-11:37:13] [E] [TRT] (Unnamed Layer* 173) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
[07/31/2020-11:37:13] [E] [TRT] Could not compute dimensions for (Unnamed Layer* 173) [Convolution]_output, because the network is not valid.
[07/31/2020-11:37:13] [E] [TRT] Network validation failed.
Build engine successfully!
yolov5s: yolov5_tensorrt/yolov5s/yolov5s.cpp:170: void APIToModel(unsigned int, nvinfer1::IHostMemory**): Assertion `engine != nullptr' failed.
已放弃 (核心已转储)

请帮我看一下大概是什么问题,谢谢了。

hoxcape commented 4 years ago

我比对过yolov5s.yaml了,模型配置和库里的一致

AIpakchoi commented 4 years ago

@hoxcape 你这个engine没有成功生成,貌似是三个YOLO head层的参数不对,255 = (80+5)*3,即80个类,5个预测值,每个尺度用3个anchor。如果你用自己的数据训练的,请在yololayer.h文件中把自己数据的类别、anchor等参数修改以下。重新cmake,make编译一下。

hoxcape commented 4 years ago

谢谢,我试试