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

How can I trained a Grayscale image? #30

Open
echocxl opened this issue Jan 21, 2022 · 1 comment
Open

How can I trained a Grayscale image? #30

echocxl opened this issue Jan 21, 2022 · 1 comment

Comments

@echocxl
Copy link

echocxl commented Jan 21, 2022

I have some single channel grayscale images to generate, and I changed the parameters
parser. add_ argument('--nc_im',type=int,help='image # channels',default=1),
However, an error was encountered:
The behavior of rgb2gray will change in scikit-image 0.19. Currently, rgb2gray allows 2D grayscale image to be passed as inputs and leaves them unmodified as outputs. Starting from version 0.19, 2D arrays will be treated as 1D images with 3 channels.
x = color.rgb2gray(x)
Traceback (most recent call last):
File "main_train.py", line 113, in
train(opt)
File "/root/ConSinGAN-master/ConSinGAN/training_generation.py", line 23, in train
real = functions.adjust_scales2image(real, opt)
File "/root/ConSinGAN-master/ConSinGAN/functions.py", line 185, in adjust_scales2image
real = imresize(real_, opt.scale1, opt)
File "/root/ConSinGAN-master/ConSinGAN/imresize.py", line 52, in imresize
im = np2torch(im,opt)
File "/root/ConSinGAN-master/ConSinGAN/imresize.py", line 26, in np2torch
x = color.rgb2gray(x)
File "/usr/local/lib/python3.6/dist-packages/skimage/color/colorconv.py", line 809, in rgb2gray
rgb = _prepare_colorarray(rgb)
File "/usr/local/lib/python3.6/dist-packages/skimage/color/colorconv.py", line 150, in _prepare_colorarray
raise ValueError("Input array must have a shape == (..., 3)), "
ValueError: Input array must have a shape == (..., 3)), got (250, 250, 1)

How should I deal with it?Thank!

@GuigzoS
Copy link

GuigzoS commented Feb 15, 2022

I guess it is related to SinGAN implementation mistake, this issue should help you : tamarott/SinGAN#131

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