1
$\begingroup$

I have seen many examples online regarding the MNIST dataset, but it's all in black and white. In that case, a 2D array can be constructed where the values at each array element represent the intensity of the corresponding pixel. However, what if I want to do colored images? What's the best way to represent the RGB data?

There's a very brief discussion of it here, which I quote below. However, I still don't get how the RGB data should be organized. Additionally, is there some OpenCV library/command we should use to preprocess the colored images?

the feature detectors in the second convolutional-pooling layer have access to all the features from the previous layer, but only within their particular local receptive field*

*This issue would have arisen in the first layer if the input images were in color. In that case we'd have 3 input features for each pixel, corresponding to red, green and blue channels in the input image. So we'd allow the feature detectors to have access to all color information, but only within a given local receptive field.

$\endgroup$
2
  • $\begingroup$ Please do not cross-post :) $\endgroup$
    – Dawny33
    Jan 4, 2016 at 11:59
  • $\begingroup$ Sorry about that. What's the difference between the two? I will delete this one. $\endgroup$
    – FullStack
    Jan 5, 2016 at 10:23

1 Answer 1

3
$\begingroup$

Normally you represent each colour channel as a feature map.

So (if you follow pylearn conventions) your input will have shape (n_samples, 3, size_y, size_x). Since images are usually stored colour-channel last (n_images, size_y, size_x, 3), in python you usually reformat your image collection with feature_maps = np.rollaxis(image_collection, 3, 1)

$\endgroup$
1
  • $\begingroup$ Awesome, I'll be sure the axes match next time! $\endgroup$
    – FullStack
    Jan 9, 2016 at 1:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.