Remove hand_action condition and action editor
This commit is contained in:
parent
ad1c2a4bb7
commit
0e779dc942
@ -148,7 +148,6 @@ python/python.exe -X utf8 -m unittest discover -s tests -p test_worker.py -v
|
||||
| `time_elapsed` | 否 | 计时 |
|
||||
| `hand_in_region` | 否 | MediaPipe |
|
||||
| `hand_move` | 否 | MediaPipe(起点证据来自上一帧的轨迹) |
|
||||
| `hand_action` | 否 | MediaPipe |
|
||||
| `object_present` | 是 | YOLO |
|
||||
| `object_in_zone` | 是 | YOLO |
|
||||
| `hand_near_object` | 是 | YOLO + MediaPipe |
|
||||
@ -162,7 +161,7 @@ python/python.exe -X utf8 -m unittest discover -s tests -p test_worker.py -v
|
||||
### 配方编辑器
|
||||
|
||||
SOP 页配方行的「编辑 / 新建」。表单式,四个 tab:步骤 / 区域 / 全局设置 / 检测模型,
|
||||
字段与 YAML 一一对应;method、区域名、hand、动作、违规类型都是下拉选——就是为了不让
|
||||
字段与 YAML 一一对应;method、区域名、hand、违规类型都是下拉选——就是为了不让
|
||||
"照抄别人的 YAML 拼错一个字母"这种事发生(下拉候选就是 `ConditionMethod` 那几项)。
|
||||
区域改键名会同步更新所有引用它的步骤;删区域会清掉引用。
|
||||
|
||||
@ -200,7 +199,7 @@ dotnet run --project tests/RegionEditorSmoke/RegionEditorSmoke.csproj
|
||||
## 判定语义(踩过的坑)
|
||||
|
||||
- **稳定帧门控**:按 `(步骤Id, 条件序号)` 累计连续命中帧数,达标才放行,未命中立即清零。
|
||||
`time_elapsed` / `hand_move` / `hand_action` 豁免(自带时序或瞬时语义)。
|
||||
`time_elapsed` / `hand_move` 豁免(自带时序或瞬时语义)。
|
||||
- **Start / Reset 必须清空跨帧状态**,否则第二轮会"秒过",防抖形同虚设。
|
||||
- **区域坐标是绝对像素**,必须在真机画面上标定,别照抄别人的 YAML。
|
||||
|
||||
|
||||
@ -107,7 +107,6 @@ public class RecipeNode : EditorNode
|
||||
ConditionMethod.TimeElapsed,
|
||||
ConditionMethod.HandInRegion,
|
||||
ConditionMethod.HandMove,
|
||||
ConditionMethod.HandAction,
|
||||
ConditionMethod.HandNearObject,
|
||||
ConditionMethod.ObjectPresent,
|
||||
ConditionMethod.ObjectInZone,
|
||||
@ -115,7 +114,6 @@ public class RecipeNode : EditorNode
|
||||
];
|
||||
|
||||
Hands = ["any", "left", "right"];
|
||||
Actions = ["", "pickup", "putdown"];
|
||||
ViolationTypes = [ViolationType.Timeout, ViolationType.ObjectRemoved];
|
||||
|
||||
AddRegionCommand = new DelegateCommand(() => { AddRegion(); Changed?.Invoke(); });
|
||||
@ -249,9 +247,6 @@ public class RecipeNode : EditorNode
|
||||
/// <summary>hand 下拉候选</summary>
|
||||
public IReadOnlyList<string> Hands { get; }
|
||||
|
||||
/// <summary>action 下拉候选(hand_action 用)</summary>
|
||||
public IReadOnlyList<string> Actions { get; }
|
||||
|
||||
/// <summary>违规类型下拉候选</summary>
|
||||
public IReadOnlyList<string> ViolationTypes { get; }
|
||||
|
||||
@ -862,7 +857,6 @@ public class ConditionNode : EditorNode
|
||||
private float _minConfidence = 0.7f;
|
||||
private int _stableFrames = 5;
|
||||
private int _durationMs;
|
||||
private string _action = "";
|
||||
|
||||
/// <summary>判定方法</summary>
|
||||
public string Method
|
||||
@ -934,13 +928,6 @@ public class ConditionNode : EditorNode
|
||||
set { SetProperty(ref _durationMs, value); }
|
||||
}
|
||||
|
||||
/// <summary>动作语义(hand_action 用)</summary>
|
||||
public string Action
|
||||
{
|
||||
get { return _action; }
|
||||
set { SetProperty(ref _action, value); }
|
||||
}
|
||||
|
||||
/// <summary>读入</summary>
|
||||
public static ConditionNode From(StepCondition from) => new()
|
||||
{
|
||||
@ -954,7 +941,6 @@ public class ConditionNode : EditorNode
|
||||
MinConfidence = from.MinConfidence,
|
||||
StableFrames = from.StableFrames,
|
||||
DurationMs = from.DurationMs,
|
||||
Action = from.Action,
|
||||
};
|
||||
|
||||
/// <summary>写出</summary>
|
||||
@ -970,7 +956,6 @@ public class ConditionNode : EditorNode
|
||||
MinConfidence = MinConfidence,
|
||||
StableFrames = StableFrames,
|
||||
DurationMs = DurationMs,
|
||||
Action = Action,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -301,11 +301,8 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="动作" Style="{StaticResource Field}" />
|
||||
<ComboBox Grid.Column="1" ItemsSource="{Binding DataContext.Recipe.Actions, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
SelectedItem="{Binding Detection.Action}" />
|
||||
<TextBlock Grid.Column="2" Text="容差像素" Style="{StaticResource Field}" Margin="16,0,8,0" Width="Auto" />
|
||||
<TextBox Grid.Column="3" Text="{Binding Detection.Tolerance}" />
|
||||
<TextBlock Text="容差像素" Style="{StaticResource Field}" />
|
||||
<TextBox Grid.Column="1" Text="{Binding Detection.Tolerance}" />
|
||||
</Grid>
|
||||
|
||||
<Grid Style="{StaticResource Row}">
|
||||
@ -332,7 +329,7 @@
|
||||
<TextBox Grid.Column="1" Text="{Binding Detection.DurationMs}" HorizontalAlignment="Left" Width="120" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Text="time_elapsed / hand_move / hand_action 豁免稳定帧门控(自带时序或瞬时语义)"
|
||||
<TextBlock Text="time_elapsed / hand_move 豁免稳定帧门控(自带时序或瞬时语义)"
|
||||
Foreground="{StaticResource FgDim}" FontSize="12" Margin="0,0,0,6" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@ -169,7 +169,6 @@ public class ConditionEvaluator
|
||||
}
|
||||
|
||||
case ConditionMethod.HandMove:
|
||||
case ConditionMethod.HandAction:
|
||||
{
|
||||
var from = Region(condition.FromRegion);
|
||||
var to = Region(condition.ToRegion);
|
||||
@ -201,7 +200,7 @@ public class ConditionEvaluator
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 稳定帧门控。time_elapsed / hand_move / hand_action 豁免
|
||||
/// 稳定帧门控。time_elapsed / hand_move 豁免
|
||||
/// (自带时序或瞬时交互语义,与参考项目的豁免清单一致)。
|
||||
/// </summary>
|
||||
private ConditionResult ApplyStableGate(int stepId, int probeSeed, StepCondition condition, ConditionResult raw)
|
||||
@ -209,8 +208,7 @@ public class ConditionEvaluator
|
||||
var method = condition.Method.ToLowerInvariant();
|
||||
|
||||
var exempt = method == ConditionMethod.TimeElapsed
|
||||
|| method == ConditionMethod.HandMove
|
||||
|| method == ConditionMethod.HandAction;
|
||||
|| method == ConditionMethod.HandMove;
|
||||
|
||||
if (exempt) return raw;
|
||||
|
||||
|
||||
@ -183,8 +183,6 @@ public class StepCondition
|
||||
/// <summary>计时毫秒(time_elapsed 用)</summary>
|
||||
public int DurationMs { get; set; }
|
||||
|
||||
/// <summary>动作语义(hand_action 用:pickup / putdown)</summary>
|
||||
public string Action { get; set; } = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -205,9 +203,6 @@ public static class ConditionMethod
|
||||
/// <summary>手从 A 区移到 B 区(7 次;配方里写作 hand_move)</summary>
|
||||
public const string HandMove = "hand_move";
|
||||
|
||||
/// <summary>取放动作(10 次;= hand_move + 动作语义)</summary>
|
||||
public const string HandAction = "hand_action";
|
||||
|
||||
/// <summary>手-物相邻(3 次)</summary>
|
||||
public const string HandNearObject = "hand_near_object";
|
||||
|
||||
|
||||
@ -87,7 +87,6 @@ public static partial class SopConfigLoader
|
||||
ConditionMethod.ObjectInZone,
|
||||
ConditionMethod.HandInRegion,
|
||||
ConditionMethod.HandMove,
|
||||
ConditionMethod.HandAction,
|
||||
ConditionMethod.HandNearObject,
|
||||
ConditionMethod.PersonPresent,
|
||||
ConditionMethod.TimeElapsed,
|
||||
@ -150,7 +149,7 @@ public static partial class SopConfigLoader
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 该方法是否依赖 YOLO 模型。手部类(hand_in_region / hand_move / hand_action)
|
||||
/// 该方法是否依赖 YOLO 模型。手部类(hand_in_region / hand_move)
|
||||
/// 与计时只用 MediaPipe,不在此列;hand_near_object 要比对物体,算依赖。
|
||||
/// </summary>
|
||||
private static bool NeedsModel(string method) => method.ToLowerInvariant() switch
|
||||
|
||||
Loading…
Reference in New Issue
Block a user