MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / recover_metric_depth

Function recover_metric_depth

lib/test_utils.py:229–242  ·  view source on GitHub ↗
(pred, gt)

Source from the content-addressed store, hash-verified

227
228
229def recover_metric_depth(pred, gt):
230 if type(pred).__module__ == torch.__name__:
231 pred = pred.cpu().numpy()
232 if type(gt).__module__ == torch.__name__:
233 gt = gt.cpu().numpy()
234 gt = gt.squeeze()
235 pred = pred.squeeze()
236 mask = (gt > 1e-8) & (pred > 1e-8)
237
238 gt_mask = gt[mask]
239 pred_mask = pred[mask]
240 a, b = np.polyfit(pred_mask, gt_mask, deg=1)
241 pred_metric = a * pred + b
242 return pred_metric

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected