executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
inference-workflowsUse when running RobustVideoMatting inference, loading weights, using convert_video or TorchHub, converting image/video inputs, or reasoning about exported model runtimes.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this sub-skill for user-facing RVM inference: loading models, converting videos or image sequences, configuring outputs, and adapting the documented runtime formats.
convert_video, python inference.py, output alpha,
foreground, or composition files.downsample_ratio, seq_chunk, input_resize, video
bitrate, or image-sequence output.Route other tasks elsewhere:
Confirm the runtime surface.
MattingNetwork and
convert_video from the local RVM source modules.Load a model.
import torch
from model import MattingNetwork
model = MattingNetwork("mobilenetv3").eval().to("cuda")
model.load_state_dict(torch.load("rvm_mobilenetv3.pth", map_location="cuda"))
Convert a video file or sorted image-sequence directory with the converter API. Always request at least one output.
from inference import convert_video
convert_video(
model,
input_source="frames_or_input.mp4",
output_type="png_sequence",
output_composition="composition",
output_alpha="alpha",
downsample_ratio=0.25,
seq_chunk=4,
)
For safe PNG image-sequence conversion from arbitrary working directories, use the bundled wrapper:
python scripts/rvm_convert_image_sequence.py \
--repo-root /path/to/RobustVideoMatting \
--variant mobilenetv3 \
--checkpoint rvm_mobilenetv3.pth \
--input-dir frames \
--output-dir rvm_outputs \
--device cpu \
--alpha --composition
Validate outputs. PNG sequence mode writes numbered images under the output directories you request. Video mode uses PyAV/H.264 and can fail for media dependency or codec reasons unrelated to model quality.
convert_video signature, CLI flags, output modes, and
downsample/sequence-chunk behavior.mobilenetv3 unless the user explicitly asks for the larger ResNet50
variant.output_type="png_sequence" for debuggable alpha/foreground/composition
artifacts; use output_type="video" only when video encoding dependencies are
available and a video container is required.downsample_ratio=None for auto max-side-512 behavior, or set it based
on resolution/content. For 1080p portrait video, 0.25 is a common starting
point.seq_chunk to process multiple sequential frames at once when memory
permits. The converter still recycles recurrent states across chunks.A good answer names the selected runtime, exact converter arguments or CLI flags, required input/output paths, checkpoint/device handling, validation steps, and likely failure modes. It should not require future agents to open the original repository docs or scripts.