Skip to content

Custom识别器无法获取And识别器中其他节点的信息 #1267

@overflow65537

Description

@overflow65537

问题类型 / Issue Type

一般 Bug / General Bug

问题描述及复现步骤 / Problem Description & Reproduction Steps

预期行为

根据 AND 识别结果,应能正确将前序节点(如“物品位置”)的识别结果传递给后续节点(如 custom 识别器),从而完成基于偏移和表达式的条件判断。

实际行为

custom 识别器执行时,无法获取到 AND 列表中前序节点(“物品位置”)的识别结果,导致 custom 内部依赖该结果进行 roi_offset 计算时出错。

复现步骤与配置说明

Image

识别流程使用 all_of(AND 逻辑)组合两个节点:

{
"all_of": [
   "物品位置",
   "custom对比价格"
]
}

1. “物品位置”节点(正常执行)

  • 类型:图形识别(绿色框)
  • 作用:定位目标物品在屏幕中的区域
  • 日志显示该节点已成功运行,并输出了有效 ROI。

2. “custom对比价格”节点(异常)

内部结构如下:
物品价格子节点,接受物品位置,来偏移识别物品的价格,这个节点不会自动运行,由custom识别器主动运行

"物品价格": {
{
  "recognition": {
    "type": "OCR",
    "param": {
      "roi": "物品位置",
      "roi_offset": [60, 60, 60, 60],
      "expected": []
    }
  }
}
}

custom程序本体,他会运行物品价格和剩余调度券两个节点,冰获取text进行对比

{
"custom": {
  "recognition": {
    "type": "Custom",
    "param": {
      "custom_recognition": "ExpressionRecognition",
      "custom_recognition_param": {
        "expression": "{物品价格} < {剩余调度券}"
      }
    }
  }
}
}

custom 内部逻辑

  • 期望通过 物品位置 节点的结果作为 ROI,偏移后识别“物品价格”
  • 使用 run_reco 动态获取识别结果并进行表达式比较

问题现象

  • 物品位置 节点确实已执行,并在日志中可见有效结果
  • 但在 custom 识别器内部执行 物品价格 时,无法获取到 物品位置 的输出结果( "roi": "物品位置",)
  • 疑似 AND 上下文中的中间结果未正确传递给后续的 custom 识别器

MaaFramework 版本 / Version

v5.10.1

日志文件 / Log Files

.

Pipeline JSON

{
    "Tesst": {
        "recognition": {
            "type": "And",
            "param": {
                "all_of": [
                    "条件1",
                    "基于条件1的识别节点"
                ]
            }
        }
    },
    "条件1": {
        "recognition": {
            "type": "OCR",
            "param": {
                "roi": [
                    0,
                    0,
                    0,
                    0
                ],
                "expected": [
                    "测试内容"
                ]
            }
        }
    },
    "基于条件1的识别结果文字": {
        "recognition": {
            "type": "OCR",
            "param": {
                "roi": "条件1",
                "expected": [
                    "测试内容"
                ]
            }
        }
    },
    "基于条件1的识别结果": {
        "recognition": {
            "type": "Custom",
            "param": {
                "custom_recognition": "TestRecognition",
                "custom_recognition_param": {
                    "run": "基于条件1的识别结果文字"
                }
            }
        }
    }
}

崩溃 Dump 文件 / Crash Dump (仅崩溃问题 / Crash only)

No response

Draw 调试图片 / Draw Debug Images (仅识别问题 / Recognition only)

No response

模板图片 / Template Images (仅识别问题 / Recognition only)

No response

其他信息 / Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions