Training a neural netnork

1 visualización (últimos 30 días)
Lameck Amugongo
Lameck Amugongo el 14 de Ag. de 2014
I have two files one imageReader that reads ans get the co-occurence matrix all images in the dataset and the neuralnet which does the training at the testing. It seems like the imageReader is only returning the co-occurence matrix of one image. I would like to use the co-ccurence matrix of the images to train. I would also like to label the images (as either cancerous or non cancerous).
ImageReader file
function dataset = imageReader(Folder,imgType)
Imgs = dir([Folder '/' imgType]); NumImgs = size(Imgs,1); image = double(imread([Folder '/' Imgs(1).name])); dataset = zeros([NumImgs size(image)]);
for i=1:NumImgs, image = double(imread([Folder '/' Imgs(i).name]));
[rows columns numberOfColorChannels] = size(Imgs);
%%Check if the im loaded is a grayscale image
if numberOfColorChannels > 1
%%Coverting to grayscale & get the co-occurrence matrix
F = graycomatrix(rgb2gray(imresize(image,[50 50])));
dataset = F;
else
F= graycomatrix(imresize(image,[50 50])); %get co-occurrence matrix
dataset = F;
end
end
end
neuralNet file
function neuralNet()
net = feedforwardnet(10);
%Loop to get the features for all images x = imageReader('TrainingSet','*.png');
for j=1:20
end
% Create a Self-Organizing Map som = selforgmap([10 10]); som = train(som,x); t = som(x); %Extract class data %t should 0 or 1
%t'=[0,0,0,0,0,1,1,1,1,1]
% Train the Network net = train(net,x,t); msgbox(sprintf('Training Successful'),'Success','success');
% Test the Network outputs = net(x); % now test it with a new x errors = gsubtract(t,outputs); performance = perform(net,t,outputs)
% View the Network view(net)
end
Any one that can help me with the neural Network please. Thank you.

Respuestas (0)

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by