DexiNed icon indicating copy to clipboard operation
DexiNed copied to clipboard

non-broadcastable output operand with shape () doesn't match the broadcast shape (3,)

Open G-YY opened this issue 4 years ago • 1 comments

I try to train my own dataset , I got an error : /home/lab606/anaconda3/envs/dexined/bin/python /home/lab606/code/DexiNed/DexiNed-Pytorch/main.py Number of GPU's available: 1 Pytorch version: 1.0.1.post2 mean_bgr: [104.00699, 116.66877, 122.67892] Mon Aug 31 16:27:39 2020 Epoch: 0 Sample 0/5693 Loss: 2641.2958984375 Mon Aug 31 16:27:43 2020 Epoch: 0 Sample 5/5693 Loss: 2556.032958984375 Mon Aug 31 16:27:47 2020 Epoch: 0 Sample 10/5693 Loss: 2207.842529296875 Traceback (most recent call last): File "/home/lab606/code/DexiNed/DexiNed-Pytorch/main.py", line 358, in main(args) File "/home/lab606/code/DexiNed/DexiNed-Pytorch/main.py", line 343, in main args=args) File "/home/lab606/code/DexiNed/DexiNed-Pytorch/main.py", line 41, in train_one_epoch for batch_id, sample_batched in enumerate(dataloader): File "/home/lab606/anaconda3/envs/dexined/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 623, in next return self._process_next_batch(batch) File "/home/lab606/anaconda3/envs/dexined/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch raise batch.exc_type(batch.exc_msg) ValueError: Traceback (most recent call last): File "/home/lab606/anaconda3/envs/dexined/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/lab606/anaconda3/envs/dexined/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 138, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/lab606/code/DexiNed/DexiNed-Pytorch/datasets.py", line 295, in getitem image, label = self.transform(img=image, gt=label) File "/home/lab606/code/DexiNed/DexiNed-Pytorch/datasets.py", line 310, in transform img -= self.mean_bgr ValueError: non-broadcastable output operand with shape () doesn't match the broadcast shape (3,)

Process finished with exit code 1 I have checked my data and find nothing. Is it my dataset not correct? How can I solve the problem? thank you

G-YY avatar Aug 31 '20 08:08 G-YY

I try to train my own dataset , I got an error : /home/lab606/anaconda3/envs/dexined/bin/python /home/lab606/code/DexiNed/DexiNed-Pytorch/main.py Number of GPU's available: 1 Pytorch version: 1.0.1.post2 mean_bgr: [104.00699, 116.66877, 122.67892] Mon Aug 31 16:27:39 2020 Epoch: 0 Sample 0/5693 Loss: 2641.2958984375 Mon Aug 31 16:27:43 2020 Epoch: 0 Sample 5/5693 Loss: 2556.032958984375 Mon Aug 31 16:27:47 2020 Epoch: 0 Sample 10/5693 Loss: 2207.842529296875 Traceback (most recent call last): File "/home/lab606/code/DexiNed/DexiNed-Pytorch/main.py", line 358, in main(args) File "/home/lab606/code/DexiNed/DexiNed-Pytorch/main.py", line 343, in main args=args) File "/home/lab606/code/DexiNed/DexiNed-Pytorch/main.py", line 41, in train_one_epoch for batch_id, sample_batched in enumerate(dataloader): File "/home/lab606/anaconda3/envs/dexined/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 623, in next return self._process_next_batch(batch) File "/home/lab606/anaconda3/envs/dexined/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch raise batch.exc_type(batch.exc_msg) ValueError: Traceback (most recent call last): File "/home/lab606/anaconda3/envs/dexined/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/lab606/anaconda3/envs/dexined/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 138, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/lab606/code/DexiNed/DexiNed-Pytorch/datasets.py", line 295, in getitem image, label = self.transform(img=image, gt=label) File "/home/lab606/code/DexiNed/DexiNed-Pytorch/datasets.py", line 310, in transform img -= self.mean_bgr ValueError: non-broadcastable output operand with shape () doesn't match the broadcast shape (3,)

Process finished with exit code 1 I have checked my data and find nothing. Is it my dataset not correct? How can I solve the problem? thank you

Hi, this is a preliminary answer, I think the problem is with your dataset, since I have tested on different datasets and I cannot find the same problem. I suggest you to try with TF2, but you need to list of your dataset. Generally, when you have this error message "non-broadcastable output operand with shape () doesn't match the broadcast shape (3,)" is because opencv has not read the input data.

Hope it helps, but I will be checking the DataLoader

xavysp avatar Sep 02 '20 04:09 xavysp