Home > samsung-code > train_demo.m

train_demo

PURPOSE ^

TRAIN_DEMO trains the detection model from scratch (except for the CNN model training)

SYNOPSIS ^

function train_demo( model_type )

DESCRIPTION ^

 TRAIN_DEMO trains the detection model from scratch (except for the CNN model training)
   CNN model training can be done by ./finetune_vgg16_on_voc2007.sh
 
 Usage:

   train_demo( model_type )

 Input: 

   model_type: can be a string naming the classifier model type:
       'struct' - (linear) structured SVM, 
                  use the models in ./models_svm_linear
       'linear' - ordinary linear SVM
                  use the models in ./models_svm_struct

 Output:

   The trained (intermediate) models and intermediate outputs are all in
     the cache folders (SPECIFIC_DIRS in the code)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function train_demo( model_type )
0002 % TRAIN_DEMO trains the detection model from scratch (except for the CNN model training)
0003 %   CNN model training can be done by ./finetune_vgg16_on_voc2007.sh
0004 %
0005 % Usage:
0006 %
0007 %   train_demo( model_type )
0008 %
0009 % Input:
0010 %
0011 %   model_type: can be a string naming the classifier model type:
0012 %       'struct' - (linear) structured SVM,
0013 %                  use the models in ./models_svm_linear
0014 %       'linear' - ordinary linear SVM
0015 %                  use the models in ./models_svm_struct
0016 %
0017 % Output:
0018 %
0019 %   The trained (intermediate) models and intermediate outputs are all in
0020 %     the cache folders (SPECIFIC_DIRS in the code)
0021 %
0022 
0023 if ~exist('model_type','var') || isempty( model_type )
0024     model_type = 'struct';
0025 end
0026 
0027 %% Preparation
0028 
0029 fprintf( '========== Preparation\n' );
0030 
0031 switch model_type
0032     case 'struct'   % do initialization for structured svm model
0033         trainInit_svmStruct;
0034     case 'linear'   % do initialization for linear svm model
0035         trainInit_svmLinear
0036     otherwise
0037         error( 'Unknown model_type' );
0038 end
0039 
0040 % prepare dataset
0041 trainCallStage('PrepDataset');
0042 
0043 % do selective search (on trainval & test)
0044 trainCallStage('RegionProposal');
0045 
0046 %% Classifier & BBox regression model training
0047 
0048 fprintf( '========== Classifier & BBox regression model training\n' );
0049 
0050 % compute best iou with gt (on trainval)
0051 trainCallStage('BestIoU4Train');
0052 
0053 % extract features from proposed bboxes (on trainval & test)
0054 trainCallStage('Features4Proposed');
0055 
0056 % extract features from groundtruth bboxes (on trainval)
0057 trainCallStage('Features4Groundtruth');
0058 
0059 % train classifier
0060 trainCallStage('Train');
0061 
0062 % train bbox regression model
0063 trainCallStage('BBoxRegTrain');
0064 
0065 %% GP model training
0066 
0067 fprintf( '========== GP model training\n' );
0068 
0069 % generate additional regions for GP training
0070 trainCallStage('RegionProposal4GPTrain');
0071 
0072 % extract features from the additional regions
0073 trainCallStage('Features4GPTrain');
0074 
0075 % test on the training set (observations for GP training)
0076 trainCallStage('Test4GPTrain');
0077 
0078 % gp training
0079 trainCallStage('GPTrain');
0080 
0081

Generated on Thu 18-Dec-2014 22:27:44 by m2html © 2005