Giter Club home page Giter Club logo

Comments (4)

faustomorales avatar faustomorales commented on August 21, 2024

First, thanks for trying out the package!

Getting detection to work well in this case is relatively easy but improving recognition will take more work.

On detection, because the text is so small upscaling is very important. The default upscaling of 2x works but because the image is so tall, you hit the default max_size limit too soon. I found setting that parameter to 4096 to be enough to get high quality text detection.

import matplotlib.pyplot as plt
import keras_ocr

image = keras_ocr.tools.read(
    'https://user-images.githubusercontent.com/25033310/74313656-fece6500-4d6b-11ea-8fae-082421897241.jpg'
)

pipeline = keras_ocr.pipeline.Pipeline(max_size=4096)
predictions = pipeline.recognize([image])[0]

fig, ax = plt.subplots()
keras_ocr.tools.drawAnnotations(image=image, predictions=predictions, ax=ax)

plotted predictions

The bounding boxes look pretty good -- but the text recognition is quite poor. To fix this, I think you'll need to get a dataset together of text that looks like that in your use case to train a custom recognizer. The good news is that it is much easier to train the recognizer than the detector! There's an example for fine tuning the detector in the documentation which I think you may want to adapt.

I'm going to close this now because it is not so much a bug in the package as it is a how-to question which I believe my comments above answer. If you run into problems with the example or with training the recognizer in general, please open a new issue.

from keras-ocr.

faustomorales avatar faustomorales commented on August 21, 2024

I forgot to run your second example, but that one actually does a little better.

import matplotlib.pyplot as plt
import keras_ocr

image = keras_ocr.tools.read(
    'https://user-images.githubusercontent.com/25033310/74313659-ffff9200-4d6b-11ea-907e-89bd0459f275.jpg'
)
pipeline = keras_ocr.pipeline.Pipeline(max_size=4096)
predictions = pipeline.recognize([image])[0]
fig, ax = plt.subplots()
keras_ocr.tools.drawAnnotations(image=image, predictions=predictions, ax=ax)

second example

from keras-ocr.

shekarneo avatar shekarneo commented on August 21, 2024

from keras-ocr.

faustomorales avatar faustomorales commented on August 21, 2024

Yes, that's correct -- it appears that you will need to obtain some real-world labeled data to train the recognizer for this use case.

from keras-ocr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.