Files
1hew-ComfyUI-1hewNodes/web/docs/1hew_MaskBatchMathOps/zh.md
T
2025-11-18 18:35:12 +08:00

33 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Mask Batch Math Ops - 批量遮罩逻辑归约(OR/AND)
**节点功能:** `Mask Batch Math Ops` 在批次维度对遮罩进行归约,支持按像素 `最大值`(OR)或 `最小值`(AND)。输出为单帧批次的聚合遮罩。
## 输入
| 参数名称 | 入端选择 | 数据类型 | 默认值 | 取值范围 | 描述 |
| -------- | -------- | -------- | ------ | -------- | ---- |
| `mask` | - | MASK | - | - | 输入遮罩批次;支持 `B×H×W` 或 `B×H×W×1` |
| `operation` | - | COMBO | `or` | `or` / `and` | 批次维度归约运算符 |
## 输出
| 输出名称 | 数据类型 | 描述 |
|---------|----------|------|
| `mask` | MASK | 单帧聚合遮罩(`B=1`),并限制在 `[0,1]` 范围内 |
## 功能说明
- OR 归约:跨帧按像素取最大值。
- AND 归约:跨帧按像素取最小值。
- 通道处理:自动压缩末尾单通道并通过 `unsqueeze(0)` 恢复批次维。
- 分块处理:按 `512` 帧分块归约,降低内存压力。
- 输出规范化:转换为 `float32`,限制 `[0,1]`,保持设备一致。
## 典型用法
- 使用 `or` 聚合多次分割结果形成宽松共识遮罩。
- 使用 `and` 获取严格重叠区域遮罩。
## 注意与建议
- 当批次大小 `≤1` 时,直接返回输入遮罩。