Skip to main content

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!

Release files for autodistill-dinov2 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autodistill-dinov2 0.1.1
File Size Uploaded
autodistill-dinov2-0.1.1.tar.gz 12.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for autodistill-dinov2 0.1.1
File Interpreter ABI Platform
autodistill_dinov2-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.1 kB

Release files / autodistill-dinov2-0.1.1.tar.gz

Download URL autodistill-dinov2-0.1.1.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
87a0f3a72dd1a7531bdedae36b9662dbeadf610285b866aa66c32a9909600896
BLAKE2b-256 checksum
How to use checksums
a4d0e10f836f8430476c88887d5e4df6cfcf0d88a3f2abcdb056041d106932a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / autodistill_dinov2-0.1.1-py3-none-any.whl

Download URL autodistill_dinov2-0.1.1-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2b63c8459f0c7286267c10357002ab34789a6c5e52e561550d8a11aed31e3a9
BLAKE2b-256 checksum
How to use checksums
195b29eee648f8c015e56762074e703bd2c9e623955a15f54bef9d158cf972d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page