Ask Your Question

feeding feature vector from surf detector in neural network

asked 2013-08-17 00:19:23 -0600

VoidMee gravatar image

updated 2013-08-17 00:53:58 -0600

berak gravatar image

I want to implement Surf feature detector in neural network with python version of opencv.

What I did?

#surf feature detector
detector = cv2.SURF(400, 5, 5)

#feature detection
k1, d1 = detector.detectAndCompute(img1, None)
k2, d2 = detector.detectAndCompute(img2, None)

#shape of feature vectors
#d1 : 119 x 128
#d2 : 129 x 128

#neural network creation
nn = cv2.ANN_MLP(np.array([128, 128, 128, 4]), cv2.ANN_MLP_SIGMOID_SYM)

Now, I don't know how to use this varying number of rows in feature vector for different images.Also, do I have to normalize the feature vector before feeding into the neural network?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-08-17 03:31:35 -0600

AFAIK you will always have to limit the feature vectors to a standard size, like for example choose the first 50 features. All machine learning approaches demand the same size of input vectors for all images.

Normalizing the feature vector is a logical approach if you want to keep your data in a normalized range, which is done quite often in computer vision. However, this doesn't have to be, it is possible to apply ANN to unnormalized data also. The result however, will be influenced if the data has various value ranges.

edit flag offensive delete link more


I think in the above try out, the feature vector extracted for each image is "multidimensional" with "no. of rows varying but no. of cols always fixed which is 128". I created an ANN of 128 input nodes. Because for each image, I have more than one such input values how do I feed them.

VoidMee gravatar imageVoidMee ( 2013-08-17 09:33:34 -0600 )edit

Also I didn't get how to limit the feature vectors to a standard size. So, can you please help me how to do this?

VoidMee gravatar imageVoidMee ( 2013-08-17 09:35:40 -0600 )edit

So you have 128 input values for each point in an image? Which lead to a various number of rows, depending on the amount of points it find?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-17 13:41:51 -0600 )edit

yes, what should I do for those input values of an image before feed in to my ANN because I think for every single image there should be only one set of input values (feature vectors), isn't it

VoidMee gravatar imageVoidMee ( 2013-08-17 20:29:45 -0600 )edit

For ANN you need indeed 1 sequence of 128 values for each input image. Thats why surf and sift features are not that good for this. You should google papers that combine surf and sift and see what they do with the data.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-18 04:00:33 -0600 )edit

Question Tools


Asked: 2013-08-17 00:19:23 -0600

Seen: 962 times

Last updated: Aug 17 '13