Relative path fix, rerun pipeline logic fix

pull/979/head
Piero Toffanin 2019-04-28 22:48:49 -04:00
rodzic 3e7096edf4
commit 934ee78f9b
3 zmienionych plików z 34 dodań i 1 usunięć

Wyświetl plik

@ -147,6 +147,38 @@ class OSFMContext:
def path(self, *paths):
return os.path.join(self.opensfm_project_path, *paths)
def set_image_list_absolute(self):
"""
Checks the image_list.txt file and makes sure that all paths
written in it are absolute paths and not relative paths.
If there are relative paths, they are changed to absolute paths.
"""
image_list_file = self.path("image_list.txt")
tmp_list_file = self.path("image_list.txt.tmp")
if io.file_exists(image_list_file):
changed = False
with open(image_list_file, 'r') as f:
content = f.read()
lines = []
for line in map(str.strip, content.split('\n')):
if line and not line.startswith("/"):
changed = True
line = os.path.abspath(os.path.join(self.opensfm_project_path, line))
lines.append(line)
if changed:
with open(tmp_list_file, 'w') as f:
f.write("\n".join(lines))
os.remove(image_list_file)
os.rename(tmp_list_file, image_list_file)
log.ODM_DEBUG("%s now contains absolute paths" % image_list_file)
else:
log.ODM_WARNING("No %s found, cannot check for absolute paths." % image_list_file)
def get_submodel_argv(args, submodels_path, submodel_name):
"""

Wyświetl plik

@ -360,7 +360,7 @@ class ODM_Stage:
log.ODM_INFO('Finished %s stage' % self.name)
# Last stage?
if self.args.end_with == self.name:
if self.args.end_with == self.name or self.args.rerun == self.name:
log.ODM_INFO("No more stages to run")
return

Wyświetl plik

@ -46,6 +46,7 @@ class ODMSplitStage(types.ODM_Stage):
shutil.rmtree(tree.submodels_path)
octx.run("create_submodels")
octx.set_image_list_absolute()
else:
log.ODM_WARNING("Submodels directory already exist at: %s" % tree.submodels_path)