Error with DeepStream and yolov5

I’m having an issue running DeepStream with a yoloV5 model. I’m following these instructions: GitHub - marcoslucianops/DeepStream-Yolo: NVIDIA DeepStream SDK 6.0.1 configuration for YOLO models

I convert my .pt file to .cfg and .wts, and then point my DeepStream config file to them. However, I get this error when running deepstream-app:

Loading pre-trained weights
Loading weights of 220419_kv_pep_sku_detector complete
Total weights read: 35399256
Building YOLO network

  layer                        input               output         weightPtr

(0) conv_silu 3 x 640 x 640 48 x 320 x 320 5376
(1) conv_silu 48 x 320 x 320 96 x 160 x 160 47232
(2) conv_silu 96 x 160 x 160 48 x 160 x 160 52032
(3) route - 96 x 160 x 160 52032
(4) conv_silu 96 x 160 x 160 48 x 160 x 160 56832
(5) conv_silu 48 x 160 x 160 48 x 160 x 160 59328
(6) conv_silu 48 x 160 x 160 48 x 160 x 160 80256
(7) shortcut_linear: 4 - 48 x 160 x 160 -
(8) conv_silu 48 x 160 x 160 48 x 160 x 160 82752
(9) conv_silu 48 x 160 x 160 48 x 160 x 160 103680
(10) shortcut_linear: 7 - 48 x 160 x 160 -
(11) route - 96 x 160 x 160 103680
(12) conv_silu 96 x 160 x 160 96 x 160 x 160 113280
(13) conv_silu 96 x 160 x 160 192 x 80 x 80 279936
(14) conv_silu 192 x 80 x 80 96 x 80 x 80 298752
(15) route - 192 x 80 x 80 298752
(16) conv_silu 192 x 80 x 80 96 x 80 x 80 317568
(17) conv_silu 96 x 80 x 80 96 x 80 x 80 327168
(18) conv_silu 96 x 80 x 80 96 x 80 x 80 410496
(19) shortcut_linear: 16 - 96 x 80 x 80 -
(20) conv_silu 96 x 80 x 80 96 x 80 x 80 420096
(21) conv_silu 96 x 80 x 80 96 x 80 x 80 503424
(22) shortcut_linear: 19 - 96 x 80 x 80 -
(23) conv_silu 96 x 80 x 80 96 x 80 x 80 513024
(24) conv_silu 96 x 80 x 80 96 x 80 x 80 596352
(25) shortcut_linear: 22 - 96 x 80 x 80 -
(26) conv_silu 96 x 80 x 80 96 x 80 x 80 605952
(27) conv_silu 96 x 80 x 80 96 x 80 x 80 689280
(28) shortcut_linear: 25 - 96 x 80 x 80 -
(29) route - 192 x 80 x 80 689280
(30) conv_silu 192 x 80 x 80 192 x 80 x 80 726912
(31) conv_silu 192 x 80 x 80 384 x 40 x 40 1392000
(32) conv_silu 384 x 40 x 40 192 x 40 x 40 1466496
(33) route - 384 x 40 x 40 1466496
(34) conv_silu 384 x 40 x 40 192 x 40 x 40 1540992
(35) conv_silu 192 x 40 x 40 192 x 40 x 40 1578624
(36) conv_silu 192 x 40 x 40 192 x 40 x 40 1911168
(37) shortcut_linear: 34 - 192 x 40 x 40 -
(38) conv_silu 192 x 40 x 40 192 x 40 x 40 1948800
(39) conv_silu 192 x 40 x 40 192 x 40 x 40 2281344
(40) shortcut_linear: 37 - 192 x 40 x 40 -
(41) conv_silu 192 x 40 x 40 192 x 40 x 40 2318976
(42) conv_silu 192 x 40 x 40 192 x 40 x 40 2651520
(43) shortcut_linear: 40 - 192 x 40 x 40 -
(44) conv_silu 192 x 40 x 40 192 x 40 x 40 2689152
(45) conv_silu 192 x 40 x 40 192 x 40 x 40 3021696
(46) shortcut_linear: 43 - 192 x 40 x 40 -
(47) conv_silu 192 x 40 x 40 192 x 40 x 40 3059328
(48) conv_silu 192 x 40 x 40 192 x 40 x 40 3391872
(49) shortcut_linear: 46 - 192 x 40 x 40 -
(50) conv_silu 192 x 40 x 40 192 x 40 x 40 3429504
(51) conv_silu 192 x 40 x 40 192 x 40 x 40 3762048
(52) shortcut_linear: 49 - 192 x 40 x 40 -
(53) route - 384 x 40 x 40 3762048
(54) conv_silu 384 x 40 x 40 384 x 40 x 40 3911040
(55) conv_silu 384 x 40 x 40 768 x 20 x 20 6568320
(56) conv_silu 768 x 20 x 20 384 x 20 x 20 6864768
(57) route - 768 x 20 x 20 6864768
(58) conv_silu 768 x 20 x 20 384 x 20 x 20 7161216
(59) conv_silu 384 x 20 x 20 384 x 20 x 20 7310208
(60) conv_silu 384 x 20 x 20 384 x 20 x 20 8638848
(61) shortcut_linear: 58 - 384 x 20 x 20 -
(62) conv_silu 384 x 20 x 20 384 x 20 x 20 8787840
(63) conv_silu 384 x 20 x 20 384 x 20 x 20 10116480
(64) shortcut_linear: 61 - 384 x 20 x 20 -
(65) route - 768 x 20 x 20 10116480
(66) conv_silu 768 x 20 x 20 768 x 20 x 20 10709376
(67) conv_silu 768 x 20 x 20 384 x 20 x 20 11005824
(68) maxpool 384 x 20 x 20 384 x 20 x 20 11005824
(69) maxpool 384 x 20 x 20 384 x 20 x 20 11005824
(70) maxpool 384 x 20 x 20 384 x 20 x 20 11005824
(71) route - 1536 x 20 x 20 11005824
(72) conv_silu 1536 x 20 x 20 768 x 20 x 20 12188544
(73) conv_silu 768 x 20 x 20 384 x 20 x 20 12484992
(74) upsample 384 x 20 x 20 384 x 40 x 40 -
(75) route - 768 x 40 x 40 12484992
(76) conv_silu 768 x 40 x 40 192 x 40 x 40 12633216
(77) route - 768 x 40 x 40 12633216
(78) conv_silu 768 x 40 x 40 192 x 40 x 40 12781440
(79) conv_silu 192 x 40 x 40 192 x 40 x 40 12819072
(80) conv_silu 192 x 40 x 40 192 x 40 x 40 13151616
(81) conv_silu 192 x 40 x 40 192 x 40 x 40 13189248
(82) conv_silu 192 x 40 x 40 192 x 40 x 40 13521792
(83) route - 384 x 40 x 40 13521792
(84) conv_silu 384 x 40 x 40 384 x 40 x 40 13670784
(85) conv_silu 384 x 40 x 40 192 x 40 x 40 13745280
(86) upsample 192 x 40 x 40 192 x 80 x 80 -
(87) route - 384 x 80 x 80 13745280
(88) conv_silu 384 x 80 x 80 96 x 80 x 80 13782528
(89) route - 384 x 80 x 80 13782528
(90) conv_silu 384 x 80 x 80 96 x 80 x 80 13819776
(91) conv_silu 96 x 80 x 80 96 x 80 x 80 13829376
(92) conv_silu 96 x 80 x 80 96 x 80 x 80 13912704
(93) conv_silu 96 x 80 x 80 96 x 80 x 80 13922304
(94) conv_silu 96 x 80 x 80 96 x 80 x 80 14005632
(95) route - 192 x 80 x 80 14005632
(96) conv_silu 192 x 80 x 80 192 x 80 x 80 14043264
(97) conv_silu 192 x 80 x 80 192 x 40 x 40 14375808
(98) route - 384 x 40 x 40 14375808
(99) conv_silu 384 x 40 x 40 192 x 40 x 40 14450304
(100) route - 384 x 40 x 40 14450304
(101) conv_silu 384 x 40 x 40 192 x 40 x 40 14524800
(102) conv_silu 192 x 40 x 40 192 x 40 x 40 14562432
(103) conv_silu 192 x 40 x 40 192 x 40 x 40 14894976
(104) conv_silu 192 x 40 x 40 192 x 40 x 40 14932608
(105) conv_silu 192 x 40 x 40 192 x 40 x 40 15265152
(106) route - 384 x 40 x 40 15265152
(107) conv_silu 384 x 40 x 40 384 x 40 x 40 15414144
(108) conv_silu 384 x 40 x 40 384 x 20 x 20 16742784
(109) route - 768 x 20 x 20 16742784
(110) conv_silu 768 x 20 x 20 384 x 20 x 20 17039232
(111) route - 768 x 20 x 20 17039232
(112) conv_silu 768 x 20 x 20 384 x 20 x 20 17335680
(113) conv_silu 384 x 20 x 20 384 x 20 x 20 17484672
(114) conv_silu 384 x 20 x 20 384 x 20 x 20 18813312
(115) conv_silu 384 x 20 x 20 384 x 20 x 20 18962304
(116) conv_silu 384 x 20 x 20 384 x 20 x 20 20290944
(117) route - 768 x 20 x 20 20290944
(118) conv_silu 768 x 20 x 20 768 x 20 x 20 20883840
(119) route - 192 x 80 x 80 20883840
(120) conv_logistic 192 x 80 x 80 54 x 80 x 80 20894262
(121) yolo 54 x 80 x 80 54 x 80 x 80 20894262
(122) route - 384 x 40 x 40 20894262
(123) conv_logistic 384 x 40 x 40 54 x 40 x 40 20915052
(124) yolo 54 x 40 x 40 54 x 40 x 40 20915052
(125) route - 768 x 20 x 20 20915052
(126) conv_logistic 768 x 20 x 20 54 x 20 x 20 20956578
(127) yolo 54 x 20 x 20 54 x 20 x 20 20956578
Number of unused weights left: 14442678
deepstream-app: yolo.cpp:415: NvDsInferStatus Yolo::buildYoloNetwork(std::vector&, nvinfer1::INetworkDefinition&): Assertion `0’ failed.
Aborted (core dumped)

It turned out I was using the wrong yaml file in the models (or models/hub) directory in GitHub - ultralytics/yolov5: YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite as a base (before changing the nc “number of classes” value) when converting the .pt to .cfg/.wts. If you don’t use the correct one, then you get this error about “unused weights left” or a segmentation fault in DeepStream.

1 Like

Hi @jholbrook ,
Thank you for the update! So, we can close this topic, right?

Hi @mchi, sure thing! You can go ahead and close the topic.

1 Like

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