Image-Forgery-using-Deep-Learning icon indicating copy to clipboard operation
Image-Forgery-using-Deep-Learning copied to clipboard

Error in runing train_MBN2_mod.py

Open Liuhailong2016 opened this issue 4 years ago • 1 comments

Hi. I used CASIA 2.0 dataset and train MBN2 model, in running train_MBN2_mod.py, the system raised the error as below:


Train on epoch 1 0%| | 0/19 [00:00<?, ?it/s] Traceback (most recent call last): File "train_MBN2_mod.py", line 163, in loss_train, acc_train, time_train = train_on_epoch( File "/home/rr-ubuntu/pythonproject/Image-Forgery-using-Deep-Learning/utils/learning.py", line 32, in train_on_epoch logits = model(X) File "/home/rr-ubuntu/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/home/rr-ubuntu/pythonproject/Image-Forgery-using-Deep-Learning/utils/models.py", line 217, in forward out = self.linear(out) File "/home/rr-ubuntu/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/home/rr-ubuntu/.local/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 93, in forward return F.linear(input, self.weight, self.bias) File "/home/rr-ubuntu/.local/lib/python3.8/site-packages/torch/nn/functional.py", line 1690, in linear ret = torch.addmm(bias, input, weight.t()) RuntimeError: mat1 dim 1 must match mat2 dim 0

How can I do for solving this problem?

Liuhailong2016 avatar Jun 25 '21 11:06 Liuhailong2016

I have solved this problem. The reason is the photos from CASIA 2.0 dataset is 384256, but the input of the netural network is 6464, so we should resize the image before training as below: image

Liuhailong2016 avatar Jun 30 '21 08:06 Liuhailong2016