INNER CODE UNIT · Python
ori_imgs
junshutang/Make-It-3D · main.py:185
ori_imgs = ref_imgs[:, :3, :, :] * ref_imgs[:, 3:, :, :] + (1 - ref_imgs[:, 3:, :, :])
mask = imgs[:, :, 3:]
# mask[mask < 0.5 * 255] = 0
# mask[mask >= 0.5 * 255] = 1
kernel = np.ones(((5,5)), np.uint8) ##11
mask = cv2.erode(mask,kernel,iterations=1)
mask = (mask == 0)
mask = (torch.from_numpy(mask)).unsqueeze(0).unsqueeze(0).to(device)
depth_mask = mask
# depth estimation
with torch.no_grad():
depth_prediction = depth_model.forward(depth_transform(ori_imgs))
depth_prediction = torch.nn.functional.interpolate(
depth_prediction.unsqueeze(1),
size=512,
mode="bicubic",