Skip to content

fix: 迷失之地 YOLO 推理前涂黑战斗头像 - #2488

Merged
ShadowLemoon merged 3 commits into
OneDragon-Anything:mainfrom
kawayiYokami:fix/lost-void-mask-battle-avatars
Jul 17, 2026
Merged

fix: 迷失之地 YOLO 推理前涂黑战斗头像#2488
ShadowLemoon merged 3 commits into
OneDragon-Anything:mainfrom
kawayiYokami:fix/lost-void-mask-battle-avatars

Conversation

@kawayiYokami

@kawayiYokami kawayiYokami commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • LostVoidDetector.run() 入口,对战斗画面 头像-3-1/3-2/3-3 区域涂黑后再做 YOLO 推理
  • 避免角色头像被误检为迷失之地目标
  • 同步补充检测模型文档说明

Testing

  • 本地用 debug 图 _1783595904619 跑过涂黑与 26n 推理,头像区域涂黑正常
  • ruff check 已通过修改文件

Summary by CodeRabbit

  • Bug Fixes
    • 优化目标识别:在推理前自动遮挡战斗头像区域,降低头像被误识别为目标的概率。
    • 提升相关场景下识别的准确性与稳定性。

避免角色头像-3-1/3-2/3-3 被误检为目标,统一在 LostVoidDetector.run 入口处理。
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

LostVoidDetector 在 YOLO 推理前复制图像并遮挡战斗头像区域,新增头像遮罩矩形配置及对应处理方法,检测参数继续透传。

Changes

LostVoid 头像遮罩

Layer / File(s) Summary
检测前头像遮罩与推理封装
src/zzz_od/application/hollow_zero/lost_void/context/lost_void_detector.py
引入 OpenCV 类型与绘图支持,定义战斗头像遮罩矩形,复制并填充图像后将其传入 YOLO 检测。

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了该 PR 的核心改动:在迷失之地 YOLO 推理前涂黑战斗头像区域。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment on lines +22 to +24
(104, 40, 274, 110), # 头像-3-1
(559, 40, 662, 91), # 头像-3-2
(741, 40, 844, 91), # 头像-3-3

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

既然都硬编码了直接涂黑左上角一个大矩形吧

按 review 意见把 3-1/3-2/3-3 三个区域合并为最小外接矩形。
@kawayiYokami

Copy link
Copy Markdown
Contributor Author

@ShadowLemoon 暗檬大大~

按你的 review 意见改好了:现在是左上角单一最小外接矩形 (104, 40, 844, 110),一次涂黑包住 头像-3-1/3-2/3-3

麻烦有空帮看下,可以的话合并一下,谢谢!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/zzz_od/application/hollow_zero/lost_void/context/lost_void_detector.py (1)

52-84: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

为头像遮罩增加回归测试。

建议验证:原图不会被修改、矩形区域像素全部变黑、矩形外区域保持不变,并确认 run() 传给父类的是遮罩后的图像而非原图。当前仅有 debug 图验证,后续坐标或图像类型变更容易引入回归。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/zzz_od/application/hollow_zero/lost_void/context/lost_void_detector.py`
around lines 52 - 84, 为 LostVoidDetector.mask_battle_avatars
增加回归测试,验证返回副本、原图不被修改、BATTLE_AVATAR_MASK_RECT 覆盖区域全部为黑色且外部像素保持不变;同时测试 run 调用
Yolov8Detector.run 时传入的是遮罩后的图像而非原图。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/zzz_od/application/hollow_zero/lost_void/context/lost_void_detector.py`:
- Around line 52-84: 为 LostVoidDetector.mask_battle_avatars
增加回归测试,验证返回副本、原图不被修改、BATTLE_AVATAR_MASK_RECT 覆盖区域全部为黑色且外部像素保持不变;同时测试 run 调用
Yolov8Detector.run 时传入的是遮罩后的图像而非原图。

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 785db60b-5645-4605-a26a-03de052675ec

📥 Commits

Reviewing files that changed from the base of the PR and between b95819c and c11b19d.

📒 Files selected for processing (1)
  • src/zzz_od/application/hollow_zero/lost_void/context/lost_void_detector.py

@ShadowLemoon
ShadowLemoon merged commit 84c4b5e into OneDragon-Anything:main Jul 17, 2026
8 checks passed
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants