Do I have to have a dataset to train a Neural Network or can I just insert the folder location?

1 Ansicht (letzte 30 Tage)
Below you can find my code and the 5 attemps made at inserting the images.
close all;
clear;
%%GOAL%%
% get 300 images
% x = 640 x 300
% t = 3 x 300
%% attempt 1 %%
% size(x)
% imgFolder = fullfile('D:\train\chair');
% imgSet = imageSet(imgFolder);
%% attempt 2 %%
% [x,t] = image_dataset;
% [ I N ] = size(x) % [ 640 300 ]
% [ O N ] = size(t) % [ 3 300 ]
%% attempt 3 %%
% imds = imageDatastore('D:\test\cup');
% imgRGB = imds.read;
%% attempt 4 %%
% my_dataset = 'D:\train\chair';
% load(my_dataset);
%% attempt 5 %%
% folder = 'D:\train\chair';
% myImgaes =imageSet(folder);
% x = folder;
% t =
net = patternnet(10);
view(net);
[net,tr] = train(net,x,t);
nntraintool;
plotperform(tr)
testX = x(:,tr.testInd);
testT = t(:,tr.testInd);
testY = net(testX);
testIndices = vec2ind(testY);
plotconfusion(testT,testY)

Akzeptierte Antwort

Eustace Tan
Eustace Tan am 25 Jul. 2019
What should happen is:
  1. Read the first image of size m-by-n. (I'm assuming greyscale. Additional work required if RGB.)
  2. Reshape to mn-by-1 vector.
  3. Repeat for the other 299 images.
  4. Organise data into mn-by-300 matrix.
  5. Pair up with target matrix t-by-300.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by