Skip to main content

SegGPT for use with Autodistill

Project description

Autodistill SegGPT Module

This repository contains the code supporting the SegGPT base model for use with Autodistill.

SegGPT is a transformer-based few-shot semantic segmentation model developed by BAAI Vision.

This model performs well on task-specific segmentation tasks when given a few labeled images from which to learn features about the objects you want to identify.

Read the full Autodistill documentation.

Read the SegGPT Autodistill documentation.

Installation

To use SegGPT with autodistill, you need to install the following dependency:

pip3 install autodistill-seggpt

About SegGPT

This Autodistill module uses a handful of pre-labelled images for improved accuracy.

You will need some labeled images to use SegGPT. Don't have any labeled images? Check out Roboflow Annotate, a feature-rich annotation tool from which you can export data for use with Autodistill.

Quickstart

from autodistill_seggpt import SegGPT,FewShotOntology

base_model = SegGPT(
    ontology=FewShotOntology(supervision_dataset)
)

base_model.label("./unlabelled-climbing-photos", extension=".jpg")

How to load data from Roboflow

Labelling and importing images is easy!

You can use Roboflow Annotate to label a few images (5-10 should work fine). For your Project Type, make sure to pick Instance Segmentation--you'll be labelling with polygons.

Once you've labelled your images, you can press Generate > Generate New Version. You can use all the default options--no Augmentations are necessary.

Once your dataset version is generated, you can press Export > Continue.

Then you'll get some download code to copy--it should look something like this:

!pip install roboflow

from roboflow import Roboflow
rf = Roboflow(api_key="ABCDEFG")
project = rf.workspace("lorem-ipsum").project("dolor-sit-amet")
dataset = project.version(1).download("yolov8")

To import your dataset into Autodistill, run the following:

import supervision as sv
supervision_dataset = sv.DetectionDataset.from_yolo(
    images_directory_path=f"{dataset.location}/train/images",
    annotations_directory_path=f"{dataset.location}/train/labels",
    data_yaml_path=f"{dataset.location}/data.yaml",
    force_masks=True
)

License

The code in this repository is licensed under an MIT license.

See the SegGPT repository for more information on the SegGPT license.

🏆 Contributing

We love your input! Please see the core Autodistill contributing guide to get started. Thank you 🙏 to all our contributors!

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

autodistill-seggpt-0.0.2.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

autodistill_seggpt-0.0.2-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file autodistill-seggpt-0.0.2.tar.gz.

File metadata

  • Download URL: autodistill-seggpt-0.0.2.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.12

File hashes

Hashes for autodistill-seggpt-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ddef7a2bb7aed7d12c4cfa4fc12387d43b42fdf660925987ec41c6345ffa8866
MD5 b6204a0a7f0a25de9847d5b55e24fed0
BLAKE2b-256 c332c37050b2d71ad4ee003584b3120668251b5d4d74991d6fbe5f91684421a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for autodistill_seggpt-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c1dfe9b935812b38013cc17e5d1254f8ffb9917ca4cf7360d57c37e4cc7c8a69
MD5 00dcb883caf6e9f616ed6948e7afbf82
BLAKE2b-256 80a012d99a6fa7f40b9b0629ef46d3b5ae2e42ea89fa52050bcadc8f5a5b25b4

See more details on using hashes here.

Supported by

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