contrastive-unpaired-translation icon indicating copy to clipboard operation
contrastive-unpaired-translation copied to clipboard

Seems to not work with --input_nc 1 (grayscale)

Open adodd202 opened this issue 3 years ago • 3 comments

When I try to run the training code with --input_nc 1 and --output_nc 1 (grayscale img to img conversion), the script fails with:

RuntimeError: Given groups=1, weight of size [64, 1, 7, 7], expected input[4, 3, 262, 262] to have 1 channels, but got 3 channels instead

I checked the get_transforms function call in the unaligned_dataset class and don't see any mention of single image preprocessing. get_transforms has an argument grayscale that is not set when the function is called. Switching this line to transform = get_transform(modified_opt, grayscale=True) worked for me for single channel training.

adodd202 avatar Nov 10 '20 15:11 adodd202

brilliant ! thanks for the tip @adodd202

dr-benway avatar Nov 11 '20 12:11 dr-benway

Thank you, was having the same issue !

HReynaud avatar Jan 09 '21 18:01 HReynaud

When I try to run the training code with --input_nc 1 and --output_nc 1 (grayscale img to img conversion), the script fails with:

RuntimeError: Given groups=1, weight of size [64, 1, 7, 7], expected input[4, 3, 262, 262] to have 1 channels, but got 3 channels instead

I checked the get_transforms function call in the unaligned_dataset class and don't see any mention of single image preprocessing. get_transforms has an argument grayscale that is not set when the function is called. Switching this line to transform = get_transform(modified_opt, grayscale=True) worked for me for single channel training.

Great, that's the question. Thank you

7W7W7W avatar Jan 29 '24 10:01 7W7W7W