Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
I = imread('C:\ECE 4132\dataset\asl_alphabet_test\asl_alphabet_test\A_test.jpg');
bw = im2bw(I, 0.2);
gray = rgb2gray(I);
bin = imbinarize(gray);
%imshow(bw)
imds = imageDatastore('C:\ECE 4132\dataset\asl_alphabet_train\asl_alphabet_train', 'IncludeSubfolders', true, 'LabelSource', 'foldernames');
[imdsTrain,imdsValidation] = splitEachLabel(imds,0.7,'randomized');
%augimds=augmentedImageDatastore([227 227],imds);
%[augimdsTrain,augimdsValidation] = splitEachLabel(augimds,0.7,'randomized');
% numTrainImages = numel(imdsTrain.Labels);
% idx = randperm(numTrainImages,16);
% figure
% for i = 1:16
% subplot(4,4,i)
% I = readimage(imdsTrain,idx(i));
% imshow(I)
% end
% numTrainAugImages = numel(augimdsTrain.Labels);
% idx = randperm(numTrainAugImages,16);
% figure
% for i = 1:16
% subplot(4,4,i)
% I = readimage(augimdsTrain,idx(i));
% imshow(I)
% end
net = alexnet;
layersTransfer = net.Layers(1:end-3);
numClasses = numel(categories(imdsTrain.Labels));
layers = [
layersTransfer
fullyConnectedLayer(numClasses,'WeightLearnRateFactor',20,'BiasLearnRateFactor',20)
softmaxLayer
classificationLayer];
augimdsValidation = augmentedImageDatastore([227 227], imdsValidation);
augimdsTrain = augmentedImageDatastore([227 227], imdsTrain);
options = trainingOptions('sgdm', ...
'MiniBatchSize',10, ...
'MaxEpochs',2, ...
'InitialLearnRate',3e-4, ...
'Shuffle','every-epoch', ...
'Verbose',false, ...
'Plots','training-progress');
%netTransfer = trainNetwork(augimdsTrain,layers,options);
[YPred,scores] = classify(netTransfer,augimdsValidation);
idx = randperm(numel(imdsValidation.Files),4);
figure
for i = 1:4
subplot(2,2,i)
I = readimage(imdsValidation,idx(i));
imshow(I)
label = YPred(idx(i));
title(string(label));
end
%analyzeNetwork(net);
%hello down there