[中] 固定选眼路径的邻域过滤为 O(n²)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- numpy, python
- Domain
- performance
Research direction
Open windows/birdlock/core/analysis.py around lines 471-473, inside build_track(), where actual comes from np.flatnonzero(...) and the per-index np.any(np.abs(actual - i) <= 8) check runs. Replace that check with the suggested np.searchsorted(actual, i+9) - np.searchsorted(actual, i-8) > 0. Done means the two forms return identical results on the same arrays and a 3000-frame rebuild is measurably faster; no test file is named, so verify by re-running a sequence through build_track() after a manual eye correction.
Written by the indexing model from the issue text.
Description
位置:windows/birdlock/core/analysis.py:471-473
现象:actual 已由 np.flatnonzero(...) 得到有序数组,随后对每个 i 执行 np.any(np.abs(actual - i) <= 8)。n=3000 时约 900 万次运算,而 build_track() 在每次手动修正/选眼后都会重建。
复现:在 3000 帧序列上反复点选/修正眼睛,观察每次重建耗时。
建议:用 np.searchsorted(actual, i+9) - np.searchsorted(actual, i-8) > 0。
来源:2026-11-15 全仓只读审计,PR #7 未包含此项。 未在 Windows 实机复现,复现路径由代码审计推得。
- Dominant language
- Swift
- Stars
- 2
- Forks
- 2
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 2
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