Update README.md
Browse files
README.md
CHANGED
@@ -159,19 +159,13 @@ blurred_image = gaussian_blur(img)
|
|
159 |
#### Depth
|
160 |
|
161 |
```python
|
162 |
-
# install
|
163 |
-
|
164 |
-
from depthfm.dfm import DepthFM
|
165 |
-
depthfm_model = DepthFM(ckpt_path=checkpoint_path)
|
166 |
-
depthfm_model.eval()
|
167 |
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
with torch.no_grad():
|
173 |
-
img = self.depthfm_model(img, num_steps=2, ensemble_size=4)
|
174 |
-
img = F.interpolate(img, (h, w), mode='bilinear', align_corners=False)
|
175 |
```
|
176 |
|
177 |
### Tips
|
|
|
159 |
#### Depth
|
160 |
|
161 |
```python
|
162 |
+
# install image_gen_aux with: pip install git+https://github.com/asomoza/image_gen_aux.git
|
163 |
+
from image_gen_aux import DepthPreprocessor
|
|
|
|
|
|
|
164 |
|
165 |
+
image = load_image("path to image")
|
166 |
+
|
167 |
+
depth_preprocessor = DepthPreprocessor.from_pretrained("depth-anything/Depth-Anything-V2-Large-hf").to("cuda")
|
168 |
+
depth_image = depth_preprocessor(image, invert=True)[0].convert("RGB")
|
|
|
|
|
|
|
169 |
```
|
170 |
|
171 |
### Tips
|