https://github.com/autodistill/autodistill-dinov2
DINOv2 module for use with Autodistill.
https://github.com/autodistill/autodistill-dinov2
autodistill computer-vision dinov2
Last synced: about 2 months ago
JSON representation
DINOv2 module for use with Autodistill.
- Host: GitHub
- URL: https://github.com/autodistill/autodistill-dinov2
- Owner: autodistill
- License: other
- Created: 2023-06-09T10:59:43.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-06T11:31:01.000Z (over 1 year ago)
- Last Synced: 2025-04-14T12:13:15.902Z (about 2 months ago)
- Topics: autodistill, computer-vision, dinov2
- Language: Python
- Homepage: https://docs.autodistill.com
- Size: 17.6 KB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 DINOv2target_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!