Commit Graph
34 Commits
Author SHA1 Message Date
Minh Vu 44ef224799 Fix SAM3 io_utils to handle extensionless video files from OIL
Summary: Fix SAM3 io_utils.py to handle extensionless video files from OIL (Object Image Library). Previously, the code would immediately raise NotImplementedError when encountering files without recognized video extensions. This change attempts to load such files as videos using the video loader, only raising an exception if the actual decoding fails. This enables SAM3 to process OIL-stored video paths that don't include file extensions.

Differential Revision: D99228861

fbshipit-source-id: c93d089ad4b7eac9e0eb629d7a71b021604db410
2026-04-12 02:38:44 -07:00
generatedunixname26232875646305581 bfbed072a0 Daily arc lint --take BLACK
Differential Revision: D98889675

fbshipit-source-id: e9d0089e5abb73b9327f5453ad20fa5060b12a40
2026-03-31 03:16:31 -07:00
Nadav Yutal 29aecc4b7d Revert unintended changes from D98651970
Summary:
D98651970 accidentally included changes to sam3_image.py,
shopping_segmentation_images config, inference_engine, and tests
that were not part of the shared segmentation inputs refactor.
This reverts only those unintended files.

Reviewed By: omriharosh

Differential Revision: D98875697

fbshipit-source-id: 3e47fa686364f645295ddff094a5eff2237e9b33
2026-03-31 02:51:54 -07:00
Nadav Yutal e54adc4523 Extract shared segmentation inputs into reusable component
Summary:
All three segment tracking demo pages duplicate the same input widgets
(Everstore Handle, Text Queries, Confidence Threshold, Prediction Tier,
and optionally Thumbnail Size). Extract them into a SegmentationInputs
dataclass with a create() staticmethod that renders all shared Gradio
widgets and returns them as a typed bundle.

This eliminates duplication and ensures widget consistency across the
Segmentation, Query Comparison, and Incremental Query pages.

Differential Revision: D98651970

fbshipit-source-id: 60540a719b888095c5c8d0ba5e9bb321a4bd7cf1
2026-03-30 03:13:57 -07:00
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