From a08dd96e8215074aab065de7644f69910b973613 Mon Sep 17 00:00:00 2001 From: Pau Gargallo Date: Wed, 17 May 2017 11:36:18 +0200 Subject: [PATCH] Skip submodels with no reconstruction --- scripts/metadataset/run_all.sh | 4 ++++ scripts/metadataset/run_dense.py | 6 ++++++ scripts/metadataset/split.py | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/metadataset/run_all.sh b/scripts/metadataset/run_all.sh index 5149300e..f6652d50 100755 --- a/scripts/metadataset/run_all.sh +++ b/scripts/metadataset/run_all.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +RUNPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/../.. +export PYTHONPATH=$RUNPATH/SuperBuild/install/lib/python2.7/dist-packages:$RUNPATH/SuperBuild/src/opensfm:$PYTHONPATH +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RUNPATH/SuperBuild/install/lib + set -e DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) diff --git a/scripts/metadataset/run_dense.py b/scripts/metadataset/run_dense.py index 0970800f..2b0d5e0e 100644 --- a/scripts/metadataset/run_dense.py +++ b/scripts/metadataset/run_dense.py @@ -36,6 +36,12 @@ class DenseReconstructor: unaligned = os.path.join(opensfm_submodel_path, 'reconstruction.unaligned.json') aligned = os.path.join(opensfm_submodel_path, 'reconstruction.aligned.json') main = os.path.join(opensfm_submodel_path, 'reconstruction.json') + + if not os.path.isfile(aligned): + logger.warning("No SfM reconstruction for submodel {}." + " Skipping submodel.".format(submodel_path)) + return + if not os.path.isfile(unaligned): os.rename(main, unaligned) if not os.path.islink(main): diff --git a/scripts/metadataset/split.py b/scripts/metadataset/split.py index c91bfb0d..4b12dd80 100644 --- a/scripts/metadataset/split.py +++ b/scripts/metadataset/split.py @@ -22,4 +22,4 @@ if __name__ == "__main__": command = os.path.join(context.opensfm_path, 'bin', 'opensfm') path = os.path.join(args.dataset, 'opensfm') - run_command([command, 'create_submodels', path, '--size', '20', '--dist', '20']) + run_command([command, 'create_submodels', path])