stream3d / NAVI /README.md
WalkerCH's picture
Add files using upload-large-folder tool
25a49bc verified
|
Raw
History Blame Contribute Delete
9.89 kB
# NAVI Eval Dataset
This directory contains the curated NAVI evaluation dataset for streaming image-to-3D generation.
Dataset root:
```text
/root/autodl-tmp/data/navi/navi_eval
```
Source code:
```text
/root/autodl-tmp/data/navi/navi_code
```
The loader in `navi_code/data_util.py` is prepared for this dataset layout.
## Subsets
There are two benchmark subsets:
| subset | objects | videos | total frames | purpose |
|---|---:|---:|---:|---|
| `normal` | 31 | 31 | 4333 | standard setting |
| `hard` | 31 | 31 | 4274 | challenging setting |
Both subsets contain the same 31 objects in the same order. Each object has exactly one selected video stream.
## Directory Structure
```text
navi_eval/
README.md
normal/
subset_info.json
3d_dollhouse_sink/
model.glb
info.json
video/
annotations.json
video.mp4
images/
frame_00000.jpg
frame_00015.jpg
...
masks/
frame_00000.png
frame_00015.png
...
depth/
frame_00000.png
frame_00015.png
...
...
hard/
subset_info.json
3d_dollhouse_sink/
model.glb
info.json
video/
annotations.json
video.mp4
images/
masks/
depth/
...
```
Per object:
- `model.glb`: GT 3D model.
- `video/images/`: RGB video frames.
- `video/masks/`: binary object foreground masks.
- `video/depth/`: encoded GT depth maps.
- `video/annotations.json`: per-frame pose, intrinsics, filename, split, and occlusion metadata.
- `video/video.mp4`: original video file for quick visualization.
- `info.json`: object-level metadata, selected video name, frame count, camera model, and source/output paths.
Per subset:
- `subset_info.json`: stable object order and per-object frame counts.
## Quick Start
Use `navi_code/data_util.py` directly:
```python
from pathlib import Path
import sys
sys.path.insert(0, "/root/autodl-tmp/data/navi/navi_code")
import data_util
ROOT = Path("/root/autodl-tmp/data/navi/navi_eval")
objects = data_util.list_eval_objects(ROOT, "hard")
print(objects[:5])
sample = data_util.load_eval_object(
ROOT,
subset="hard",
object_id=objects[0],
max_num_images=4,
load_images=True,
load_depths=True,
load_masks=True,
)
print(sample["object_id"])
print(sample["model_path"])
print(sample["video_root"])
print(len(sample["annotations"]))
print(sample["images"][0].size)
print(sample["depths"][0].shape)
print(sample["masks"][0].size)
print(sample["camera_matrices"][0][0].shape) # object_to_world
print(sample["camera_matrices"][0][1].shape) # intrinsics
```
The returned dictionary contains:
```python
{
"subset": "hard",
"object_id": "...",
"index": 0,
"record": ..., # entry from subset_info.json
"subset_info": ..., # full subset_info.json
"object_root": Path(...),
"video_root": Path(...),
"model_path": Path(...),
"info_path": Path(...),
"annotations_path": Path(...),
"info": ..., # info.json
"annotations": [...],
"camera_matrices": [...], # list of (object_to_world, intrinsics)
"images": [...], # PIL images, if load_images=True
"depths": [...], # numpy arrays, if load_depths=True
"masks": [...], # PIL images, if load_masks=True
"mesh": ..., # trimesh object, if load_mesh=True
"video": ..., # mediapy video array, if load_video=True
}
```
## Iterate Through A Benchmark
```python
from pathlib import Path
import sys
sys.path.insert(0, "/root/autodl-tmp/data/navi/navi_code")
import data_util
ROOT = Path("/root/autodl-tmp/data/navi/navi_eval")
for item in data_util.iter_eval_subset(
ROOT,
"hard",
max_num_images=64,
load_images=True,
load_depths=False,
load_masks=False,
):
object_id = item["object_id"]
model_path = item["model_path"]
images = item["images"]
annotations = item["annotations"]
# Feed images to your streaming image-to-3D model here.
print(object_id, model_path, len(images), annotations[0]["filename"])
```
## Frame Order
The loader sorts annotations by numeric video frame id by default:
```text
frame_00000.jpg
frame_00015.jpg
frame_00030.jpg
...
```
This means `load_eval_object(..., max_num_images=64)` returns the first 64 chronological frames. If you need the raw JSON order, pass:
```python
sample = data_util.load_eval_object(ROOT, "hard", sort_frames=False)
```
## Loading Meshes And Videos
Image/depth/mask/camera loading works with the lightweight dependencies already available in most Python environments:
- `pillow`
- `numpy`
- `torch`
For `load_mesh=True`, install `trimesh`.
For `load_video=True`, install `mediapy`.
The full dependency set is listed in:
```text
/root/autodl-tmp/data/navi/navi_code/requirements.txt
```
Install it with:
```bash
cd /root/autodl-tmp/data/navi/navi_code
pip install -r requirements.txt
```
Example:
```python
sample = data_util.load_eval_object(
ROOT,
"hard",
object_id="3d_dollhouse_sink",
load_mesh=True,
load_video=True,
)
mesh = sample["mesh"]
video = sample["video"]
```
## Camera Matrices
Each annotation contains:
```json
{
"camera": {
"q": [qw, qx, qy, qz],
"t": [tx, ty, tz],
"focal_length": 3024.0,
"camera_model": "pixel_5"
},
"filename": "frame_00000.jpg",
"image_size": [1920, 1080]
}
```
Use:
```python
object_to_world, intrinsics = data_util.camera_matrices_from_annotation(annotation)
```
`load_eval_object` already computes these for every returned annotation:
```python
object_to_world, intrinsics = sample["camera_matrices"][0]
```
## Depth Maps
Depth PNGs are encoded disparity images. Do not read raw PNG values as depth.
Use:
```python
depth = data_util.read_depth_from_png(depth_path)
```
or load all selected depths through:
```python
sample = data_util.load_eval_object(ROOT, "hard", load_depths=True)
depths = sample["depths"]
```
The decoder is:
```python
disparity = uint16_png.astype(np.float32) / (((2**16) - 1) * 10.0)
disparity[disparity == 0] = np.inf
depth = 1.0 / disparity
```
## Masks
Mask PNGs are binary foreground masks. Foreground pixels are nonzero:
```python
import numpy as np
mask = np.array(sample["masks"][0]) > 0
```
Use masks for foreground-only appearance and geometry metrics.
## Suggested Evaluation Loop
For each object:
1. Load the object with `data_util.load_eval_object`.
2. Use the first `N` chronological RGB frames as streaming input.
3. Generate a predicted 3D model.
4. Render the predicted model using the annotation cameras.
5. Compare rendered RGB/depth with GT `images`, `depths`, and `masks`.
Example skeleton:
```python
ROOT = "/root/autodl-tmp/data/navi/navi_eval"
for item in data_util.iter_eval_subset(
ROOT,
"hard",
max_num_images=64,
load_images=True,
load_depths=True,
load_masks=True,
):
object_id = item["object_id"]
images = item["images"]
gt_depths = item["depths"]
masks = item["masks"]
annotations = item["annotations"]
camera_matrices = item["camera_matrices"]
gt_model = item["model_path"]
# pred_model = your_model.generate(images)
# rendered_rgb, rendered_depth = render(pred_model, camera_matrices)
# compute PSNR/SSIM/LPIPS and depth metrics on mask foreground.
```
## Metric Notes
Appearance metrics:
- PSNR
- SSIM
- LPIPS
Geometry metrics:
- Depth MAE
- Depth RMSE
- Acc@5cm
- RelAcc@5
Foreground-only depth metric example:
```python
import numpy as np
valid = (mask > 0) & np.isfinite(gt_depth) & np.isfinite(pred_depth)
err = np.abs(pred_depth - gt_depth)
depth_mae = err[valid].mean()
depth_rmse = np.sqrt((err[valid] ** 2).mean())
acc_5cm = (err[valid] < 5.0).mean()
relacc_5 = ((err[valid] / gt_depth[valid]) < 0.05).mean()
```
## Validation
The dataset and loader were checked after preparation:
- `normal`: 31 objects, 31 videos, 4333 frames.
- `hard`: 31 objects, 31 videos, 4274 frames.
- Every object has `model.glb`, `video/`, and `info.json`.
- For every object, `len(images) == len(masks) == len(depth) == len(annotations)`.
- First image/mask/depth dimensions match for every object.
- No symlinks were found under `navi_eval`.
- `data_util.load_eval_object` successfully loaded RGB images, depth maps, masks, and camera matrices.
- `model.glb` files were loaded with `trimesh`.
- GT mesh surface points were projected into RGB frames using the annotation camera poses.
- Projected mesh bounding boxes were compared with GT mask bounding boxes on first/middle/last frames for all 62 subset entries.
- Alignment check result: 186 frame checks, 0 failures, minimum bbox IoU `0.9583`, mean per-object minimum bbox IoU `0.9926`.
## Validation Notebook
The validation notebook is:
```text
/root/autodl-tmp/data/navi/navi_eval/src_code/NAVI Dataset Tutorial.ipynb
```
A rendered HTML preview is available at:
```text
/root/autodl-tmp/data/navi/navi_eval/src_code/NAVI Dataset Tutorial.html
```
The notebook demonstrates:
- loading `hard` and `normal` with `data_util.py`
- loading RGB frames, masks, decoded depth maps, camera poses, and `model.glb`
- visualizing RGB / mask / depth
- projecting sampled GT mesh surface points onto the RGB image
- overlaying projected mesh points with the GT foreground mask
- validating mesh-camera-mask alignment across all entries
The mesh alignment example image is saved at:
```text
/root/autodl-tmp/data/navi/navi_eval/src_code/mesh_alignment_overlay_example.png
```
To rerun the notebook:
```bash
cd /root/autodl-tmp/data/navi/navi_eval/src_code
jupyter nbconvert --to notebook --execute --inplace "NAVI Dataset Tutorial.ipynb" --ExecutePreprocessor.timeout=600
jupyter nbconvert --to html "NAVI Dataset Tutorial.ipynb" --output "NAVI Dataset Tutorial.html"
```