Giter Club home page Giter Club logo

Comments (5)

ChWick avatar ChWick commented on June 18, 2024

It is not surprising that a model trained on white characters and black background cannot be used to predict the inverse. The model can only predict what it knowns: Usually this should be black foreground and white background in the case of Calamari.
Calamari does not support color features, since it converts all data to grayscale. However, you need to train on gray-scale images in order to receive meaningful results.

The actual prediction time for predicting a single line are about 0.3 Seconds per line on a single CPU. I guess most of the time is needed to load the model, however this must only be done once. Thus, to reach these times, you must manually create and store a calamari_ocr.ocr.Predictor-Object and initialize it. Then use this model to predict a line:
E. g. (but untested)

from calamari_ocr.ocr import Predictor, create_dataset, DataSetType, DataSetMode

# Load (only once)
predictor = Predictor('PATH_TO_THE_MODEL_WITHOUT_EXT')

# Predict
data = create_dataset(
  DataSetType.RAW,  # if you already have np.arrays or DataSetType.File to load from the filesystem
  DataSetMode.PREDICT,
  images=[raw_image_or_path_to_image],
)
prediction, _ = list(predictor.predict_dataset(data))[0]

from calamari.

lianganwei1994 avatar lianganwei1994 commented on June 18, 2024

thank you for response.

from calamari.

lianganwei1994 avatar lianganwei1994 commented on June 18, 2024

well,i've already create a data like this :
data=FileDataSet(DataSetMode.PREDICT,input_image_files) or
data=RawDataSet(DataSetMode.PREDICT,images)
the first one works well,input_image_files=path to the images(str)
my question is about the second one, the description of the parameter images is the list of images,Is that mean the np.arrays of the image or the list of np.arrays?

from calamari.

ChWick avatar ChWick commented on June 18, 2024

images is a list of np.array's for a RawDataSet

from calamari.

lianganwei1994 avatar lianganwei1994 commented on June 18, 2024

that's great,thank you!!!

from calamari.

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.