Hey @Frank_Wu ,
Based on the traceback and debug output you shared:
TypeError: object of type 'NoneType' has no len()
This is happening in the update_reshape_output_format()
method during ONNX parsing. Your debug logs show:
self.name = "p2o.Reshape.67"
input_format = [batch, width, channels]
self.output_format = None
After looking at your Netron visualization, I can see the issue clearly. The Reshape
node in your model:
- Receives inputs from a
Concat(axis=0)
and anAdd(B=360)
- Feeds into a
Transpose
operation - Is missing the second input tensor that defines the target shape
This is a common issue we see with models converted from Paddle frameworks, where the Reshape operations rely on dynamic shape inference that our DFC can’t resolve.
Here are two solutions that have worked for other customers:
Solution 1: Use ONNX Simplifier (Recommended)
First, try using onnxsim
to simplify and add static shapes to your model:
pip install onnxsim
python3 -m onnxsim model.onnx model_simplified.onnx
This tool will attempt to infer the missing shapes and inject them as constant tensors, which our compiler can then process correctly.
Solution 2: Manual ONNX Patching
If simplification doesn’t work, you’ll need to patch your ONNX file to add the missing shape input to the problematic Reshape node.
You may need to adjust the target shape dimensions based on your specific model architecture.
Why This Happens
This is mentioned in our DFC User Guide :
“Some ONNX models, especially from Paddle or PyTorch, may contain layers that rely on dynamic shape propagation. It is highly recommended to preprocess and simplify the model to inject static shapes where possible.”
PaddleOCR models often use this dynamic reshaping pattern that doesn’t translate cleanly to ONNX without additional processing.
Best Practices
From our experience with customer models:
- Always run
onnxsim
on Paddle-exported ONNX models before using with Hailo DFC - When working with OCR models, pay special attention to Reshape operations
Let me know if this resolves your issue, or if you need further assistance with the model conversion process!