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 adjustscales2image
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)
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 adjustscales2image
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!