You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
UCTransNet
transformer head num: 4
transformer layers num: 4
transformer expand ratio: 4
Let's use 2 GPUs!
log dir:
========= Epoch [1/2001] =========
Test_session_09.13_13h31
Training with batch size : 4
Traceback (most recent call last):
File ".\train.py", line 187, in <module>
model = main_loop(model_type=config.model_name, tensorboard=True)
File ".\train.py", line 135, in main_loop
train_one_epoch(train_loader, model, criterion, optimizer, writer, epoch, None, model_type, logger)
File "D:\Projects\Crack\UCTransNet\Train_one_epoch.py", line 70, in train_one_epoch
preds = model(images)
File "C:\Users\techno v\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\techno v\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\parallel\data_parallel.py", line 168, in forward
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "C:\Users\techno v\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\parallel\data_parallel.py", line 178, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "C:\Users\techno v\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\parallel\parallel_apply.py", line 86, in parallel_apply
output.reraise()
File "C:\Users\techno v\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\_utils.py", line 425, in reraise
raise self.exc_type(msg)
RuntimeError: Caught RuntimeError in replica 0 on device 0.
Original Traceback (most recent call last):
File "C:\Users\techno v\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\parallel\parallel_apply.py", line 61, in _worker
output = module(*input, **kwargs)
File "C:\Users\techno v\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "D:\Projects\Crack\UCTransNet\models\UCTransNet.py", line 123, in forward
x1,x2,x3,x4,att_weights = self.mtc(x1,x2,x3,x4)
File "C:\Users\techno v\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "D:\Projects\Crack\UCTransNet\models\CTrans.py", line 348, in forward
emb1 = self.embeddings_1(en1)
File "C:\Users\techno v\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "D:\Projects\Crack\UCTransNet\models\CTrans.py", line 43, in forward
embeddings = x + self.position_embeddings
RuntimeError: The size of tensor a (1600) must match the size of tensor b (196) at non-singleton dimension 1
The text was updated successfully, but these errors were encountered:
Hi, please check your image size, the size we used in the code is 224*224, so the number of patches is (224/16)^2=196. If you do not want to resize your images, you can change the "img_size" parameter in "Config.py". Hope this can help!
I tried to train model but got error:
The text was updated successfully, but these errors were encountered: