You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.3 KiB
Matlab

% Testscript um ein Bild aus den Daten durch die Netze laufen zu lassen
close all;
clear;
%die netze mit besserer Erkennung _2
RCCN_NET = 'netDetectorResNet50_2.mat';
inputSize = [224 224 3];
% first we need the data...
dataDir = 'Picturedata'; % Destination-Folder for provided (img) Data
zippedDataFile = 'PicturesResizedLabelsResizedSignsCutted.zip'; %Data provided by TA
grDataFile = 'signDatasetGroundTruth.mat';
func_setupData(dataDir, zippedDataFile, grDataFile);
%load data
grdata = load(grDataFile);
traficSignDataset = grdata.DataSet;
%Random Index
%shuffledIndices = randperm(height(traficSignDataset));
%testindx = shuffledIndices(1)
testindx = 7
% Bild einlesen
imgname = traficSignDataset.imageFilename{testindx}
I = imresize(imread(imgname),inputSize(1:2));
%RCCN-Detector laden
pretrained = load(RCCN_NET);
detector = pretrained.detector;
[bboxes,scores] = detect(detector,I);
sfigTitle = ""
bdetected = height(bboxes) > 0;
if bdetected
I = insertObjectAnnotation(I,'rectangle',bboxes,scores);
sfigTitle = "Detected";
else
sfigTitle = "Not Detected";
end
figure;
imshow(I);
annotation('textbox', [0.5, 0.2, 0.1, 0.1], 'String', sfigTitle)
%ggf. bild zuschneiden
if bdetected
icrop = imcrop(I , bboxes);
figure;
imshow(icrop);
alex_test(icrop);
end