0

hi;
i need to know that how to convert an image to a vector for neural networks.
please help

3
Contributors
5
Replies
7
Views
7 Years
Discussion Span
Last Post by dusktreader
0

Search the forum first. I'm pretty sure whether its for a neural network or anything else is immaterial. What you want to know is how to convert an image to a vector, period. Am I right?

0

Search the forum first. I'm pretty sure whether its for a neural network or anything else is immaterial. What you want to know is how to convert an image to a vector, period. Am I right?

yes you are right i want to know is how to convert an image to a vector

1

First of all, you need to have the image data stored in some sort of serially accessible data structure. Lets suppose that you have the image data in an array of floats.

Next, you need to scale your data to a specific range. Often, this range is the interval [0,1.0). However, some activation/squashing function combinations do better with different input ranges. It may be more appropriate to choose the (-1.0, 1.0 ) interval. Your choice of scaling method could also be significant. Often, you will want to normalize the pixel values to a specific range. The easiest approach is to scale each value by 1.0 / MaxPixelValue ( usually 1.0 / 255 ). However, it is usually better to do a min/max nomralization.

Once you have your normalized image data in a serially accessible data structure, all you need to do is step through it and assign each pixel value to an input node (or, with some ANNs, pass the array to the train/classify function).

One thing you should be sure to note: Neural nets are extremely sensitive to affine transformations of image data. So, rotations, displacements, and scalings will confuse your ANN. To combat this problem, you either need a method to correct affine transformations before classification, or you need a method to convert raw pixel data into another form that is invariant to these affine transformations.

0

Thanks alot for your help.
do you have some code for this in matlab? i m new in this field. sooo please if you colud provide me some code for understanding as well i will b grateful.
regards

0

Thanks alot for your help.
do you have some code for this in matlab? i m new in this field. sooo please if you colud provide me some code for understanding as well i will b grateful.
regards

Sorry, I use c++ with OpenCV for this sort of thing.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.