Open HyZhu39 opened 5 years ago
Broadcast shape (3, 128, 128) is (rgb, height, width) of image. output shape (1, 128, 128) means it's outputting one color channel, instead of 3/RGB. I think , I don't know that much about coding. Hopefully this helps.
I have the same problem, no idea why
I encountered this error when I was training in the following configuration:
python train.py --images_dir='data/bird' --folder_distributed=True --sample_dir='samples/exp_1' --model_dir='models/exp_1'
I changed default options in train.py where "default='os.environ['SM_MODEL_DIR']," to “samples/exp_1',” "default=os.environ['SM_CHANNEL_TRAINING'],“ to "default='data/bird',", "default='os.environ['SM_MODEL_DIR']," to “samples/exp_1',”
The dataset is loaded correctly. but it failed in training with this error :
Traceback (most recent call last): File "train.py", line 267, in
main(parse_arguments())
File "train.py", line 261, in main
start=args.start
File "/data/user/BMSG-GAN/sourcecode/MSG_GAN/GAN.py", line 417, in train
for (i, batch) in enumerate(data, 1):
File "/data/user/.local/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 582, in next
return self._process_next_batch(batch)
File "/data/user/.local/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
RuntimeError: Traceback (most recent call last):
File "/data/user/.local/lib/python3.5/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/data/user/.local/lib/python3.5/site-packages/torch/utils/data/_utils/worker.py", line 99, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/data/user/BMSG-GAN/sourcecode/dataprocessing/DataLoader.py", line 132, in getitem
img = self.transform(img)
File "/data/user/.local/lib/python3.5/site-packages/torchvision/transforms/transforms.py", line 60, in call
img = t(img)
File "/data/user/.local/lib/python3.5/site-packages/torchvision/transforms/transforms.py", line 163, in call
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "/data/user/.local/lib/python3.5/site-packages/torchvision/transforms/functional.py", line 208, in normalize
tensor.sub(mean[:, None, None]).div_(std[:, None, None])
RuntimeError: output with shape [1, 128, 128] doesn't match the broadcast shape [3, 128, 128]
I think this error has nothing to do with my modification. Could you please tell me what caused this error?