Thread Subject: PCA extract image features from mnist database

Subject: PCA extract image features from mnist database

From: Tasos

Date: 21 Nov, 2009 11:14:02

Message: 1 of 1

Hello to everyone,

 I use Matlab to read the MNIST database. Those images are, originally, 28x28 (=784) pixels. So, I have a 2D 784x1000 array (meaning, I have read 1000 images).
 
 Supposing my 2D array's name is IMGS, the Matlab expression: IMGS(:, 1), would give me the first image.

 In order to perform PCA, so to extract some of the features of the image (from the 784 of them):

 1. I transpose the array IMGS, putting the images to rows and features (dimensions) to columns, in an array called IMGS_T (IMGS_T(1, :) corresponds to first image).
 2. I use the princomp function like this: [COEFF, SCORES] = princomp(IMGS_T];

 My question is this (and it may be a little trivial but, I want to be sure for this):
Supposing I want to extract 100 features from the overall of the 784 of them, all I need is the first 100 columns of SCORES?

 So, in Matlab terms, all I need is to write: IMGS_PCA = IMGS(:, 100)'
and I will have created an 100x1000 array, called IMGS_PCA which will hold my 1000 MNIST images in its columns and the first 100 most important features of them in its rows?

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
dimension reduc... Tasos 21 Nov, 2009 06:14:04
feature extraction Tasos 21 Nov, 2009 06:14:04
mnist Tasos 21 Nov, 2009 06:14:04
pca Tasos 21 Nov, 2009 06:14:03
rssFeed for this Thread

Contact us at files@mathworks.com