[高] ONNX 元数据缺少 names 时类别数退化为 1,会把 person 当 bird、飞机类别判为空
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- computer-vision, machine-learning
Research direction
Start at windows/birdlock/core/models.py around lines 99 and 112-123: read how class_names is parsed from ONNX metadata and where num_classes is set. Inspect session.get_outputs()[0].shape and the detection output layout to derive class count from the channel dimension (C - 4 - 3 * num_keypoints) instead of trusting the parse. Done when a model without names reports the real class count, bird_class is 14, and airplane mode no longer shows the missing-class message; reproduce with a no-names ONNX at windows/models/BirdDetector.onnx.
Written by the indexing model from the issue text.
Description
位置:windows/birdlock/core/models.py:99、:112-123
现象:self.num_classes = len(self.class_names) or 1。若导出的 ONNX 没有可解析的 names 元数据(或当前只支持单引号的正则匹配失败),num_classes 变成 1。此时 bird_class 返回 0(COCO 的 person)而不是 14,airplane_class 返回 None,飞机模式会报「当前整机检测模型不包含飞机类别」,而模型输出通道实际是 84。
复现:用一个不带 names 元数据的 YOLO ONNX 替换 windows/models/BirdDetector.onnx,做一次鸟类分析并查看选中框的类别与飞机模式提示。
建议:从 session.get_outputs()[0].shape 推导类别数,或在 detect() 里用 nc = C - 4 - 3 * num_keypoints 判定 80 类回退,不要用解析结果直接决定回退值。
来源:2026-11-15 全仓只读审计,PR #7 未包含此项。 未在 Windows 实机复现,复现路径由代码审计推得。
- Dominant language
- Swift
- Stars
- 2
- Forks
- 2
- Avg merge
- 2d 53m
- Merged PRs (30d)
- 8
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from cyandee/BirdLock
-
Difficulty 2/5 Under an hour Newbie friendliness 62/100
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
All issues in cyandee/BirdLock
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Photivra/nope-camera#168 ·
Maintainers usually reply within 1 day
-
area:shared bug priority:low status:queued
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
isaaclins/freesnitch#488 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
software-mansion-labs/Diplomat#20 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day