- Model: Google's official MediaPipe Selfie Segmenter (landscape, Apache-2.0 per model card), converted to ONNX by tools/selfie-seg/convert_tflite_to_onnx.py (custom op Convolution2DTransposeBias -> ConvTranspose) and verified against MediaPipe's own runtime (verify_against_mediapipe.py: max |diff| 5e-5, 100% binary agreement). Embedded resource, 430 KB. - Services/BackgroundEffects: IPersonSegmenter seam, OnnxPersonSegmenter (onnxruntime 1.31.0 CPU, never throws), BackgroundEffectProcessor (None passthrough, Remove = alpha mask). Not wired yet. - Tests: Remove integration test (fake segmenter) + bundled-model contract test vs MediaPipe reference mask. Full suite 407/408 — the one failure is the documented interactive-desktop flake RealMouseDrag_OnTheLayerList_PersistsTheReorder (passed in the run before; code path untouched). - Docs: ai.md reversal + section + licensing guard, THIRD-PARTY-NOTICES 11-12, TASK 51, indexes, MyMistakes recipe, HANDOFF. References: obs-backgroundremoval (approach only — ONNX Runtime on CPU, 2 threads; GPL-3.0, no code used) https://github.com/royshil/obs-backgroundremoval ; MediaPipe image segmenter https://ai.google.dev/edge/mediapipe/solutions/vision/image_segmenter
14 lines
584 B
C#
14 lines
584 B
C#
namespace ytLive.Services.BackgroundEffects;
|
|
|
|
/// <summary>A person-probability mask at the segmenter's own resolution: row-major,
|
|
/// one value per pixel, 0 = background, 1 = person.</summary>
|
|
public sealed record SegmentationMask(int Width, int Height, float[] Values);
|
|
|
|
/// <summary>Seam over the person-segmentation model (TASK 51) so tests inject a fake and
|
|
/// never run real inference. Returns null when no mask can be produced; callers then pass
|
|
/// the frame through untouched.</summary>
|
|
public interface IPersonSegmenter
|
|
{
|
|
SegmentationMask? Segment(VideoFrame frame);
|
|
}
|