MCPcopy Index your code
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / estimateleres

Function estimateleres

src/depthmap_generation.py:406–421  ·  view source on GitHub ↗
(img, model, w, h)

Source from the content-addressed store, hash-verified

404
405
406def estimateleres(img, model, w, h):
407 # leres transform input
408 rgb_c = img[:, :, ::-1].copy()
409 A_resize = cv2.resize(rgb_c, (w, h))
410 img_torch = scale_torch(A_resize)[None, :, :, :]
411
412 # compute
413 with torch.no_grad():
414 if depthmap_device == torch.device("cuda"):
415 img_torch = img_torch.cuda()
416 prediction = model.depth_model(img_torch)
417
418 prediction = prediction.squeeze().cpu().numpy()
419 prediction = cv2.resize(prediction, (img.shape[1], img.shape[0]), interpolation=cv2.INTER_CUBIC)
420
421 return prediction
422
423
424def scale_torch(img):

Callers 2

get_raw_predictionMethod · 0.85
singleestimateFunction · 0.85

Calls 1

scale_torchFunction · 0.85

Tested by

no test coverage detected