banner
hughie

hughie

热爱技术的小菜鸟, 记录一下所学所感

SALT - Universal Annotation Tool based on SAM

Introduction#

This article briefly records and introduces the usage of SALT.

SALT is a universal annotation tool based on Meta's recently released Segment-Anything model. It is used to annotate images and save annotation data in COCO format.


Main Content#

1. Introduction to SALT#

SALT is based on the Segment-Anything model to annotate images and save annotation data in COCO format. Thanks to the powerful segmentation capability of SAM, it can help annotators annotate any desired entity more easily and accurately.

2. SALT Installation#

  • Install SAM (environment requirements: python>=3.8, pytorch>=1.7, and torchvision>=0.8)
git clone https://github.com/facebookresearch/segment-anything.git
cd segment-anything && pip install -e .

After installation, download the default model parameters: vit-h and place them in a custom location.

  • Install SALT
git clone https://github.com/anuragxel/salt.git
cd salt
  • Convert the dataset

Prepare the dataset to be annotated, place the images in dataset/images, and create a new folder dataset/embeddings.

Run the command:

python helpers/extract_embeddings.py --checkpoint-path "custom path to sam model parameter file" --dataset-path "path to the dataset to be annotated"
  • Convert the model

Run the command:

python helpers/generate_onnx.py --checkpoint-path "custom path to sam model parameter file" --onnx-models-path "custom path to the converted onnx model file" --dataset-path "path to the dataset to be annotated"
  • Start annotation
python segment_anything_annotator.py --onnx-models-path "custom path to the converted onnx model file" --dataset-path "path to the dataset to be annotated" --categories "list of objects to be annotated, e.g., cat, dog"

3. Using SALT#

Annotating furniture
8-salt1

Annotating people

8-salt2

8-salt3

4. Conclusion#

The installation and usage are not difficult, but a GPU with at least 6GB of VRAM is required.

The annotation results are more accurate and faster than manual annotation. It supports click annotation and box selection annotation, etc.

Side note: Meta has released many valuable projects, including SAM, DINOv2, "leaked" LLaMa language model, etc., as well as PyTorch, which is essential for deep learning research.


Finally#

References:

Official Project

Segment-Anything Universal Segmentation Model


Disclaimer#

This article is only for personal learning records.

This article is synchronized with hblog.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.