DINOv2 module for use with Autodistill
Project description
Autodistill DINOv2 Module
This repository contains the code supporting the DINOv2 base model for use with Autodistill.
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.
Read the DINOv2 Autodistill documentation.
Installation
To use DINOv2 with autodistill, you need to install the following dependency:
pip3 install autodistill-dinov2
Quickstart
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.
🏆 Contributing
We love your input! Please see the core Autodistill contributing guide to get started. Thank you 🙏 to all our contributors!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file autodistill-dinov2-0.1.1.tar.gz
.
File metadata
- Download URL: autodistill-dinov2-0.1.1.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87a0f3a72dd1a7531bdedae36b9662dbeadf610285b866aa66c32a9909600896 |
|
MD5 | 587ecba2d1117c5fe8d9712c918b0863 |
|
BLAKE2b-256 | a4d0e10f836f8430476c88887d5e4df6cfcf0d88a3f2abcdb056041d106932a8 |
File details
Details for the file autodistill_dinov2-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: autodistill_dinov2-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2b63c8459f0c7286267c10357002ab34789a6c5e52e561550d8a11aed31e3a9 |
|
MD5 | cf25255aa46c73c66b6fb14c8cefbca4 |
|
BLAKE2b-256 | 195b29eee648f8c015e56762074e703bd2c9e623955a15f54bef9d158cf972d7 |