In the MNIST dataset, are the images on white or black background? I seem to have encounter both type of images by googling around. Does the background color has any effects on the performance of a neural network in a recognition task?
1 Answer
The home of the MNIST dataset is at http://yann.lecun.com/exdb/mnist/
The page says: "Pixel values are 0 to 255. 0 means background (white), 255 means foreground (black)."
What matters to a neural net are the pixel values 0 (background) and 255 (foreground), though you can assign different colors to these pixel values when plotting the images.
A neural net trained on images with 0 as background and 255 as foreground will not be able to recognize images with inverted colors. You'd have a train a neural net on both types of images if you want it to work on both.
-
$\begingroup$ strangely, I have obtained better results by using black as background. Im not sure what is going on.. $\endgroup$– dnthAug 12, 2015 at 9:14
-
$\begingroup$ What pixel value have you assigned to black? 0 or 255? If 0 is black, then the neural net should work fine. $\endgroup$– stmaxAug 12, 2015 at 9:55
-
-
1$\begingroup$ That's why the neural net works.. it doesn't know about colors, only about pixel values (0 - 255). As long as the background is 0 and the digits are 255 it will work, no matter what color you assign to foreground/background. $\endgroup$– stmaxAug 12, 2015 at 11:23
-
1$\begingroup$ @JackSimpson yes, the network's architecture can stay the same. Just train it with your own data. $\endgroup$– stmaxFeb 21, 2017 at 13:57