Skip to main content

Autodistill OWLv2 Module

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

OWLv2 is a zero-shot object detection model that follows from on the OWL-ViT architecture. OWLv2 has an open vocabulary, which means you can provide arbitrary text prompts for the model. You can use OWLv2 with autodistill for object detection.

Read the full Autodistill documentation.

Read the OWLv2 Autodistill documentation.

Installation

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

pip3 install autodistill-owlv2

Quickstart

from autodistill_owlv2 import OWLv2
from autodistill.detection import CaptionOntology

# define an ontology to map class names to our OWLv2 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 = OWLv2(
    ontology=CaptionOntology(
        {
            "person": "person",
            "a forklift": "forklift"
        }
    )
)

# run inference on a single image
results = base_model.predict("./context_images/image.png")

base_model.label("./context_images", extension=".jpeg")

License

This model is licensed under an Apache 2.0 (see original model implementation license, and the corresponding HuggingFace Transformers documentation).

🏆 Contributing

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

Release files for autodistill-owlv2 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autodistill-owlv2 0.1.1
File Size Uploaded
autodistill-owlv2-0.1.1.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for autodistill-owlv2 0.1.1
File Interpreter ABI Platform
autodistill_owlv2-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / autodistill-owlv2-0.1.1.tar.gz

Download URL autodistill-owlv2-0.1.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ee823e4cc7ed07e74412c73c2a454f1c1f5a61c9651b27aeeb672b172901ebb2
BLAKE2b-256 checksum
How to use checksums
db37fc49346158940fd1281f93e5169896495bf5d593c507c0335edeb5bf509d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / autodistill_owlv2-0.1.1-py3-none-any.whl

Download URL autodistill_owlv2-0.1.1-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d2c564849e77bcbfb07b2a6ee29c50f282f7256de6c09662d93bc43eb80054e
BLAKE2b-256 checksum
How to use checksums
5d0e1c7e3a06b7fd78f37d6f8da1c6cb863a4e0c28724e17c6cc2442c68c970c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page