load model raise error,RuntimeError: Error(s) in loading state_dict for DepthAnythingV2

#4
by sunway86 - opened

import cv2
import torch

from depth_anything_v2.dpt import DepthAnythingV2

model = DepthAnythingV2(encoder='vitl', features=256, out_channels=[256, 512, 1024, 1024])
model.load_state_dict(torch.load('/data/models/Depth-Anything-V2-Small/depth_anything_v2_vits.pth', map_location='cpu'))
model.eval()

raw_img = cv2.imread('assets/examples/demo01.jpg')
depth = model.infer_image(raw_img) # HxW raw depth map
print("depth",depth)

Your need to confirm your account before you can post a new comment.

Sign up or log in to comment