[Python] Unity Sentis fails to run YOLOv9s ONNX model with "IndexError: axis 3 is out of...

Discussão em 'Python' iniciado por Stack, Junho 9, 2025.

  1. Stack

    Stack Membro Participativo

    Unity Sentis fails to run YOLOv9s ONNX model with "IndexError: axis 3 is out of bounds"

    I'm using a YOLOv9s model trained on a custom dataset and facing issues running it in Unity Sentis with the HOLO DNN backend.

    Setup

    • Trained with: YOLOv9s (.pt)
    • Exported with: yolo export format=onnx opset=15
    • Input shape: (1, 3, 448, 640)
    • Output shape: (1, 7, 7581)
    Error (in Unity Sentis)


    Exception: [error] can not add post process to model for some reason. (IndexError: axis 3 is out of bounds shape of rank, 3 Assertion failure. Value was False Expected: True)

    What Works

    • The .pt model runs perfectly fine using PyTorch locally.
    • The issue only arises when importing and using the ONNX model in Unity Sentis.
    What I Need Help With

    • Is this error due to a mismatch in output shape expected by Sentis post-process hooks?
    • Do I need to reshape the output manually or bypass post-processing somehow?
    • Are there best practices to convert custom YOLOv9s models for Unity inference?

    Any insights from those who have worked with Sentis and ONNX models (especially YOLO variants) would be appreciated.

    Continue reading...

Compartilhe esta Página