N
N
Nikita2022-03-12 12:57:10
Neural networks
Nikita, 2022-03-12 12:57:10

Why does the neural network correctly recognize only data from MNIST?

I am implementing a neural network for digit recognition in pure C++ (only for educational purposes). I decided to use MNIST as data . I took 60,000 images for training, 10,000 for testing . Wrote a neural network, wrote back propagation, a minute of training and data for testing are recognized with a probability of 92.69% ( 9 269 / 10 000 ). After that, I decided to test the neural network on my own images. Opened GIMP , wrote the numbers from 0 to 9 in white on a black background, exported to PBMformat, and then loaded into the program. I checked the correctness of loading the image, the image was loaded into the array of colors correctly. I run the neural network and see that the correct results appear with a probability of 10-20% , that is, not much better than a random choice. What to do? What could be the reason?

Neural network topology:

  • Input layer - 784 neurons ( 28 * 28 )
  • Hidden layer 1 - 16 neurons
  • Hidden layer 2 - 16 neurons
  • Output layer - 10 neurons (each neuron for each digit)


I understand that it is unlikely that anyone will be too lazy to look at the code and what I did there, but just in case, here is a link .

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita, 2022-03-20
@gth-other

I decided to match my images and images from MNIST. It turned out that the numbers in my images are of different sizes, written in different parts of the picture, and the numbers from MNIST are approximately the same size and written exactly in the center. That is why it is easy for a neural network to determine the numbers from MNIST'a and so difficult to determine mine. The solution to the problem lies in the transition from multilayer perceptrons to convolutional neural networks.

R
rPman, 2022-03-12
@rPman

most likely the network has retrained
a known misfortune for neural networks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question