Image-to-3D
PEFT
Safetensors
3D-reconstruction
test-time-adaptation
self-supervised-learning
depth-estimation
3d-vision
Instructions to use PeterDAI/Free-Geometry with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use PeterDAI/Free-Geometry with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -74,22 +74,43 @@ This adapter corresponds to:
|
|
| 74 |
- Method: `Free-Geo`
|
| 75 |
- Dataset: `eth3d`, `7scenes`, `hiroom`, or `scannetpp` (all come from [depth-anything/DA3-BENCH](https://huggingface.co/depth-anything/DA3-BENCH)
|
| 76 |
|
| 77 |
-
#
|
| 78 |
|
| 79 |
-
|
| 80 |
-
from transformers import AutoModel, AutoProcessor
|
| 81 |
-
from peft import PeftModel
|
| 82 |
|
| 83 |
-
|
| 84 |
-
adapter_repo = "YOUR_USERNAME/YOUR_ADAPTER_REPO"
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
|
|
|
| 89 |
|
| 90 |
-
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
```
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
# Repository Variants
|
| 95 |
|
|
|
|
| 74 |
- Method: `Free-Geo`
|
| 75 |
- Dataset: `eth3d`, `7scenes`, `hiroom`, or `scannetpp` (all come from [depth-anything/DA3-BENCH](https://huggingface.co/depth-anything/DA3-BENCH)
|
| 76 |
|
| 77 |
+
## Inference With PEFT
|
| 78 |
|
| 79 |
+
This repository contains PEFT/LoRA adapter weights. The adapters are not standalone models, so first load the DA3 base model, then attach one adapter from this repo.
|
|
|
|
|
|
|
| 80 |
|
| 81 |
+
Example using the DA3 + Free-Geo HiRoom adapter:
|
|
|
|
| 82 |
|
| 83 |
+
```python
|
| 84 |
+
import torch
|
| 85 |
+
from peft import PeftModel
|
| 86 |
+
from depth_anything_3.api import DepthAnything3
|
| 87 |
|
| 88 |
+
base_model_id = "depth-anything/DA3-GIANT-1.1"
|
| 89 |
+
adapter_repo_id = "PeterDAI/Free-Geometry"
|
| 90 |
+
adapter_subfolder = "DA3+Free-Geo/hiroom"
|
| 91 |
+
|
| 92 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 93 |
+
|
| 94 |
+
model = DepthAnything3.from_pretrained(base_model_id).to(device)
|
| 95 |
+
model.model.backbone.pretrained = PeftModel.from_pretrained(
|
| 96 |
+
model.model.backbone.pretrained,
|
| 97 |
+
adapter_repo_id,
|
| 98 |
+
subfolder=adapter_subfolder,
|
| 99 |
+
is_trainable=False,
|
| 100 |
+
)
|
| 101 |
+
model.eval()
|
| 102 |
+
|
| 103 |
+
prediction = model.inference(
|
| 104 |
+
["image1.jpg", "image2.jpg"],
|
| 105 |
+
export_dir="output/da3_free_geometry_hiroom",
|
| 106 |
+
export_format="mini_npz",
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
print(prediction.depth.shape)
|
| 110 |
```
|
| 111 |
+
To use another adapter from this repo, keep adapter_repo_id the same and change only adapter_subfolder, for example:
|
| 112 |
+
|
| 113 |
+
```adapter_subfolder = "DA3+Free-Geo/eth3d"```
|
| 114 |
|
| 115 |
# Repository Variants
|
| 116 |
|