<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 OWLv2 Module
This repository contains the code supporting the OWLv2 base model for use with [Autodistill](https://github.com/autodistill/autodistill).
OWLv2 is a zero-shot object detection model that follows from on the OWL-ViT architecture. OWLv2 has an open vocabulary, which means you can provide arbitrary text prompts for the model. You can use OWLv2 with autodistill for object detection.
Read the full [Autodistill documentation](https://autodistill.github.io/autodistill/).
Read the [OWLv2 Autodistill documentation](https://autodistill.github.io/autodistill/base_models/owlv2/).
## Installation
To use OWLv2 with autodistill, you need to install the following dependency:
```bash
pip3 install autodistill-owlv2
```
## Quickstart
```python
from autodistill_owlv2 import OWLv2
from autodistill.detection import CaptionOntology
# define an ontology to map class names to our OWLv2 prompt
# the ontology dictionary has the format {caption: class}
# where caption is the prompt sent to the base model, and class is the label that will
# be saved for that caption in the generated annotations
# then, load the model
base_model = OWLv2(
ontology=CaptionOntology(
{
"person": "person",
"a forklift": "forklift"
}
)
)
# run inference on a single image
results = base_model.predict("./context_images/image.png")
base_model.label("./context_images", extension=".jpeg")
```
## License
This model is licensed under an [Apache 2.0](LICENSE) ([see original model implementation license](https://huggingface.co/docs/transformers/main/en/model_doc/owlv2), and the corresponding [HuggingFace Transformers documentation](https://huggingface.co/docs/transformers/main/en/model_doc/owlv2)).
## 🏆 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-owlv2",
"name": "autodistill-owlv2",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Roboflow",
"author_email": "support@roboflow.com",
"download_url": "https://files.pythonhosted.org/packages/db/37/fc49346158940fd1281f93e5169896495bf5d593c507c0335edeb5bf509d/autodistill-owlv2-0.1.1.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 OWLv2 Module\n\nThis repository contains the code supporting the OWLv2 base model for use with [Autodistill](https://github.com/autodistill/autodistill).\n\nOWLv2 is a zero-shot object detection model that follows from on the OWL-ViT architecture. OWLv2 has an open vocabulary, which means you can provide arbitrary text prompts for the model. You can use OWLv2 with autodistill for object detection.\n\nRead the full [Autodistill documentation](https://autodistill.github.io/autodistill/).\n\nRead the [OWLv2 Autodistill documentation](https://autodistill.github.io/autodistill/base_models/owlv2/).\n\n## Installation\n\nTo use OWLv2 with autodistill, you need to install the following dependency:\n\n\n```bash\npip3 install autodistill-owlv2\n```\n\n## Quickstart\n\n```python\nfrom autodistill_owlv2 import OWLv2\nfrom autodistill.detection import CaptionOntology\n\n# define an ontology to map class names to our OWLv2 prompt\n# the ontology dictionary has the format {caption: class}\n# where caption is the prompt sent to the base model, and class is the label that will\n# be saved for that caption in the generated annotations\n# then, load the model\nbase_model = OWLv2(\n ontology=CaptionOntology(\n {\n \"person\": \"person\",\n \"a forklift\": \"forklift\"\n }\n )\n)\n\n# run inference on a single image\nresults = base_model.predict(\"./context_images/image.png\")\n\nbase_model.label(\"./context_images\", extension=\".jpeg\")\n```\n\n\n## License\n\nThis model is licensed under an [Apache 2.0](LICENSE) ([see original model implementation license](https://huggingface.co/docs/transformers/main/en/model_doc/owlv2), and the corresponding [HuggingFace Transformers documentation](https://huggingface.co/docs/transformers/main/en/model_doc/owlv2)).\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": "",
"summary": "OWLv2 base model for use with Autodistill.",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/autodistill/autodistill-owlv2"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5d0e1c7e3a06b7fd78f37d6f8da1c6cb863a4e0c28724e17c6cc2442c68c970c",
"md5": "bea61a93f2066a0221163cc307a2e1c9",
"sha256": "1d2c564849e77bcbfb07b2a6ee29c50f282f7256de6c09662d93bc43eb80054e"
},
"downloads": -1,
"filename": "autodistill_owlv2-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bea61a93f2066a0221163cc307a2e1c9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7844,
"upload_time": "2023-12-06T09:10:54",
"upload_time_iso_8601": "2023-12-06T09:10:54.264380Z",
"url": "https://files.pythonhosted.org/packages/5d/0e/1c7e3a06b7fd78f37d6f8da1c6cb863a4e0c28724e17c6cc2442c68c970c/autodistill_owlv2-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "db37fc49346158940fd1281f93e5169896495bf5d593c507c0335edeb5bf509d",
"md5": "43c05bf362f3175007803aa2e0e19cc7",
"sha256": "ee823e4cc7ed07e74412c73c2a454f1c1f5a61c9651b27aeeb672b172901ebb2"
},
"downloads": -1,
"filename": "autodistill-owlv2-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "43c05bf362f3175007803aa2e0e19cc7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 7520,
"upload_time": "2023-12-06T09:11:01",
"upload_time_iso_8601": "2023-12-06T09:11:01.034267Z",
"url": "https://files.pythonhosted.org/packages/db/37/fc49346158940fd1281f93e5169896495bf5d593c507c0335edeb5bf509d/autodistill-owlv2-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-06 09:11:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "autodistill",
"github_project": "autodistill-owlv2",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "autodistill-owlv2"
}