Skip to content

Latest commit

 

History

History
21 lines (13 loc) · 1.1 KB

README.md

File metadata and controls

21 lines (13 loc) · 1.1 KB

SAMLab

Herein are notebooks and functions for generating label images from predictions created after predicting from the Segment Anything Model provided through ultralytics. The notebook "SAM_To_Label_Images.ipynb" demonstrates how this works.

Usage

First, install ultralytics into a conda environment or with pip.

For example, to initialize and activate a new conda environment, as well as install the relevant packages conda create --name ultralytics-env python=3.8 -y

conda activate ultralytics-env

conda install -c pytorch -c nvidia -c conda-forge pytorch torchvision pytorch-cuda=11.8 ultralytics

The function "make_label_image.py" inputs the masks generated by ultralytics and generates a label image from it. These are easier to interoperate with, and are not (currently) directly exportable from ultralytics.

Original Image Mask Image

So far, I've tested this on 2-dimensional RGB PNG and TIF images.

I hope this helps you with segmenting your images!