xmindflow / deformableLKA

[WACV 2024] Beyond Self-Attention: Deformable Large Kernel Attention for Medical Image Segmentation
https://arxiv.org/abs/2309.00121
157 stars 12 forks source link

processing 12% and then error #20

Closed 10dutel closed 3 months ago

10dutel commented 3 months ago

When training synapse data in 2D, processing 12% and then error:

Traceback (most recent call last): File "train_MaxViT_deform_LKA.py", line 134, in trainer[dataset_name](args, net, args.output_dir) File "/home/sjh/mydisk/project/deformableLKA/2D/trainer_MaxViT_deform_LKA.py", line 168, in trainer_synapse image = image_batch[1, 0:1, :, :] IndexError: index 1 is out of bounds for dimension 0 with size 1

Who can handle this problem?

Leonngm commented 3 months ago

Hi, If you use a batchsize and datasetsize, that could lead to a single image remaining at the end of the epoch, this error will occur. Change image = image_batch[1, 0:1, :, :] to image = image_batch[0, 0:1, :, :] and it should be solved. Same for image = image_batch[1, 0:1, :, :] change to image = image_batch[1, :, :, :] Best