diff --git a/examples/benchmarks/compression/mcmc.sh b/examples/benchmarks/compression/mcmc.sh index 4c7165f3d..e55ef6aab 100644 --- a/examples/benchmarks/compression/mcmc.sh +++ b/examples/benchmarks/compression/mcmc.sh @@ -49,7 +49,7 @@ done if command -v zip &> /dev/null then echo "Zipping results" - python benchmarks/compression/summarize_stats.py --results_dir $RESULT_DIR + python benchmarks/summarize_stats.py --results_dir $RESULT_DIR --scenes $SCENE_LIST --stage compress else echo "zip command not found, skipping zipping" fi \ No newline at end of file diff --git a/examples/benchmarks/compression/mcmc_tt.sh b/examples/benchmarks/compression/mcmc_tt.sh index 054920929..e637ae434 100644 --- a/examples/benchmarks/compression/mcmc_tt.sh +++ b/examples/benchmarks/compression/mcmc_tt.sh @@ -42,7 +42,7 @@ done if command -v zip &> /dev/null then echo "Zipping results" - python benchmarks/compression/summarize_stats.py --results_dir $RESULT_DIR --scenes $SCENE_LIST + python benchmarks/summarize_stats.py --results_dir $RESULT_DIR --scenes $SCENE_LIST --stage compress else echo "zip command not found, skipping zipping" fi \ No newline at end of file diff --git a/examples/benchmarks/normal/2dgs_dtu.sh b/examples/benchmarks/normal/2dgs_dtu.sh new file mode 100644 index 000000000..0b8adc296 --- /dev/null +++ b/examples/benchmarks/normal/2dgs_dtu.sh @@ -0,0 +1,17 @@ +SCENE_DIR="data/DTU" +SCENE_LIST="scan24 scan37 scan40 scan55 scan63 scan65 scan69 scan83 scan97 scan105 scan106 scan110 scan114 scan118 scan122" + +RESULT_DIR="results/benchmark_dtu_2dgs" + +for SCENE in $SCENE_LIST; +do + echo "Running $SCENE" + + # train and eval + CUDA_VISIBLE_DEVICES=0 python simple_trainer_2dgs.py --disable_viewer --data_factor 1 \ + --data_dir $SCENE_DIR/$SCENE/ \ + --result_dir $RESULT_DIR/$SCENE/ +done + +echo "Summarizing results" +python benchmarks/summarize_stats.py --results_dir $RESULT_DIR --scenes $SCENE_LIST --stage val diff --git a/examples/benchmarks/normal/mcmc_dtu.sh b/examples/benchmarks/normal/mcmc_dtu.sh new file mode 100644 index 000000000..140412b2e --- /dev/null +++ b/examples/benchmarks/normal/mcmc_dtu.sh @@ -0,0 +1,28 @@ +SCENE_DIR="data/DTU" +SCENE_LIST="scan24 scan37 scan40 scan55 scan63 scan65 scan69 scan83 scan97 scan105 scan106 scan110 scan114 scan118 scan122" +RENDER_TRAJ_PATH="ellipse" + +RESULT_DIR="results/benchmark_dtu_mcmc_0.25M_normal" +CAP_MAX=250000 + +# RESULT_DIR="results/benchmark_dtu_mcmc_0.5M_normal" +# CAP_MAX=500000 + +# RESULT_DIR="results/benchmark_dtu_mcmc_1M_normal" +# CAP_MAX=1000000 + +for SCENE in $SCENE_LIST; +do + echo "Running $SCENE" + + # train and eval + CUDA_VISIBLE_DEVICES=0 python simple_trainer.py mcmc --disable_viewer --data_factor 1 \ + --strategy.cap-max $CAP_MAX \ + --normal_consistency_loss \ + --render_traj_path $RENDER_TRAJ_PATH \ + --data_dir $SCENE_DIR/$SCENE/ \ + --result_dir $RESULT_DIR/$SCENE/ +done + +echo "Summarizing results" +python benchmarks/summarize_stats.py --results_dir $RESULT_DIR --scenes $SCENE_LIST --stage val diff --git a/examples/benchmarks/normal/mcmc_normal.sh b/examples/benchmarks/normal/mcmc_normal.sh index 1de152f34..3127099d6 100644 --- a/examples/benchmarks/normal/mcmc_normal.sh +++ b/examples/benchmarks/normal/mcmc_normal.sh @@ -1,5 +1,5 @@ SCENE_DIR="data/360_v2" -SCENE_LIST="garden bicycle stump bonsai counter kitchen room" # treehill flowers +SCENE_LIST="garden bicycle stump bonsai counter kitchen room treehill flowers" RESULT_DIR="results/benchmark_normal" RENDER_TRAJ_PATH="ellipse" @@ -20,3 +20,6 @@ do --data_dir $SCENE_DIR/$SCENE/ \ --result_dir $RESULT_DIR/$SCENE/ done + +echo "Summarizing results" +python benchmarks/summarize_stats.py --results_dir $RESULT_DIR --scenes $SCENE_LIST --stage val diff --git a/examples/benchmarks/compression/summarize_stats.py b/examples/benchmarks/summarize_stats.py similarity index 67% rename from examples/benchmarks/compression/summarize_stats.py rename to examples/benchmarks/summarize_stats.py index d11dbed6f..e76ebc90f 100644 --- a/examples/benchmarks/compression/summarize_stats.py +++ b/examples/benchmarks/summarize_stats.py @@ -8,11 +8,8 @@ import tyro -def main(results_dir: str, scenes: List[str]): - print("scenes:", scenes) - stage = "compress" - - summary = defaultdict(list) +def main(results_dir: str, scenes: List[str], stage: str = "val"): + stats_all = defaultdict(list) for scene in scenes: scene_dir = os.path.join(results_dir, scene) @@ -25,15 +22,20 @@ def main(results_dir: str, scenes: List[str]): f"stat -c%s {zip_path}", shell=True, capture_output=True ) size = int(out.stdout) - summary["size"].append(size) + stats_all["size"].append(size) with open(os.path.join(scene_dir, f"stats/{stage}_step29999.json"), "r") as f: stats = json.load(f) for k, v in stats.items(): - summary[k].append(v) + stats_all[k].append(v) + + summary = {"scenes": scenes} + for k, v in stats_all.items(): + summary[k] = np.mean(v) + print(summary) - for k, v in summary.items(): - print(k, np.mean(v)) + with open(os.path.join(results_dir, f"{stage}_summary.json"), "w") as f: + json.dump(summary, f, indent=2) if __name__ == "__main__":