inference-and-demo
Use this sub-skill when the task is about running BackgroundMattingV2 demos or
understanding the inference-time model path.
Typical triggers
- image matting on a directory of source/background images
- video matting on a source video and a background image or video
- webcam matting, background capture, or GUI interaction
- throughput or speed testing on PyTorch or TorchScript
- choosing
mattingbasevsmattingrefine - choosing
resnet101,resnet50, ormobilenetv2 - using
cpuvscuda - deciding when
preprocess-alignmentis helpful
Read first
references/workflows.mdfor concrete demo recipes and option meaning.references/troubleshooting.mdfor missing checkpoints, shape mismatch,
alignment, webcam, and output-overwrite issues.
scripts/smoke_forward.pyfor the safe tiny forward smoke.scripts/run_inference_images.pyandscripts/run_inference_video.pyfor
dry-run or execute wrappers around the checkout's demo CLIs.
What this sub-skill owns
- model selection and inference-time configuration
- input pairing and alignment behavior
- output types
com,pha,fgr,err, andref - small smoke tests that prove the model path works without checkpoints
- guidance for the webcam demo, while acknowledging its hardware and GUI needs
What it does not own
- TorchScript or ONNX conversion details; use
export-and-backends. - Dataset layout and training setup; use
training. - Octave/MATLAB benchmark notes; those stay with
trainingreferences.
Recommended first checks
- Run
scripts/smoke_forward.pywith a tiny resolution on CPU or CUDA. - If you only want to inspect the exact source CLI, use the dry-run wrappers.
- Move to the native CLI only when you have a real checkpoint and matching
source/background inputs.
Cross-links
../export-and-backends/SKILL.md../training/SKILL.md../../references/backend-compatibility.md