Failed to build engine file

我使用yolov5s来训练自己模型,训练好之后使用python gen_wts_yoloV5.py -c ./models/yolov5s.yaml -w gang.pt命令创建了yolov5_gang.cfg和yolov5_gang.wts文件,然后编写了config_infer_gang.txt和deepstream_app_gang_config.txt
其中config_infer_gang.txt的内容为:
[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-color-format=0
custom-network-config=yolov5_gang.cfg
#custom-network-config=yolov5s.cfg
model-file=yolov5_gang.wts
#model-file=yolov5s.wts
model-engine-file=model_b2_gpu0_fp32.engine
#model-engine-file=gang.engine
#int8-calib-file=calib.table
labelfile-path=labels.txt
batch-size=1
network-mode=0
num-detected-classes=12
interval=0
gie-unique-id=1
process-mode=1
network-type=0
cluster-mode=2
maintain-aspect-ratio=1
parse-bbox-func-name=NvDsInferParseYolo
custom-lib-path=nvdsinfer_custom_impl_Yolo/libnvdsinfer_custom_impl_Yolo.so
engine-create-func-name=NvDsInferYoloCudaEngineGet

[class-attrs-all]
nms-iou-threshold=0.45
pre-cluster-threshold=0.25

其中deepstream_app_gang_config.txt的内容为:
[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-color-format=0
custom-network-config=yolov5_gang.cfg
#custom-network-config=yolov5s.cfg
model-file=yolov5_gang.wts
#model-file=yolov5s.wts
model-engine-file=model_b2_gpu0_fp32.engine
#model-engine-file=gang.engine
#int8-calib-file=calib.table
labelfile-path=labels.txt
batch-size=1
network-mode=0
num-detected-classes=12
interval=0
gie-unique-id=1
process-mode=1
network-type=0
cluster-mode=2
maintain-aspect-ratio=1
parse-bbox-func-name=NvDsInferParseYolo
custom-lib-path=nvdsinfer_custom_impl_Yolo/libnvdsinfer_custom_impl_Yolo.so
engine-create-func-name=NvDsInferYoloCudaEngineGet

[class-attrs-all]
nms-iou-threshold=0.45
pre-cluster-threshold=0.25

root@eeff6db0b785:/opt/nvidia/deepstream/deepstream-6.1/sources/BaoGang# clear
root@eeff6db0b785:/opt/nvidia/deepstream/deepstream-6.1/sources/BaoGang# cat deepstream_app_gang_config.txt
[application]
enable-perf-measurement=1
perf-measurement-interval-sec=5

[tiled-display]
enable=1
rows=1
columns=1
width=1280
height=720
gpu-id=0
nvbuf-memory-type=0

[source0]
enable=1
type=3
#uri=file:/opt/nvidia/deepstream/deepstream-6.1/samples/configs/deepstream-app/1-10.mp4
uri=file:/opt/nvidia/deepstream/deepstream-6.1/samples/streams/0004.jpg
num-sources=1
gpu-id=0
cudadec-memtype=0

[sink0]
enable=1
type=2
sync=0
gpu-id=0
nvbuf-memory-type=0

[osd]
enable=1
gpu-id=0
border-width=5
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0
nvbuf-memory-type=0

[streammux]
gpu-id=0
live-source=0
batch-size=1
batched-push-timeout=40000
width=1920
height=1080
enable-padding=0
nvbuf-memory-type=0

[primary-gie]
enable=1
gpu-id=0
gie-unique-id=1
nvbuf-memory-type=0
config-file=config_infer_gang.txt

[tests]
file-loop=0

当我使用deepstream-app -c deepstream_app_gang_config.txt构建engine文件时却出现如下错误
Loading pre-trained weights
Loading weights of yolov5_gang complete
Total weights read: 7112473
Building YOLO network

  layer                        input               output         weightPtr

(0) reorgV5 3 x 640 x 640 12 x 320 x 320 0
(1) conv_silu 12 x 320 x 320 32 x 320 x 320 3584
(2) conv_silu 32 x 320 x 320 64 x 160 x 160 22272
(3) conv_silu 64 x 160 x 160 32 x 160 x 160 24448
(4) route - 64 x 160 x 160 24448
(5) conv_silu 64 x 160 x 160 32 x 160 x 160 26624
(6) conv_silu 32 x 160 x 160 32 x 160 x 160 27776
(7) conv_silu 32 x 160 x 160 32 x 160 x 160 37120
(8) shortcut_linear: 5 - 32 x 160 x 160 -
(9) route - 64 x 160 x 160 37120
(10) conv_silu 64 x 160 x 160 64 x 160 x 160 41472
(11) conv_silu 64 x 160 x 160 128 x 80 x 80 115712
(12) conv_silu 128 x 80 x 80 64 x 80 x 80 124160
(13) route - 128 x 80 x 80 124160
(14) conv_silu 128 x 80 x 80 64 x 80 x 80 132608
(15) conv_silu 64 x 80 x 80 64 x 80 x 80 136960
(16) conv_silu 64 x 80 x 80 64 x 80 x 80 174080
(17) shortcut_linear: 14 - 64 x 80 x 80 -
(18) conv_silu 64 x 80 x 80 64 x 80 x 80 178432
(19) conv_silu 64 x 80 x 80 64 x 80 x 80 215552
(20) shortcut_linear: 17 - 64 x 80 x 80 -
(21) conv_silu 64 x 80 x 80 64 x 80 x 80 219904
(22) conv_silu 64 x 80 x 80 64 x 80 x 80 257024
(23) shortcut_linear: 20 - 64 x 80 x 80 -
(24) route - 128 x 80 x 80 257024
(25) conv_silu 128 x 80 x 80 128 x 80 x 80 273920
(26) conv_silu 128 x 80 x 80 256 x 40 x 40 569856
(27) conv_silu 256 x 40 x 40 128 x 40 x 40 603136
(28) route - 256 x 40 x 40 603136
(29) conv_silu 256 x 40 x 40 128 x 40 x 40 636416
(30) conv_silu 128 x 40 x 40 128 x 40 x 40 653312
(31) conv_silu 128 x 40 x 40 128 x 40 x 40 801280
(32) shortcut_linear: 29 - 128 x 40 x 40 -
(33) conv_silu 128 x 40 x 40 128 x 40 x 40 818176
(34) conv_silu 128 x 40 x 40 128 x 40 x 40 966144
(35) shortcut_linear: 32 - 128 x 40 x 40 -
(36) conv_silu 128 x 40 x 40 128 x 40 x 40 983040
(37) conv_silu 128 x 40 x 40 128 x 40 x 40 1131008
(38) shortcut_linear: 35 - 128 x 40 x 40 -
(39) route - 256 x 40 x 40 1131008
(40) conv_silu 256 x 40 x 40 256 x 40 x 40 1197568
(41) conv_silu 256 x 40 x 40 512 x 20 x 20 2379264
(42) conv_silu 512 x 20 x 20 256 x 20 x 20 2511360
(43) maxpool 256 x 20 x 20 256 x 20 x 20 2511360
(44) route - 256 x 20 x 20 2511360
(45) maxpool 256 x 20 x 20 256 x 20 x 20 2511360
(46) route - 256 x 20 x 20 2511360
(47) maxpool 256 x 20 x 20 256 x 20 x 20 2511360
(48) route - 1024 x 20 x 20 2511360
(49) conv_silu 1024 x 20 x 20 512 x 20 x 20 3037696
(50) conv_silu 512 x 20 x 20 256 x 20 x 20 3169792
(51) route - 512 x 20 x 20 3169792
(52) conv_silu 512 x 20 x 20 256 x 20 x 20 3301888
(53) conv_silu 256 x 20 x 20 256 x 20 x 20 3368448
(54) conv_silu 256 x 20 x 20 256 x 20 x 20 3959296
(55) route - 512 x 20 x 20 3959296
(56) conv_silu 512 x 20 x 20 512 x 20 x 20 4223488
(57) conv_silu 512 x 20 x 20 256 x 20 x 20 4355584
(58) upsample 256 x 20 x 20 256 x 40 x 40 -
(59) route - 512 x 40 x 40 4355584
(60) conv_silu 512 x 40 x 40 128 x 40 x 40 4421632
(61) route - 512 x 40 x 40 4421632
(62) conv_silu 512 x 40 x 40 128 x 40 x 40 4487680
(63) conv_silu 128 x 40 x 40 128 x 40 x 40 4504576
(64) conv_silu 128 x 40 x 40 128 x 40 x 40 4652544
(65) route - 256 x 40 x 40 4652544
(66) conv_silu 256 x 40 x 40 256 x 40 x 40 4719104
(67) conv_silu 256 x 40 x 40 128 x 40 x 40 4752384
(68) upsample 128 x 40 x 40 128 x 80 x 80 -
(69) route - 256 x 80 x 80 4752384
(70) conv_silu 256 x 80 x 80 64 x 80 x 80 4769024
(71) route - 256 x 80 x 80 4769024
(72) conv_silu 256 x 80 x 80 64 x 80 x 80 4785664
(73) conv_silu 64 x 80 x 80 64 x 80 x 80 4790016
(74) conv_silu 64 x 80 x 80 64 x 80 x 80 4827136
(75) route - 128 x 80 x 80 4827136
(76) conv_silu 128 x 80 x 80 128 x 80 x 80 4844032
(77) conv_silu 128 x 80 x 80 128 x 40 x 40 4992000
(78) route - 256 x 40 x 40 4992000
(79) conv_silu 256 x 40 x 40 128 x 40 x 40 5025280
(80) route - 256 x 40 x 40 5025280
(81) conv_silu 256 x 40 x 40 128 x 40 x 40 5058560
(82) conv_silu 128 x 40 x 40 128 x 40 x 40 5075456
(83) conv_silu 128 x 40 x 40 128 x 40 x 40 5223424
(84) route - 256 x 40 x 40 5223424
(85) conv_silu 256 x 40 x 40 256 x 40 x 40 5289984
(86) conv_silu 256 x 40 x 40 256 x 20 x 20 5880832
(87) route - 512 x 20 x 20 5880832
(88) conv_silu 512 x 20 x 20 256 x 20 x 20 6012928
(89) route - 512 x 20 x 20 6012928
(90) conv_silu 512 x 20 x 20 256 x 20 x 20 6145024
(91) conv_silu 256 x 20 x 20 256 x 20 x 20 6211584
(92) conv_silu 256 x 20 x 20 256 x 20 x 20 6802432
(93) route - 512 x 20 x 20 6802432
(94) conv_silu 512 x 20 x 20 512 x 20 x 20 7066624
(95) route - 128 x 80 x 80 7066624
(96) conv_logistic 128 x 80 x 80 255 x 80 x 80 7099519
(97) yolo 255 x 80 x 80 255 x 80 x 80 7099519
(98) route - 256 x 40 x 40 7099519
(99) conv_logistic 256 x 40 x 40 255 x 40 x 40 7165054
(100) yolo 255 x 40 x 40 255 x 40 x 40 7165054
(101) route - 512 x 20 x 20 7165054
(102) conv_logistic 512 x 20 x 20 255 x 20 x 20 7295869
(103) yolo 255 x 20 x 20 255 x 20 x 20 7295869
Number of unused weights left: 18446744073709368220
deepstream-app: yolo.cpp:410: NvDsInferStatus Yolo::buildYoloNetwork(std::vector&, nvinfer1::INetworkDefinition&): Assertion `0’ failed.
Aborted (core dumped)
有人可以告诉我这是怎么回事吗?

You can refer the link below to find if there is a problem with your steps. Thanks
https://forums.developer.nvidia.com/t/deepstream-sdk-faq/80236/24

我的问题现在变成了这样:
** ERROR: main:716: Failed to set pipeline to PAUSED
Quitting
ERROR from src_bin_muxer: Output width not set
Debug info: gstnvstreammux.c(2794): gst_nvstreammux_change_state (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstNvStreamMux:src_bin_muxer
App run failed

Did you use your own code or the config file you attached to run the test?

There is no update from you for a period, assuming this is not an issue anymore.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.