Skip to content

Fix a bug that leads to "ValueError: axes don't match array" in dataset_tool.py#111

Open
lowlypalace wants to merge 1 commit intoNVlabs:mainfrom
lowlypalace:fix-dataset_tool-bug
Open

Fix a bug that leads to "ValueError: axes don't match array" in dataset_tool.py#111
lowlypalace wants to merge 1 commit intoNVlabs:mainfrom
lowlypalace:fix-dataset_tool-bug

Conversation

@lowlypalace
Copy link
Copy Markdown

@lowlypalace lowlypalace commented Apr 16, 2022

This is a patch to the Issue #110

Here's a fix for dataset_tool.py that fixes ValueError: axes don't match array, images will work one run and not work the next error.

My debugging of the issue was as follows:

  • I first thought that maybe some of the images I scraped were grayscale. To solve this I used imagemagick and tried to run magick identify *.jpg to search for greyscale images to purge from the dataset but the issue still persisted in my case.
  • I tried to mass-edit the colorspace of the images and resolution. This still hasn't fixed the error which I was randomly getting on some of the images.
  • I still can't debug the exact origin of the issue such as a specific colorspace causing dataset_tool.py to crash.

I propose to use PIL to convert the image to RGB in any case. It should be able to work fine if the images are not sRGB, including the case when they are grayscale. It will most likely slows down the dataset preprocessing step a little bit (I haven't run any benchmarks). However, it is convenient if the training data is coming from varied sources, which I believe is the case for my users.

@lowlypalace lowlypalace changed the title Fix a bug that led to "ValueError: axes don't match array" in dataset_tool.py Fix a bug that leads to "ValueError: axes don't match array" in dataset_tool.py Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant