How to train SVM for Tamil Character Recognition using MATLAB? - neural-network

Hi I am doing my Final Year M.E Project in Tamil Character Recognition. I have completed till Feature Extraction step. Now I got Features for Each image in the Dataset(HP Labs). How to Feed these features to train SVM and How to Perform Class Labeling. I am new to this Neural Network area. So please Help me....

In Training
In Matlab neural Network has two inputs:
Input vector
Target Vector
Example:
net = newFF(input,target);
net = train(net,input,target);
You give feature is input vector. Target is corresponding feature id(char ID).
In Testing
Extract feature from image, then test the feature in Neural Network using sim function.
sim(net,features).. It returns corresponding char-ID.
open Matlab then type nftool and study that tool box.
same thing in SVM
Training
svmtrain(input,label).
input as feature.
label as ID of particular feature.
Testing
using svmclassify() method . It returns output of charID.

you may want to look at the svmclassify and svmtrain methods in the bioinformatics toolbox in matlab.
by the way, do you really want support vector machines or neural networks? they are very different from each other. please be clear which classifier you want to use for your problem before deciding to use a particular implementation.
if you are new to the field of machine learning and want to try out a couple of algorithms, I would suggest you try Weka first.

Related

How to set alexnet from scratch?

I would train an alexnet DNN (given by MATLAB function alexnet) from scratch (i.e. without pretraining on ImageNet given by alexnet function). I could to manually set weights but I don't know the from what distribution I can sample my initial weights. Is there a built-in MATLAB option that make it for me?
For example, I've read that Python's library has the option pre-training=off but I don't find a similar option in MATLAB.

Can a neural network be trained with just a single class of training data?

I just want to know if a neural network can be trained with a single class of data set. I have a set of data that I want to train a neural network with. After training it, I want to give new data(for testing) to the trained neural network to check if it can recognize it as been similar to the training sample or not.
Is this possible with neural network? If yes, will that be a supervised learning or unsupervised.
I know neural networks can be used for classification if there are multiple classes but I have not seen with a single class before. A good explanation and link to any example will be much appreciated. Thanks
Of course it can be. But in this case it will only recognize this one class that you have trained it with. And depending on the expected output you can measure the similarity to the training data.
An NN, after training, is just a function. For classification problems you can imagine it as a function that takes data as input and returns an integer indicating to which class it belongs to. That being said, if you have only one class that can be represented by an integer value 1, and if training data is not similar to that class, you will get something like 1.555; It will not tel you that it belongs to another class, because you have introduced only one, but it will definitely give you a hint about its similarity.
NNs are considered to be supervised learning, because before training you have to provide both input and target, i. e. the expected output.
If you train a network with only a single class of data then It is popularly known as One-class Classification. There are various algorithms developed in the past like One-class SVM, Support Vector Data Description, OCKELM etc. Tax and Duin developed a MATLAB toolbox for this and it supports various one-class classifiers.
DD Toolbox
One-class SVM
Kernel Ridge Regression based or Kernelized ELM based or LSSVM(where bias=0) based One-class Classification
There is a paper Anomaly Detection Using One-Class Neural Networks
which combines One-Class SVM and Neural Networks.
Here is source code. However, I've had difficulty connecting the source code and the paper.

In Matlab, How to use already trained neural network on real time values?

Using nntool(Neural Network Manager) in Matlab, we have created a neural network named network1, the network type is Feed Forward backprop. Training function is TRAINLM, learning function is LEARNGDM, performance function is MSE. No. of layers are 2 and transfer function is TRANSIG. No. of Inputs is 2.
We have trained it using known datasets.
Now, we want to use this trained Neural Network on real time values(dynamically one by one) to get the output.
We are unable to use the network on real time values.
So, please guide us through the steps to use trained neural network on real time values.
if you created a ann via
network1 = feedforwardnet;
or something of that kind and then trained it with your known data, you should be able to use said net via
outputs = network1(inputs);
You can create a function from the neural network that you have trained and use it as regular MATLAB functions.
You can either create it with genFun command or using the GUI in neural network toolbox.
genFunction(net,pathname)
If you want the function to accept only matrix elements you should use this command:
genFunction(net,pathname,'MatrixOnly','yes')

How to train SVM in matlab for character recognition?

Im a final year student working on my major project. My project is basically to extract text from a natural scene, and recognize it and then display them in a notepad etc..
I have already extracted the text form the images and have also obtained 85 features for each character which is extracted.
How ever, for the recognition part, I have no clue as of how to train or use SVM(support vector machines) in matlab so I can get a match.
Please help me out as this is turning out to be painstakingly difficult
If you're happy with using an existing SVM implementation, then you should either use the bioinformatics toolbox svmtrain, or download the Matlab version of libsvm. If you want to implement an SVM yourself then you should understand SVM theory and you can use quadprog to solve the appropriate optimisation problem.
With your data, you will need to have an N-by-85 feature matrix, where N is a number of characters, and an N-by-1 array of 'true labels' which you provide manually. Depending on which tool you use to train an SVM, the paramaters to svmtrain are slightly different - check the documentation.
If you want to evaluate your SVM to show that it works, you may need to organise your data such that you can estimate the generalization error of classifier - see cross-validation

svm classification

I am a beginner in MATLAB and doing my Programming project in Digital Image Processing,i.e. Magnetic Resonance image classification using wavelet features+SVM+PCA+ANN. I executed the example SVM classification from MATLAB tool and modified that to fit my requirements. I am facing problems in storing more than one feature in an input vector and in giving new input to SVM. Please help.
Simply feed multidimensional feature data to svmtrain(Training, Group) function as Training parameter (Training can be matrix, each column represents separate feature). After that use svmclassify(SVMStruct, Sample) for testing data classification.