Run SAM 2 locally with OpenEye

    Segment Anything Model 2 for precise object boundaries. Automatic mask generation for any object in any image. Used in scene graph construction and spatial reasoning. OpenEye, the open-source perception CLI, downloads SAM 2, runs it on your CPU or GPU, and returns structured JSON you can pipe into scripts, agents, and robots.

    TaskSegmentation
    CLI idsam2
    CreatorMeta AI
    Weightsfacebook/sam2-hiera-small (~150 MB)
    HardwareCPU, NVIDIA CUDA, Apple Silicon (MPS)
    Install extraopeneye-sh[sam]

    1. Install

    pipx install "openeye-sh[sam]"

    2. Pull SAM 2

    openeye pull sam2

    3. Run inference

    Output is JSON on stdout, so it composes with jq and any other Unix tool.

    openeye run sam2 photo.jpg --pretty

    4. Serve it as an API

    Start a local server with REST and WebSocket endpoints for apps, agents, and live camera streams.

    openeye serve sam2

    See the serve reference, REST endpoints, and Python SDK.

    Other models