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

Errors related to the generated image #55

Closed
wry123456 opened this issue Feb 28, 2021 · 5 comments
Closed

Errors related to the generated image #55

wry123456 opened this issue Feb 28, 2021 · 5 comments

Comments

@wry123456
Copy link

The following error occurred when generating images with self-trained pkl files:
python generate.py --outdir outt --seeds 0-50 --network ./00005-data-auto2/network-snapshot-000600.pkl

Traceback (most recent call last):
File "generate.py", line 127, in
generate_images() # pylint: disable=no-value-for-parameter
File "/mistgpu/site-packages/click/core.py", line 829, in call
return self.main(*args, **kwargs)
File "/mistgpu/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/mistgpu/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/mistgpu/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/mistgpu/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "generate.py", line 121, in generate_images
PIL.Image.fromarray(img[0].cpu().numpy(), 'RGB').save(f'{outdir}/seed{seed:04d}.png')
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2785, in fromarray
return frombuffer(mode, size, obj, "raw", rawmode, 0, 1)
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2725, in frombuffer
return frombytes(mode, size, data, decoder_name, args)
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2671, in frombytes
im.frombytes(data, decoder_name, args)
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 800, in frombytes
raise ValueError("not enough image data")
ValueError: not enough image data

What caused the above reasons?

@FwiffoSnork
Copy link

Is your pickle trained on greyscale or RGB images?

@wry123456
Copy link
Author

您的泡菜是否经过了灰度或RGB图像训练?

thanks for your hints. My training set data is grayscale images, and I modified the way the images are saved in the generation code. It can be run.

@nurpax nurpax closed this as completed Mar 9, 2021
@ramnoob
Copy link

ramnoob commented Mar 12, 2021

@wry123456
I would be very happy if you could share how to do this.

@whyydsforever
Copy link

@wry123456 I would be very happy if you could share how to do this.
if your dataset is gratscale, you can delete the last dimesion of image by
adding img = np.squeeze(img, axis=3) in line 121
it will solve this problem

@Elkortya
Copy link

FWIW, I also has to change the "RGB" string in the (original) line 121 to "L" for it to work.

This issue was closed.
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

6 participants