FastViT model for use with Autodistill
Project description
Autodistill FastViT Module
This repository contains the code supporting the FastViT base model for use with Autodistill.
FastViT, developed by Apple, is a classification model that supports zero-shot classification.
Read the full Autodistill documentation.
Read the FastViT Autodistill documentation.
Installation
To use FastViT with autodistill, you need to install the following dependency:
pip3 install autodistill-fastvit
Quickstart
FastViT works using the ImageNet-1k class list. This class list is available in the FASTVIT_IMAGENET_1K_CLASSES
variable.
You can provide classes from the list to retrieve predictions for a specific class in the list. You can also provide a custom ontology to map classes from the list to your own classes.
from autodistill_fastvit import FastViT, FASTVIT_IMAGENET_1K_CLASSES
from autodistill.detection import CaptionOntology
# zero shot with no prompts
base_model = FastViT(None)
# zero shot with prompts from FASTVIT_IMAGENET_1K_CLASSES
base_model = FastViT(
ontology=CaptionOntology(
{
"coffeemaker": "coffeemaker",
"ice cream": "ice cream"
}
)
)
predictions = base_model.predict("./example.png")
labels = [FASTVIT_IMAGENET_1K_CLASSES[i] for i in predictions.class_id.tolist()]
print(labels)
License
See LICENSE for the model license.
🏆 Contributing
We love your input! Please see the core Autodistill 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-fastvit-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7161fd438a584f5a69f57e13abf32f8f031bf1f6960ee19f389239e7c2a5eded |
|
MD5 | 98f5d7b4361c17c3d2d7f62bb26b2ebb |
|
BLAKE2b-256 | b7c658c36b6fd9f76e939bb8c23784b606e62f25b1c7a3e98a701d8a0489d1e5 |
Hashes for autodistill_fastvit-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abc47d885cc81a009edf47ecb7e0326736bbd92b7f8deaf54469d3a9dff60fba |
|
MD5 | 29b854c7a5bcc23781709867014ec0e7 |
|
BLAKE2b-256 | 44ee65a5e66aa77fa794fc18e2b1f2b792d81da3c0cd8ca368f839121ed84b30 |