Commit fe72f10f authored by uysyr's avatar uysyr
Browse files

Replace AlexNet_Main.m

parent 30b2308d
......@@ -22,6 +22,14 @@ for i=1:1:15
x = (size(imgResize, 2) - 227) / 2 + 1;
y = (size(imgResize, 1) - 227) / 2 + 1;
imgCrop = imcrop(imgResize, [x, y, 227-1, 227-1]);
if (i == 15)
% Crop for an object at the left image border
imgCrop = imcrop(imgResize, [1, y, 227-1, 227-1]);
else
imgCrop = imcrop(imgResize, [x, y, 227-1, 227-1]);
end
label = classify(net, imgCrop)
subplot(1,2,1);
......@@ -50,13 +58,10 @@ testImages = imageDatastore(testPath,...
'LabelSource', 'foldernames');
% the number of labels
% Checking the number of labels
numClasses = numel(categories(trainingImages.Labels));
% Matrix information
exampleMatrix = [1,2;3,4;5,6]
size(exampleMatrix)
length(exampleMatrix)
numel(exampleMatrix)
%replacing the final 3-layers
layersTransfer = net.Layers(1:end-3);
......@@ -87,7 +92,7 @@ netTransfer= trainNetwork(trainingImages, layersConcat, options);
load(strcat(folder, 'netTransfer.mat'));
% remap foldernames to class names
% Rename the folders to class names
keySet = 1:numClasses;
valueSet = {...
'Speed limit 20', ...
......@@ -136,6 +141,14 @@ valueSet = {...
};
map = containers.Map(keySet,valueSet);
% The information about the 'numel' work compared to 'length' and 'size'
exampleMatrix = [1,2;
3,4;
5,6]
size(exampleMatrix)
length(exampleMatrix)
numel(exampleMatrix)
% visualizing the classification
idx = randi([0, 9000], 5);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment