ku21fan / STR-Fewer-Labels

Scene Text Recognition (STR) methods trained with fewer real labels (CVPR 2021)
MIT License
173 stars 27 forks source link

size mismatch for module.prediction.weight/bias #15

Closed AtiBabaie closed 1 year ago

AtiBabaie commented 1 year ago

Hi,

I have done the pre-train and train part with no errors and got pretty good accuracy. but for the test part I have got this error that says the torch size is different of 216 and 218. you can see the full error below. I would appreciate any help. Thanks in advance.

test error:

4_test_3 4_test_2

train accuracy:

4_train_23

ku21fan commented 1 year ago

Hi,

Glad to hear that your training went well!

This error indicates a discrepancy in the number of character classes. From your error message, your trained model used 216 for character classes, but in your test code, # of tokens and characters: 218 From this, I guess your test code uses 2 additional characters compared to the training code.

Please check the character set of your train.py and test.py

Hope it helps, Jeonghun

AtiBabaie commented 1 year ago

Thank you Jeonghun,

Yes, I've realized that, the character sets were different and I fixed it and got the test accuracy too. :) but I have another question. There are 2 characters that exist in the character set but it shows unknown in the output. As you can see in train accuracy image up there. The 2 characters are : آ and ئـ I think the net consider each as 2 separated character. cause the output is : ا + ~ on the top of it. And same for the latter one. here is another example :

4_train_18

Do you have any idea on this case? Thanks again.

ku21fan commented 1 year ago

Hi Ati,

I am not familiar with the Arabic language, so I am not sure what is an effective solution. I guess the below part separates آ into two characters. https://github.com/ku21fan/STR-Fewer-Labels/blob/e6aa817e2eacbf29b3fcd11390d78b1a8f96bf78/utils.py#L52

In my opinion, there is a workaround using substitute characters for آ and ئـ as shown in the below issue (2) https://github.com/clovaai/deep-text-recognition-benchmark/issues/85#issuecomment-592019386

Hope it helps, Jeonghun

AtiBabaie commented 1 year ago

Yes, thank you so much. :)