(img, model, w, h)
| 404 | |
| 405 | |
| 406 | def 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 | |
| 424 | def scale_torch(img): |
no test coverage detected