Skip to main content

Run Segment Anything with ONNX models

Project description

segment-anything-onnx

Use ONNX models for Segment Anything inference.

Special thanks to Viet-Anh NGUYEN for creating the SAM Exporter libraries from which these files are derived.

Installation

From PyPi:

pip install segment-anything-onnx

From source:

git clone git@github.com:whatstyle-ai/segment-anything-onnx.git
cd segment-anything-onnx
pip install -e .

Usage

  1. Use the SAM Exporter to generate the ONNX models
  2. Copy the ONNX models to the segment-anything-onnx/models directory
  3. Run inference
    python -m segment_anything_onnx.inference \
        --encoder_model ./models/sam_vit_l_0b3195.encoder.onnx \
        --decoder_model ./models/sam_vit_l_0b3195.decoder.onnx \
        --image ./examples/laura.jpg \
        --prompt ./examples/laura_prompt.json \
        --output ./output/laura-L.png \
        --show
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

segment_anything_onnx-0.0.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

segment_anything_onnx-0.0.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file segment_anything_onnx-0.0.2.tar.gz.

File metadata

  • Download URL: segment_anything_onnx-0.0.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for segment_anything_onnx-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2fba0e9e95dbb49c8618eb20ad1260bc91355efcb5f067655ca9b828cfce02a9
MD5 fa221af874afb65839de16b106f3fca8
BLAKE2b-256 008c3ba7ef0b12e2925158cd00049592c838162fe5ebf5b06922fe6de06185d2

See more details on using hashes here.

File details

Details for the file segment_anything_onnx-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for segment_anything_onnx-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 69336a22d575d00ca2d6ba055086ae0192a472c293b456f1c1c8834dc99e14fb
MD5 478aa0026971d254ecf22f7afbcdaa69
BLAKE2b-256 0556ade3f4531a510ada2bbaaceb7a0241307819384236aad4aaeea216666527

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page