<div align="center">
<p>
<a align="center" href="" target="_blank">
<img
width="850"
src="https://media.roboflow.com/open-source/autodistill/autodistill-banner.png"
>
</a>
</p>
</div>
# 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!
Raw data
{
"_id": null,
"home_page": "https://github.com/autodistill/autodistill-fastvit",
"name": "autodistill-fastvit",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Roboflow",
"author_email": "support@roboflow.com",
"download_url": "https://files.pythonhosted.org/packages/bb/0a/f21e7f0ed4379e1a74ca27dcfb0a097acb48e939408c31b5bb5c927f676d/autodistill_fastvit-0.1.2.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n <p>\n <a align=\"center\" href=\"\" target=\"_blank\">\n <img\n width=\"850\"\n src=\"https://media.roboflow.com/open-source/autodistill/autodistill-banner.png\"\n >\n </a>\n </p>\n</div>\n\n# Autodistill FastViT Module\n\nThis repository contains the code supporting the FastViT base model for use with [Autodistill](https://github.com/autodistill/autodistill).\n\n[FastViT](https://github.com/apple/ml-fastvit), developed by Apple, is a classification model that supports zero-shot classification.\n\nRead the full [Autodistill documentation](https://autodistill.github.io/autodistill/).\n\nRead the [FastViT Autodistill documentation](https://autodistill.github.io/autodistill/base_models/fastvit/).\n\n## Installation\n\nTo use FastViT with autodistill, you need to install the following dependency:\n\n\n```bash\npip3 install autodistill-fastvit\n```\n\n## Quickstart\n\nFastViT works using the ImageNet-1k class list. This class list is available in the `FASTVIT_IMAGENET_1K_CLASSES` variable.\n\nYou 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.\n\n```python\nfrom autodistill_fastvit import FastViT, FASTVIT_IMAGENET_1K_CLASSES\nfrom autodistill.detection import CaptionOntology\n\n# zero shot with no prompts\nbase_model = FastViT(None)\n\n# zero shot with prompts from FASTVIT_IMAGENET_1K_CLASSES\nbase_model = FastViT(\n ontology=CaptionOntology(\n {\n \"coffeemaker\": \"coffeemaker\",\n \"ice cream\": \"ice cream\"\n }\n )\n)\n\npredictions = base_model.predict(\"./example.png\")\n\nlabels = [FASTVIT_IMAGENET_1K_CLASSES[i] for i in predictions.class_id.tolist()]\n\nprint(labels)\n```\n\n\n## License\n\nSee [LICENSE](LICENSE) for the model license.\n\n## \ud83c\udfc6 Contributing\n\nWe love your input! Please see the core Autodistill [contributing guide](https://github.com/autodistill/autodistill/blob/main/CONTRIBUTING.md) to get started. Thank you \ud83d\ude4f to all our contributors!\n",
"bugtrack_url": null,
"license": null,
"summary": "FastViT model for use with Autodistill",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/autodistill/autodistill-fastvit"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d5bd39cd9567c3212195f3f46eaa0bba0da31dce1acfb520d4c8fc6c933a0fd7",
"md5": "5b8ee26ed012733cfd2f9af3e372a0ec",
"sha256": "f478c93ee934dfd07b4542fb3aec43d9f765766d40f061debb7e36afab9cbbdf"
},
"downloads": -1,
"filename": "autodistill_fastvit-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5b8ee26ed012733cfd2f9af3e372a0ec",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 11298,
"upload_time": "2024-05-20T14:48:40",
"upload_time_iso_8601": "2024-05-20T14:48:40.803332Z",
"url": "https://files.pythonhosted.org/packages/d5/bd/39cd9567c3212195f3f46eaa0bba0da31dce1acfb520d4c8fc6c933a0fd7/autodistill_fastvit-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bb0af21e7f0ed4379e1a74ca27dcfb0a097acb48e939408c31b5bb5c927f676d",
"md5": "ad773957833e77f82830f94181ed3f82",
"sha256": "2a661d941e802dce473774abd8cdcb413c43a88426578c008d4e7ef0d48060b9"
},
"downloads": -1,
"filename": "autodistill_fastvit-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "ad773957833e77f82830f94181ed3f82",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 18738,
"upload_time": "2024-05-20T14:48:42",
"upload_time_iso_8601": "2024-05-20T14:48:42.712708Z",
"url": "https://files.pythonhosted.org/packages/bb/0a/f21e7f0ed4379e1a74ca27dcfb0a097acb48e939408c31b5bb5c927f676d/autodistill_fastvit-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-20 14:48:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "autodistill",
"github_project": "autodistill-fastvit",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "autodistill-fastvit"
}