%% Main file for VOC tests

clear all;close all;clc

addpath_recurse('../voc-release5')

cd ../voc-release5

fv_cache('unlock')

startup
% compile
try
    matlabpool close
catch
end

% matlabpool open 4

cd ../voc-kitti


%%
close all

load VOC2007/car_final.mat;
im = imread('000034.jpg');

fprintf('Starting detection\n');
tic
[bbox, fbbox] = process(im, model, -0.5);
fprintf(['Detection time: ' num2str(toc) 's \n'] )

% fbbox = reshape(fbbox,length(fbbox)/4,5)
if ~isempty(bbox)
    showboxes(im, [bbox(1:4) fbbox]);
else
    disp('No detection')
end


%% Try to train with kitti data

close all; clc

fv_cache('unlock')

cd ~/Dropbox/VOC/voc-kitti
addpath '/home/jorge/Escritorio/kitti/devkit/matlab'


kitti_train('pedestrian',3)


%% Do short training

close all; clc

fv_cache('unlock')

addpath '/home/jorge/Escritorio/kitti/devkit/matlab'

try
% matlabpool open 4
catch
end

short_train('Pedestrian',1)


