testscript and RCCN net for direct detection
parent
d2b5aeebf5
commit
014ac2ebfc
Binary file not shown.
@ -0,0 +1,66 @@
|
||||
% Testscript um ein Bild aus den Daten durch das RCCN_NET mit direkter
|
||||
% klassifizierung laufen zu lassen
|
||||
|
||||
close all;
|
||||
clear;
|
||||
|
||||
%die netze mit besserer Erkennung _2
|
||||
RCCN_NET = 'netDetectorResNet50_stepthree.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)
|
||||
%for testindx = 50:200
|
||||
testindx = 125;
|
||||
|
||||
% Bild einlesen
|
||||
imgname = traficSignDataset.imageFilename{testindx}
|
||||
I = imresize(imread(imgname),inputSize(1:2));
|
||||
|
||||
%RCCN-Detector laden
|
||||
pretrained = load(RCCN_NET);
|
||||
detector = pretrained.detector;
|
||||
|
||||
[bbox, score, label] = detect(detector, I, 'MiniBatchSize', 32);
|
||||
|
||||
|
||||
sfigTitle = ""
|
||||
bdetected = height(bbox) > 0;
|
||||
if bdetected
|
||||
I = insertObjectAnnotation(I,'rectangle',bbox,score);
|
||||
sfigTitle = "Detected" + string(label);
|
||||
|
||||
else
|
||||
sfigTitle = "Not Detected"
|
||||
end
|
||||
|
||||
%end %end forschleife testindex
|
||||
|
||||
figure;
|
||||
imshow(I);
|
||||
annotation('textbox', [0.5, 0.2, 0.1, 0.1], 'String', sfigTitle)
|
||||
|
||||
%ggf. bild zuschneiden
|
||||
if bdetected
|
||||
icrop = imcrop(I , bbox);
|
||||
figure;
|
||||
imshow(icrop);
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue