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>🚀 examples</h2>
<pre lang="python"><code>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_models
are models that have been pre-trained to have a wide breadth of knowledge. -
Base models have
ontologies
which 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_models
are 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
Hashes for autodistill-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f74e7252abe4cbe803cd8d4471bd6c03debb5af08a57646fd6d633ba9b3fa9bc |
|
MD5 | f5dd44fde3f2d055f450895d4ff871cd |
|
BLAKE2b-256 | bc67b93b2c39f13dc2639535e5fadb219b3612159d2b08b35f1d47a36d184619 |