Open feitgemel opened 2 years ago
This is the link : https://github.com/feitgemel/3d-photo-inpainting
Thank you for that, I'm installing your version however there's some issue with you guide, you forget the command after "Next, please download the model weight using the following command:". Also I have to install PyQt5 with the following commands:
pip install "pyqtwebengine<5.13" pip install "PyQt5<5.13"
else there's conflicts
Also wget should be replaced by curl in the download.sh
But I still can't run it in Windows 10:
(3DP) H:\git\3d-photo-inpainting>python main.py --config argument.yml
running on device 0
0%| | 0/1 [00:00<?, ?it/s]Current Source ==> IMG_20211002_174918
Running depth extraction at 1634718298.483715
cp: ne peut créer le fichier régulier `BoostingMonocularDepth\\inputs\\IMG_20211002_174918.jpg': No such file or directory
python: can't open file 'run.py': [Errno 2] No such file or directory
0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "main.py", line 54, in <module>
run_boostmonodepth(sample['ref_img_fi'], config['src_folder'], config['depth_folder'])
File "H:\git\3d-photo-inpainting\boostmonodepth_utils.py", line 41, in run_boostmonodepth
depth = imageio.imread(os.path.join(BOOST_BASE, BOOST_OUTPUTS, tgt_name))
File "H:\Programmes\miniconda3\envs\3DP\lib\site-packages\imageio\core\functions.py", line 265, in imread
reader = read(uri, format, "i", **kwargs)
File "H:\Programmes\miniconda3\envs\3DP\lib\site-packages\imageio\core\functions.py", line 172, in get_reader
request = Request(uri, "r" + mode, **kwargs)
File "H:\Programmes\miniconda3\envs\3DP\lib\site-packages\imageio\core\request.py", line 124, in __init__
self._parse_uri(uri)
File "H:\Programmes\miniconda3\envs\3DP\lib\site-packages\imageio\core\request.py", line 260, in _parse_uri
raise FileNotFoundError("No such file: '%s'" % fn)
FileNotFoundError: No such file: 'H:\git\3d-photo-inpainting\BoostingMonocularDepth\outputs\IMG_20211002_174918.png'
Hi, Very strange . I think you have a problem with the "direction" of the slash / instead of \
I will make a tutorial video in the next weeks
Eran
I think you have a problem with the "direction" of the slash / instead of \
Not sur, it doesn't create any folder I don't have a BoostingMonocularDepth folder.
I tried to run cmd as administrator and chmo 777 the whole 3d-photo-inpainting folder with no success.
Hi. Have you noticed that I made this fork for Windows ?
The original repo is for Lynux.
I don't understand why you ask me, yes I noticed it is the purpose of my messages, but that doesn't create any folder anyway...
It's because the function copy
doesn't create folder in windows, if I create the folders manualy the files are copied but that still stop trying to open 'run.py' that doesn't exit.
Just found that I had to use MiDaS, I don't know what is it, but is seems to work, I'm waiting for the job to finish, it doesn't seem to use the GPU looking at the resource monitor...
same problem , I use wls2 on Win11
that's because the use of linux command by os.system in boostmonodepth_utils.py. use this to replace then it'll be fine:
import os
import shutil
import cv2
import glob
import numpy as np
import imageio
from MiDaS.MiDaS_utils import write_depth
BOOST_BASE = 'BoostingMonocularDepth'
BOOST_INPUTS = 'inputs'
BOOST_OUTPUTS = 'outputs'
def run_boostmonodepth(img_names, src_folder, depth_folder):
if not isinstance(img_names, list):
img_names = [img_names]
# remove irrelevant files first
clean_folder(os.path.join(BOOST_BASE, BOOST_INPUTS))
clean_folder(os.path.join(BOOST_BASE, BOOST_OUTPUTS))
tgt_names = []
for img_name in img_names:
base_name = os.path.basename(img_name)
tgt_name = os.path.join(BOOST_BASE, BOOST_INPUTS, base_name)
shutil.copy(img_name, tgt_name)
# keep only the file name here.
# they save all depth as .png file
tgt_names.append(os.path.basename(tgt_name).replace('.jpg', '.png'))
os.system(f'cd {BOOST_BASE} && python run.py --Final --data_dir {BOOST_INPUTS}/ --output_dir {BOOST_OUTPUTS} --depthNet 0')
for i, (img_name, tgt_name) in enumerate(zip(img_names, tgt_names)):
img = imageio.imread(img_name)
H, W = img.shape[:2]
scale = 640. / max(H, W)
# resize and save depth
target_height, target_width = int(round(H * scale)), int(round(W * scale))
depth = imageio.imread(os.path.join(BOOST_BASE, BOOST_OUTPUTS, tgt_name))
depth = np.array(depth).astype(np.float32)
depth = resize_depth(depth, target_width, target_height)
np.save(os.path.join(depth_folder, tgt_name.replace('.png', '.npy')), depth / 32768. - 1.)
write_depth(os.path.join(depth_folder, tgt_name.replace('.png', '')), depth)
def clean_folder(folder, img_exts=['.png', '.jpg', '.npy']):
for img_ext in img_exts:
for file in os.listdir(folder):
if file.endswith(img_ext):
os.remove(os.path.join(folder, file))
def resize_depth(depth, width, height):
"""Resize numpy (or image read by imageio) depth map
Args:
depth (numpy): depth
width (int): image width
height (int): image height
Returns:
array: processed depth
"""
depth = cv2.blur(depth, (3, 3))
return cv2.resize(depth, (width, height), interpolation=cv2.INTER_AREA)
None of the above did work for me. The installation seems to be ok but have exactly the same Filenotfound error. No solution sofar? What was that with using Midas?
I also had several problems running this in a Windows environment.
The most effective methods are:
I successfully executed it in a Windows environment using the above method.
wget doesn't work when downloading the models in the batch file.
Looks like you also have to pip install matplotlib
I get a trackback with vispy:
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 2575: character maps to <undefined>
Upgrading vispy to 0.11 and I still get the same traceback. Not sure how to fix it...
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 2575: character maps to
Upgrading vispy to 0.11 and I still get the same traceback. Not sure how to fix it...
Ever figure this out?
Ever figure this out?
No.
Looks like I have to give up
Hi, This isn't an open issue.
This is a very nice project
Just want to update that I did some changes in several files and now your repo can run on Windows 10 as well (not just Linux) I forked it for a new repo.
Eran