Skip to content

Export Script for SAM3 Video Segmentation - #243

Merged
kevchengcodes merged 2 commits into
apple:mainfrom
kevchengcodes:sam3-video-export
Sep 10, 2026
Merged

kevchengcodes merged 2 commits into
apple:mainfrom
kevchengcodes:sam3-video-export

Conversation

@kevchengcodes

Copy link
Copy Markdown
Contributor

Summary

This PR introduces the SAM3-Video Core AI export recipe. A future PR will bring in the Swift runtime to segment a video using this export.

The export matches the Hugging Face (HF) implementation as closely as possible. However, the HF Sam3VideoInferenceSession cannot be converted/traced in the Core AI export. Therefore, we will extract that into the Swift runtime and split the Python export into separate modules for the image encoding, text encoding, detection, and tracking/memory bank functions.

Usage

A new model card and export entry script can be found at models/sam3_video.

uv run models/sam3_video/export.py

Note that under the hood, this script uses the same coreai.segmentation.export module, but routes to the --video export pipeline instead. The existing image segmentation export functionality is maintained.

# for image segmentation, use the same commands as before
uv run models/sam3/export.py # for the lite model intended for iOS
uv run models/sam3/export.py --full # for the vanilla HF model

Comment thread models/sam3_video/README.md
@kevchengcodes
kevchengcodes merged commit 0ee915e into apple:main Sep 10, 2026
3 checks passed
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.

3 participants