Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support arbitrary image resolution in more loaders #787

Merged
merged 20 commits into from
Mar 28, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
logger = logger_utils.get_logger()


_TANKS_AND_TEMPLES_RESOLUTION_PX = 1080


# TODO(johnwlambert,travisdriver): Make this generic for any dataset with a GT mesh.
class GtsfmRunnerSyntheticTanksAndTemplesLoader(GtsfmRunnerBase):
tag = "GTSFM with LiDAR scans, COLMAP camera poses, and image names stored in Tanks and Temples format"
Expand All @@ -24,7 +21,7 @@ def construct_argparser(self) -> argparse.ArgumentParser:
parser = super().construct_argparser()

parser.add_argument(
"--dataset_root", type=str, required=True, help="Path to zip file containing packaged data."
"--dataset_root", type=str, required=True, help="Path to dir, for unzipped file containing packaged data."
)
parser.add_argument("--scene_name", type=str, required=True, help="Name of dataset scene.")
parser.add_argument(
Expand Down Expand Up @@ -52,7 +49,8 @@ def construct_loader(self) -> LoaderBase:
ply_alignment_fpath=ply_alignment_fpath,
bounding_polyhedron_json_fpath=bounding_polyhedron_json_fpath,
colmap_ply_fpath=colmap_ply_fpath,
max_resolution=_TANKS_AND_TEMPLES_RESOLUTION_PX,
# NOTE: Native resolution for T&T is 1080 px.
max_resolution=self.parsed_args.max_resolution,
max_num_images=self.parsed_args.max_num_images,
)
return loader
Expand Down
145 changes: 145 additions & 0 deletions scripts/tanks_and_temples_benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Script to launch jobs over various Tanks & Temples datasets & front-ends.
# https://www.tanksandtemples.org/download/

USER_ROOT=$1
CLUSTER_CONFIG=$2

now=$(date +"%Y%m%d_%H%M%S")


datasets=(
barn-tanks-and-temples-410
courthouse-1106
ignatius-263
church-507
caterpillar-383
meetingroom-371
truck-251
)

max_frame_lookahead_sizes=(
# 0
# 5
10
#15
)

num_matched_sizes=(
# 0
5
# 10
# 15
# 20
# 25
)

correspondence_generator_config_names=(
sift
lightglue
superglue
loftr
disk
)

if [[ $CLUSTER_CONFIG ]]
then
CLUSTER_ARGS="--cluster_config $CLUSTER_CONFIG"
else
CLUSTER_ARGS=""
fi


for num_matched in ${num_matched_sizes[@]}; do
for max_frame_lookahead in ${max_frame_lookahead_sizes[@]}; do
for dataset in ${datasets[@]}; do


INTRINSICS_ARGS="--share_intrinsics"


if [[ $num_matched == 0 && $max_frame_lookahead == 0 ]]
then
# Matches must come from at least some retriever.
continue
fi

for correspondence_generator_config_name in ${correspondence_generator_config_names[@]}; do

if [[ $correspondence_generator_config_name == *"sift"* ]]
then
num_workers=1
elif [[ $correspondence_generator_config_name == *"lightglue"* ]]
then
num_workers=1
elif [[ $correspondence_generator_config_name == *"superglue"* ]]
then
num_workers=1
elif [[ $correspondence_generator_config_name == *"disk"* ]]
then
num_workers=1
elif [[ $correspondence_generator_config_name == *"loftr"* ]]
then
num_workers=1
fi

echo "Dataset: ${dataset}"
echo "Num matched: ${num_matched}"
echo "Max frame lookahead: ${max_frame_lookahead}"
echo "Correspondence Generator: ${correspondence_generator_config_name}"
echo "Num workers: ${num_workers}"
echo "Intrinsics: ${INTRINSICS_ARGS}"


if [[ $dataset == *"barn-tanks-and-temples-410"* ]]
then
dataset_root="/usr/local/gtsfm-data/TanksAndTemples/Barn"
scene_name="Barn"
elif [[ $dataset == *"caterpillar-383"* ]]
then
dataset_root=/usr/local/gtsfm-data/TanksAndTemples/Caterpillar
scene_name="Caterpillar"
elif [[ $dataset == *"church-507"* ]]
then
dataset_root=/usr/local/gtsfm-data/TanksAndTemples/Church
scene_name="Church"
elif [[ $dataset == *"courthouse-1106"* ]]
then
dataset_root=/usr/local/gtsfm-data/TanksAndTemples/Courthouse
scene_name="Courthouse"
elif [[ $dataset == *"ignatius-263"* ]]
then
dataset_root=/usr/local/gtsfm-data/TanksAndTemples/Ignatius
scene_name="Ignatius"
elif [[ $dataset == *"meetingroom-371"* ]]
then
dataset_root=/usr/local/gtsfm-data/TanksAndTemples/Meetingroom
scene_name="Meetingroom"
elif [[ $dataset == *"truck-251"* ]]
then
dataset_root=/usr/local/gtsfm-data/TanksAndTemples/Truck
scene_name="Truck"
fi

OUTPUT_ROOT=${USER_ROOT}/${now}/${now}__${dataset}__results__num_matched${num_matched}__maxframelookahead${max_frame_lookahead}__760p__unified_${correspondence_generator_config_name}
mkdir -p $OUTPUT_ROOT

python gtsfm/runner/run_scene_optimizer_tanks_and_temples.py \
--scene_name $scene_name \
--mvs_off \
--config unified \
--correspondence_generator_config_name $correspondence_generator_config_name \
--dataset_root $dataset_root \
--num_workers $num_workers \
--num_matched $num_matched \
--max_frame_lookahead $max_frame_lookahead \
--worker_memory_limit "32GB" \
--output_root $OUTPUT_ROOT \
--max_resolution 760 \
$INTRINSICS_ARGS $CLUSTER_ARGS \
2>&1 | tee $OUTPUT_ROOT/out.log

done
done
done
done

Loading