Commit ·
e6ca873
1
Parent(s): b0cd9d2
minor changes
Browse files
README.md
CHANGED
|
@@ -2,7 +2,6 @@
|
|
| 2 |
license: cc-by-nc-sa-4.0
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
-
library_name: generic
|
| 6 |
pipeline_tag: depth-estimation
|
| 7 |
tags:
|
| 8 |
- depth-estimation
|
|
@@ -11,31 +10,6 @@ tags:
|
|
| 11 |
- aerial
|
| 12 |
- UAV
|
| 13 |
- drone
|
| 14 |
-
code_samples:
|
| 15 |
-
- language: python
|
| 16 |
-
code: |
|
| 17 |
-
import cv2
|
| 18 |
-
import torch
|
| 19 |
-
from depth_anything_v2.dpt import DepthAnythingV2
|
| 20 |
-
from huggingface_hub import hf_hub_download
|
| 21 |
-
|
| 22 |
-
# Initialize the fine-tuned aerial model architecture
|
| 23 |
-
model = DepthAnythingV2(encoder='vits', features=64, out_channels=[48, 96, 192, 384])
|
| 24 |
-
|
| 25 |
-
# Safely stream and cache the checkpoint from this Hugging Face repository
|
| 26 |
-
checkpoint_path = hf_hub_download(
|
| 27 |
-
repo_id="your_username/depth_anything_v2_vits_occufly",
|
| 28 |
-
filename="OccuFly-DepthAnything2.pth"
|
| 29 |
-
)
|
| 30 |
-
|
| 31 |
-
# Load the weights state dict
|
| 32 |
-
model.load_state_dict(torch.load(checkpoint_path, map_location='cpu'))
|
| 33 |
-
model.eval()
|
| 34 |
-
|
| 35 |
-
# Run inference
|
| 36 |
-
with torch.no_grad():
|
| 37 |
-
raw_img = cv2.imread('example.jpg')
|
| 38 |
-
depth = model.infer_image(raw_img) # HxW metric depth map
|
| 39 |
---
|
| 40 |
|
| 41 |
# OccuFly's Aerial DepthAnythingV2
|
|
|
|
| 2 |
license: cc-by-nc-sa-4.0
|
| 3 |
language:
|
| 4 |
- en
|
|
|
|
| 5 |
pipeline_tag: depth-estimation
|
| 6 |
tags:
|
| 7 |
- depth-estimation
|
|
|
|
| 10 |
- aerial
|
| 11 |
- UAV
|
| 12 |
- drone
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
# OccuFly's Aerial DepthAnythingV2
|