lartpang / MINet

CVPR2020, Multi-scale Interactive Network for Salient Object Detection
https://openaccess.thecvf.com/content_CVPR_2020/html/Pang_Multi-Scale_Interactive_Network_for_Salient_Object_Detection_CVPR_2020_paper.html
MIT License
237 stars 29 forks source link

Some Error #4

Closed CSer-Tang-hao closed 4 years ago

CSer-Tang-hao commented 4 years ago

This is an inspiring work, but when I try to train without any modify, I meet some trouble: [I:1279/131900][E:0:50]>[MINet_VGG16_e_40_lr_0.025_opti_f3trick_sche_Poly][Lr:0.0001000,0.0010000][Avg:0.40408|Cur:0.38437|['0.19423', '0.19013']] Exception in thread Thread-3: Traceback (most recent call last): File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/site-packages/prefetch_generator/init.py", line 80, in run for item in self.generator: File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 819, in next return self._process_data(data) File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data data.reraise() File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/site-packages/torch/_utils.py", line 385, in reraise raise self.exc_type(msg) RuntimeError: Caught RuntimeError in DataLoader worker process 2. Original Traceback (most recent call last): File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/th/anaconda3/envs/pytorch1.2.0/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch return self.collate_fn(data) File "/data/SOD/MINet/code/utils/imgs/create_loader_imgs.py", line 24, in _collate_fn mask = torch.stack(mask, dim=0) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 4 and 1 in dimension 1 at /tmp/pip-req-build-vxpey3tb/aten/src/TH/generic/THTensor.cpp:689

lartpang commented 4 years ago

The problem comes from here https://github.com/lartpang/MINet/blob/master/code/utils/imgs/create_loader_imgs.py#L19 . Because you need to ensure that the mask (https://github.com/lartpang/MINet/blob/master/code/utils/imgs/create_loader_imgs.py#L24) is a list of tensors with the same size, that is, the requirements of the stack function need to be met.

CSer-Tang-hao commented 4 years ago

The problem comes from here https://github.com/lartpang/MINet/blob/master/code/utils/imgs/create_loader_imgs.py#L19 . Because you need to ensure that the mask (https://github.com/lartpang/MINet/blob/master/code/utils/imgs/create_loader_imgs.py#L24) is a list of tensors with the same size, that is, the requirements of the stack function need to be met.

Thanks! I have sent you an email in the hope of further communication.