MATLAB: How can we train images in matlab using artificial neural network

annDeep Learning Toolbox

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

Best 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