按照官方操作手册转换yolo11模型出现问题
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 850
- Forks
- 128
- Avg merge
- 1m
- Merged PRs (30d)
- 2
Description
环境:
python环境:
ultralytics 8.4.52
docker环境 两个版本同样错误
pulsar2 6.0
pulsar2 7.0
报错日志:
`2026-07-31 11:22:21.482 | INFO | yamain.command.precision_analysis:quant_precision_analysis:403 - save precision analysis table to [tmp/quant/debug/precision_analysis_table.txt]
2026-07-31 11:22:21.489 | INFO | yamain.command.precision_analysis:quant_precision_analysis:411 - save precision analysis graph to [tmp/quant/debug/precision_analysis.mmd]
Building native ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
2026-07-31 11:22:22.667 | INFO | yamain.command.build:compile_ptq_model:1169 - group 0 compiler transformation
2026-07-31 11:22:22.676 | WARNING | yamain.command.load_model:pre_process:622 - preprocess tensor [images]
2026-07-31 11:22:22.676 | INFO | yamain.command.load_model:pre_process:624 - tensor: images, (1, 640, 640, 3), U8
2026-07-31 11:22:22.676 | INFO | yamain.command.load_model:pre_process:625 - op: op:pre_dequant_1, AxDequantizeLinear, {'const_inputs': {'x_zeropoint': array(0, dtype=int32), 'x_scale': array(1., dtype=float32)}, 'output_dtype': <class 'numpy.float32'>, 'quant_method': 0}
2026-07-31 11:22:22.676 | INFO | yamain.command.load_model:pre_process:624 - tensor: tensor:pre_norm_1, (1, 640, 640, 3), FP32
2026-07-31 11:22:22.676 | INFO | yamain.command.load_model:pre_process:625 - op: op:pre_norm_1, AxNormalize, {'dim': 3, 'mean': [0.0, 0.0, 0.0], 'std': [255.0, 255.0, 255.0], 'output_dtype': FP32}
2026-07-31 11:22:22.676 | INFO | yamain.command.load_model:pre_process:624 - tensor: tensor:pre_transpose_1, (1, 640, 640, 3), FP32
2026-07-31 11:22:22.676 | INFO | yamain.command.load_model:pre_process:625 - op: op:pre_transpose_1, AxTranspose, {'perm': [0, 3, 1, 2]}
2026-07-31 11:22:22.677 | WARNING | yamain.command.load_model:post_process:633 - postprocess tensor [/model.23/Concat_output_0]
Traceback (most recent call last):
File "", line 59, in guard_context
File "", line 1174, in compile_ptq_model
File "", line 782, in ir_compiler_transformation
File "", line 647, in post_process
File "", line 347, in transpose_postprocess
IndexError: list assignment index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 4, in
File "", line 281, in
File "", line 277, in pulsar2
File "", line 158, in wrapper
File "", line 21, in wrapper
File "", line 115, in build_error
File "", line 13, in wrapper
File "", line 625, in build
File "", line 1138, in compile_ptq_model
File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
File "", line 61, in guard_context
File "", line 73, in error_func
yamain.common.error.CodeException: (<ErrorCode.FrontendError: 6>, IndexError('list assignment index out of range'))`
目前解决方案:
可以通过修改yolo11n.npu.json的方式来规避报错:
"dst_perm": [0, 1, 3, 2]“ 改为 "dst_perm": [0, 1, 2]"
生成的模型可以在板端推理,使用下面命令:
ax_run_model -m xxx.axmodel -r 100
但无法使用Maixpy 推理
报错:
`start running...
-- [I] [Maix Comm Protocol] auto set pinmap A21 to UART4_TX for uart4
-- [I] [Maix Comm Protocol] auto set pinmap A22 to UART4_RX for uart4
-- [I] [Maix Comm Protocol] listening on uart port: uart4(/dev/ttyS4)
-- [I] npu_ai_isp_on from config: 0 (off)
-- [I] init middleware SYSTEM
-- [I] maix multi-media driver used count: 1
-- [I] init middleware NPU ENGINE
-- [I] maix npu driver used count: 1
-- [I] load model from: /root/my_models/yolo11n_npu.axmodel
-- [I] input_cache : 1, flush input cache to ddr before run model: 0
-- [I] output_cache: 1, invalidate output cache after run model: 1
-- [I] model info:
type: yolo11
input type: rgb
mean:0.000000 0.000000 0.000000
scale:0.003922 0.003922 0.003922
labels num: 1
input size: 96x96
-- [E] output node shape error, please check 2
-- [I] Outputs:
LayerInfo(name='/model.23/Concat_output_0', dtype=float32, shape=[1, 64, 189])
LayerInfo(name='/model.23/Concat_1_output_0', dtype=float32, shape=[1, 1, 189])
LayerInfo(name='/model.23/Concat_2_output_0', dtype=float32, shape=[1, 4, 189])
Traceback (most recent call last):
File "/tmp/maixpy_run/main.py", line 4, in
detector = nn.YOLO11(model="/root/my_models/yolo11n.mud", dual_buff=True)
RuntimeError: Invalid arguments: load model failed`
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the official YOLO11 conversion with ultralytics 8.4.52 and Pulsar2 6.0 or 7.0, using the reported logs as the starting point. Inspect yolo11n.npu.json, especially dst_perm, and the transpose_postprocess failure, then compare the generated output shapes with MaixPy's YOLO11 loader expectations. Done means the model converts without manual JSON edits and loads successfully in MaixPy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai, embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100