(device, img_rgb, img_depth, inputnames, outpath, gen_inpainted_mesh_demos, vid_ssaa, vid_format)
| 363 | |
| 364 | |
| 365 | def run_3dphoto(device, img_rgb, img_depth, inputnames, outpath, gen_inpainted_mesh_demos, vid_ssaa, vid_format): |
| 366 | mesh_fi = '' |
| 367 | try: |
| 368 | print("Running 3D Photo Inpainting .. ") |
| 369 | edgemodel_path = './models/3dphoto/edge_model.pth' |
| 370 | depthmodel_path = './models/3dphoto/depth_model.pth' |
| 371 | colormodel_path = './models/3dphoto/color_model.pth' |
| 372 | # create paths to model if not present |
| 373 | os.makedirs('./models/3dphoto/', exist_ok=True) |
| 374 | |
| 375 | ensure_file_downloaded( |
| 376 | edgemodel_path, |
| 377 | ["https://huggingface.co/spaces/Epoching/3D_Photo_Inpainting/resolve/e389e564fd2a55cf/checkpoints/edge-model.pth", |
| 378 | "https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/edge-model.pth"], |
| 379 | "b1d768bd008ad5fe9f540004f870b8c3d355e4939b2009aa4db493fd313217c9") |
| 380 | ensure_file_downloaded( |
| 381 | depthmodel_path, |
| 382 | ["https://huggingface.co/spaces/Epoching/3D_Photo_Inpainting/resolve/e389e564fd2a55cf/checkpoints/depth-model.pth", |
| 383 | "https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/depth-model.pth"], |
| 384 | "2d0e63e89a22762ddfa8bc8c9f8c992e5532b140123274ffc6e4171baa1b76f8") |
| 385 | ensure_file_downloaded( |
| 386 | colormodel_path, |
| 387 | ["https://huggingface.co/spaces/Epoching/3D_Photo_Inpainting/resolve/e389e564fd2a55cf/checkpoints/color-model.pth", |
| 388 | "https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/color-model.pth"], |
| 389 | "383c9b1db70097907a6f9c8abb0303e7056f50d5456a36f34ab784592b8b2c20" |
| 390 | ) |
| 391 | |
| 392 | print("Loading edge model ..") |
| 393 | depth_edge_model = Inpaint_Edge_Net(init_weights=True) |
| 394 | depth_edge_weight = torch.load(edgemodel_path, map_location=torch.device(device)) |
| 395 | depth_edge_model.load_state_dict(depth_edge_weight) |
| 396 | depth_edge_model = depth_edge_model.to(device) |
| 397 | depth_edge_model.eval() |
| 398 | print("Loading depth model ..") |
| 399 | depth_feat_model = Inpaint_Depth_Net() |
| 400 | depth_feat_weight = torch.load(depthmodel_path, map_location=torch.device(device)) |
| 401 | depth_feat_model.load_state_dict(depth_feat_weight, strict=True) |
| 402 | depth_feat_model = depth_feat_model.to(device) |
| 403 | depth_feat_model.eval() |
| 404 | depth_feat_model = depth_feat_model.to(device) |
| 405 | print("Loading rgb model ..") |
| 406 | rgb_model = Inpaint_Color_Net() |
| 407 | rgb_feat_weight = torch.load(colormodel_path, map_location=torch.device(device)) |
| 408 | rgb_model.load_state_dict(rgb_feat_weight) |
| 409 | rgb_model.eval() |
| 410 | rgb_model = rgb_model.to(device) |
| 411 | |
| 412 | config = {} |
| 413 | config["gpu_ids"] = 0 |
| 414 | config['extrapolation_thickness'] = 60 |
| 415 | config['extrapolate_border'] = True |
| 416 | config['depth_threshold'] = 0.04 |
| 417 | config['redundant_number'] = 12 |
| 418 | config['ext_edge_threshold'] = 0.002 |
| 419 | config['background_thickness'] = 70 |
| 420 | config['context_thickness'] = 140 |
| 421 | config['background_thickness_2'] = 70 |
| 422 | config['context_thickness_2'] = 70 |
no test coverage detected