How can we train images in matlab using artificial neural network?

I am training a set of images to classify it in ANN.But in neural networks how can we train a set of images and how can test image is sent as a input to check the trained images. for example:I have two sets of images...first set contains N number of images(A1, A2,...AN) and second set contains 20 images(B1,B2,...B20)..I need to train the first set images in Neural Network to match each image in the first set one by one with the second set of 20 images and display the name of the image with maximum percentage of matching...for example if A1 match best with B9 then it display A1B9 on text file...how can I do this...I'm new to Neural Network...any sort of help is highly appreciated.please help me with a full example code. Thanks in advance

2 Comments

Do you mean
How can we train Artificial Neural Networks in MATLAB using images?
Thanks for help. yes i have to train images in neural networks. In my project i had a set of Brain images affected by diseases and i had extracted its features using glcm and a set of Brain images not affected by diseases and i also had extracted its features using glcm. Now i have to classify those images using neural network.And as a result when a test image is given as a input it should classify and say whether it is diseased or non diseased image.kindly help me with code or syntax for this concept. Thanks in advance

Sign in to comment.

 Accepted Answer

Typically, especially for huge sizes, some form of feature extraction is used to reduce the size of the input.
So, instead of image --> image(:), you get image --> featurevector.
If the number of extracted features is I, then the input matrix for N images has size
[ I N ] = size(input);
Next, if there are c categories with Ni (1=1:c) members each, the corresponding target matrix has N columns from the c dimensional unit matrix eye(c) so that
[ c N ] = size(target),
sum(target) = ones(1,N),
sum(target') = [ N1, N2, ...Nc],
and
sum(sum(target)) = sum(sum(target')) = sum(target(:)) = N
Hope this helps.
Thank you for formally accepting my answer
Greg

5 Comments

thank you.but is there any way to detect the pixel region in that image,because in a 256*256 image in a particular part only the disease is affected,in the sense is there any way to detect the particular region by any code
The purpose of the neural network is to detect potential disease. If you had code that found the particular part of the image affected by the disease, to exact the features only in that area, then you would not need the neural network, because that code would have done the task of detecting potential disease.
Possibly what you want to do is subdivide the image into smaller regions and run feature extraction on those. For example, perhaps you might want to divide into 16 x 16 areas with an overlap of 8 on each side (doing this instead of just plain 8 x 8 so that you do not run into odd effects due to block boundaries -- you might run into those odd effects on one but you would then be more centered over the region on one of the overlapping windows.) Such techniques still fall under the category of "feature extraction".
ok anyway thanks for your suggestions,ill work on it.Is there any possibility to combine glcm and neural networks,If possible help me with some example code in .mfile format.Thanks in advance
graycomatrix returns an array. You can use (:) to reshape that array into a vector. Or you can use graycoprops on the array to create summary statistics that you could use as a feature.

Sign in to comment.

More Answers (1)

Reshape the images into vectors. Put all of vectors beside each other to form a rectangular array. That array is your data for training.

3 Comments

thanks for answer.but as i am new to NN,i dont know to convert into vectors,so can you give some sample code for that for my better understanding
ya thank you,i will try to work on it

Sign in to comment.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!