eseefrie/csu101-colmap
CSU 101 NeRF Training — Undergrad Guide This document explains what has already been done, what you need to do, and how to do it. Background: What is COLMAP and what has already been done? COLMAP is a photogrammetry tool. Given a set of images or video frames of a building, it figures out where the camera was located and which direction it was pointing for every single frame. This process — called Structure from Motion (SfM) — produces a 3D point cloud and a… See the full description on the dataset page: https://huggingface.co/datasets/eseefrie/csu101-colmap.
0105
1#!/usr/bin/env python32"""Create a train-only Nerfstudio dataset directory for a benchmark split.3 4The source processed dataset remains untouched. The output dataset contains:5 - transforms.json with only split train frames6 - images -> symlink to the original images directory7 - sparse_pc.ply or any relative ply_file_path target if present8 9This lets us train on every_6th train frames while evaluating held-out frames10from benchmark/splits/<scene>/every_6th/test_frames.json separately.11"""12 13import argparse14import json15import os16from pathlib import Path17 18 19def relink(src: Path, dst: Path):20 if dst.exists() or dst.is_symlink():21 return22 dst.parent.mkdir(parents=True, exist_ok=True)23 os.symlink(src, dst)24 25 26def main():27 ap = argparse.ArgumentParser()28 ap.add_argument("--scene", required=True)29 ap.add_argument("--split", default="every_6th")30 ap.add_argument("--data_root", default="/data/csu101-nerfs/colmap_runs")31 ap.add_argument("--splits_root", default="/data/csu101-nerfs/benchmark/splits")32 ap.add_argument("--out_root", default="/data/csu101-nerfs/benchmark/validation/arc_vs_every6/data")33 args = ap.parse_args()34 35 src_processed = Path(args.data_root) / args.scene / "processed"36 split_dir = Path(args.splits_root) / args.scene / args.split37 out_processed = Path(args.out_root) / args.split / args.scene / "processed"38 39 with open(src_processed / "transforms.json") as f:40 meta = json.load(f)41 with open(split_dir / "train_frames.json") as f:42 train_frames = json.load(f)43 44 out_processed.mkdir(parents=True, exist_ok=True)45 relink(src_processed / "images", out_processed / "images")46 47 ply = meta.get("ply_file_path")48 if ply:49 ply_src = Path(ply)50 if not ply_src.is_absolute():51 ply_src = src_processed / ply_src52 if ply_src.exists():53 relink(ply_src, out_processed / Path(ply).name)54 meta["ply_file_path"] = Path(ply).name55 56 meta["frames"] = train_frames57 with open(out_processed / "transforms.json", "w") as f:58 json.dump(meta, f)59 60 print(f"Wrote train-only dataset: {out_processed}")61 print(f" scene={args.scene} split={args.split} train_frames={len(train_frames)}")62 63 64if __name__ == "__main__":65 main()66 