许可协议: apache-2.0
标签:
展示组件:
- 示例图片: https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg
示例标题: 老虎
- 示例图片: https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg
示例标题: 茶壶
- 示例图片: https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg
示例标题: 宫殿
基于KITTI微调的GLPN模型
全局-局部路径网络(GLPN)在KITTI数据集上训练的单目深度估计模型。该模型由Kim等人在论文《采用垂直CutDepth技术的单目深度估计全局-局部路径网络》中提出,并首次发布于此代码库。
免责声明:GLPN发布团队未提供该模型的说明卡片,本卡片由Hugging Face团队撰写。
模型描述
GLPN采用SegFormer作为主干网络,顶部添加轻量级头部进行深度估计。

应用场景与限制
该模型可直接用于单目深度估计任务。访问模型中心可查看针对特定任务微调的版本。
使用方法
使用方式如下:
from transformers import GLPNImageProcessor, GLPNForDepthEstimation
import torch
import numpy as np
from PIL import Image
import requests
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
processor = GLPNImageProcessor.from_pretrained("vinvino02/glpn-kitti")
model = GLPNForDepthEstimation.from_pretrained("vinvino02/glpn-kitti")
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
predicted_depth = outputs.predicted_depth
prediction = torch.nn.functional.interpolate(
predicted_depth.unsqueeze(1),
size=image.size[::-1],
mode="bicubic",
align_corners=False,
)
output = prediction.squeeze().cpu().numpy()
formatted = (output * 255 / np.max(output)).astype("uint8")
depth = Image.fromarray(formatted)
更多代码示例详见文档。
引用信息
@article{DBLP:journals/corr/abs-2201-07436,
author = {Doyeon Kim and
Woonghyun Ga and
Pyunghwan Ahn and
Donggyu Joo and
Sehwan Chun and
Junmo Kim},
title = {Global-Local Path Networks for Monocular Depth Estimation with Vertical
CutDepth},
journal = {CoRR},
volume = {abs/2201.07436},
year = {2022},
url = {https://arxiv.org/abs/2201.07436},
eprinttype = {arXiv},
eprint = {2201.07436},
timestamp = {Fri, 21 Jan 2022 13:57:15 +0100},
biburl = {https://dblp.org/rec/journals/corr/abs-2201-07436.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}