https://github.com/autodistill/autodistill-fastvit
FastViT base model for use with Autodistill.
https://github.com/autodistill/autodistill-fastvit
autodistill computer-vision fastvit image-classification zero-shot-classification
Last synced: 3 months ago
JSON representation
FastViT base model for use with Autodistill.
- Host: GitHub
- URL: https://github.com/autodistill/autodistill-fastvit
- Owner: autodistill
- License: other
- Created: 2023-10-18T13:08:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-20T14:47:37.000Z (about 1 year ago)
- Last Synced: 2025-02-14T03:18:31.333Z (4 months ago)
- Topics: autodistill, computer-vision, fastvit, image-classification, zero-shot-classification
- Language: Python
- Homepage: https://docs.autodistill.com
- Size: 24.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Autodistill FastViT Module
This repository contains the code supporting the FastViT base model for use with [Autodistill](https://github.com/autodistill/autodistill).
[FastViT](https://github.com/apple/ml-fastvit), developed by Apple, is a classification model that supports zero-shot classification.
Read the full [Autodistill documentation](https://autodistill.github.io/autodistill/).
Read the [FastViT Autodistill documentation](https://autodistill.github.io/autodistill/base_models/fastvit/).
## Installation
To use FastViT with autodistill, you need to install the following dependency:
```bash
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.
```python
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](LICENSE) for the model license.
## 🏆 Contributing
We love your input! Please see the core Autodistill [contributing guide](https://github.com/autodistill/autodistill/blob/main/CONTRIBUTING.md) to get started. Thank you 🙏 to all our contributors!