yolov8qualcommsnpe

ONNX converted .dlc model not giving full output for segmentation


I am working on a YOLOv8 ONNX segmentation model. It contains two output tensors, output0 and output1. output0 contains information about bounding box confidence scores and mask weights, while output1 gives a prototype mask. I optimized the model using Qualcomm neural processing SDK and converted it into .dlc format. However, the new dlc model only contains output0. How should I resolve this issue?

getOutputTensorsNames() returns only output0, however, the converted dlc model should contain both output0 and output1.


Solution

  • I'm assuming you used the SNPE tool snpe-onnx-to-dlc. In that case, if your model has more than one output tensor, you should specify that explicitly in the command. This is easy to overlook as the parameters related to output tensors are not a required argument. I don't know what model you are using exactly, but as an example, I downloaded the .onnx model of this YOLOv8 Segmentation implementation. It has 5 outputs, not 2 like your model, but the example works regardless. I ran snpe-onnx-to-dlc with the following arguments:

    snpe-onnx-to-dlc \
            --input_network yolov8_seg.onnx \
            --out_name output_0 \
            --out_name output_1 \
            --out_name output_2 \
            --out_name output_3 \
            --out_name output_4 \
            --output_path yolov8_seg.dlc
    

    The command successfully generated a .dlc file from the ONNX model, and I used snpe-dlc-info -i yolov8_seg.dlc to make sure the 5 outputs were present.

    Snippet from the verbose output:

    ------------------------------------------------------------------------------
    | Input Name  | Dimensions   | Type      | Encoding Info                     |
    ------------------------------------------------------------------------------
    | image       | 1,640,640,3  | Float_32  | No encoding info for this tensor  |
    ------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    | Output Name  | Dimensions    | Type      | Encoding Info                     |
    --------------------------------------------------------------------------------
    | output_1     | 1,8400        | Float_32  | No encoding info for this tensor  |
    | output_3     | 1,8400        | Float_32  | No encoding info for this tensor  |
    | output_4     | 1,160,160,32  | Float_32  | No encoding info for this tensor  |
    | output_2     | 1,8400,32     | Float_32  | No encoding info for this tensor  |
    | output_0     | 1,8400,4      | Float_32  | No encoding info for this tensor  |
    --------------------------------------------------------------------------------
    

    You can also use snpe-dlc-viewer -i <your dlc file> to generate a HTML visualization of your model.