Skip to main content

Use models on Roboflow Universe to auto-label data for use in model training.

Project description

Autodistill Roboflow Universe Module

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

Roboflow Universe is a community where people share computer vision models and datasets. Over 50,000 models and 250,000 datasets have been shared on Universe, with new models available every day. You can use Autodistill to run object detection, classification, and segmentation models hosted on Roboflow Universe.

[!NOTE] Using this project will use Roboflow API calls. You will need a free Roboflow account to use this project. Sign up for a free Roboflow account to get started. Learn more about pricing.

Read the full Autodistill documentation.

Read the Roboflow Universe Autodistill documentation.

Installation

To use models hosted on Roboflow Universe with autodistill, you need to install the following dependency:

pip3 install autodistill-roboflow-universe

Quickstart

from autodistill_roboflow_universe import RoboflowUniverseModel
from autodistill.detection import CaptionOntology

# define an ontology to map class names to our Roboflow model prompt
# the ontology dictionary has the format {caption: class}
# where caption is the prompt sent to the base model, and class is the label that will
# be saved for that caption in the generated annotations
# then, load the model
base_model = RoboflowUniverseModel(
    ontology=CaptionOntology(
        {
            "person": "person",
            "a forklift": "forklift"
        }
    ),
    model_id="MODEL_ID",
    api_key="API_KEY",
    model_version=VERSION,
    model_type="object-detection",
)

# predict on an image
predictions = base_model.predict("image.png")

print(predictions)

# label a folder of images
base_model.label("./context_images", extension=".jpeg")

Above, replace:

  • API_KEY: with your Roboflow API key
  • PROJECT_NAME: with your Roboflow project ID.
  • VERSION: with your Roboflow model version.
  • model_type: with the type of model you want to run. Options are object-detection, classification, or segmentation. This value must be the same as the model type trained on Roboflow Universe.

Learn how to retrieve your Roboflow API key. Learn how to retrieve a model ID.

License

This project is licensed under an MIT 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-roboflow-universe-0.1.0.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

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