Skip to content

Commit

Permalink
add pytorch hub support
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachL1 committed May 8, 2024
1 parent 1b77c64 commit 5927317
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,17 @@ where the images will be first resized as the ```crop_size``` and then fed into
Please refer to [training/README.md](./training/README.md).

## ✈️ Inference
### News: Pytorch Hub is supported
Now you can use Metric3D via Pytorch Hub with just few lines of code:
```python
import torch
model = torch.hub.load('yvanyin/metric3d', 'metric3d_vit_small', pretrain=True)
pred_depth, confidence, output_dict = model.inference({'input': rgb})
```
Supported models: `metric3d_convnext_large`, `metric3d_vit_small`, `metric3d_vit_large`, `metric3d_vit_giant2`.

We've also provided a minimal working example in [hubconf.py](https://github.com/YvanYin/Metric3D/blob/main/hubconf.py#L122), which hopefully makes everything clearer.

### Download Checkpoint
| | Encoder | Decoder | Link |
|:----:|:-------------------:|:-----------------:|:-------------------------------------------------------------------------------------------------:|
Expand Down
4 changes: 0 additions & 4 deletions hubconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ def metric3d_vit_giant2(pretrain=False, **kwargs):
return model


import os
os.environ['HTTP_PROXY'] = 'http:https://192.168.195.225:7890'
os.environ['HTTPS_PROXY'] = 'http:https://192.168.195.225:7890'


if __name__ == '__main__':
import cv2
Expand Down

0 comments on commit 5927317

Please sign in to comment.