diff --git a/code/python/src/main.py b/code/python/src/main.py index 840d179ff4a2f31eff5c1d0570e64ddf44cf4d88..928bc5d0a08bbcef00b97c8ff0f4c992f5fee46e 100644 --- a/code/python/src/main.py +++ b/code/python/src/main.py @@ -1,4 +1,3 @@ -import test.configuration as config from utility import fs_utility from utility.fs_utility import FileNameConvention # import matplotlib @@ -18,6 +17,7 @@ from utility import depthmap_utils, metrics from utility import blending from utility import serialization from utility import projection_icosahedron as proj_ico +from utility import MAIN_DATA_DIR from utility.logger import Logger @@ -410,9 +410,9 @@ def monodepth_360(opt): """Pipeline.""" # 0) settting parameters # 0-0) data file name and folder - output_folder = os.path.join(Path(config.MAIN_DATA_DIR).parent.absolute(), "results/{}".format(opt.expname)) + output_folder = os.path.join(Path(MAIN_DATA_DIR).parent.absolute(), "results/{}".format(opt.expname)) output_results_file = os.path.join(output_folder, "{}.txt".format(opt.expname)) - Path(output_folder).mkdir(exist_ok=True) + Path(output_folder).mkdir(exist_ok=True, parents=True) with open(opt.data_fns, 'r') as f: data_fns = f.readlines() diff --git a/code/python/src/utility/__init__.py b/code/python/src/utility/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..6ca0b797cf855cc88161b2b69035bdbd89cf18c6 100644 --- a/code/python/src/utility/__init__.py +++ b/code/python/src/utility/__init__.py @@ -0,0 +1,20 @@ +import os +import sys + +# Add project library to Python path +python_src_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +print(f"Adding '{python_src_dir}' to sys.path") +sys.path.append(python_src_dir) # /code/python/src/ +sys.path.append(python_src_dir + "/utility/") # /code/python/src/ +sys.path.append(os.path.dirname(python_src_dir)) # /code/python/ +sys.path.append(os.path.abspath(os.path.join(python_src_dir, os.pardir, os.pardir, "cpp/lib"))) +# sys.path.append(os.path.join(python_src_dir, "../..")) # CR: unused? + +# Data directory /data/ +# TODO: remove the trailing slash once all usages of TEST_DATA_DIR are updated +TEST_DATA_DIR = os.path.abspath("../../../data/") + "/" +MAIN_DATA_DIR = os.path.abspath("../../../data/") + "/" + +# Set the PyTorch hub folder as an environment variable +# TODO: use os.path.join instead of string +os.environ['TORCH_HOME'] = TEST_DATA_DIR + 'models/' \ No newline at end of file