-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain.m
More file actions
executable file
·27 lines (24 loc) · 802 Bytes
/
Copy pathtrain.m
File metadata and controls
executable file
·27 lines (24 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function train()
% Train
load('models/TrainTable.mat');
acfDetector = trainACFObjectDetector(IRTable,'NumStages',2, 'NegativeSamplesFactor',1);
save('models/new.mat',acfDetector);
%% Video
obj.videoPlayer = vision.DeployableVideoPlayer();
i = 200; % Start frame
%% Detector Loop
runLoop = true;
while runLoop
frame = imread(fullfile(pwd, sprintf('images/img%d.jpg', i)));
[bboxes, scores] = detect(acfDetector, frame, 'SelectStrongest',true);
for j = 1:length(scores)
if scores(j) > 180
annotation = sprintf('Confidence = %.1f', scores(j));
frame = insertObjectAnnotation(frame, 'rectangle', bboxes(j,:), annotation);
end
end
step(obj.videoPlayer, frame);
runLoop = isOpen(obj.videoPlayer);
i = i+1;
end
release(obj.videoPlayer);