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
Cannot input grayscale images #92
Comments
Hi, the issue is that in the DataLoader, inputs and outputs are always converted to RGB like this, even when you specify You could remove the converting or make it conditional but RGB images seem to be required for the Vgg19 model. You could probably go with Looks like we need a custom DataLoader for grayscale images? |
Ok...thanks...I’ll try your suggestion |
Hi, I will be very grateful if you tell how prepare your dataset as grayscale images to feed the pix2pixhd? |
Hi I solved the --input_nc 1 problem by editing the data/base_dataset.py (for transforms), data/aligned_dataset.py (for transforms) and models/pix2pixHD_model.py (for VGG loss). You can get the updated version in https://github.com/WenliangDu/pix2pixHD, and find the changes in the three codes with comments of "# for --input_nc 1" |
Do you have any idea for input_nc 3(RGB) and output_nc 1(gray)? I have tried your code and it doesn't work. |
Thank you for pointing the bug. I modified Line 54 in aligned_dataset.py. You could try this code for your issue. "transform_B = get_transform(self.opt, params, grayscale=(self.opt.input_nc == 1))"=>"transform_B = get_transform(self.opt, params, grayscale=(self.opt.output_nc == 1))" |
Thank you very much!
|
Hi,
I have a folder of grayscale images that I want to use for training. I am using the following command:
python train.py --dataroot ./datasets/sample --name sample --loadSize 1536 --fineSize 512 --no_flip --batchSize 3 --niter 3000 --gpu_ids 1 --no_instance --resize_or_crop resize_and_crop --label_nc 0 --n_local_enhancers 1 --norm batch --use_dropout --input_nc 1 --output_nc 1
But I am getting the following error:
RuntimeError: Given groups=1, weight of size [64, 1, 7, 7], expected input[3, 3, 518, 518] to have 1 channels, but got 3 channels instead
What is the issue?
The text was updated successfully, but these errors were encountered: