Skip to content

Video segmentation example cvat - #415

Open
Varfalamei wants to merge 13 commits into
features/UIfrom
video-segmentation-cvat
Open

Video segmentation example cvat#415
Varfalamei wants to merge 13 commits into
features/UIfrom
video-segmentation-cvat

Conversation

@Varfalamei

Copy link
Copy Markdown
Contributor

No description provided.

… CVAT example

New example: drop a long first-person video into a folder; the pipeline samples frames
(ffmpeg fps=1 -> perceptual-hash dedup), runs SAM3 open-vocabulary text-prompt segmentation
(person), and uploads box+polygon pre-annotations to CVAT for review. Reuses the SAM3->CVAT
tail from sam_cvat verbatim; the new part is the video ingest + frame sampling front stage.
…: one task per video split into jobs of N frames

Adds a backward-compatible segment_size param to CVATStep, passed to the CVAT TaskWriteRequest so a
task is split into jobs of N frames. robots_ego_cvat scopes the CVAT batch by video_id (one task per
video), sets SEGMENT_SIZE (jobs) and a large FILES_BATCH, and defaults SAMPLE_FPS to 0.2 (1 frame/5s).
…ont renders the pipeline graph, table browser and per-stage run triggers
…setup skill

- infer_image: downscale frames to SAM_MAX_INFER_SIDE (default 640) before SAM3
  and map detections back to full-res coords (CVAT still gets the full-res frame);
  on OOM retry at 512/384 and skip the frame as a last resort so one frame never
  kills the run; empty_cache between frames
- config: set PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True before importing
  torch so it applies to both CLI and UI-triggered runs; add SAM_MAX_INFER_SIDE knob
- models: take HF_TOKEN from the env instead of persisting it to disk (works on
  read-only home dirs)
- README: GPU-memory/OOM section, HF_HOME note, and a datapipe-api-vs-CLI run-log
  collision warning; ffmpeg now optional (imageio-ffmpeg fallback)
- add setup-video-segmentation-cvat skill
- commit the .env.example template (was gitignored, unlike sibling examples)
@Varfalamei Varfalamei self-assigned this Jul 23, 2026
@Varfalamei Varfalamei changed the title Video segmentation cvat Video segmentation example cvat Jul 23, 2026
…restore verbatim sam_cvat tail

The 8GB-GPU OOM fix used to live inside infer_image (downscale + coord rescale +
retry), which diverged models.py from sam_cvat and broke the example's "tail
identical to sam_cvat" contract. Move that concern out into an explicit pipeline
step instead:

- new steps.downscale_frames (stage=sample): resizes each deduped frame so its
  longest side <= SAM_MAX_INFER_SIDE (default 640) into IMAGES_DIR; the resized
  frame is what both SAM and CVAT use, so detections need no coordinate rescaling.
  0 passes the original frame through.
- dedup_frames now outputs deduped_frames (full-res); downscale_frames -> local_images
- data.py: add deduped_frames table; local_images is now the resize output
- config.py: add IMAGES_DIR; SAM_MAX_INFER_SIDE moves to the sampling knobs; drop the
  PYTORCH_CUDA_ALLOC_CONF hack (unneeded once frames are pre-sized)
- models.py: revert to a verbatim copy of sam_cvat/models.py (HF read-only-home is
  handled by HF_HOME in .env, not by patching ensure_hf_login)
- README/.env.example/setup skill: document the downscale_frames step and IMAGES_DIR
…rch notes

- drop the downscale_frames step and SAM_MAX_INFER_SIDE/IMAGES_DIR: SAM3 runs at the
  frame's native resolution (a FlashAttention GPU fits full 720p in ~5GB). dedup_frames
  feeds local_images directly again; models.py stays a verbatim copy of sam_cvat
- README/.env.example/setup skill: drop the resize knobs; add a measured GPU field note
  and a "bare GPU pod (no Docker)" deploy section
- add video-native-cvat.md: researched notes on annotating video natively in CVAT
  (tracks/interpolation, SAM2 tracker, export formats) with sources
…ostgres stand-up

- app.py/README/skill: the SAM-config stage was labelled "ingest" (a leftover from
  sam_cvat where ingest = image loading). Here frames come from the video front, so
  the stage only declares the text prompt -> rename to "prompt" (graph reads
  video -> sample -> prompt -> sam -> cvat)
- setup skill: add a "Stand up CVAT + Postgres" section (docker run postgres,
  clone+compose CVAT v2.65.0, create admin + project/labels) and a one-line caveat
  for very new GPUs whose CUDA arch the pinned torch predates
…nstead of YouTube

fetch_video.py now curls pre-encoded 720p .webm from $VIDEO_BUCKET_URL (default the e8-demo bucket)
by key (drops yt-dlp/deno/cookies/n-challenge). Keys split into the city-walk set + smoke clip so the
two-stage demo can fetch them separately. README + setup skill updated; the YouTube-ToS provenance
note stays.
…p research note

~25% of frames in the 720p run hit the old 20-detection cap (busy street scenes have >20 people), so
raise the default to 50. Remove video-native-cvat.md (a one-off CVAT-video research note, not part of
the example).
…heckout-current, flaky torch index)

From a from-scratch subagent dry-run of stage 1: (1) name cu128 explicitly for Blackwell/50-series
+ note the index can 503 (retry); (2) tell the operator to verify the checkout is current — a stale
one ships the old YouTube fetch_video.py instead of the bucket-fetch version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant