Afficher commentaires plus anciens
DeepLearningToolboxを使用しています。
下記より使用コード
digitDatasetPath = fullfile('C:\Users\2111105\Desktop\gazou1-7');
imds = imageDatastore(digitDatasetPath,...
'IncludeSubfolders',true,'LabelSource','foldernames');
figure;
perm=randperm(1010,50);
for i=1:50
subplot(5,10,i);
imshow(imds.Files{perm(i)});
end
labelCount=countEachLabel(imds);
jpg=readimage(imds,1);
size(jpg)
numTrainFiles = 7;
[imdsTrain, imdsValidation] = splitEachLabel(imds, numTrainFiles, ...
'randomize');
layers = [
imageInputLayer([150 900 3])
convolution2dLayer(3,8, 'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,8, 'Padding', 'same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,32,'padding', 'same')
batchNormalizationLayer
reluLayer
fullyConnectedLayer(101)
softmaxLayer
classificationLayer];
options = trainingOptions ('sgdm','InitialLearnRate',0.01,...
'MaxEpochs',20,'Shuffle','every-epoch','ValidationData',imdsValidation, ...
'ValidationFrequency',1,'Verbose',false,'Plots','training-progress');
net = trainNetwork(imdsTrain,layers,options);
YPred = classify(net,imdsValidation);
YValidation = imdsValidation.Labels;
accuracy = sum(YPred == YValidation)/numel(YValidation);
文字の筆跡を画像データとして読み込ませていた場合
このプログラムから得られる結果は筆跡を識別していることになるでしょうか?
Réponses (1)
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!