Escolar Documentos
Profissional Documentos
Cultura Documentos
Technische Universität Chemnitz presently. The project which was handed over to me was on object
recognition & development of a working model. During this project I encountered that very few
students actually know how to do image processing and most of all there is no place to find a good
tutorial for beginners who do not want to go by theoretical knowledge and would want to get their
hands dirty with MATLAB programming. So, my blog is targeted for those students who wants to work
in this field and unfortunately are not able to find any relevant information on machine learning
algorithms and programming with MATLab anywhere on Internet.
Image can be processed in plenty of ways and one of them which I will present to you is on machine
learning algorithms which I will be using on MATLAB. I will keep my language as basic as possible
for beginners to understand, no offense to professionals as we all were in a learning phase in our life.
At the moment, I will assume that you are familiar with the term machine learning algorithms. I have
absolutely zero intention to discuss theory over here.
Finally, I will present you a simple code for classification using SVM. I have used the Caltech101
dataset for this experiment. Train dataset will consist of 30 images divided in two class and two labels
will be provided to them. Code is very basic to be understood. Hope it helps. The program goes as
follows:
Prepatory steps:
Training set - Create a folder with 15 "Faces" images and 15 "airplanes" images, this will be our
dataset.
Test set - Create another folder with random face and airplanes images, this will be our testset,
basically we have to understand here is that if you use training set images as test set images then you
will get 100% recognition performance.
--------------------------------------------------------------------------------------------------------
clc
clear all
% Load Datasets
width=100; height=100;
DataSet = cell([], 1);
for i=1:length(dir(fullfile(Dataset,'*.jpg')))
% Image transformation
if strcmp(imgInfo.ColorType,'grayscale')
DataSet{j} = double(imresize(tempImage,[width height])); % array of images
else
DataSet{j} = double(imresize(rgb2gray(tempImage),[width height])); % array of images
end
end
end
TestSet = cell([], 1);
for i=1:length(dir(fullfile(Testset,'*.jpg')))
% Image transformation
if strcmp(imgInfo.ColorType,'grayscale')
TestSet{j} = double(imresize(tempImage,[width height])); % array of images
else
TestSet{j} = double(imresize(rgb2gray(tempImage),[width height])); % array of images
end
end
end
Test_Set=[];
for j=1:length(TestSet)
Test_set_tmp = reshape(TestSet{j},1, 100*100);
Test_Set=[Test_Set;Test_set_tmp];
end
------------------------------------------------------------------------------------------------------------
Finally, you can check you Image recognition performance by seeing Group variable. you can also try
to give the same dataset and testset location and you will achieve 100% recognition. This is because the
same image is being classified which you are using to train you svm.
In my next tutorial, I will explain you how to use multisvm and re-evaluate the
recognition performance of scholarly articles. I will try to explain you how you can repeat the
recognition performance of "Robust Object Recognition with Cortex-Like Mechanisms" by Thomas
Serre, Lior Wolf, Stanley Bileschi, Maximilian Riesenhuber, and Tomaso Poggio, Member, IEEE
C:\Users\Mircea\Desktop\DRIVE\training\images\hogtraining