S
S
Sergey Sokolov2020-07-24 16:09:53
Machine learning
Sergey Sokolov, 2020-07-24 16:09:53

Explain OCR on fingers: how to parse a sequence of letters?

I understand how a classifier that parses single characters works. The same handwritten MNIST. For my task, I built a primitive model that perfectly copes with my particular task: a certain font, only 21 characters in the alphabet - individual characters are recognized with a bang.

font and model

an example of my font, generated pictures for training: 5f1ade692159c927788503.png

Primitive model. 21 class:
model = tf.keras.models.Sequential([
  tf.keras.layers.Flatten(input_shape=(28, 28, 1)),
  tf.keras.layers.Dense(128,activation='relu'),
  tf.keras.layers.Dense(21, activation='softmax')
])
model.compile(
    loss='categorical_crossentropy',
    optimizer=tf.keras.optimizers.Adam(0.001),
    metrics=['accuracy'],
)


I can't "drive in" how to parse the sequence: a line of text.

The length of the string is known and constant: 11 characters. Dictionary not applicable: these are serial numbers.
Examples

source: 5f1ae201d5bc0047129645.jpeg
processed: 5f1ae0ec63189702935962.png
generated:5f1ae21bb40fb400598031.jpeg


From what I read , I realized that it is necessary to convolutionally “go with your eyes” along the line in small steps, trying to identify the symbol “in the frame” at each.
5f1adc9bd3958190996124.png

I can't figure out how to build the final string from a set of output assumptions. After all, a symbol can be repeated on several adjacent frames. Some left options can be assumed between symbols with low confidence. They write about the CTC loss function (Connectionist Temporal Classification), but there is training on a large amount of examples. And I have a complete enumeration of all combinations of the alphabet.

I want to implement it myself, without OpenCV, Tesseract and Keras-OCR. Only TensorFlow, Keras, hard- softcore.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question