vkgs-sim / third_party /harmonizer /doc /test_dataset_preparation_tutorial.md
kimjunhan's picture
Add files using upload-large-folder tool
ad0aa3a verified
|
Raw History Blame Contribute Delete
3.52 kB

Harmonizer Test Dataset Preparation Tutorial

This tutorial explains how to prepare test datasets for evaluating the Harmonizer model. The test dataset is used to quantitatively measure model performance using metrics like PSNR and LPIPS.

Dataset Structure

The test dataset should be organized in the following directory structure:

test_dataset/
β”œβ”€β”€ {scene_id_1}/
β”‚   β”œβ”€β”€ render/
β”‚   β”‚   β”œβ”€β”€ {camera_id_1}/
β”‚   β”‚   β”‚   β”œβ”€β”€ {timestamp_1}.png
β”‚   β”‚   β”‚   β”œβ”€β”€ {timestamp_2}.png
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ {camera_id_2}/
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   └── ...
β”‚   └── gt/
β”‚       β”œβ”€β”€ {camera_id_1}/
β”‚       β”‚   β”œβ”€β”€ {timestamp_1}.png
β”‚       β”‚   β”œβ”€β”€ {timestamp_2}.png
β”‚       β”‚   └── ...
β”‚       β”œβ”€β”€ {camera_id_2}/
β”‚       β”‚   └── ...
β”‚       └── ...
β”œβ”€β”€ {scene_id_2}/
β”‚   β”œβ”€β”€ render/
β”‚   └── gt/
└── ...

Directory Explanation

  • {scene_id}: A unique identifier for each scene (e.g., UUID like 05443ac1-8125-4ace-9daa-6ecdc0df43ff)
  • render/: Contains the degraded/rendered images that will be fed to the Harmonizer model as input
  • gt/: Contains the ground truth images that will be used to evaluate the model's output
  • {camera_id}: Camera identifier (e.g., camera_front_tele_30fov, camera_front_wide_120fov)
  • {timestamp}.png: Image files with timestamp-based filenames (e.g., 116930318359.png)

Important Notes

  1. Matching Structure: The render/ and gt/ directories must have identical subdirectory structures and matching filenames
  2. Image Format: Images should be in PNG, JPEG, or JPG format
  3. Filename Matching: For each image in render/{camera_id}/{timestamp}.png, there must be a corresponding gt/{camera_id}/{timestamp}.png
  4. Resolution: Images can be of any resolution; they will be automatically resized during evaluation

Generating Test Dataset using NuRec

You can generate test datasets using the same methods described in the dataset preparation tutorial (sparse reconstruction, model underfitting, or cross reference), but with specific configurations for test dataset generation.

Running Evaluation

Once your test dataset is prepared, run the evaluation script:

# Start the PyTorch container
docker run --gpus=all --ipc=host -it \
  -v $(pwd):/work \
  harmonizer-cosmos-env

  # Run evaluation
  python /work/src/evaluate_test_dataset.py \
  --model /work/models/diffusion_harmonizer.pkl \
  --input /work/test_dataset

Evaluation Output

The evaluation script will:

  1. Process each scene and camera in the test dataset
  2. Apply the Harmonizer model to all rendered images
  3. Compare the model outputs with ground truth images
  4. Calculate PSNR and LPIPS metrics
  5. Save enhanced images to the evaluation/ directory with the same structure as test_dataset/
  6. Generate a metrics.yaml file with:
    • Overall metrics (mean and standard deviation)
    • Per-scene metrics
    • Inference time statistics
    • GPU memory usage statistics

Example Metrics Output

overall:
  psnr_mean: 29.335
  psnr_std: 2.028
  lpips_mean: 0.109
  lpips_std: 0.043
  avg_inference_time: 0.025
  total_images: 117
per_scene:
  05443ac1-8125-4ace-9daa-6ecdc0df43ff:
    psnr: 28.716
    lpips: 0.187
    num_images: 12
    avg_inference_time: 0.025
  ...