Automatically distill large foundational models into smaller, in-domain models for deployment
Project description
👋 hello
Automatically distill large, foundational models into smaller, realtime models via unsupervised and semi-supervised methods. Go from images to inference on a custom model with no labeling in between. Autodistill transfers knowledge from general models to domain-specific models that can run on the edge.
autodistill contains code to:
- load base models (like CLIP)
- load target models (like YOLO)
- automatically create labeled datasets from raw image data
- (optional) add a human in the loop for dataset review & curation
- train target models
- (optional) deploy trained models
💻 install
Pip install the supervision package in a 3.10>=Python>=3.7 environment.
pip install autodistill
Install from source
</code></pre>
</details>
<h2><a href="#user-content--examples" aria-hidden="true" class="anchor" id="user-content--examples"></a>🚀 examples</h2>
<pre><code class="language-python">from autodistill.base_models.instance_segmentation import GroundedSAM
from autodistill.base_models import classDescriptionOntology
from autodistill.target_models.instance_segmentation import YOLOv8,
# load ontology from json file
ontology from = classDescriptionOntology("path/to/ontology.json")
# load base model
base_model = GroundedSAM(ontology=ontology)
base_model.view_prediction(img_path="path/to/example.jpg")
# create context
context_path = base_model.label(context="path/to/images/directory", upload_dataset_to_roboflow=False)
# destill target model
target_model = YOLOv8(size="n", hyper_params)
distilled_model = target_model.train(labeled_context=context_path, deploy_model_to_roboflow=False)
distilled_model.view_pred(img_path="path/to/example.jpg")
-
base_modelsare models that have been pre-trained to have a wide breadth of knowledge. -
Base models have
ontologieswhich are the prompts we can use to draw predictions from them. Deciding the proper ontology (and installing your CUDA drivers) is most of the work you will have to do to train distilled models with autodistill. -
To distill a model, you will need to bring example data of the context you want to your model to operate in.
-
target_modelsare the smaller in-domain model to distill the larger base model into. These are a set of models that are known to perform well under supervised settings.
📍 roadmap
🚧 - work in progress
object detection
| base / target | YOLOv5 | YOLOv7 | YOLOv8 | RT-DETR |
|---|---|---|---|---|
| Grounded DINO | ||||
| Grounded SAM | 🚧 | |||
| DETIC | ||||
| OWL-ViT |
instance segmentation
| base / target | YOLOv5 | YOLOv7 | YOLOv8 | RT-DETR |
|---|---|---|---|---|
| Grounded SAM | 🚧 |
classification
| base / target | YOLOv8 | YOLOv5 |
|---|---|---|
| CLIP |
🏆 contribution
We love your input! Please see our contributing guide to get started. Thank you 🙏 to all our contributors!
Project details
Release history Release notifications | RSS feed
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-0.0.6.tar.gz.
File metadata
- Download URL: autodistill-0.0.6.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44417d074f72695aa889838c52a28249ad500d3a14edc6eb2c3eb698a538b58d
|
|
| MD5 |
74c64370cbd48bcddc2fff4ddc75e3d1
|
|
| BLAKE2b-256 |
824ca2a00c0377595c3d85a37f18c440f3dc74cf4d6b8859216e9d37abc9830e
|
File details
Details for the file autodistill-0.0.6-py3-none-any.whl.
File metadata
- Download URL: autodistill-0.0.6-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f74e7252abe4cbe803cd8d4471bd6c03debb5af08a57646fd6d633ba9b3fa9bc
|
|
| MD5 |
f5dd44fde3f2d055f450895d4ff871cd
|
|
| BLAKE2b-256 |
bc67b93b2c39f13dc2639535e5fadb219b3612159d2b08b35f1d47a36d184619
|