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

dataset_tool raise Value Error: not enough image data? #637

Open
yellowAcute opened this issue Mar 26, 2024 · 1 comment
Open

dataset_tool raise Value Error: not enough image data? #637

yellowAcute opened this issue Mar 26, 2024 · 1 comment

Comments

@yellowAcute
Copy link

I am using a dataset for infrared image dim-small aircraft target to train a model by the stylegan3 code. The datasets are infrared images. I want to use dataset_tool.py for data preprocessing on the dataset. But it can't work when I run the code. The information is followed.
error:
root@interactive74491:/opt/data/private/stylegan3# python3 dataset_tool.py --source raw_datasets/infrared_img.zip --dest /pre_datasets/infrared_256x256.zip --transform=center-crop --resolution=256x256
2%|██▉ | 399/16491 [00:01<01:06, 241.86it/s]
Traceback (most recent call last):
File "dataset_tool.py", line 465, in
convert_dataset() # pylint: disable=no-value-for-parameter
File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1128, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "dataset_tool.py", line 421, in convert_dataset
img = transform_image(image['img'])
File "dataset_tool.py", line 235, in center_crop
img = PIL.Image.fromarray(img, 'RGB')
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2670, in fromarray
return frombuffer(mode, size, obj, "raw", rawmode, 0, 1)
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2613, in frombuffer
return frombytes(mode, size, data, decoder_name, args)
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2546, in frombytes
im.frombytes(data, decoder_name, args)
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 833, in frombytes
raise ValueError("not enough image data")
ValueError: not enough image data

What can I do about that? Thanks for helping me solve the problem.

@Neilstid
Copy link

Neilstid commented Apr 2, 2024

Hi,

Here are 2 relative topics that may help you to solve your issue:
#211
https://stackoverflow.com/questions/8328198/pil-valueerror-not-enough-image-data

To solve you will have to slightly modify the image loader in order to PIL to load the image. I Hope it will help you :)

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

No branches or pull requests

2 participants