hcolde/bmv2

Alpha-only video matting for 5-10 second white-background videos using BackgroundMattingV2 MobileNetV2 TorchScript.

Public
6 runs

Run time and cost

This model runs on Nvidia T4 GPU hardware. We don't yet have enough runs of this model to provide performance information.

Readme

bmv2 on Replicate

BackgroundMattingV2 封装为一个只输出 alpha 视频的 Replicate public 模型。

行为约束

  • 输入:5-10 秒、长边不超过 2048 的视频文件
  • 背景:固定为纯白色,不作为输入暴露
  • 输出:单个 alpha.mp4
  • 默认权重:torchscript_mobilenetv2_fp16.pth
  • 预留切换位:torchscript_mobilenetv2_fp32.pth

实现说明

  • 推理后端使用上游官方发布的 TorchScript 权重
  • sampling 模式下固定 backbone_scale=0.25
  • 对不能被 4 整除的输入尺寸,内部补齐到 4 的倍数后再裁回原尺寸
  • 小分辨率输入会自动下调 refine_sample_pixels,避免上游脚本在 sampling 模式下越界

切换到 fp32

默认不暴露给最终用户。需要切换时,在重新构建/推送前设置:

export BMV2_MODEL_VARIANT=mobilenetv2_fp32

可选值:

  • mobilenetv2_fp16
  • mobilenetv2_fp32

本地验证

cog predict -i video=@/absolute/path/to/input.mp4

推送到 Replicate

先登录 Docker registry:

printf '%s' "$REPLICATE_CLI_TOKEN" | cog login --token-stdin

然后推送:

cog push r8.im/hcolde/bmv2

上游来源

  • 模型与权重来源:PeterL1n/BackgroundMattingV2
  • 上游许可证:MIT
Model created