Calamari-OCR / calamari

Line based ATR Engine based on OCRopy
Apache License 2.0
1.04k stars 209 forks source link

Model very sensitive on PNG input #336

Open junyizhao04 opened 1 year ago

junyizhao04 commented 1 year ago

I tried multiple size and source (photo from screen, paper, screenshot etc) and attempted to run it in Calamari OCR using the given model. However, the model is very sensitive towards input and only around 5% works. What is the expected PNG input size?

andbue commented 1 year ago

I don't think the input size matters that much. Please note that calamari is line based, it does not include code or models for segmentation tasks. As long as your images is cropped nicely around a single line or you provide coordinates via PAGE XML, it should work.

junyizhao04 commented 1 year ago

I don't think the input size matters that much. Please note that calamari is line based, it does not include code or models for segmentation tasks. As long as your images is cropped nicely around a single line or you provide coordinates via PAGE XML, it should work.

then I believe image like this may work, but it does not.

11

andbue commented 1 year ago

The uw3 dataset the model uw3-modern-english was trained on contains only binarised data, therefore the model struggles with colour or grayscale images. If you convert your image to monochrome, e.g. via convert online.png -monochrome online.bin.png, it's recognised perfectly.