JizhiziLi / AIM

[IJCAI'21] Deep Automatic Natural Image Matting
MIT License
386 stars 34 forks source link

ValueError: operands could not be broadcast together with shapes (900,1600,1) (900,1600) #21

Open largerwxt opened 1 year ago

largerwxt commented 1 year ago

Hello, the following error occurred when I reproduced the code. How can I solve it? Traceback (most recent call last): File "core/train.py", line 156, in main() File "core/train.py", line 150, in main train(args, model, optimizer, train_loader, epoch) File "core/train.py", line 78, in train for iteration, batch in enumerate(train_loader, 1): File "/home/anaconda/envs/wxt-env/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 628, in next data = self._next_data() File "/home/anaconda/envs/wxt-env/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 671, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/anaconda/envs/wxt-env/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 58, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/anaconda/envs/wxt-env/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 58, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/wxt/AIM-master/core/data.py", line 101, in getitem ori, fg, bg = generate_composite(fg, bg, mask) File "/home/wxt/AIM-master/core/util.py", line 111, in generate_composite composite = alpha fg + (1 - alpha) bg ValueError: operands could not be broadcast together with shapes (900,1600,1) (900,1600)