[中] 分析阶段用 try? 把模型推理错误当成「没有检测到」

Open
#54 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
swift

Research direction

Start at Sources/BirdLockCore/Analysis/Analyzer.swift around lines 102 and 137, where (try? det.detect(...)) ?? [] and if let ds = try? pose.detect(...) drop the thrown error. Read the per-frame loop to see how frame results are collected, then look at Diagnostics.record to learn the existing reporting path. A thread-safe holder for the first error plus a count of failed frames drives both outcomes: throw when every frame fails, otherwise record and surface a notice. Done means a failing model no longer yields an empty success result; verify by forcing detect to throw and rerunning the analysis.

Written by the indexing model from the issue text.

Description

位置:Sources/BirdLockCore/Analysis/Analyzer.swift:102、:137

现象:let dets = (try? det.detect(...)) ?? [] 与 if let ds = try? pose.detect(...) 会静默吞掉推理错误。若 Core ML 模型加载或推理在每帧都失败,用户得到的是空的「识别完成」,而不是错误提示。

建议:在线程安全容器里记录首个错误;全部帧失败时抛出,个别帧失败时至少 Diagnostics.record 并在界面提示。

来源:2026-11-15 全仓只读审计,PR #7 未包含此项。 未在实机复现(静态审计)。

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cyandee/BirdLock

All issues in cyandee/BirdLock

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.