Skip to content

Commit

Permalink
add gitignores, minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kbitr committed Dec 19, 2017
1 parent 51b2f95 commit 4875a6a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions darknet/cfg/tiny-yolo.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[net]
batch=64
batch=32
subdivisions=8
width=416
height=416
width=196
height=196
channels=3
momentum=0.9
decay=0.0005
Expand Down
32 changes: 16 additions & 16 deletions mainLED.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,24 @@ function mainLED()
clear all; clc;

%% Parameters
live = 1; % live or file mode
serial = 0;

% YOLO
datacfg = fullfile(pwd,'darknet/cfg/coco.data');
cfgfile = fullfile(pwd,'darknet/cfg/tiny-yolo.cfg'); %ALT: tiny_yolo.cfg
weightfile = fullfile(pwd,'weights/tiny-yolo.weights'); %ALT: tiny_yolo.weights
cfgfile = fullfile(pwd,'darknet/cfg/tiny-yolo.cfg'); %or: yolo.cfg
weightfile = fullfile(pwd,'weights/tiny-yolo.weights'); %or: yolo.weights
resizeRatio = 1;
thresh = 0.24;
hier_thresh = 0.5;

% Display
ansLED = 10;
drawBoxes = 0;
drawLED = 1;
live = 1; % live or file mode
serial = 0;
numFrame = 500; % Set start frame
numLED = 10;
drawBoxes = 1;
drawLED = 0;
drawLines = 0;
serialLED = 1;
serialLED = 0;

%% Init
% Serial
Expand All @@ -40,16 +41,15 @@ function mainLED()
frame = snapshot(vidObj);
else
frame = imread(fullfile(pwd, 'images/img0.jpg'));
numFrame = 250; % Set start frame
end
frameSize = size(frame);

% LED
if drawLED
coord = zeros(ansLED-1:4);
x_coord = frameSize(2)/ansLED;
coord = zeros(numLED-1:4);
x_coord = frameSize(2)/numLED;
y = frameSize(1);
for li = 1:ansLED-1
for li = 1:numLED-1
coord(li,:) = [li*x_coord 0 li*x_coord y];
end
end
Expand All @@ -74,7 +74,7 @@ function mainLED()
%% Cleanup
release(obj.videoPlayer);
yolomex('cleanup');
fscanf(serObj)
if serial, fscanf(serObj); end
delete(instrfindall);

%% Display Results
Expand All @@ -91,9 +91,9 @@ function displayResults()
frame = insertObjectAnnotation(frame, 'rectangle', bbs, ddts(i).class, 'Color','yellow', 'LineWidth',1);
end
if drawLED
x_coord = frameSize(2)/ansLED;
LED_left = round(ddts(i).left/frameSize(2)*ansLED);
LED_right = round(ddts(i).right/frameSize(2)*ansLED);
x_coord = frameSize(2)/numLED;
LED_left = round(ddts(i).left/frameSize(2)*numLED);
LED_right = round(ddts(i).right/frameSize(2)*numLED);
LED_range = LED_right - LED_left;
frame = insertShape(frame, 'FilledRectangle', [LED_left*x_coord, 0, LED_range*x_coord, frameSize(1)], 'Color','green', 'Opacity',0.2);
if serialLED
Expand Down
2 changes: 1 addition & 1 deletion mainTracking.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function mainTracking()
global hier_thresh; hier_thresh = 0.5;
datacfg = fullfile(pwd,'darknet/cfg/coco.data');
cfgfile = fullfile(pwd,'darknet/cfg/tiny-yolo.cfg');
weightfile = fullfile(pwd,'tiny-yolo-old.weights');
weightfile = fullfile(pwd,'weights/tiny-yolo.weights');

%% Init
trk = struct('id',{},'color',{},'bboxes',{},'scores',{},'kalmanFilter',{},'age',{},'totalVisibleCount',{},'confidence',{},'predPosition',{}); % Empty array
Expand Down
8 changes: 4 additions & 4 deletions matlab/yoloDetectPeople.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@

global thresh;
global hier_thresh;
bboxes = [9999 9999 9999 9999]; % out of range init
bboxes = [9997 9999 1 1]; % out of range init
scores = 0;

ddts = yolomex('detect',frame,thresh,hier_thresh);

for i = 1:size(vertcat(ddts.left))
%if strcmp(ddts(i).class,'person')
if strcmp(ddts(i).class,'person')
bboxes(i,:) = [ddts(i).left ddts(i).top ddts(i).right-ddts(i).left ddts(i).bottom-ddts(i).top];
scores(i,:) = [ddts(i).prob];
% end
end
end
% Look up the estimated height of a pedestrian based on location of their feet.
height = bboxes(:, 4);
y = (bboxes(:,2)-1) / 2;
yfoot = min(length(aScale), round(y + height));
estHeight = aScale(1); %% (yfoot) !! %%
estHeight = aScale(round(yfoot)); %% (yfoot) !! %%

% Remove detections whose size deviates from the expected size,
% provided by the calibrated scale estimation.
Expand Down

0 comments on commit 4875a6a

Please sign in to comment.