gaussian-splatting/full_eval.py

113 lines
4.4 KiB
Python
Raw Normal View History

#
# Copyright (C) 2023, Inria
# GRAPHDECO research group, https://team.inria.fr/graphdeco
# All rights reserved.
#
# This software is free for non-commercial, research and evaluation use
# under the terms of the LICENSE.md file.
#
# For inquiries contact george.drettakis@inria.fr
#
2023-07-04 08:00:48 +00:00
import os
from argparse import ArgumentParser
2024-08-21 12:30:43 +00:00
import time
2023-07-04 08:00:48 +00:00
2023-07-12 10:14:22 +00:00
mipnerf360_outdoor_scenes = ["bicycle", "flowers", "garden", "stump", "treehill"]
2023-07-04 08:00:48 +00:00
mipnerf360_indoor_scenes = ["room", "counter", "kitchen", "bonsai"]
tanks_and_temples_scenes = ["truck", "train"]
deep_blending_scenes = ["drjohnson", "playroom"]
parser = ArgumentParser(description="Full evaluation script parameters")
parser.add_argument("--skip_training", action="store_true")
parser.add_argument("--skip_rendering", action="store_true")
parser.add_argument("--skip_metrics", action="store_true")
2023-07-05 23:49:18 +00:00
parser.add_argument("--output_path", default="./eval")
parser.add_argument("--use_depth", action="store_true")
parser.add_argument("--use_expcomp", action="store_true")
parser.add_argument("--fast", action="store_true")
parser.add_argument("--aa", action="store_true")
2023-07-04 08:00:48 +00:00
args, _ = parser.parse_known_args()
2023-07-05 23:49:18 +00:00
all_scenes = []
all_scenes.extend(mipnerf360_outdoor_scenes)
all_scenes.extend(mipnerf360_indoor_scenes)
all_scenes.extend(tanks_and_temples_scenes)
all_scenes.extend(deep_blending_scenes)
if not args.skip_training or not args.skip_rendering:
2023-07-04 08:00:48 +00:00
parser.add_argument('--mipnerf360', "-m360", required=True, type=str)
parser.add_argument("--tanksandtemples", "-tat", required=True, type=str)
parser.add_argument("--deepblending", "-db", required=True, type=str)
args = parser.parse_args()
2023-07-05 23:49:18 +00:00
if not args.skip_training:
common_args = " --disable_viewer --quiet --eval --test_iterations -1 "
if args.aa:
common_args += " --antialiasing "
if args.use_depth:
common_args += " -d depths2/ "
if args.use_expcomp:
common_args += " --exposure_lr_init 0.001 --exposure_lr_final 0.0001 --exposure_lr_delay_steps 5000 --exposure_lr_delay_mult 0.001 --train_test_exp "
if args.fast:
common_args += " --optimizer_type sparse_adam "
2024-08-21 12:30:43 +00:00
start_time = time.time()
2023-07-13 12:21:52 +00:00
for scene in mipnerf360_outdoor_scenes:
source = args.mipnerf360 + "/" + scene
os.system("python train.py -s " + source + " -i images_4 -m " + args.output_path + "/" + scene + common_args)
for scene in mipnerf360_indoor_scenes:
source = args.mipnerf360 + "/" + scene
os.system("python train.py -s " + source + " -i images_2 -m " + args.output_path + "/" + scene + common_args)
2024-08-21 12:30:43 +00:00
m360_timing = (time.time() - start_time)/60.0
start_time = time.time()
2023-07-09 13:14:31 +00:00
for scene in tanks_and_temples_scenes:
source = args.tanksandtemples + "/" + scene
os.system("python train.py -s " + source + " -m " + args.output_path + "/" + scene + common_args)
2024-08-21 12:30:43 +00:00
tandt_timing = (time.time() - start_time)/60.0
start_time = time.time()
2023-07-09 13:14:31 +00:00
for scene in deep_blending_scenes:
source = args.deepblending + "/" + scene
os.system("python train.py -s " + source + " -m " + args.output_path + "/" + scene + common_args)
2024-08-21 12:30:43 +00:00
db_timing = (time.time() - start_time)/60.0
with open(os.path.join(args.output_path,"timing.txt"), 'w') as file:
2024-08-21 12:30:43 +00:00
file.write(f"m360: {m360_timing} minutes \n tandt: {tandt_timing} minutes \n db: {db_timing} minutes\n")
2023-07-04 08:00:48 +00:00
if not args.skip_rendering:
2023-07-05 23:49:18 +00:00
all_sources = []
for scene in mipnerf360_outdoor_scenes:
all_sources.append(args.mipnerf360 + "/" + scene)
for scene in mipnerf360_indoor_scenes:
all_sources.append(args.mipnerf360 + "/" + scene)
for scene in tanks_and_temples_scenes:
all_sources.append(args.tanksandtemples + "/" + scene)
for scene in deep_blending_scenes:
all_sources.append(args.deepblending + "/" + scene)
2023-07-05 23:49:18 +00:00
common_args = " --quiet --eval --skip_train"
if args.aa:
common_args += " --antialiasing "
if args.use_expcomp:
common_args += " --train_test_exp "
2023-07-05 23:49:18 +00:00
for scene, source in zip(all_scenes, all_sources):
os.system("python render.py --iteration 7000 -s " + source + " -m " + args.output_path + "/" + scene + common_args)
os.system("python render.py --iteration 30000 -s " + source + " -m " + args.output_path + "/" + scene + common_args)
2023-07-04 08:00:48 +00:00
if not args.skip_metrics:
scenes_string = ""
for scene in all_scenes:
2023-07-05 23:49:18 +00:00
scenes_string += "\"" + args.output_path + "/" + scene + "\" "
2023-07-04 08:00:48 +00:00
os.system("python metrics.py -m " + scenes_string)