polarisZhao / PFLD-pytorch

PFLD pytorch Implementation
808 stars 198 forks source link

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 188 and 156 in dimension 2 at /pytorch/aten/src/TH/generic/THTensor.cpp:689 #15

Closed wyuzyf closed 4 years ago

wyuzyf commented 4 years ago

您好,非常感谢你的工作。 我在运行train.py的时候遇到了上面这个问题。具体的错误如下:Traceback (most recent call last):

File "train.py", line 232, in main(args) File "train.py", line 173, in main criterion, epoch) File "train.py", line 85, in validate for img, landmark_gt, attribute_gt, euler_angle_gt in wlfw_val_dataloader: File "/home//anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 819, in next return self._process_data(data) File "/home//anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data data.reraise() File "/home//anaconda3/lib/python3.6/site-packages/torch/_utils.py", line 369, in reraise raise self.exc_type(msg) RuntimeError: Caught RuntimeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch return self.collate_fn(data) File "/hom/anaconda3/lib/python3.6/site-packages/torch/utils/data/_utils/collate.py", line 80, in default_collate return [default_collate(samples) for samples in transposed] File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/_utils/collate.py", line 80, in return [default_collate(samples) for samples in transposed] File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/_utils/collate.py", line 56, in default_collate return torch.stack(batch, 0, out=out) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 188 and 156 in dimension 2 at /pytorch/aten/src/TH/generic/THTensor.cpp:689

wyuzyf commented 4 years ago

我已经解决了这个。因为您分数据集的时候与tensorflow版本有些不同,谢谢您分享的代码