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?
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:
