S2.65: help and bench follow all four SAM 2 sizes; tests for the size configs and detection

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kristian Myram
2026-10-30 08:43:31 +01:00
co-authored by Claude Sonnet 5.5
parent 2acd0ca1a8
commit ac8765bf67
5 changed files with 42 additions and 7 deletions
+5 -4
View File
@@ -28,7 +28,7 @@
//! effectcraft-cli bench --ops [--small] [--layers N] [--comps N] [--footage N] everyday-operation timings
//! on a large generated project (open, save, auto-save, undo/redo, timeline, Project panel)
//! effectcraft-cli bench --roto [--frames N] [--sam2 model.safetensors] [--mobilesam mobile_sam.pt] [--fixes] [--clip FRAMES --truth MASKS] [--json] Roto Brush trackers on synthetic clips with known mattes
//! (classical engine, MobileSAM and SAM 2.1 Tiny when installed; IoU, flicker, re-appearance, seconds per frame)
//! (classical engine, MobileSAM and SAM 2.1 (any installed size) when installed; IoU, flicker, re-appearance, seconds per frame)
//! effectcraft-cli script FILE.jsx [F.ecproj] | --eval CODE run an After Effects-style script
//! effectcraft-cli mcp [--autosave | --bridge PORT] MCP server on stdio
//!
@@ -1030,11 +1030,11 @@ fn bench_roto(args: &Args) -> Result<(), Failure> {
note!("bench --roto: MobileSAM is not installed; comparing the classical engine only");
}
// `--sam2 FILE` uses the weights at FILE; otherwise the installed ones.
let sam2_file = args.opt("--sam2").map(std::path::PathBuf::from).or_else(|| session.model_path(&effectcraft_segment::SAM2_TINY));
let sam2_file = args.opt("--sam2").map(std::path::PathBuf::from).or_else(|| effectcraft_sam2::mask::SIZES.iter().find_map(|m| session.model_path(m)));
let sam2: Option<std::sync::Arc<dyn MaskModel>> =
sam2_file.and_then(|p| std::fs::read(p).ok()).and_then(|bytes| effectcraft_sam2::mask::load(&bytes).ok()).map(|m| m as std::sync::Arc<dyn MaskModel>);
if sam2.is_none() {
note!("bench --roto: SAM 2.1 Tiny is not installed; no SAM 2 column");
note!("bench --roto: no SAM 2.1 size is installed; no SAM 2 column");
}
// `--fixes`: also count the correction strokes each needs before every frame reaches IoU 0.9 (up to 6).
let fixes = args.flag("--fixes");
@@ -1053,7 +1053,8 @@ fn bench_roto(args: &Args) -> Result<(), Failure> {
runs.extend(measure(&sc, &|s| Some(bench::run_flow(s, "mobilesam", Some(m.as_ref())))));
}
if let Some(m) = &sam2 {
runs.extend(measure(&sc, &|s| bench::run_tracker(s, "sam2-tiny", m.as_ref())));
let label = m.info().id.replacen("sam2.1-hiera-", "sam2-", 1);
runs.extend(measure(&sc, &|s| bench::run_tracker(s, &label, m.as_ref())));
}
}
if args.flag("--json") {