Skip to content

feat(tool): 开发全新画面分析工具及CV流水线集成 #1110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

kawayiYokami
Copy link
Contributor

@kawayiYokami kawayiYokami commented Jun 17, 2025

以后应该可以推广到所有 涉及cv和ocr的地方,但是现在只有敌方状态使用了。

引入全新的计算机视觉流水线,支持敌方目标状态检测。
同时开发了画面分析工具,旨在优化调试和开发效率。

详细说明:

  • CV流水线:设计并实现模块化的图像处理流程,从数据输入到目标状态输出。
  • 目标检测:集成了基于深度学习的目标检测模型,用于识别和分类敌方单位。
  • 画面分析工具:一个独立的开发工具,提供可视化界面来监控流水线的每个阶段,便于调试和性能分析。
  • 这次变更对系统架构有较大影响,为后续扩展奠定了基础。

@kawayiYokami kawayiYokami changed the title CV流水线,敌方目标状态检测 CV流水线,敌方目标状态检测,全新开发工具-画面分析流水线 Jun 17, 2025
@DoctorReid
Copy link
Collaborator

性能怎么样

@kawayiYokami
Copy link
Contributor Author

kawayiYokami commented Jun 20, 2025

性能怎么样

异常用了ocr,延迟在0.2秒左右,使用异步,默认不启用

锁定和血条就是跟以前的CV方法是一样的,只是CV流水线更加方便在GUI里调试和安排处理流程,用时不到1毫秒

新增了状态管理,可以通过一次检测,匹配多种状态

@@ -80,6 +81,8 @@ def init_before_running(self) -> Tuple[bool, str]:
check_chain_interval=self.get('check_chain_interval', 1),
check_quick_interval=self.get('check_quick_interval', 0.5),
check_end_interval=self.get('check_end_interval', 5),
target_lock_interval=self.get('target_lock_interval', 0),
Copy link
Collaborator

Choose a reason for hiding this comment

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

是否默认开启锁定?这样不需要每个模板都写一遍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

突然想起来,闪避助手那里不需要自动锁定,需要把闪避那几个配置文件的target_lock_interval=0


for key, value in old_options.items():
if key in self.ocr_options and self.ocr_options[key] != value:
log.info(f'OCR配置项 {key} 发生变更,模型将重新加载')
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个加载模型消耗还是挺大的,不建议允许修改。

我看当前的pipeline应该也还不需要,这段先删掉吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我觉得是否在初始化的时候,需要建立一个全局参数?因为OCR会默认缩放图片到900,而全屏截图是1920X1080的,会导致全屏识别的时候,字符识别不出来,所以我才加的这个功能。

Copy link
Collaborator

@DoctorReid DoctorReid Jul 1, 2025

Choose a reason for hiding this comment

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

通过改参数来完成特定场景的识别,感觉还是很不实用,后续也应该避免这方面的考虑。

  1. 1920的OCR耗时上升了多少
  2. 900的识别哪些识别不到?异常相关的话能否关闭伤害数字来实现
  3. 如果实在需要高分辨率的识别,后续可以区分两个matcher来实现

Copy link
Contributor Author

Choose a reason for hiding this comment

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

通过改参数来完成特定场景的识别,感觉还是很不实用,后续也应该避免这方面的考虑。

  1. 1920的OCR耗时上升了多少
  2. 900的识别哪些识别不到?异常相关的话能否关闭伤害数字来实现
  3. 如果实在需要高分辨率的识别,后续可以区分两个matcher来实现

非常抱歉,我描述不够准确,他这个参数的意思是,如果接受来源的截图,仅在图片长宽之一大于900,则缩放到900以内,所以哪怕设置在1920。现在的小截图,长宽之一小于900的,不会因为这个导致性能问题。我觉得需要全屏ocr的时候不应该是一个性能敏感场景,因为我们用的是小模型,我电脑使用cpu,用时1920的情况下,依然在0.3秒~0.5秒以内。绝区零的字体太粗,一旦缩小一点点就会黏在一起。 这个大概只有在大型截图里面才会有效。 所以如果不想影响性能,就应该像现在这样,裁剪的时候就尽可能往小的去裁剪。

这个感觉只有不良影响,因为如果有些画面识别的地方,需要一个长条的截图,比如1500宽,ocr的时候也会被压缩到900以内,倒是识别不出来。

Copy link
Collaborator

Choose a reason for hiding this comment

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

需要全屏ocr的时候不应该是一个性能敏感场景

的确,后续再开一个pr调整到默认 1920 吧

start_time = time.time()
result_map: dict = {}
scan_result_list: list = self._model.ocr(image, cls=False)
scan_result_list: list = self._model.ocr(
Copy link
Collaborator

Choose a reason for hiding this comment

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

突然想到onnxruntime不是线程安全的,这个异步OCR部分会有问题,这个问题先不在这里改,记在 #874 后续再一起解决

Copy link
Collaborator

Choose a reason for hiding this comment

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

异常状态暂时不要开启

@DoctorReid
Copy link
Collaborator

当前PR较大,修复以上问题后,暂时不用再添加新功能,测试合并后再继续添加新功能

@kawayiYokami
Copy link
Contributor Author

还有什么问题不?

@kawayiYokami kawayiYokami changed the title CV流水线,敌方目标状态检测,全新开发工具-画面分析流水线 feat(tool): 开发全新画面分析工具及CV流水线集成 Jul 4, 2025
@DoctorReid DoctorReid changed the base branch from main to dev_ocr_20250630 July 12, 2025 09:20
@DoctorReid DoctorReid merged commit 6f1951b into OneDragon-Anything:dev_ocr_20250630 Jul 12, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 15, 2025
@kawayiYokami kawayiYokami deleted the enemy_state branch July 23, 2025 12:57
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