vidgod/setup/smoke_test.sh
type-two 8c84243b61 phase 2: vg-remove (ProPainter), vg-interp (RIFE), vg-cutie, farm ops, zoo mirror
- vg-remove: object/logo/watermark removal via ProPainter on MPS; static --box,
  SAM2-tracked --point for moving objects, or user --mask. Output always scaled
  back to source dims (imageio macro-block-pads ProPainter output).
- vg-interp: RIFE frame interpolation via rife-ncnn-vulkan (universal binary,
  native Metal/MoltenVK, rife-v4.6); smooth (fps x N) or --slowmo.
- vg-cutie: Cutie interactive segmentation GUI launcher (local GUI session).
- setup/fetch_phase2.sh: idempotent clones + weights + deps + patches.
- patches: propainter-cv2-reader (torchvision >= 0.23 removed read_video),
  cutie-device (get_default_model hard-coded .cuda(); now cuda->mps->cpu).
- smoke_test.sh: adds the RIFE lane (skips when not fetched).
- Farm: vidgod_roto/vidgod_index operators live in MODELBEAST (8965d22),
  verified from JING5; weights mirrored to NAS modelzoo/vidgod-weights.

All lanes verified on ultra 2026-08-24: de-logo reconstruction eyeballed clean,
24->48fps interp, Cutie headless propagation PASS, smoke test 4/4.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 15:42:52 +10:00

65 lines
3.4 KiB
Bash
Executable File

#!/bin/zsh
# VIDGOD smoke test — fast lanes only (beats, transcode, index, find). ~1-2 min.
# Add --roto to also run the full SAM2+MatAnyone pipeline on a bundled demo clip (minutes).
export PATH=/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin
VG="$(cd "$(dirname "$0")/.." && pwd)"
T="$VG/tests/smoke"
mkdir -p "$T/oldstyle"
fails=0
check(){ if [ $1 -eq 0 ]; then echo "PASS: $2"; else echo "FAIL: $2"; fails=$((fails+1)); fi }
echo "== 1. vg-beats (synthetic 120bpm click) =="
"$VG/venvs/index/bin/python" - <<PYEOF
import numpy as np, soundfile as sf
sr=22050; dur=20; y=np.zeros(sr*dur)
for b in np.arange(0,dur,0.5):
i=int(b*sr); n=min(3000,len(y)-i)
e=np.exp(-np.arange(n)/500); y[i:i+n]+=0.9*np.sin(2*np.pi*60*np.arange(n)/sr)*e
sf.write("$T/click120.wav", y, sr)
PYEOF
"$VG/bin/vg-beats" "$T/click120.wav" --fps 25 >/dev/null 2>&1
[ -s "$T/click120.beats.edl" ] && grep -q "ResolveColor" "$T/click120.beats.edl"
check $? "vg-beats produced marker EDL"
echo "== 2. vg-transcode (fake xvid avi + wmv) =="
ffmpeg -hide_banner -loglevel error -y -f lavfi -i "testsrc=duration=4:size=640x480:rate=25" -c:v mpeg4 -vtag xvid -qscale:v 5 "$T/oldstyle/fake_xvid.avi"
ffmpeg -hide_banner -loglevel error -y -f lavfi -i "smptebars=duration=4:size=640x480:rate=25" -f lavfi -i "sine=frequency=440:duration=4" -c:v wmv2 -c:a wmav2 "$T/oldstyle/fake_wmv.wmv"
"$VG/bin/vg-transcode" "$T/oldstyle" >/dev/null 2>&1
[ -s "$T/oldstyle-prores/fake_xvid.mov" ] && [ -s "$T/oldstyle-prores/fake_wmv.mov" ]
check $? "vg-transcode converted both to ProRes"
echo "== 3. vg-index + vg-find (speech clip with a hard cut) =="
if command -v say >/dev/null; then
say -o "$T/speech.aiff" "The radical robot destroyed the shopping mall. Totally awesome dude."
ffmpeg -hide_banner -loglevel error -y -f lavfi -i "testsrc2=duration=2.5:size=640x360:rate=25" -f lavfi -i "smptebars=duration=2.5:size=640x360:rate=25" -i "$T/speech.aiff" -filter_complex "[0:v][1:v]concat=n=2:v=1[v]" -map "[v]" -map 2:a -c:v libx264 -crf 20 -c:a aac -shortest "$T/dialogue_test.mp4"
"$VG/bin/vg-index" "$T/dialogue_test.mp4" --force >/dev/null 2>&1
"$VG/bin/vg-find" radical | grep -qi radical
check $? "vg-index + vg-find round-trip (whisper heard 'radical')"
else
echo "SKIP: no 'say' binary for speech synthesis"
fi
if [ -x "$VG/tools/rife/rife-ncnn-vulkan" ]; then
echo "== 4. vg-interp (RIFE 2x on a tiny clip) =="
ffmpeg -hide_banner -loglevel error -y -f lavfi -i "testsrc2=duration=2:size=320x180:rate=25" -c:v libx264 -crf 20 "$T/interp_in.mp4"
"$VG/bin/vg-interp" "$T/interp_in.mp4" --factor 2 --out "$T/interp_out.mov" >/dev/null 2>&1
frames=$(ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames -of csv=p=0 "$T/interp_out.mov" 2>/dev/null)
[ -n "$frames" ] && [ "$frames" -ge 90 ]
check $? "vg-interp doubled the frame count ($frames frames)"
else
echo "SKIP: rife not installed (run setup/fetch_phase2.sh)"
fi
if [ "${1:-}" = "--roto" ]; then
echo "== 4. vg-roto (bundled demo clip, full SAM2+MatAnyone) =="
DEMO="$VG/tools/MatAnyone/inputs/video/test-sample3.mp4"
ffmpeg -hide_banner -loglevel error -y -t 4 -i "$DEMO" -c:v libx264 -crf 12 -an "$T/roto_in.mp4"
"$VG/bin/vg-roto" "$T/roto_in.mp4" --point 970,220 --point 1150,500 --out "$T/roto_out"
[ -s "$T/roto_out/roto_in_alpha.mov" ]
check $? "vg-roto produced ProRes 4444 alpha"
fi
echo
if [ $fails -eq 0 ]; then echo "SMOKE TEST: all passed"; else echo "SMOKE TEST: $fails FAILED"; fi
exit $fails