CeiT-pytorch icon indicating copy to clipboard operation
CeiT-pytorch copied to clipboard

Changing in Image Size Problem

Open khawar-islam opened this issue 4 years ago • 3 comments

Hi @rishikksh20,

Thank you for your great work. When I give an image 224x224, it works fine. Then, I just changed image 224 to 112x112 and it gives an error. Any advice?

Code

"CeiT": CeiT(
        GPU_ID=GPU_ID,
        image_size=112,
        patch_size=4,
        dim=512,
        depth=20,
        num_classes=NUM_CLASS,
        heads=8,
        dropout=0.1,
        emb_dropout=0.1
        )

Traceback

    raise EinopsError(' Error while computing {!r}\n {}'.format(self, e))
einops.EinopsError:  Error while computing Rearrange('b c (h w) -> b c h w', h=14, w=14)
 Shape mismatch, 49 != 196

khawar-islam avatar Jul 06 '21 12:07 khawar-islam

Code is writing by making sure size should be 224 as mentioned in paper. In this line : https://github.com/rishikksh20/CeiT-pytorch/blob/d41cb23743fbb34c4354564a958f1d78de4e2770/module.py#L121 change w=7 and h=7 and do the same in this line : https://github.com/rishikksh20/CeiT-pytorch/blob/d41cb23743fbb34c4354564a958f1d78de4e2770/module.py#L127

rishikksh20 avatar Jul 06 '21 13:07 rishikksh20

@rishikksh20 Thank you. It works.

khawar-islam avatar Jul 06 '21 13:07 khawar-islam

Hello! my input picture is 256x256. After the change to h=16, w=16, an error of 7 is != 256, Any advice?

yuwanting828 avatar Nov 16 '22 14:11 yuwanting828