Skip to content

Instantly share code, notes, and snippets.

View gist:6d052b4afa7bd2e765c7e63a3aebc0f7
imds = imageDatastore('/Users/mizuno/Documents/MATLAB/deeplearning/SimpleDeepLearning/trainingSet/','IncludeSubfolders',true,'LabelSource','foldernames');
labelCount = countEachLabel(imds)
perm = randperm(40000,20);
montage(imds, 'Indices', perm);
img = readimage(imds,1);
size(img)
[imdsTrain,imdsValidation] = splitEachLabel(imds,0.8);
layers = [imageInputLayer([28 28 1])
convolution2dLayer(5,20)
reluLayer
View gist:45095c8c658ce3daa1c24d862a226247
[numberconf, numbernames] = confusionmat(YValidation, YPred)
heatmap(numbernames, numbernames, numberconf);
View gist:3a00c9f39358f4b74375f2d14d6f522d
YPred = classify(net,imdsValidation);
YValidation = imdsValidation.Labels;
accuracy = sum(YPred == YValidation)/numel(YValidation)
@smzn
smzn / gist:aea1d35e17bba44f98ab7c1b11d8dd4e
Last active Jul 4, 2019
最小学習オプション
View gist:aea1d35e17bba44f98ab7c1b11d8dd4e
options = trainingOptions('sgdm', ...
'InitialLearnRate',0.001, ...
'MaxEpochs',4, ...
'Shuffle','every-epoch', ...
'ValidationData',imdsValidation, ...
'ValidationFrequency',30, ...
'Verbose',false, ...
'Plots','training-progress');
View 最小ネットワーク
layers = [imageInputLayer([28 28 1])
convolution2dLayer(5,20)
reluLayer
maxPooling2dLayer(2,'Stride',2)
fullyConnectedLayer(10)
softmaxLayer
classificationLayer];
View gist:c424d01922d8ec049989f4fbb4720ac6
layers = [
imageInputLayer([28 28 1])
convolution2dLayer(3,8,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,16,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
View gist:910255bf1b9b367f303a7240def6d5bc
[imdsTrain,imdsValidation] = splitEachLabel(imds,0.8);
View gist:d2a08b981b83cecd2dd62f496dd23582
perm = randperm(40000,20);
montage(imds, 'Indices', perm);
You can’t perform that action at this time.