LPRNet_Pytorch icon indicating copy to clipboard operation
LPRNet_Pytorch copied to clipboard

batch size will affect test accuracy

Open Wenboisstrong opened this issue 4 years ago • 8 comments

When I test my model with test batch size = 128, the result is better than batch size = 1. Why? I have set model.eval () Can anyone answer my doubts Thanks

Wenboisstrong avatar Apr 27 '20 05:04 Wenboisstrong

I’m dealing with the same problem as you.

pppnkn avatar Jul 01 '20 10:07 pppnkn

https://blog.csdn.net/weixin_39027619/article/details/106143755 @pppnkn you can see this blog

Wenboisstrong avatar Jul 01 '20 10:07 Wenboisstrong

Thank you so much @Wenboisstrong

pppnkn avatar Jul 01 '20 10:07 pppnkn

Hi @Wenboisstrong I already try the code in your link. But the model result is not good ... training/validation loss is very very high, compared with the code from sirius-ai. Do you have this problem.

Note that my data is not chinese license plates.

pppnkn avatar Jul 02 '20 07:07 pppnkn

@pppnkn In fact, I trained the repository used by lprnet and raised the issue https://github.com/xuexingyu24/License_Plate_Detection_Pytorch/issues/22 This repository has a stn module. The code I tested on my data set solved the problem of. I don't think the code is only valid for Chinese license plates. What is the accuracy of your data set? I offer you two ideas. First, if your accuracy is low, you can consider the problem of the data set. If the accuracy is >90%, you can use the stn module. Second, you consider modifying the problem I mentioned in the above link. About (torch.mean(f_pow)) by modifying the calculation to get [basth,mean] to improve the problem.

Wenboisstrong avatar Jul 02 '20 08:07 Wenboisstrong

@pppnkn When I first tried to modify the model, I tested a lot of sub-models. They usually only have an accuracy rate of 90%~95%. But as I said in the blog, after modifying the code by referring to intel, it reached 97%. In my data, maybe I There are still some problems with the changes made. If you find it, please let me know

Wenboisstrong avatar Jul 02 '20 08:07 Wenboisstrong

Hi @Wenboisstrong. Based on the code from sirius-ai (without stn module) the valiadation loss is ~0.04. The accuracy are ~90% and 93% for batch size are 1 and 64 respectively. However when I use the code from https://blog.csdn.net/weixin_39027619/article/details/106143755 the validation loss is ~0.7 (I have not run accuracy yet but it should be low for sure).

pppnkn avatar Jul 03 '20 03:07 pppnkn

加载数据得时候random.shuffle(self.img_paths) 这句话注销就可以了,不注销,每一批数据,数据得顺序是不一样的

babyta avatar Apr 02 '21 09:04 babyta