NVIDIAGameWorks / kaolin-wisp

NVIDIA Kaolin Wisp is a PyTorch library powered by NVIDIA Kaolin Core to work with neural fields (including NeRFs, NGLOD, instant-ngp and VQAD).
Other
1.46k stars 132 forks source link

Lego dataset win_size exceeds error #131

Open engrkhurramshabbir opened 1 year ago

engrkhurramshabbir commented 1 year ago

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/khurram/kaolin-wisp/app/nerf/main_nerf.py", line 488, in app.run() # Run in interactive mode File "/home/khurram/kaolin-wisp/wisp/renderer/app/wisp_app.py", line 253, in run app.run() # App clock should always run as frequently as possible (background tasks should not be limited) File "/home/khurram/anaconda3/envs/wisp/lib/python3.9/site-packages/glumpy/app/init.py", line 362, in run run(duration, framecount) File "/home/khurram/anaconda3/envs/wisp/lib/python3.9/site-packages/glumpy/app/init.py", line 344, in run count = backend.process(dt) File "/home/khurram/anaconda3/envs/wisp/lib/python3.9/site-packages/glumpy/app/window/backends/backend_glfw_imgui.py", line 451, in process window.dispatch_event('on_idle', dt) File "/home/khurram/anaconda3/envs/wisp/lib/python3.9/site-packages/glumpy/app/window/event.py", line 396, in dispatch_event if getattr(self, event_type)(*args): File "/home/khurram/kaolin-wisp/wisp/renderer/app/wisp_app.py", line 521, in _run_hook hook() File "/home/khurram/kaolin-wisp/wisp/trainers/base_trainer.py", line 333, in iterate self.end_epoch() File "/home/khurram/kaolin-wisp/wisp/trainers/base_trainer.py", line 294, in end_epoch self.validate() File "/home/khurram/kaolin-wisp/wisp/trainers/multiview_trainer.py", line 225, in validate evaluation_results = self.evaluate_metrics(self.validation_dataset, lods[-1], File "/home/khurram/kaolin-wisp/wisp/trainers/multiview_trainer.py", line 118, in evaluate_metrics ssim_total += ssim(rb.rgb[...,:3], gts[...,:3]) File "/home/khurram/kaolin-wisp/wisp/ops/image/metrics.py", line 84, in ssim return skimage.metrics.structural_similarity( File "/home/khurram/anaconda3/envs/wisp/lib/python3.9/site-packages/skimage/metrics/_structural_similarity.py", line 178, in structural_similarity raise ValueError( ValueError: win_size exceeds image extent. Either ensure that your images are at least 7x7; or pass win_size explicitly in the function call, with an odd value less than or equal to the smaller side of your images. If your images are multichannel (with color channels), set channel_axis to the axis number corresponding to the channels.

orperel commented 1 year ago

Hi @engrkhurramshabbir , SSIM seems to work fine on my end, which configuration are you running?

engrkhurramshabbir commented 1 year ago

I am using following configuration cd kaolin-wisp python3 app/nerf/main_nerf.py --config app/nerf/configs/nerf_octree.yaml --dataset-path /path/to/lego

engrkhurramshabbir commented 1 year ago

My data structure is as follows: test train val transform_test.json transform_train.json transform_val.json

engrkhurramshabbir commented 1 year ago

I even tried multiply configurations and other data e.g. fox. But still getting same error. Problem seems to define win_size explicitly for the given data set in metrics.py, multiview_trainer.py and base_trainer.py

File "/home/khurram/kaolin-wisp/wisp/renderer/app/wisp_app.py", line 521, in _run_hook hook() File "/home/khurram/kaolin-wisp/wisp/trainers/base_trainer.py", line 333, in iterate self.end_epoch() File "/home/khurram/kaolin-wisp/wisp/trainers/base_trainer.py", line 294, in end_epoch self.validate() File "/home/khurram/kaolin-wisp/wisp/trainers/multiview_trainer.py", line 225, in validate evaluation_results = self.evaluate_metrics(self.validation_dataset, lods[-1], File "/home/khurram/kaolin-wisp/wisp/trainers/multiview_trainer.py", line 118, in evaluate_metrics ssim_total += ssim(rb.rgb[...,:3], gts[...,:3]) File "/home/khurram/kaolin-wisp/wisp/ops/image/metrics.py", line 84, in ssim return skimage.metrics.structural_similarity( File "/home/khurram/anaconda3/envs/wisp/lib/python3.9/site-packages/skimage/metrics/_structural_similarity.py", line 178, in structural_similarity raise ValueError( ValueError: win_size exceeds image extent. Either ensure that your images are at least 7x7; or pass win_size explicitly in the function call, with an odd value less than or equal to the smaller side of your images. If your images are multichannel (with color channels), set channel_axis to the axis number corresponding to the channels.

jaeheungs commented 1 year ago

I think it may be an issue with skimage version

I change the file at wisp/ops/image/metrics.py to include the channel_axis, namely:

    return skimage.metrics.structural_similarity(
        rgb[..., :3].cpu().numpy(),
        gts[..., :3].cpu().numpy(),
        multichannel=True,
        data_range=1,
        gaussian_weights=True,
        sigma=1.5,
        channel_axis=-1)

and it works now.