CLIP module for use with Autodistill
Project description
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!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autodistill_clip-0.1.5.tar.gz.
File metadata
- Download URL: autodistill_clip-0.1.5.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e74d773822bdbb4c163f46e1c71d5bda7db1a5379dc5f66f4b72f09dc8769f00
|
|
| MD5 |
0f5962c354a3d576d50ea46c110595d6
|
|
| BLAKE2b-256 |
d4f26b5f38355f885e7ed12cb7a67c018b38bd33353b3abac28615fb1f6373d3
|
File details
Details for the file autodistill_clip-0.1.5-py3-none-any.whl.
File metadata
- Download URL: autodistill_clip-0.1.5-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45b2b566d0edbba1fabd1c2742dff867c7533103e2e913a3d26c4ecfc7acb5f5
|
|
| MD5 |
eae916ef74e2c5891ea7aa74f05ecb35
|
|
| BLAKE2b-256 |
e8dfe1724244c736c207f90c092d10981538631bb82fcf94a1bfab8a0306ae29
|