# StartFromHere

## PURPOSE

StartFromHere - The entry point of this project.

## SYNOPSIS

This is a script file.

## DESCRIPTION

     StartFromHere - The entry point of this project.

       StartFromHere learns active basis templates and adaboost strong classifiers
       for all image categories under the "image" folder. It generates figures
       needed for the project report and the corresponding latex into the "document" folder.

## CROSS-REFERENCE INFORMATION

This function calls:

- GenerateFigureCaption GenerteFigureCaption - Generates html and latex documentation for the learning results.
- LearnActiveBasisTemplate LearnActiveBasisTemplate - Learns an active basis template.
- LearnAdaboostTemplate LearnAdaboostTemplate - Learns an adaboost "template", i.e. strong classifier.
- OutputActiveBasisTemplate OutputActiveBasisTemplate - Generates figures and captions.
- OutputAdaboostTemplate OutputAdaboostTemplate - Generates figures for adaboost strong classifier.
- SetTemplateParameters SetTemplateParameters - Set parameters for each template.
- GetNaturalStat GetNaturalStat - Obtain statistics from natural images.
- PrepareNegativeImagePatches PrepareNegativeImagePatches - Crop image patches randomly from background images.

This function is called by:

## SOURCE CODE

    0001 % StartFromHere - The entry point of this project.
    0002 %
    0003 %   StartFromHere learns active basis templates and adaboost strong classifiers
    0004 %   for all image categories under the "image" folder. It generates figures
    0005 %   needed for the project report and the corresponding latex into the "document" folder.
    0006
    0007 %% compilation
    0008 cd common
    0009 mex ClocalNormalizeDouble.c
    0010 mex Chistog.c
    0011 mex CcomputeMAX1.c
    0012 mex Ctransform.c
    0013 cd ../activebasis
    0014 mex Clearn.c
    0015 cd ../adaboost
    0016 mex adaboostLearning.c
    0017 mex adaboostTesting.c
    0018 cd ..
    0019
    0020 %% obtain natural statistics
    0021 if ~exist('result/natural_stat.mat','file')
    0022     cd('common');
    0023     GetNaturalStat;
    0024     cd ..
    0025 end
    0026
    0027
    0028 %% template parameters per category
    0029 SetTemplateParameters;
    0030 cd common
    0031
    0032 %% collect negative patches for adaboost
    0033 PrepareNegativeImagePatches;
    0034 cd ..
    0035
    0036 disp('parameters set');
    0037
    0038 %% learning templates by active basis model and by adaboost
    0039 folders = {'cow','deer','catHead','wolfHead','horse','butterfly'};
    0040 for iFolder = 1:length(folders)
    0041     % learn and save the model to "result" folder
    0042     LearnActiveBasisTemplate(folders{iFolder});
    0043     LearnAdaboostTemplate(folders{iFolder});
    0044 end
    0045
    0046 %% generate figures
    0047 addpath('common');
    0048 folders = {'cow','deer','catHead','wolfHead','horse','butterfly'};
    0049 for iFolder = 1:length(folders)
    0050     % generate latex files with figures and captions
    0051     OutputActiveBasisTemplate(folders{iFolder});
    0052     OutputAdaboostTemplate(folders{iFolder});
    0053 end
    0054
    0055 %% generate latex text
    0056 % folders = {'zebra','women_model1','cow','pigeon','car','lion', 'deer', 'elephant_frontal', 'elephant_side', 'giraff', 'head_shoulder'};
    0057 folders = {'cow','deer','catHead','wolfHead','horse','butterfly'};
    0058 % generate latex files with figures and captions
    0059 GenerateFigureCaption(folders);
    0060
    0061
    0062