0

I'm currently using the CIFAR-10 dataset, and I'm trying to run some dimensionality reduction algorithms on it. It's a bunch of 32x32 colour images, so I'm currently importing the data by putting each 32x32x3 image into one column, like so:

X = zeros(3072, num_data_points);
for i=1:num_data_points
filename = sprintf('train/%d.png', i)
X(:,i)=reshape(imread(filename), [], 1);
end

This gives me a data matrix of 3072x(number of images) where each column represents a different image. When I run dimensionality reduction techniques, such as PCA and KPCA, I get a terrible separation of the data. Is there a better way to import the data that would help me?

user3457834
  • 314
  • 3
  • 12
  • Looping over the images and reading them in sequentially is the only way to go in this case. I don't have any other suggestions for you other than what you're doing! – rayryeng Nov 16 '14 at 08:28
  • Alright thanks! I was hoping there was a faster way, but this will have to do! – user3457834 Nov 16 '14 at 17:53

0 Answers0