Skip to content

Commit

Permalink
add support to BoostMonocularDepth
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonATsu committed Jun 21, 2021
1 parent 60ce4fc commit b3a2b1d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
2 changes: 2 additions & 0 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ argument.yml
- Pretrained model of color inpainting
- `MiDaS_model_ckpt: MiDaS/model.pt`
- Pretrained model of depth estimation
- `use_boostmonodepth: True`
- Use [BoostMonocularDepth](https://github.com/compphoto/BoostingMonocularDepth) to get sharper monocular depth estimation
- `fps: 40`
- Frame per second of output rendered video
- `num_frames: 240`
Expand Down
1 change: 1 addition & 0 deletions argument.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ depth_edge_model_ckpt: checkpoints/edge-model.pth
depth_feat_model_ckpt: checkpoints/depth-model.pth
rgb_feat_model_ckpt: checkpoints/color-model.pth
MiDaS_model_ckpt: MiDaS/model.pt
use_boostmonodepth: True
fps: 40
num_frames: 240
x_shift_range: [0.00, 0.00, -0.02, -0.02]
Expand Down
19 changes: 14 additions & 5 deletions download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ fb_status=$(wget --spider -S https://filebox.ece.vt.edu/ 2>&1 | grep "HTTP/1.1
mkdir checkpoints

echo "downloading from filebox ..."
wget https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/color-model.pth
wget https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/depth-model.pth
wget https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/edge-model.pth
wget https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/model.pt

#wget https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/color-model.pth
#wget https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/depth-model.pth
#wget https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/edge-model.pth
#wget https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/model.pt

mv color-model.pth checkpoints/.
mv depth-model.pth checkpoints/.
mv edge-model.pth checkpoints/.
mv model.pt MiDaS/.

echo "cloning from BoostingMonocularDepth ..."
git clone https://github.com/compphoto/BoostingMonocularDepth.git
mkdir -p BoostingMonocularDepth/pix2pix/checkpoints/mergemodel/

echo "downling from google drive ... (how?)"
mv latest_net_G.pth BoostingMonocularDepth/pix2pix/checkpoints/mergemodel/
#cd BoostingMonocularDepth/midas/
wget https://github.com/intel-isl/MiDaS/releases/download/v2/model-f46da743.pt
mv model-f46da743.pt BoostingMonocularDepth/midas/model.pt
6 changes: 5 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import copy
from networks import Inpaint_Color_Net, Inpaint_Depth_Net, Inpaint_Edge_Net
from MiDaS.run import run_depth
from boostmonodepth_utils import run_boostmonodepth
from MiDaS.monodepth_net import MonoDepthNet
import MiDaS.MiDaS_utils as MiDaS_utils
from bilateral_filtering import sparse_bilateral_filtering
Expand Down Expand Up @@ -49,9 +50,12 @@
image = imageio.imread(sample['ref_img_fi'])

print(f"Running depth extraction at {time.time()}")
if config['require_midas'] is True:
if config['use_boostmonodepth'] is True:
run_boostmonodepth(sample['ref_img_fi'], config['src_folder'], config['depth_folder'])
elif config['require_midas'] is True:
run_depth([sample['ref_img_fi']], config['src_folder'], config['depth_folder'],
config['MiDaS_model_ckpt'], MonoDepthNet, MiDaS_utils, target_w=640)

if 'npy' in config['depth_format']:
config['output_h'], config['output_w'] = np.load(sample['depth_fi']).shape[:2]
else:
Expand Down

0 comments on commit b3a2b1d

Please sign in to comment.