Fix --optimize-disk-space

pull/1225/head
Piero Toffanin 2021-01-15 15:39:29 -05:00
rodzic 8b6d636abf
commit 3ca4629f08
1 zmienionych plików z 11 dodań i 7 usunięć

Wyświetl plik

@ -35,18 +35,20 @@ class ODMOpenSfMStage(types.ODM_Stage):
octx.extract_cameras(tree.path("cameras.json"), self.rerun()) octx.extract_cameras(tree.path("cameras.json"), self.rerun())
self.update_progress(70) self.update_progress(70)
if args.optimize_disk_space: def cleanup_disk_space():
for folder in ["features", "matches", "exif", "reports"]: if args.optimize_disk_space:
folder_path = octx.path(folder) for folder in ["features", "matches", "exif", "reports"]:
if os.path.islink(folder_path): folder_path = octx.path(folder)
os.unlink(folder_path) if os.path.islink(folder_path):
else: os.unlink(folder_path)
shutil.rmtree(folder_path) else:
shutil.rmtree(folder_path)
# If we find a special flag file for split/merge we stop right here # If we find a special flag file for split/merge we stop right here
if os.path.exists(octx.path("split_merge_stop_at_reconstruction.txt")): if os.path.exists(octx.path("split_merge_stop_at_reconstruction.txt")):
log.ODM_INFO("Stopping OpenSfM early because we found: %s" % octx.path("split_merge_stop_at_reconstruction.txt")) log.ODM_INFO("Stopping OpenSfM early because we found: %s" % octx.path("split_merge_stop_at_reconstruction.txt"))
self.next_stage = None self.next_stage = None
cleanup_disk_space()
return return
updated_config_flag_file = octx.path('updated_config.txt') updated_config_flag_file = octx.path('updated_config.txt')
@ -205,6 +207,8 @@ class ODMOpenSfMStage(types.ODM_Stage):
if not args.skip_report: if not args.skip_report:
octx.export_stats(self.rerun()) octx.export_stats(self.rerun())
cleanup_disk_space()
if args.optimize_disk_space: if args.optimize_disk_space:
os.remove(octx.path("tracks.csv")) os.remove(octx.path("tracks.csv"))
if io.file_exists(octx.recon_backup_file()): if io.file_exists(octx.recon_backup_file()):