pip3 install git+https://github.com/jjshoots/SAMtool
samtool --imagedir <images directory> --labeldir <labels directory> --annotations <annotations.yaml file>
- Go to
127.0.0.1:7860
The labels must be defined as a yaml
file. Example contents of the file:
__ignore__: 0
cat: 1
dog: 2
other: 3
All labels are stored as a series of jpg files on the disk. To operate on labels, we provide several helper functions:
import os
from samtool import retrieve_label
for image_filename in os.listdir("./your_image_dir"):
npy_label = retrieve_label(label_dir="./your_label_dir", image_filename=image_filename)
import os
from samtool import label_exists
all_labels = yaml.safe_load(open(annotations_path))
num_labels = len(all_labels)
for image_filename in os.listdir("./your_image_dir"):
has_label = label_exists(label_dir="./your_label_dir", image_filename=image_filename, num_labels=num_labels)