MNIST dataset, what is this condition?

时间:2018-02-03 11:01:02

标签: python opencv mnist

What is this number 0.88 in training mnist dataset

bw=((color.rgb2gray(mnist_picture)/255.0)>0.88).astype('uint8')

Thanks

1 个答案:

答案 0 :(得分:2)

There are 2 conversions in that line: colour -> greyscale -> black & white.

The first conversion, from colour to greyscale, is performed using the

rgb2gray(...)

function.

The second conversion, from greyscale to black & white, is done by thresholding the range of greys so that any dark grey colour (with value > 0.88) is converted to black, and the others to white.

The 0.88 is an arbitrary value. Any threshold value that makes the converted black & white characters legible would be just as valid to use. Try experimenting with a few different threshold values to see their effect.