Skip to main content

Autodistill CLIP Module

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

CLIP, developed by OpenAI, is a computer vision model trained using pairs of images and text. You can use CLIP with autodistill for image classification.

Read the full Autodistill documentation.

Read the CLIP Autodistill documentation.

Installation

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

pip3 install autodistill-clip

Quickstart

from autodistill_clip import CLIP
from autodistill.detection import CaptionOntology

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

results = base_model.predict("./context_images/test.jpg")

print(results)

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

License

The code in this repository 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!

Release files for autodistill-clip 0.1.5

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-clip 0.1.5
File Size Uploaded
autodistill_clip-0.1.5.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for autodistill-clip 0.1.5
File Interpreter ABI Platform
autodistill_clip-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 8.6 kB

Release files / autodistill_clip-0.1.5.tar.gz

Download URL autodistill_clip-0.1.5.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e74d773822bdbb4c163f46e1c71d5bda7db1a5379dc5f66f4b72f09dc8769f00
BLAKE2b-256 checksum
How to use checksums
d4f26b5f38355f885e7ed12cb7a67c018b38bd33353b3abac28615fb1f6373d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / autodistill_clip-0.1.5-py3-none-any.whl

Download URL autodistill_clip-0.1.5-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45b2b566d0edbba1fabd1c2742dff867c7533103e2e913a3d26c4ecfc7acb5f5
BLAKE2b-256 checksum
How to use checksums
e8dfe1724244c736c207f90c092d10981538631bb82fcf94a1bfab8a0306ae29
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.5 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

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