Dimensionality reduction in HOG feature vector












2















I found out the HOG feature vector of the following image in MATLAB.



Input Image



I used the following code.



I = imread('input.jpg');
I = rgb2gray(I);
[features, visualization] = extractHOGFeatures(I,'CellSize',[16 16]);


features comes out to be a 1x1944 vector and I need to reduce the dimensionality of this vector (say to 1x100), what method should I employ for the same?



I thought of Principal Component Analysis and ran the following in MATLAB.



prinvec = pca(features);  


prinvec comes out to be an empty matrix (1944x0). Am I doing it wrong? If not PCA, what other methods can I use to reduce the dimension?










share|improve this question




















  • 2





    No. Not PCA. Not again. This won't work. You have only 1 observation and almost 2k features. Impossible. Please see this canonical answer as to why this is pertinently impossible.

    – Adriaan
    Jan 29 '16 at 11:52











  • @Adriaan Thanks man. I just realized what I should really do. I should loop through each frame of the video and form a Nx1944 HOG matrix and then apply PCA. Is that right?

    – Abdul Fatir
    Jan 29 '16 at 12:14











  • Possibly, if N > 1e4, see my answer I linked on why you need some 5 times more observations than features.

    – Adriaan
    Jan 29 '16 at 12:17











  • Yes, can you write everything you mentioned as an answer so that I can mark it as an answer.

    – Abdul Fatir
    Jan 29 '16 at 12:19











  • what features are you trying to extract and what is your ultimate goal? looping through the video and applying PCA to the final feature matrix will not necessarily give you what you want

    – GameOfThrows
    Jan 29 '16 at 12:19
















2















I found out the HOG feature vector of the following image in MATLAB.



Input Image



I used the following code.



I = imread('input.jpg');
I = rgb2gray(I);
[features, visualization] = extractHOGFeatures(I,'CellSize',[16 16]);


features comes out to be a 1x1944 vector and I need to reduce the dimensionality of this vector (say to 1x100), what method should I employ for the same?



I thought of Principal Component Analysis and ran the following in MATLAB.



prinvec = pca(features);  


prinvec comes out to be an empty matrix (1944x0). Am I doing it wrong? If not PCA, what other methods can I use to reduce the dimension?










share|improve this question




















  • 2





    No. Not PCA. Not again. This won't work. You have only 1 observation and almost 2k features. Impossible. Please see this canonical answer as to why this is pertinently impossible.

    – Adriaan
    Jan 29 '16 at 11:52











  • @Adriaan Thanks man. I just realized what I should really do. I should loop through each frame of the video and form a Nx1944 HOG matrix and then apply PCA. Is that right?

    – Abdul Fatir
    Jan 29 '16 at 12:14











  • Possibly, if N > 1e4, see my answer I linked on why you need some 5 times more observations than features.

    – Adriaan
    Jan 29 '16 at 12:17











  • Yes, can you write everything you mentioned as an answer so that I can mark it as an answer.

    – Abdul Fatir
    Jan 29 '16 at 12:19











  • what features are you trying to extract and what is your ultimate goal? looping through the video and applying PCA to the final feature matrix will not necessarily give you what you want

    – GameOfThrows
    Jan 29 '16 at 12:19














2












2








2


1






I found out the HOG feature vector of the following image in MATLAB.



Input Image



I used the following code.



I = imread('input.jpg');
I = rgb2gray(I);
[features, visualization] = extractHOGFeatures(I,'CellSize',[16 16]);


features comes out to be a 1x1944 vector and I need to reduce the dimensionality of this vector (say to 1x100), what method should I employ for the same?



I thought of Principal Component Analysis and ran the following in MATLAB.



prinvec = pca(features);  


prinvec comes out to be an empty matrix (1944x0). Am I doing it wrong? If not PCA, what other methods can I use to reduce the dimension?










share|improve this question
















I found out the HOG feature vector of the following image in MATLAB.



Input Image



I used the following code.



I = imread('input.jpg');
I = rgb2gray(I);
[features, visualization] = extractHOGFeatures(I,'CellSize',[16 16]);


features comes out to be a 1x1944 vector and I need to reduce the dimensionality of this vector (say to 1x100), what method should I employ for the same?



I thought of Principal Component Analysis and ran the following in MATLAB.



prinvec = pca(features);  


prinvec comes out to be an empty matrix (1944x0). Am I doing it wrong? If not PCA, what other methods can I use to reduce the dimension?







matlab machine-learning computer-vision pca






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 29 '16 at 21:55









rayryeng

82.7k17111139




82.7k17111139










asked Jan 29 '16 at 11:35









Abdul FatirAbdul Fatir

4,06721642




4,06721642








  • 2





    No. Not PCA. Not again. This won't work. You have only 1 observation and almost 2k features. Impossible. Please see this canonical answer as to why this is pertinently impossible.

    – Adriaan
    Jan 29 '16 at 11:52











  • @Adriaan Thanks man. I just realized what I should really do. I should loop through each frame of the video and form a Nx1944 HOG matrix and then apply PCA. Is that right?

    – Abdul Fatir
    Jan 29 '16 at 12:14











  • Possibly, if N > 1e4, see my answer I linked on why you need some 5 times more observations than features.

    – Adriaan
    Jan 29 '16 at 12:17











  • Yes, can you write everything you mentioned as an answer so that I can mark it as an answer.

    – Abdul Fatir
    Jan 29 '16 at 12:19











  • what features are you trying to extract and what is your ultimate goal? looping through the video and applying PCA to the final feature matrix will not necessarily give you what you want

    – GameOfThrows
    Jan 29 '16 at 12:19














  • 2





    No. Not PCA. Not again. This won't work. You have only 1 observation and almost 2k features. Impossible. Please see this canonical answer as to why this is pertinently impossible.

    – Adriaan
    Jan 29 '16 at 11:52











  • @Adriaan Thanks man. I just realized what I should really do. I should loop through each frame of the video and form a Nx1944 HOG matrix and then apply PCA. Is that right?

    – Abdul Fatir
    Jan 29 '16 at 12:14











  • Possibly, if N > 1e4, see my answer I linked on why you need some 5 times more observations than features.

    – Adriaan
    Jan 29 '16 at 12:17











  • Yes, can you write everything you mentioned as an answer so that I can mark it as an answer.

    – Abdul Fatir
    Jan 29 '16 at 12:19











  • what features are you trying to extract and what is your ultimate goal? looping through the video and applying PCA to the final feature matrix will not necessarily give you what you want

    – GameOfThrows
    Jan 29 '16 at 12:19








2




2





No. Not PCA. Not again. This won't work. You have only 1 observation and almost 2k features. Impossible. Please see this canonical answer as to why this is pertinently impossible.

– Adriaan
Jan 29 '16 at 11:52





No. Not PCA. Not again. This won't work. You have only 1 observation and almost 2k features. Impossible. Please see this canonical answer as to why this is pertinently impossible.

– Adriaan
Jan 29 '16 at 11:52













@Adriaan Thanks man. I just realized what I should really do. I should loop through each frame of the video and form a Nx1944 HOG matrix and then apply PCA. Is that right?

– Abdul Fatir
Jan 29 '16 at 12:14





@Adriaan Thanks man. I just realized what I should really do. I should loop through each frame of the video and form a Nx1944 HOG matrix and then apply PCA. Is that right?

– Abdul Fatir
Jan 29 '16 at 12:14













Possibly, if N > 1e4, see my answer I linked on why you need some 5 times more observations than features.

– Adriaan
Jan 29 '16 at 12:17





Possibly, if N > 1e4, see my answer I linked on why you need some 5 times more observations than features.

– Adriaan
Jan 29 '16 at 12:17













Yes, can you write everything you mentioned as an answer so that I can mark it as an answer.

– Abdul Fatir
Jan 29 '16 at 12:19





Yes, can you write everything you mentioned as an answer so that I can mark it as an answer.

– Abdul Fatir
Jan 29 '16 at 12:19













what features are you trying to extract and what is your ultimate goal? looping through the video and applying PCA to the final feature matrix will not necessarily give you what you want

– GameOfThrows
Jan 29 '16 at 12:19





what features are you trying to extract and what is your ultimate goal? looping through the video and applying PCA to the final feature matrix will not necessarily give you what you want

– GameOfThrows
Jan 29 '16 at 12:19












1 Answer
1






active

oldest

votes


















5














You can't do PCA on this, since you have more features than your single observation. Get more observations, some 10,000 presumably, and you can do PCA.



See PCA in matlab selecting top n components for the more detailed and mathematical explanation as to why this is the case.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35083533%2fdimensionality-reduction-in-hog-feature-vector%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    You can't do PCA on this, since you have more features than your single observation. Get more observations, some 10,000 presumably, and you can do PCA.



    See PCA in matlab selecting top n components for the more detailed and mathematical explanation as to why this is the case.






    share|improve this answer






























      5














      You can't do PCA on this, since you have more features than your single observation. Get more observations, some 10,000 presumably, and you can do PCA.



      See PCA in matlab selecting top n components for the more detailed and mathematical explanation as to why this is the case.






      share|improve this answer




























        5












        5








        5







        You can't do PCA on this, since you have more features than your single observation. Get more observations, some 10,000 presumably, and you can do PCA.



        See PCA in matlab selecting top n components for the more detailed and mathematical explanation as to why this is the case.






        share|improve this answer















        You can't do PCA on this, since you have more features than your single observation. Get more observations, some 10,000 presumably, and you can do PCA.



        See PCA in matlab selecting top n components for the more detailed and mathematical explanation as to why this is the case.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited May 23 '17 at 12:32









        Community

        11




        11










        answered Jan 29 '16 at 12:20









        AdriaanAdriaan

        12.5k63160




        12.5k63160






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35083533%2fdimensionality-reduction-in-hog-feature-vector%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            Origin of the phrase “under your belt”?