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 0. Got 2560 and 1440 in dimension 2 at C:\w\1\s\tmp_conda_3.6_045031\conda\conda-bld\pytorch_1565412750030\work\aten\src\TH/generic/THTensor.cpp:689 #13

Closed mindmad closed 1 year ago

mindmad commented 3 years ago

Hello, @qinnzou I am faceing this problem is it possible to get any clarification on what I should do?

python train.py Setting up a new session... Without the incoming socket you cannot receive events from the server or register event handlers to your Visdom client. Loaded checkpoint: D:\test\deepcrack\DeepCrack-master\codes\checkpoints\DeepCrack_CT260_FT1.pth Epoch 1 --- Training --- :: 0%| | 0/202 [00:00<?, ?it/s] Traceback (most recent call last): File "train.py", line 197, in main() File "train.py", line 64, in main for idx, (img, lab) in bar: File "C:\Users\MadPC.conda\envs\deepcrack\lib\site-packages\tqdm\std.py", line 1178, in iter for obj in iterable: File "C:\Users\MadPC.conda\envs\deepcrack\lib\site-packages\torch\utils\data\dataloader.py", line 819, in next return self._process_data(data) File "C:\Users\MadPC.conda\envs\deepcrack\lib\site-packages\torch\utils\data\dataloader.py", line 846, in _process_data data.reraise() File "C:\Users\MadPC.conda\envs\deepcrack\lib\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 "C:\Users\MadPC.conda\envs\deepcrack\lib\site-packages\torch\utils\data_utils\worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "C:\Users\MadPC.conda\envs\deepcrack\lib\site-packages\torch\utils\data_utils\fetch.py", line 47, in fetch return self.collate_fn(data) File "C:\Users\MadPC.conda\envs\deepcrack\lib\site-packages\torch\utils\data_utils\collate.py", line 80, in default_collate return [default_collate(samples) for samples in transposed] File "C:\Users\MadPC.conda\envs\deepcrack\lib\site-packages\torch\utils\data_utils\collate.py", line 80, in return [default_collate(samples) for samples in transposed] File "C:\Users\MadPC.conda\envs\deepcrack\lib\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 2560 and 1440 in dimension 2 at C:\w\1\s\tmp_conda_3.6_045031\conda\conda-bld\pytorch_1565412750030\work\aten\src\TH/generic/THTensor.cpp:689

tungnlh commented 2 years ago

I have the same problem, how to solve it? @qinnzou @mindmad

qinnzou commented 1 year ago

You may need to check the path of the trained model. I

qinnzou commented 1 year ago

ywx980615 commented on Dec 31, 2021 I have tried a piece of code from Zhihu to solve this problem https://zhuanlan.zhihu.com/p/54389036?tdsourcetag=s_pctim_aiomsg The full code block is :

! npm install -g localtunnel get_ipython().system_raw('python3 -m pip install visdom') get_ipython().system_raw('python3 -m visdom.server -port 8097 >> visdomlog.txt 2>&1 &') get_ipython().system_raw('lt --port 8097 >> url.txt 2>&1 &') import time time.sleep(5) ! cat url.txt import visdom time.sleep(5) vis = visdom.Visdom(port='8097') print(vis) time.sleep(3) vis.text('testing') ! cat visdomlog.txt

I try this code in colab and insert it before test.py. It solve the problem of socket connection error.