YOlOv4-tiny, DS 6.0, Unused weights

Please provide complete information as applicable to your setup.

• (Jetson / GPU) Jetson Nano 2 GB
• DeepStream Version: 6.0
• JetPack Version (valid for Jetson only): 4.6
• Issue Type: Questions
• What is the issue?

Hi there, I’m trying to deploy a custom yolov4-tiny model for 9 classes on a jetson nano board using Deepstream-Yolo library. When I run the deepstream-app command and try to produce the engine file I get the following error:

Using winsys: x11
ERROR: Deserialize engine failed because file path: /home/aris/New/DeepStream-Yolo/model_b1_gpu0_fp32.engine open error
0:00:03.979229080 8515 0xf533640 WARN nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1889> [UID = 1]: deserialize engine from file :/home/aris/New/DeepStream-Yolo/model_b1_gpu0_fp32.engine failed
0:00:03.979421839 8515 0xf533640 WARN nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:1996> [UID = 1]: deserialize backend context from engine from file :/home/aris/New/DeepStream-Yolo/model_b1_gpu0_fp32.engine failed, try rebuild
0:00:03.979454287 8515 0xf533640 INFO nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1914> [UID = 1]: Trying to create engine from model files

Loading pre-trained weights
Loading weights of /home/aris/new/deepstream-yolo/model/yolov4-3layer complete
Total weights read: 6336094
Building YOLO network

  layer                        input               output         weightPtr

(0) conv_leaky 3 x 416 x 416 32 x 208 x 208 992
(1) conv_leaky 32 x 208 x 208 64 x 104 x 104 19680
(2) conv_leaky 64 x 104 x 104 64 x 104 x 104 56800
(3) route - 32 x 104 x 104 56800
(4) conv_leaky 32 x 104 x 104 32 x 104 x 104 66144
(5) conv_leaky 32 x 104 x 104 32 x 104 x 104 75488
(6) route - 64 x 104 x 104 75488
(7) conv_leaky 64 x 104 x 104 64 x 104 x 104 79840
(8) route - 128 x 104 x 104 79840
(9) maxpool 128 x 104 x 104 128 x 52 x 52 79840
(10) conv_leaky 128 x 52 x 52 128 x 52 x 52 227808
(11) route - 64 x 52 x 52 227808
(12) conv_leaky 64 x 52 x 52 64 x 52 x 52 264928
(13) conv_leaky 64 x 52 x 52 64 x 52 x 52 302048
(14) route - 128 x 52 x 52 302048
(15) conv_leaky 128 x 52 x 52 128 x 52 x 52 318944
(16) route - 256 x 52 x 52 318944
(17) maxpool 256 x 52 x 52 256 x 26 x 26 318944
(18) conv_leaky 256 x 26 x 26 256 x 26 x 26 909792
(19) route - 128 x 26 x 26 909792
(20) conv_leaky 128 x 26 x 26 128 x 26 x 26 1057760
(21) conv_leaky 128 x 26 x 26 128 x 26 x 26 1205728
(22) route - 256 x 26 x 26 1205728
(23) conv_leaky 256 x 26 x 26 256 x 26 x 26 1272288
(24) route - 512 x 26 x 26 1272288
(25) maxpool 512 x 26 x 26 512 x 13 x 13 1272288
(26) conv_leaky 512 x 13 x 13 512 x 13 x 13 3633632
(27) conv_leaky 512 x 13 x 13 256 x 13 x 13 3765728
(28) conv_leaky 256 x 13 x 13 512 x 13 x 13 4947424
(29) conv_linear 512 x 13 x 13 42 x 13 x 13 4968970
(30) yolo 42 x 13 x 13 42 x 13 x 13 4968970
(31) route - 256 x 13 x 13 4968970
(32) conv_leaky 256 x 13 x 13 128 x 13 x 13 5002250
(33) upsample 128 x 13 x 13 128 x 26 x 26 -
(34) route - 384 x 26 x 26 5002250
(35) conv_leaky 384 x 26 x 26 256 x 26 x 26 5888010
(36) conv_linear 256 x 26 x 26 42 x 26 x 26 5898804
(37) yolo 42 x 26 x 26 42 x 26 x 26 5898804
(38) route - 256 x 26 x 26 5898804
(39) conv_leaky 256 x 26 x 26 64 x 26 x 26 5915444
(40) upsample 64 x 26 x 26 64 x 52 x 52 -
(41) route - 192 x 52 x 52 5915444
(42) conv_leaky 192 x 52 x 52 128 x 52 x 52 6137140
(43) conv_linear 128 x 52 x 52 42 x 52 x 52 6142558
(44) yolo 42 x 52 x 52 42 x 52 x 52 6142558
Number of unused weights left: 193536
deepstream-app: yolo.cpp:421: NvDsInferStatus Yolo::buildYoloNetwork(std::vector&, nvinfer1::INetworkDefinition&): Assertion `0’ failed.
Aborted

What I changed in the config file while training are: Batch size and subdivision to 64 and 16 - max_batches to 9*2000 - step to max_batches * 0.8 and max_batches * 0.9 - filter size before Yolo layers to (9+5)*3 - classes to 9. The network I trained with this config file works fine when I use the “./darknet detector test …” command after changing the batch size and subdivision to 1.

P.S.: I know that the original YOLOv4-tiny has 2 Yolo layers but I faced the exact same problem using that architecture as well.

yolov4-3layer.cfg (3.6 KB)

I’m completely lost here and I don’t know what else to check. I would appreciate any pointers or hints I can get
Thank you.

For yolov4-tiny, could you refer to topic Yolov4 tiny in DeepStream 5.0 - #6 by linh89kr ?

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