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?
Asked
Active
Viewed 7,050 times
1 Answers
2
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.
stmax
- 426
- 1
- 4
- 11
-
strangely, I have obtained better results by using black as background. Im not sure what is going on.. – dnth Aug 12 '15 at 09:14
-
What pixel value have you assigned to black? 0 or 255? If 0 is black, then the neural net should work fine. – stmax Aug 12 '15 at 09:55
-
yep zero is black. – dnth Aug 12 '15 at 10:35
-
1That'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. – stmax Aug 12 '15 at 11:23
-
I have images I want to train/predict where the background is bright and the characters are dark. If I train exclusively with this type of labelled data, could I still use the network architecture that is typically used to solve MNIST? – Jack Simpson Feb 21 '17 at 13:20
-
1@JackSimpson yes, the network's architecture can stay the same. Just train it with your own data. – stmax Feb 21 '17 at 13:57