adil asked . 2021-06-30
Extracting Corner Features with PCA and feeding it to neural network
I am doing a project on vehicle type classification with Neural Networks( classification basis is => sedan,pick up,hatchback,etc type vehicles.)
I am doing image processing for the first time and I have detected about 40 corners using Harris Edge Detection and thus I got a matrix A[40x2].
I am using only this feature as for classification.
Now I want to know how can I use PCA to extract features from it.I know what PCA is and what pca(A) or princomp(A)in matlab will return but I dont get how to use the output of pca function as a feature matrix.
1.Does a feature matrix need to be 1-D array.
2.Should I use principle components array which is the 2nd matrix returned by pca function as a feature matrix (its a 2-D matrix)
3.How can I train Neural Network for 3 classes(hatchback,sedan and pickup).
4.Lastly suppose I have N images for each class to train so do I need to train on each image individually or do I have to create a feature matrix that has a extra dimension = N.
principal componen... , neural network , class , classification , training , pca, digital image pro
Neeta Dsouza answered . 2024-11-13 16:33:45
% Extracting Corner Features with PCA and feeding it to neural network
% Asked by Adil about 2 hours ago
% I am doing a project on vehicle type classification with Neural Networks( % classification basis is => sedan,pick up,hatchback,etc type vehicles.) % % I am doing image processing for the first time and I have detected about % 40 corners using Harris Edge Detection and thus I got a matrix A[40x2].
A = A(:); % Convert to an 80 dim column
%I am using only this feature as for classification.
%Now I want to know how can I use PCA to extract features from it.I know what PCA is and what %pca(A) or princomp(A)in matlab will return but I dont get how to use the output of pca function %as a feature matrix.
You are on the wrong track
1. Use PCA on all of the data to determine the ranking of orthogonal directions in which the data has the most spread. This is very useful for regression/curve-fitting but not necessarily for classification/pattern-recognition where the importance is on ranking directions of class separation, not total mixture spread.
2. The function PLS is the feature ranking function which is more appropo. I am struggling with it's use because I have not found an explanation which I fully understand. So, I do use PCA even though I know better.
3. I prefer using STEPWISEFIT, the linear model variable reduction function. It's suboptimal but does a great job of ranking the original variables (not orthogonal tranformed ones) for a linear model.
4. So, currently I use STEPWISEFIT However, if the dimensionality is huge,I may use PCA to get rid of obvious losers before using STEPWISEFIT.
5. It is not too hard to code a poor man's stepwise procedure where, for I input variables, performance is obtained when one of the variables is fixed at it's mean value. The variable associated with the best performance is deleted , the net is retrained, and the process is repeated. The procedure is ad hoc and has many variations. Nevertheless, variations are being used, satisfactorily, in real world situations.
% 1.Does a feature matrix need to be 1-D array.
Yes. A feature vector.
%2.Should I use principle components array which is the 2nd matrix returned by pca function as a feature matrix (its a 2-D matrix)
It would not be my first choice. See above.
% 3.How can I train Neural Network for 3 classes(hatchback,sedan and pickup).
Generate many feature vectors for each class (e.g. add noise to the ideal template). Use unit vector columns with a single 1 as targets.
help patternnet
practice on MATLAB classification/pattern-recognition datasets
help nndatasets
Search in NEWSGROUP and ANSWERS
greg patternnet
% 4.Lastly suppose I have N images for each class to train so do I need to train on each image % individually or do I have to create a feature matrix that has a extra dimension = N.
Not satisfied with the answer ?? ASK NOW