qinnzou / DeepCrack

DeepCrack: Learning Hierarchical Convolutional Features for Crack Detection
253 stars 60 forks source link

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 600 and 592 in dimension 2 #31

Open khandriod opened 2 weeks ago

khandriod commented 2 weeks ago

I can not solve this error. Could you please tell me what could be the problem?

command ``python train.py```

**Dir layout*** data/ ├── CrackTree │   ├── crack_plus_test_image │   ├── crack_plus_test_mask │   ├── crack_train_image │   └── crack_train_mask ├── pycache ├── test.txt ├── train.txt ├── train_example.txt └── val_example.txt

Environment

Python = 3.6
Cuda=10.0
Pytorch= conda install pytorch torchvision cudatoolkit=10.0 -c pytorch-nightly
Setting up a new session...
Without the incoming socket you cannot receive events from the server or register event handlers to your Visdom client.
Epoch 1 --- Training --- ::   0%|                                                                                                                                        | 0/164 [00:00<?, ?it/s]/home/ukhan18/anaconda3/envs/xmod/lib/python3.6/site-packages/torch/nn/functional.py:2494: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
  "See the documentation of nn.Upsample for details.".format(mode))
Epoch 1 --- Training --- ::   0%|                                                                                                                                        | 0/164 [10:59<?, ?it/s]
Traceback (most recent call last):
  File "train.py", line 197, in <module>
    main()
  File "train.py", line 66, in main
    pred = trainer.train_op(data, target)
  File "/home/ukhan18/DeepCrack/codes/trainer.py", line 39, in train_op
    pred_output, pred_fuse5, pred_fuse4, pred_fuse3, pred_fuse2, pred_fuse1, = self.model(input)
  File "/home/ukhan18/anaconda3/envs/xmod/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/ukhan18/anaconda3/envs/xmod/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward
    return self.module(*inputs[0], **kwargs[0])
  File "/home/ukhan18/anaconda3/envs/xmod/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/ukhan18/DeepCrack/codes/model/deepcrack.py", line 155, in forward
    output = self.final(torch.cat([fuse5,fuse4,fuse3,fuse2,fuse1],1))
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 600 and 592 in dimension 2 at /tmp/pip-req-build-ocx5vxk7/aten/src/THC/generic/THCTensorMath.cu:71