vidgod/patches/propainter-cv2-reader.patch
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

26 lines
1.1 KiB
Diff

diff --git a/inference_propainter.py b/inference_propainter.py
index 4d7f92f..b093954 100644
--- a/inference_propainter.py
+++ b/inference_propainter.py
@@ -49,10 +49,16 @@ def resize_frames(frames, size=None):
def read_frame_from_videos(frame_root):
if frame_root.endswith(('mp4', 'mov', 'avi', 'MP4', 'MOV', 'AVI')): # input video path
video_name = os.path.basename(frame_root)[:-4]
- vframes, aframes, info = torchvision.io.read_video(filename=frame_root, pts_unit='sec') # RGB
- frames = list(vframes.numpy())
- frames = [Image.fromarray(f) for f in frames]
- fps = info['video_fps']
+ # torchvision.io.read_video was removed in torchvision >= 0.23 — read via cv2
+ cap = cv2.VideoCapture(frame_root)
+ fps = cap.get(cv2.CAP_PROP_FPS) or 24
+ frames = []
+ while True:
+ ok, frame = cap.read()
+ if not ok:
+ break
+ frames.append(Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)))
+ cap.release()
else:
video_name = os.path.basename(frame_root)
frames = []