Skip to content

Commit 76a758c

Browse files
committed
Fix: Isolate vispy away
1 parent 1e92b5f commit 76a758c

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

inpaint/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ def follow_image_aspect_ratio(depth, image):
972972
return depth
973973

974974
def depth_resize(depth, origin_size, image_size):
975-
if origin_size[0] is not 0:
975+
if origin_size[0] != 0:
976976
max_depth = depth.max()
977977
depth = depth / max_depth
978978
depth = resize(depth, origin_size, order=1, mode='edge')

src/core.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@
2323
from src.depthmap_generation import ModelHolder
2424
from src import backbone
2525

26+
try:
27+
# 3d-photo-inpainting imports
28+
from inpaint.mesh import write_mesh, read_mesh, output_3d_photo
29+
from inpaint.networks import Inpaint_Color_Net, Inpaint_Depth_Net, Inpaint_Edge_Net
30+
from inpaint.utils import path_planning
31+
from inpaint.bilateral_filtering import sparse_bilateral_filtering
32+
except Exception as e:
33+
print('Impaint import failed. Impaint will not work.')
34+
import traceback
35+
traceback.print_exc()
36+
2637
global video_mesh_data, video_mesh_fn
2738
video_mesh_data = None
2839
video_mesh_fn = None
@@ -84,6 +95,7 @@ def core_generation_funnel(outpath, inputimages, inputdepthmaps, inputnames, inp
8495

8596
# TODO: ideally, run_depthmap should not save meshes - that makes the function not pure
8697
print(SCRIPT_FULL_NAME)
98+
print(f'Backbone: {backbone.USED_BACKBONE.name}')
8799

88100
backbone.unload_sd_model()
89101

@@ -351,10 +363,6 @@ def get_uniquefn(outpath, basename, ext, suffix=''):
351363

352364

353365
def run_3dphoto(device, img_rgb, img_depth, inputnames, outpath, gen_inpainted_mesh_demos, vid_ssaa, vid_format):
354-
from inpaint.mesh import write_mesh
355-
from inpaint.networks import Inpaint_Color_Net, Inpaint_Depth_Net, Inpaint_Edge_Net
356-
from inpaint.bilateral_filtering import sparse_bilateral_filtering
357-
358366
mesh_fi = ''
359367
try:
360368
print("Running 3D Photo Inpainting .. ")
@@ -504,8 +512,6 @@ def run_3dphoto(device, img_rgb, img_depth, inputnames, outpath, gen_inpainted_m
504512

505513
def run_3dphoto_videos(mesh_fi, basename, outpath, num_frames, fps, crop_border, traj_types, x_shift_range,
506514
y_shift_range, z_shift_range, video_postfix, vid_dolly, vid_format, vid_ssaa):
507-
from inpaint.mesh import read_mesh, output_3d_photo
508-
from inpaint.utils import path_planning
509515
import vispy
510516
try:
511517
if platform.system() == 'Windows':

0 commit comments

Comments
 (0)