TRI-ML / vidar

Other
563 stars 67 forks source link

dead lock #56

Closed AlanceLau closed 9 months ago

AlanceLau commented 9 months ago
AlanceLau commented 9 months ago

import torch import cv2 import numpy as np import matplotlib.pyplot as plt

zerodepth_model = torch.hub.load('/home/alance/.cache/torch/hub/TRI-ML_vidar_main', 'ZeroDepth', pretrained=True, source='local', path="/home/alance/.cache/torch/hub/checkpoints/ZeroDepth_unified.ckpt") zerodepth_model.to("cpu")

intrinsics = torch.tensor(np.load('examples/ddad_intrinsics.npy')).unsqueeze(0) rgb = torch.tensor(cv2.imread('examples/ddad_sample.png')).permute(2,0,1).unsqueeze(0)/255.

with torch.no_grad(): depth_pred = zerodepth_model(rgb, intrinsics)

plt.figure() plt.imshow(depth_pred.cpu().numpy()[0,0]) plt.savefig("zero_depth.png")