From 17ab1fb79c440e5cf486a542df9e89867af21258 Mon Sep 17 00:00:00 2001 From: Alexander Raistrick Date: Tue, 13 Aug 2024 17:39:05 -0400 Subject: [PATCH] Revise IMU/TUM docs, enable exporting them by default --- docs/GroundTruthAnnotations.md | 19 +++++++++++-------- .../configs_nature/extras/imu.gin | 2 -- infinigen_examples/generate_indoors.py | 10 +++------- infinigen_examples/generate_nature.py | 8 +++----- 4 files changed, 17 insertions(+), 22 deletions(-) delete mode 100644 infinigen_examples/configs_nature/extras/imu.gin diff --git a/docs/GroundTruthAnnotations.md b/docs/GroundTruthAnnotations.md index db624f15d..7e69f074a 100644 --- a/docs/GroundTruthAnnotations.md +++ b/docs/GroundTruthAnnotations.md @@ -145,7 +145,9 @@ To visualize point trajectories for a scene, run: python infinigen/tools/results/visualize_traj.py path/to/your/scene/frames ``` -### Camera Intrinsics & Extrinsics +### Camera Pose + +##### Intrinsic & Extrinsic Matrices Camera intrinsics and extrinsics are stored as a numpy ".npz" file inside the "camview" folder. @@ -155,13 +157,9 @@ The camera pose is stored as a 4 x 4 numpy matrix mapping from camera coordinate As is standard in computer vision, the assumed world coordinate system in the saved camera poses is +X -> Right, +Y -> Down, +Z Forward. This is opposed to how Blender internally represents geometry, with flipped Y and Z axes. -### IMU and TUM - -IMU and TUM output is stored as ".txt" files inside the "imu_tum" folder. Enable IMU and TUM collection with config `infinigen_examples/configs_nature/extras/imu.gin`: +##### Camera Velocity / Acceleration (IMU) -``` ---configs imu -``` +Camera velocity / acceleration is stored as ".txt" files inside the "frames/imu_tum" folder. Inertial Measurement Unit (IMU) records the rotational velocity and linear acceleration of each camera at each frame. Each row contains the timestamp, rotational velocity (x y z), and linear acceleration (x y z) with each value separated by a space: @@ -169,7 +167,12 @@ Inertial Measurement Unit (IMU) records the rotational velocity and linear accel timestamp rv_x rv_y rv_z a_x a_y a_z ``` -The [TUM trajectory format](https://github.com/MichaelGrupp/evo/wiki/Formats#tum---tum-rgb-d-dataset-trajectory-format) records the pose of the camera at each frame. Each row contains the timestamp, position, and rotation (as quarternion) with each value separated by a space: +##### TUM Trajectory Format + +For convenience, we also save the trajectories of any animated cameras in the [TUM trajectory format](https://github.com/MichaelGrupp/evo/wiki/Formats#tum---tum-rgb-d-dataset-trajectory-format). + + +Each row contains the timestamp, position, and rotation (as quarternion) with each value separated by a space: ``` timestamp x y z q_x q_y q_z q_w diff --git a/infinigen_examples/configs_nature/extras/imu.gin b/infinigen_examples/configs_nature/extras/imu.gin deleted file mode 100644 index ec9f06c89..000000000 --- a/infinigen_examples/configs_nature/extras/imu.gin +++ /dev/null @@ -1,2 +0,0 @@ -compose_nature.save_imu_tum_data = True -compose_indoors.save_imu_tum_data = True diff --git a/infinigen_examples/generate_indoors.py b/infinigen_examples/generate_indoors.py index 8dc1505db..63dc72e97 100644 --- a/infinigen_examples/generate_indoors.py +++ b/infinigen_examples/generate_indoors.py @@ -244,13 +244,9 @@ def pose_cameras(): def animate_cameras(): cam_util.animate_cameras(camera_rigs, solved_bbox, scene_preprocessed, pois=[]) - save_imu_tum_data = overrides.get("save_imu_tum_data") - if save_imu_tum_data: - frames_folder = output_folder.parent / "frames" - animated_cams = [ - cam for cam in camera_rigs if cam.animation_data is not None - ] - save_imu_tum_files(frames_folder / "imu_tum", animated_cams) + frames_folder = output_folder.parent / "frames" + animated_cams = [cam for cam in camera_rigs if cam.animation_data is not None] + save_imu_tum_files(frames_folder / "imu_tum", animated_cams) p.run_stage( "animate_cameras", animate_cameras, use_chance=False, prereq="pose_cameras" diff --git a/infinigen_examples/generate_nature.py b/infinigen_examples/generate_nature.py index 05d5b2299..8cee43707 100644 --- a/infinigen_examples/generate_nature.py +++ b/infinigen_examples/generate_nature.py @@ -351,11 +351,9 @@ def flying_creatures(): def animate_cameras(): cam_util.animate_cameras(camera_rigs, bbox, scene_preprocessed, pois=pois) - save_imu_tum_data = params.get("save_imu_tum_data") - if save_imu_tum_data: - frames_folder = output_folder.parent / "frames" - animated_cams = [cam for cam in camera_rigs if cam.animation_data is not None] - save_imu_tum_files(frames_folder / "imu_tum", animated_cams) + frames_folder = output_folder.parent / "frames" + animated_cams = [cam for cam in camera_rigs if cam.animation_data is not None] + save_imu_tum_files(frames_folder / "imu_tum", animated_cams) p.run_stage( "animate_cameras",