Skip to content

kutipense/Depth-Anything-V2-tinygrad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Depth-Anything-V2 Tinygrad

This is a single-file tinygrad implementation of Depth-Anything-V2. Check out the interactive Demo!

Installation

To install the required dependencies, use the requirements.txt file:

pip install -r requirements.txt

Weights

Please refer to Hugging Face for the required model weights. After downloading the .safetensors files, place them under the weights/ directory. The filenames should follow this pattern:

  • weights/vits.safetensors
  • weights/vitb.safetensors
  • weights/vitl.safetensors
Model Download Link
Small Download
Base Download
Large Download

Usage

usage: main.py [-h] [--vit-size {s,b,l,g}] --input INPUT
               [--output OUTPUT]

Run DPTv2 model on an input image.

options:
  -h, --help            Show this help message and exit.
  --vit-size {s,b,l,g}  Specify the Vision Transformer size (`s`, `b`, `l`, `g`).
  --input INPUT         Path to the input image.
  --output OUTPUT       Path to save the output image.

Example commands

  • To display the output image using matplotlib:

    python main.py --vit-size s --input docs/input.jpg
  • To save the output to a file:

    python main.py --vit-size l --input docs/input.jpg --output docs/output.jpg

Example Images

Input

Input Image

Output

Output Image (ViT-L)


This README was partially written with the assistance of AI.

About

Depth-Anything-V2 tinygrad implementation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages