- Read the first image of size m-by-n. (I'm assuming greyscale. Additional work required if RGB.)
- Reshape to mn-by-1 vector.
- Repeat for the other 299 images.
- Organise data into mn-by-300 matrix.
- Pair up with target matrix t-by-300.
Do I have to have a dataset to train a Neural Network or can I just insert the folder location?
1 view (last 30 days)
Show older comments
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)
0 Comments
Accepted Answer
Eustace Tan
on 25 Jul 2019
What should happen is:
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!