Back to directory

sam3.c

A dependency-free C11 implementation of Meta's Segment Anything Model 3 for image and video segmentation, with a Metal GPU backend and a multithreaded CPU backend.

sam3.c

sam3.c reimplements the full SAM3 pipeline, including the image encoder, prompt encoder, and mask decoder, from scratch in about 57,000 lines of portable C with no Python or PyTorch dependency. It supports Apple Metal for GPU acceleration and multithreaded SIMD kernels on CPU, half and mixed precision, and a custom mmap-friendly weight format for near-instant startup.

It ships as a single static binary with a unified command-line interface offering segment, convert, and info subcommands, supports stdin and stdout piping and JSON output, and includes video object tracking that propagates point, box, or mask prompts across frames. Multiple backbones are supported, including Hiera for full accuracy and lighter EfficientViT and TinyViT variants, along with 48 unit tests and built-in latency profiling.

More in Inference

See all 770
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • Lifeboat

    iterate.ai

    A local inference server that puts an OpenAI- and Anthropic-compatible API in front of open-weight language models running on hardware you control, from a laptop to a GPU cluster.

  • Claude S40

    github.com

    An unofficial Claude chat client for 2007-era Nokia Series 40 phones, built as a Java ME app plus a small Go relay server, with web search, reading mode and saved chats.