TASK 51 slice 1: background-effects engine — bundled MediaPipe Selfie Segmenter (ONNX) + Remove (Unit: bg-effects engine)

- 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
This commit is contained in:
2026-10-09 09:24:13 -07:00
parent f8dd1079f3
commit 9f3c154d84
20 changed files with 796 additions and 78 deletions
+21 -1
View File
@@ -115,7 +115,27 @@ there on purpose.
Transitive dependencies (Microsoft.Xaml.Behaviors.Wpf,
Microsoft.Extensions.DependencyInjection.Abstractions) are MIT,
covered by item 7's .NET notice policy; this notice is kept per
this file's "list everything" policy.
this file's "list everything" policy.
11. ONNX Runtime (Microsoft.ML.OnnxRuntime — runs the webcam background model, TASK 51)
Copyright (c) Microsoft Corporation
License: MIT
Home: https://github.com/microsoft/onnxruntime
Used as: the CPU inference runtime (managed package + native onnxruntime.dll)
behind the `IPersonSegmenter` seam. MIT imposes no source offer.
12. MediaPipe Selfie Segmenter (landscape) (webcam background Remove/Blur, TASK 51)
Copyright (c) Google LLC (authors: Tingbo Hou, Siargey Pisarchyk, Karthik
Raveendran — model card "MediaPipe Selfie Segmentation", 2021-05-06)
License: Apache License 2.0
Home: https://ai.google.dev/edge/mediapipe/solutions/vision/image_segmenter
Source: https://storage.googleapis.com/mediapipe-models/image_segmenter/selfie_segmenter_landscape/float16/latest/selfie_segmenter_landscape.tflite
Changes (Apache-2.0 §4b): converted from TensorFlow Lite to ONNX format by
tools/selfie-seg/convert_tflite_to_onnx.py — float16 weights widened
to float32, NHWC graph re-expressed in NCHW; the weights and the
network are otherwise unmodified. Embedded in the application as
selfie_segmenter_landscape.onnx. Runs entirely on the user's PC.
--------------------------------------------------------------------------------