mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-06 15:59:16 +08:00
Using ns-render instead of ns-eval for rendering well-exposed images for alignment. Wrapping both masks with transformation for alignment. Metrics documentation.
This commit is contained in:
1 parent
3176d6a8f6
commit
1b1e2d9fba
5 files changed
+189
-109
No files matched your search
+71
-10
@@ -3,7 +3,9 @@
|
||||
## 0. Setup
|
||||
|
||||
```
|
||||
tmux new -s nerf_studio
|
||||
docker run -it --rm -v /gel/usr/{USER_NAME}:/mnt/workspace/ -v /home-local2/{USER_NAME}.extra.nobkp/:/mnt/data/ --gpus '"device=0"' -p 8008:8008 -p 6006:6006 lantern_docker:latest /bin/bash
|
||||
cd /mnt/workspace/lantern/nerfstudio-HDR
|
||||
|
||||
git clone https://github.com/MrKarimiD/nerfstudio-HDR.git
|
||||
conda activate nerfstudio-HDR
|
||||
@@ -47,8 +49,8 @@ cd ../nerfstudio-HDR
|
||||
- Make sure the cameras point up to avoid having lights in the seam.
|
||||
|
||||
2. First capture with well-exposed cameras.
|
||||
- Change shutter speed to get a well exposed image. **Note the shutter speed.**
|
||||
- Start the video on one camera. Connect to the other camera following the steps above and start the vidoe on the second camera.
|
||||
- Change shutter speed to get a well-exposed image. **Note the shutter speed.**
|
||||
- Start the video on one camera. Connect to the other camera following the steps above and start the video on the second camera.
|
||||
- Clap at the beginning and at the end to use for synchronization.
|
||||
- Go around the scene with the two cameras well-exposed.
|
||||
|
||||
@@ -109,15 +111,10 @@ ns-process-data images --data /mnt/data/garden/images --output-dir /mnt/data/gar
|
||||
```
|
||||
ns-train lantern-nerfacto --data /mnt/data/scene/scene_ns/ --viewer.websocket-port 8008 --pipeline.datamanager.train-num-images-to-sample-from 1800 --pipeline.model.lantern_steps 1 --pipeline.datamanager.pixel-sampler.lantern_steps 1 --max-num-iterations 60000
|
||||
```
|
||||
For better alignment between the well and the fast exposed images:
|
||||
|
||||
1.1. Run the following command.
|
||||
1.1. For better alignment between the well and the fast exposed images, run the following command.
|
||||
```
|
||||
python lantern_scripts/align_fast_to_eval.py --input_dir /mnt/data/scene/scene_ns/ --config outputs/scene_ns/lantern-nerfacto/2024-08-07_143013/config.yml
|
||||
```
|
||||
1.2. Rerun step 1.
|
||||
```
|
||||
ns-train lantern-nerfacto --data /mnt/data/scene/scene_ns/ --viewer.websocket-port 8008 --pipeline.datamanager.train-num-images-to-sample-from 1800 --pipeline.model.lantern_steps 1 --pipeline.datamanager.pixel-sampler.lantern_steps 1 --max-num-iterations 60000
|
||||
python lantern_scripts/align_fast_to_well.py --input_dir /mnt/data/scene/scene_ns/ --config outputs/scene_ns/lantern-nerfacto/2024-08-07_143013/config.yml
|
||||
```
|
||||
|
||||
2. Run step 2 of lantern-nerfacto.
|
||||
@@ -147,11 +144,17 @@ ns-viewer --load-config outputs/scene_ns/lantern-nerfacto/2024-06-06_191338/conf
|
||||
ns-render camera-path --load-config outputs/scene_ns/lantern-nerfacto/2024-06-06_191338/config.yml --camera-path-filename /mnt/data/scene/scene_ns/camera_paths/2024-06-06_191338.json --output-path /mnt/data/scene/renders/2024-06-06_191338.mp4 --rendered-output-names rgb_fast
|
||||
```
|
||||
|
||||
To get evaluation images:
|
||||
To get evaluation images (well-exposed):
|
||||
```
|
||||
ns-eval --load-config=outputs/scene_ns/lantern-nerfacto/2024-06-17_152246/config.yml --output-path=output.json --render_output_path=/mnt/data/scene/eval
|
||||
```
|
||||
|
||||
- To get fast-exposed evaluation images, change these two lines in nerfstudio/lantern/model.py:
|
||||
```
|
||||
line 238: if batch["exposure"] != 1.0: # change to == for testing fast-exposed
|
||||
line 242: return None, None # comment for testing fast-exposed
|
||||
```
|
||||
|
||||
- To get evaluation images and tensorboard:
|
||||
```
|
||||
ns-eval --load-config=outputs/scene_ns/lantern-nerfacto/2024-06-20_142413/config.yml --output-path=output.json --render_output_path=/mnt/data/scene/eval --vis viewer+tensorboard
|
||||
@@ -161,3 +164,61 @@ ns-eval --load-config=outputs/scene_ns/lantern-nerfacto/2024-06-17_152246/config
|
||||
tensorboard --logdir=/path/to/file
|
||||
```
|
||||
- Connect to http://localhost:6006/
|
||||
|
||||
## 4. Calculate metrics
|
||||
|
||||
1. Get ground truth transformations:
|
||||
```
|
||||
ns-process-data lantern-GT-HDR --data /mnt/data/lab_downstairs_ns/ --output-dir /mnt/data/metrics/lab_downstairs --metadata /mnt/data/lab_downstairs_ns/reconstruction.json --checkpoint /mnt/workspace/lantern/nerfstudio-HDR/outputs/lab_downstairs_ns/lantern-nerfacto/2024-10-06_232947/
|
||||
```
|
||||
|
||||
2. Render panos at ground truth positions for well and fast exposed:
|
||||
```
|
||||
ns-render camera-path --load-config /mnt/workspace/lantern/nerfstudio-HDR/outputs/lab_downstairs_ns/lantern-nerfacto/2024-10-06_232947/config.yml --camera-path-filename /mnt/data/metrics/lab_downstairs/GT_transforms.json --output-path /mnt/data/metrics/renders/lab_downstairs_aligned --output-format images --rendered_output_names
|
||||
```
|
||||
```
|
||||
ns-render camera-path --load-config /mnt/workspace/lantern/nerfstudio-HDR/outputs/lab_downstairs_ns/lantern-nerfacto/2024-10-06_232947/config.yml --camera-path-filename /mnt/data/metrics/lab_downstairs/GT_transforms.json --output-path /mnt/data/metrics/renders/lab_downstairs_aligned_fast --output-format images --rendered_output_names rgb_fast
|
||||
```
|
||||
|
||||
3. Combine both well and fast exposed panos:
|
||||
```
|
||||
python lantern_scripts/combine.py --well_dir /mnt/data/metrics/renders/lab_downstairs_aligned/ --fast_dir /mnt/data/metrics/renders/lab_downstairs_aligned_fast/ --out_dir /mnt/data/metrics/renders/lab_downstairs_lin/ --experiment_location /mnt/data/lab_downstairs_ns/ --do_linearization
|
||||
```
|
||||
|
||||
4. Make sure the panos from renders have the same names as the GT panos.
|
||||
|
||||
5. Calculate PSNR, SSIM and LPIPS:
|
||||
```
|
||||
python lantern_scripts/ldr_res.py --gt_dir /mnt/data/metrics/GT_lab_downstairs/pano/ --data_dir /mnt/data/metrics/renders/lab_downstairs_lin/
|
||||
```
|
||||
|
||||
5. Generate HDR renders with blender:
|
||||
```
|
||||
blender --background /mnt/data/metrics/scene_new.blend -P lantern_scripts/hdr_blender.py -- /mnt/data/metrics/renders/lab_downstairs_lin_less/ /mnt/data/metrics/renders/lab_downstairs_lin_renders/
|
||||
```
|
||||
|
||||
6. Calculate si-RMSE, RMSE, RGB ang. and PSNR (LDR r.). Need to change values in code:
|
||||
```
|
||||
python lantern_scripts/res_table_1.py
|
||||
```
|
||||
|
||||
7. Convert exr panos to hdr:
|
||||
```
|
||||
convert GT1.exr GT1.hdr
|
||||
```
|
||||
|
||||
8. Calulate PU-PSNR, HDR-VDP and PU-SSIM following the steps in the following link:
|
||||
https://github.com/darthgera123/PanoHDR-NeRF/tree/main/LANet/metrics
|
||||
```
|
||||
cd hdrvdp-3.0.6
|
||||
```
|
||||
```
|
||||
matlab -batch "metric('../../data/GT_meeting_room/', '../../data/results_meeting_room/')"
|
||||
```
|
||||
|
||||
```
|
||||
cd ../pu21/matlab/examples
|
||||
```
|
||||
```
|
||||
matlab -batch "pupsnr('../../../../data/GT_meeting_room/', '../../../../data/results_meeting_room/')"
|
||||
```
|
||||
Reference in new issue
Block a user