Commit Graph
20 Commits
Author SHA1 Message Date
Joseph Greer 5a3143c652 Apply linter
Summary: Applies lint

Reviewed By: arpitkalla

Differential Revision: D98515496

fbshipit-source-id: 967c9bf19ef7e1e25906204075c37c8461ed2a0e
2026-03-27 12:40:51 -07:00
Arpit Kalla 9f22cb976f SAM 3.1 Release (#503)
Summary:
SAM 3.1 multiplex video tracking for the OSS sam3 repository.

Features:
- Multiplex architecture: batch N objects into fixed-capacity buckets for efficient multi-object tracking (16 objects per bucket)
- Unified API: build_sam3_predictor(version="sam3.1") with auto-download from HuggingFace (facebook/sam3.1)
- Flash Attention 3, torch.compile support (~31 FPS compiled on H100)
- Text prompts, point prompts, box prompts, object removal, refinement
- Clean inheritance: Sam3MultiplexBase extends Sam3VideoBase
- Shared base predictor (Sam3BasePredictor) for both SAM3 and SAM3.1

Performance (H100, 5 objects, compiled):
- SAM 3.1: ~31 FPS
- Memory: ~17.7 GB

Usage:
  from sam3 import build_sam3_predictor predictor = build_sam3_predictor()  # auto-downloads SAM 3.1 from HF

Pull Request resolved: https://github.com/facebookresearch/sam3/pull/503

Reviewed By: josephgreer

Differential Revision: D98500763

Pulled By: arpitkalla

fbshipit-source-id: e2b74568f24bb4ecfb3144a4e8ec559aae6db5e8
2026-03-27 10:18:58 -07:00
Yunseok Jang 86ed770940 Make decord import lazy and add image-only inference build target
Summary:
Move the top-level `from decord import cpu, VideoReader` in sam3_image_dataset.py to a lazy import inside the .mp4 video loading block. This avoids import errors for consumers that only need image inference and don't have decord installed.

Also add a new `sam3_inference_image_only` BUCK target that excludes decord from pypi_deps for downstream projects that only need image inference.

Reviewed By: haithamkhedr

Differential Revision: D96809398

fbshipit-source-id: 67c5f0be965d8420b244ff4c45d849314352d3cc
2026-03-16 15:38:39 -07:00
Haoran Wang f6e51f5950 Add empty-frames guard to cv2 video loader
Summary:
## Context
When cv2.VideoCapture opens a video but cannot decode any frames (e.g., due to an unsupported codec), the frames list is empty and np.stack crashes with "need at least one array to stack" — an unhelpful error message that obscures the real problem.

## This Diff
- Add explicit check for empty frames list after cap.release() and before np.stack
- Raise RuntimeError with descriptive message about possible causes (corrupted file, empty video, or unsupported codec)

Differential Revision: D94142839

fbshipit-source-id: 89a973d067d83439039734712d18727b06d0706d
2026-02-24 10:28:32 -08:00
Roman Rädle 2d08d73120 Introduce torch compile option
Summary: TSIA!

Reviewed By: arpitkalla

Differential Revision: D93826755

fbshipit-source-id: 0b7406b738590c4ee27099b1b1ce24b9c88680c5
2026-02-20 14:51:26 -08:00
Arpit Kalla f0399e7fce Fix compilation of position encoding
Summary:
When running with compile=True, we were getting the following error: P2186079344

Swapping to not use cudagraphs for a quik fix. Will follow up with swapping the Position embedding impl to not cache.

Reviewed By: raedle

Differential Revision: D93508585

fbshipit-source-id: 0eaa29fcf826611b6a652811a6f2472399014b84
2026-02-17 12:46:36 -08:00
generatedunixname537391475639613 2ec3c0711a fbcode/deeplearning/projects/sam3_release/sam3/train/data
Reviewed By: JuanBesa

Differential Revision: D91210167

fbshipit-source-id: a563232f4bc82f6f3b99e53df1c88cf0f39747bb
2026-02-03 13:14:44 -08:00
generatedunixname537391475639613 99d02f28c8 fbcode/deeplearning/projects/sam3_release/sam3/train/data
Reviewed By: JuanBesa

Differential Revision: D91383480

fbshipit-source-id: 5b98627fb679c7c704c1a2faba9722e3a6f2ec20
2026-01-27 04:54:06 -08:00
Bowie Chen 11dec2936d apply Black 25.11.0 style in fbcode/deeplearning/projects (21/92)
Summary:
Formats the covered files with pyfmt.

paintitblack

Reviewed By: itamaro

Differential Revision: D90476315

fbshipit-source-id: ee94c471788b8e7d067813d8b3e0311214d17f3f
2026-01-11 23:16:49 -08:00
generatedunixname89002005307016 7b89b8fc3f Add missing Pyre mode headers] [batch:11/N] [shard:17/N]
Differential Revision: D90237984

fbshipit-source-id: 526fd760f303bf31be4f743bdcd77760496de0de
2026-01-07 05:16:41 -08:00