<div align="center">
<p>
<a align="center" href="" target="_blank">
<img
width="850"
src="https://media.roboflow.com/open-source/autodistill/autodistill-banner.png?3"
>
</a>
</p>
</div>
# Autodistill DINOv2 Module
This repository contains the code supporting the DINOv2 base model for use with [Autodistill](https://github.com/autodistill/autodistill).
[DINOv2](https://github.com/facebookresearch/dinov2), developed by Meta Research, is a self-supervised training method for computer vision models. This library uses DINOv2 image embeddings with SVM to build a classification model.
Read the full [Autodistill documentation](https://docs.autodistill.com/autodistill/).
Read the [DINOv2 Autodistill documentation](https://docs.autodistill.com/target_models/dinov2/).
## Installation
To use DINOv2 with autodistill, you need to install the following dependency:
```bash
pip3 install autodistill-dinov2
```
## Quickstart
```python
from autodistill_dinov2 import DINOv2
target_model = DINOv2(None)
# train a model
# specify the directory where your annotations (in multiclass classification folder format)
# DINOv2 embeddings are saved in a file called "embeddings.json" the folder in which you are working
# with the structure {filename: embedding}
target_model.train("./context_images_labeled")
# get class list
# print(target_model.ontology.classes())
# run inference on the new model
pred = target_model.predict("./context_images_labeled/train/images/dog-7.jpg")
print(pred)
```
## License
The code in this repository is licensed under a [CC Attribution-NonCommercial 4.0 International](LICENSE) 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-dinov2",
"name": "autodistill-dinov2",
"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/a4/d0/e10f836f8430476c88887d5e4df6cfcf0d88a3f2abcdb056041d106932a8/autodistill-dinov2-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?3\"\n >\n </a>\n </p>\n</div>\n\n# Autodistill DINOv2 Module\n\nThis repository contains the code supporting the DINOv2 base model for use with [Autodistill](https://github.com/autodistill/autodistill).\n\n[DINOv2](https://github.com/facebookresearch/dinov2), developed by Meta Research, is a self-supervised training method for computer vision models. This library uses DINOv2 image embeddings with SVM to build a classification model.\n\nRead the full [Autodistill documentation](https://docs.autodistill.com/autodistill/).\n\nRead the [DINOv2 Autodistill documentation](https://docs.autodistill.com/target_models/dinov2/).\n\n## Installation\n\nTo use DINOv2 with autodistill, you need to install the following dependency:\n\n\n```bash\npip3 install autodistill-dinov2\n```\n\n## Quickstart\n\n```python\nfrom autodistill_dinov2 import DINOv2\n\ntarget_model = DINOv2(None)\n\n# train a model\n# specify the directory where your annotations (in multiclass classification folder format)\n# DINOv2 embeddings are saved in a file called \"embeddings.json\" the folder in which you are working\n# with the structure {filename: embedding}\ntarget_model.train(\"./context_images_labeled\")\n\n# get class list\n# print(target_model.ontology.classes())\n\n# run inference on the new model\npred = target_model.predict(\"./context_images_labeled/train/images/dog-7.jpg\")\n\nprint(pred)\n```\n\n\n## License\n\nThe code in this repository is licensed under a [CC Attribution-NonCommercial 4.0 International](LICENSE) 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": "",
"summary": "DINOv2 module for use with Autodistill",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/autodistill/autodistill-dinov2"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "195b29eee648f8c015e56762074e703bd2c9e623955a15f54bef9d158cf972d7",
"md5": "cf25255aa46c73c66b6fb14c8cefbca4",
"sha256": "d2b63c8459f0c7286267c10357002ab34789a6c5e52e561550d8a11aed31e3a9"
},
"downloads": -1,
"filename": "autodistill_dinov2-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cf25255aa46c73c66b6fb14c8cefbca4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 10262,
"upload_time": "2023-12-06T11:30:37",
"upload_time_iso_8601": "2023-12-06T11:30:37.174393Z",
"url": "https://files.pythonhosted.org/packages/19/5b/29eee648f8c015e56762074e703bd2c9e623955a15f54bef9d158cf972d7/autodistill_dinov2-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a4d0e10f836f8430476c88887d5e4df6cfcf0d88a3f2abcdb056041d106932a8",
"md5": "587ecba2d1117c5fe8d9712c918b0863",
"sha256": "87a0f3a72dd1a7531bdedae36b9662dbeadf610285b866aa66c32a9909600896"
},
"downloads": -1,
"filename": "autodistill-dinov2-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "587ecba2d1117c5fe8d9712c918b0863",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 12866,
"upload_time": "2023-12-06T11:30:39",
"upload_time_iso_8601": "2023-12-06T11:30:39.038623Z",
"url": "https://files.pythonhosted.org/packages/a4/d0/e10f836f8430476c88887d5e4df6cfcf0d88a3f2abcdb056041d106932a8/autodistill-dinov2-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-06 11:30:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "autodistill",
"github_project": "autodistill-dinov2",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "autodistill-dinov2"
}