Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lego dataset win_size exceeds error #131

Open
engrkhurramshabbir opened this issue Mar 16, 2023 · 5 comments
Open

Lego dataset win_size exceeds error #131

engrkhurramshabbir opened this issue Mar 16, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@engrkhurramshabbir
Copy link

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
Copy link
Collaborator

orperel commented Mar 20, 2023

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

@orperel orperel added the bug Something isn't working label Mar 20, 2023
@engrkhurramshabbir
Copy link
Author

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
Copy link
Author

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

@engrkhurramshabbir
Copy link
Author

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
Copy link
Contributor

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.

jaeheungs added a commit to jaeheungs/kaolin-wisp that referenced this issue Mar 22, 2023
orperel pushed a commit that referenced this issue Mar 23, 2023
Addressing github issue #131 : #131

Fixes: the demos on the README leads to an error due to skimage thinking that the color channel for the images used for SSIM are part of the image dimension rather than channels.
orperel pushed a commit to AvivSham/kaolin-wisp that referenced this issue May 30, 2023
…s#133)

Addressing github issue NVIDIAGameWorks#131 : NVIDIAGameWorks#131

Fixes: the demos on the README leads to an error due to skimage thinking that the color channel for the images used for SSIM are part of the image dimension rather than channels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants