Skip to content

Commit

Permalink
summarize stats
Browse files Browse the repository at this point in the history
  • Loading branch information
jefequien committed Sep 24, 2024
1 parent 541990a commit 38f2532
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/benchmarks/compression/mcmc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion examples/benchmarks/compression/mcmc_tt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions examples/benchmarks/normal/2dgs_dtu.sh
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions examples/benchmarks/normal/mcmc_dtu.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion examples/benchmarks/normal/mcmc_normal.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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__":
Expand Down

0 comments on commit 38f2532

Please sign in to comment.