Home > samsung-code > trainCallStage.m

trainCallStage

PURPOSE ^

TRAINCALLSTAGE calls a given training stage with user-specified parameters

SYNOPSIS ^

function trainCallStage( STAGE_NAME, PARAM, SPECIFIC_DIRS, CategIdOfInterest )

DESCRIPTION ^

 TRAINCALLSTAGE calls a given training stage with user-specified parameters
 
 Intro:
   For a training stage with the name STAGE_NAME, its code is at 
       ./train_pipeline/pip(STAGE_NAME).m
   While it is OK to call this script directly, calling it through
     trainCallStage can
   1) handle the parameters in a cleaner way;
   2) avoid intermediate variable mixed in the MATLAB base work space;
   3) keep track whether a stage is complete or not

 Usage:

   trainCallStage( STAGE_NAME, PARAM )

 Input:

   STAGE_NAME: should be a string indicating the name of the stage
    List of stages:
          BBoxRegTrain
          BestIoU4Train
          BoxList4Finetune
          FeatureNorm4Train
          FeatureNorm4Train_Internal
          Features4GPTrain
          Features4Groundtruth
          Features4Proposed
          GPTrain
          PrepDataset
          RegionProposal
          RegionProposal4GPTrain
          Test4GPTrain
          Train

   PARAM: should be a struct consisting of the full parameter set for training
       Refer to trainInit for more details.
    If PARAM is not specified or empty, the variable value of
       PARAM in the caller will be used.

   SPECIFIC_DIRS: should be a vector of integer number that indicates
     which categories should be included in training
       Refer to trainInit for more details.
    If SPECIFIC_DIRS is not specified or empty, the variable value of
       SPECIFIC_DIRS in the caller will be used.

   CategIdOfInterest: should be a struct consisting of the cache folder paths
     for all the stages
       Refer to trainInit for more details.
    If CategIdOfInterest is not specified or empty, the variable value of
       CategIdOfInterest in the caller will be used.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function trainCallStage( STAGE_NAME, PARAM, SPECIFIC_DIRS, CategIdOfInterest )
0002 % TRAINCALLSTAGE calls a given training stage with user-specified parameters
0003 %
0004 % Intro:
0005 %   For a training stage with the name STAGE_NAME, its code is at
0006 %       ./train_pipeline/pip(STAGE_NAME).m
0007 %   While it is OK to call this script directly, calling it through
0008 %     trainCallStage can
0009 %   1) handle the parameters in a cleaner way;
0010 %   2) avoid intermediate variable mixed in the MATLAB base work space;
0011 %   3) keep track whether a stage is complete or not
0012 %
0013 % Usage:
0014 %
0015 %   trainCallStage( STAGE_NAME, PARAM )
0016 %
0017 % Input:
0018 %
0019 %   STAGE_NAME: should be a string indicating the name of the stage
0020 %    List of stages:
0021 %          BBoxRegTrain
0022 %          BestIoU4Train
0023 %          BoxList4Finetune
0024 %          FeatureNorm4Train
0025 %          FeatureNorm4Train_Internal
0026 %          Features4GPTrain
0027 %          Features4Groundtruth
0028 %          Features4Proposed
0029 %          GPTrain
0030 %          PrepDataset
0031 %          RegionProposal
0032 %          RegionProposal4GPTrain
0033 %          Test4GPTrain
0034 %          Train
0035 %
0036 %   PARAM: should be a struct consisting of the full parameter set for training
0037 %       Refer to trainInit for more details.
0038 %    If PARAM is not specified or empty, the variable value of
0039 %       PARAM in the caller will be used.
0040 %
0041 %   SPECIFIC_DIRS: should be a vector of integer number that indicates
0042 %     which categories should be included in training
0043 %       Refer to trainInit for more details.
0044 %    If SPECIFIC_DIRS is not specified or empty, the variable value of
0045 %       SPECIFIC_DIRS in the caller will be used.
0046 %
0047 %   CategIdOfInterest: should be a struct consisting of the cache folder paths
0048 %     for all the stages
0049 %       Refer to trainInit for more details.
0050 %    If CategIdOfInterest is not specified or empty, the variable value of
0051 %       CategIdOfInterest in the caller will be used.
0052 %
0053 
0054 if ~exist( 'PARAM', 'var' ) || isempty( PARAM )
0055     PARAM = evalin( 'caller', 'PARAM' );
0056 end
0057 if ~exist( 'SPECIFIC_DIRS', 'var' ) || isempty( SPECIFIC_DIRS )
0058     SPECIFIC_DIRS = evalin( 'caller', 'SPECIFIC_DIRS' );
0059 end
0060 if ~exist( 'CategIdOfInterest', 'var' ) || isempty( CategIdOfInterest )
0061     CategIdOfInterest = evalin( 'caller', 'CategIdOfInterest' );
0062 end
0063 
0064 STAGE_SPECIFIC_DIR = eval( sprintf('SPECIFIC_DIRS.%s', STAGE_NAME) );
0065 STAGE_COMPLETE_FILENAME = fullfile(STAGE_SPECIFIC_DIR, 'COMPLETE');
0066 
0067 fprintf( '****** Call stage : %s : ', STAGE_NAME );
0068 
0069 if exist( STAGE_COMPLETE_FILENAME, 'file' )
0070     fprintf( 'Complete already\n' );
0071     return;
0072 end
0073 fprintf( 'Run\n' );
0074 
0075 eval( sprintf( 'pip%s', STAGE_NAME ) );
0076 
0077 fclose( fopen( STAGE_COMPLETE_FILENAME, 'w' ) );
0078 
0079 end

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