I teach a light neural network, which I give a pixel-by-pixel image (colors of pixels) to the input and I want to get the text in the picture (I pass it on when learning)

  • input neurons: height * picture width
  • output neurons: 6 (constant text length)

I fann_train($ann, inputs_array, outputs_array) with fann_train($ann, inputs_array, outputs_array) for each picture (I couldn’t understand how to work fann_train_on_data , but rather how to generate a training data resource)

Here's the question

Fann on the output neurons adjusts the weights (probabilities), how to get the finished text?

Possible stupid decision (please comment on it too)

Add 1 more to the input neurons (the index of the character I want to receive), and make the number of output neurons equal to the used alphovite and receive the text using it

Cons of my decision

  • New neurons are added, which means more memory
  • At least 6 times reduced training time and the program in general

Ps. I don’t think that code listings are required here, but if they are needed, I’ll add to the question (code on another keeper)

    1 answer 1

    Training with a teacher. Always at the output you will receive not the text, but the probability that you want to interpret as you like, for example, from 0 to 1. Then you can try to give the input width * the height of one digit to begin with, and the output will be - number of characters in the picture = count -in exits, in our case, let it be one. And we will try to teach this way, we can get numbers from 0 to 9 to the input, then we divide our probability (from 0 to 1 ) into equal intervals from 0.00 to 0.10, it will be "0", then if the probability is 0.03-0.07, then we define it well as "0", and so on we train with each number. (Further from 0.10 to 0.20 this is "1", if 0.13-0.17 fits, then ok, we will believe that "1", and at the edges it will be an error that we do not consider).

    Roughly speaking, we give the input "0" and teach the network to issue 0.05, take "2" and teach to issue 0.15, etc. You should also take into account the inaccuracy + -0.02

    Try first to learn one character at a time and then the whole alphabet, but I think it will be very slow to determine. And so there are different types of neural networks. Each task needs its own well-tuned one.

    • Can you demonstrate with a specific example? I break the picture (for example: prntscr.com/bmkk22 , after removing noise and resulting in black and white letters) on pixels and transfer color to the neural network and transfer what the network should output from this input (in this case: Ad4Yfm). - Victor Evlampiev