Skip to content

Image Segment Anything Model (SAM)

Description

Note

This service is the first that has his code hosted on GitLab. It uses the CI/CD pipeline adapted to GitLab.

Note

More information about the service specification can be found in the Core concepts > Service documentation.

This service uses PyTorch and OpenCV to segment everything in an image.

You can read more about the SAM model here.

The API documentation is automatically generated by FastAPI using the OpenAPI standard. A user friendly interface provided by Swagger is available under the /docs route, where the endpoints of the service are described.

This simple service only has one route /compute that takes an image as input, which will be used to guess the number.

Environment variables

Check the Core concepts > Service > Environment variables documentation for more details.

Run the tests with Python

Check the Core concepts > Service > Run the tests with Python documentation for more details.

Start the service locally

In order to start the service locally, you need to download the model weights with the following command:

# Download the model's weights
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth -P model/

Then, you can start the service following the instructions in the Core concepts > Service > Start the service locally documentation for more details.