Skip to content

Commit

Permalink
Merge pull request from 'safijari'
Browse files Browse the repository at this point in the history
  • Loading branch information
ShihMengLi committed May 1, 2020
1 parent ac36036 commit 9781918
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 10 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ignore all kind of files
*.*
#except php files
!*.py
!*.yml
!*.txt
!*.md
!*LICENSE
!image/moon.jpg
!depth/moon.npy
!video/moon_swing.mp4
!video/moon_zoom-in.mp4
!video/moon_dolly-zoom-in.mp4
!video/moon_straight-line.mp4
!video/moon.mp4
!video/moon_circle.mp4
!misc/moon_40.gif
1 change: 0 additions & 1 deletion bilateral_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,3 @@ def acc_shape(i):
_strides = [acc_shape(i)*s*a.itemsize for i,s in enumerate(strides)] + list(a.strides)

return np.lib.stride_tricks.as_strided(a, shape=shape, strides=_strides)

24 changes: 16 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
print("Current Source ==> ", sample['src_pair_name'])
mesh_fi = os.path.join(config['mesh_folder'], sample['src_pair_name'] +'.ply')
image = imageio.imread(sample['ref_img_fi'])

print(f"Running depth extraction at {time.time()}")

run_depth([sample['ref_img_fi']], config['src_folder'], config['depth_folder'],
config['MiDaS_model_ckpt'], MonoDepthNet, MiDaS_utils, target_w=640)
config['output_h'], config['output_w'] = np.load(sample['depth_fi']).shape[:2]
Expand Down Expand Up @@ -76,6 +78,7 @@
depth_edge_model.load_state_dict(depth_edge_weight)
depth_edge_model = depth_edge_model.to(device)
depth_edge_model.eval()

print(f"Loading depth model at {time.time()}")
depth_feat_model = Inpaint_Depth_Net()
depth_feat_weight = torch.load(config['depth_feat_model_ckpt'],
Expand All @@ -92,16 +95,19 @@
rgb_model.eval()
rgb_model = rgb_model.to(device)
graph = None


print(f"Writing depth ply (and basically doing everything) at {time.time()}")
rt_info = write_ply(image,
depth,
sample['int_mtx'],
mesh_fi,
config,
rgb_model,
depth_edge_model,
depth_edge_model,
depth_feat_model)
depth,
sample['int_mtx'],
mesh_fi,
config,
rgb_model,
depth_edge_model,
depth_edge_model,
depth_feat_model)

if rt_info is False:
continue
rgb_model = None
Expand All @@ -113,6 +119,8 @@
verts, colors, faces, Height, Width, hFov, vFov = read_ply(mesh_fi)
else:
verts, colors, faces, Height, Width, hFov, vFov = rt_info


print(f"Making video at {time.time()}")
videos_poses, video_basename = copy.deepcopy(sample['tgts_poses']), sample['tgt_name']
top = (config.get('original_h') // 2 - sample['int_mtx'][1, 2] * config['output_h'])
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.black]
line-length = 120
target-version = ['py37']
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ opencv-python==4.2.0.32
vispy==0.6.4
moviepy==1.0.2
transforms3d==0.3.1
networkx==2.3
networkx==2.3
cynetworkx
scikit-image

0 comments on commit 9781918

Please sign in to comment.