def main(): args = parse_args() # train - test - tune information info = yaml.load(open(args.cfg, 'r').read()) info = info['SIAMRPN'] trainINFO = info['TRAIN'] testINFO = info['TEST'] tuneINFO = info['TUNE'] # epoch training -- train 50 or more epochs if trainINFO['ISTRUE']: print('==> train phase') print( 'python ../siamese_tracking/train_siamrpn.py --cfg {0} --gpus {1} --workers {2} 2>&1 | tee logs/siamrpn_train.log' .format(args.cfg, info['GPUS'], info['WORKERS'])) if not exists('logs'): os.makedirs('logs') os.system( 'python ../siamese_tracking/train_siamrpn.py --cfg {0} --gpus {1} --workers {2} 2>&1 | tee logs/siamrpn_train.log' .format(args.cfg, info['GPUS'], info['WORKERS'])) # epoch testing -- test 30-50 epochs (or more) if testINFO['ISTRUE']: print('==> test phase') print( 'mpiexec -n {0} python ../siamese_tracking/test_epochs.py --arch {1} --start_epoch {2} --end_epoch {3} --gpu_nums={4} \ --threads {0} --dataset {5} --anchor_nums {6} --resume {7} 2>&1 | tee logs/siamrpn_epoch_test.log' .format( testINFO['THREADS'], trainINFO['MODEL'], testINFO['START_EPOCH'], testINFO['END_EPOCH'], (len(info['GPUS']) + 1) // 2, testINFO['DATA'], len(trainINFO['ANCHORS_RATIOS']) * len(trainINFO['ANCHORS_SCALES']), info["CHECKPOINT_DIR"])) if not exists('logs'): os.makedirs('logs') os.system( 'mpiexec -n {0} python ../siamese_tracking/test_epochs.py --arch {1} --start_epoch {2} --end_epoch {3} --gpu_nums={4} \ --threads {0} --dataset {5} --anchor_nums {6} --resume {7} 2>&1 | tee logs/siamrpn_epoch_test.log' .format( testINFO['THREADS'], trainINFO['MODEL'], testINFO['START_EPOCH'], testINFO['END_EPOCH'], (len(info['GPUS']) + 1) // 2, testINFO['DATA'], len(trainINFO['ANCHORS_RATIOS']) * len(trainINFO['ANCHORS_SCALES']), info["CHECKPOINT_DIR"])) if 'VOT' in testINFO['DATA']: os.system('python eval.py') else: raise ValueError('not supported') # tuning -- with TPE if tuneINFO['ISTRUE']: if 'VOT' in testINFO['DATA']: # for vot real-time and baseline resume = extract_logs('logs/siamrpn_eval_epochs.log', 'VOT') else: raise ValueError('not supported now') print('==> tune phase') print( 'python -u ../siamese_tracking/tune_tpe.py --arch {0} --resume {1} --dataset {2} --gpu_nums {3} --anchor_nums {4} \ 2>&1 | tee logs/tpe_tune_rpn.log'.format( trainINFO['MODEL'], 'snapshot/' + resume, tuneINFO['DATA'], (len(info['GPUS']) + 1) // 2, len(trainINFO['ANCHORS_RATIOS']) * len(trainINFO['ANCHORS_SCALES']))) if not exists('logs'): os.makedirs('logs') os.system( 'python -u ../siamese_tracking/tune_tpe.py --arch {0} --resume {1} --dataset {2} --gpu_nums {3} --anchor_nums {4} \ 2>&1 | tee logs/tpe_tune_rpn.log'.format( trainINFO['MODEL'], 'snapshot/' + resume, tuneINFO['DATA'], (len(info['GPUS']) + 1) // 2, len(trainINFO['ANCHORS_RATIOS']) * len(trainINFO['ANCHORS_SCALES'])))
def main(): args = parse_args() # train - test - tune information info = yaml.load(open(args.cfg, 'r').read()) info = info['DAG'] trainINFO = info['TRAIN'] testINFO = info['TEST'] tuneINFO = info['TUNE'] dataINFO = info['DATASET'] # epoch training -- train 50 or more epochs if trainINFO['ISTRUE']: print('==> train phase') print( 'python ./tracking/train_DAG.py --cfg {0} --gpus {1} --workers {2} 2>&1 | tee logs/DAG_train.log' .format(args.cfg, info['GPUS'], info['WORKERS'])) if not exists('logs'): os.makedirs('logs') os.system( 'python ./tracking/train_DAG.py --cfg {0} --gpus {1} --workers {2} 2>&1 | tee logs/DAG_train.log' .format(args.cfg, info['GPUS'], info['WORKERS'])) # epoch testing -- test 11-50 epochs (or more) if testINFO['ISTRUE']: print('==> test phase') print( 'mpiexec -n {0} python ./tracking/test_epochs.py --arch {1} --start_epoch {2} --end_epoch {3} --gpu_nums={4} \ --threads {0} --dataset {5} --align {6} 2>&1 | tee logs/DAG_epoch_test.log' .format(testINFO['THREADS'], trainINFO['MODEL'], testINFO['START_EPOCH'], testINFO['END_EPOCH'], (len(info['GPUS']) + 1) // 2, testINFO['DATA'], trainINFO['ALIGN'])) if not exists('logs'): os.makedirs('logs') os.system( 'mpiexec -n {0} python ./tracking/test_epochs.py --arch {1} --start_epoch {2} --end_epoch {3} --gpu_nums={4} \ --threads {0} --dataset {5} --align {6} 2>&1 | tee logs/DAG_epoch_test.log' .format(testINFO['THREADS'], trainINFO['MODEL'], testINFO['START_EPOCH'], testINFO['END_EPOCH'], (len(info['GPUS']) + 1) // 2, testINFO['DATA'], trainINFO['ALIGN'])) # test on vot or otb benchmark print('====> use new testing toolkit') trackers = os.listdir(os.path.join('./result', testINFO['DATA'])) trackers = " ".join(trackers) if 'VOT' in testINFO['DATA']: print( 'python lib/eval_toolkit/bin/eval.py --dataset_dir dataset --dataset {0} --tracker_result_dir result/{0} --trackers {1}' .format(testINFO['DATA'], trackers)) os.system( 'python lib/eval_toolkit/bin/eval.py --dataset_dir dataset --dataset {0} \ --tracker_result_dir result/{0} --trackers {1} 2>&1 | tee logs/DAG_eval_epochs.log' .format(testINFO['DATA'], trackers)) else: raise ValueError('not supported now, please add new dataset') # tuning -- with TPE if tuneINFO['ISTRUE']: if 'VOT' in testINFO['DATA']: # for vot real-time and baseline resume = extract_logs('logs/DAG_eval_epochs.log', 'VOT') else: raise ValueError('not supported now') print('==> tune phase') print( 'python -u ./tracking/tune_tpe.py --arch {0} --resume {1} --dataset {2} --gpu_nums {3} --align {4}\ 2>&1 | tee logs/tpe_tune.log'.format( trainINFO['MODEL'], 'snapshot/' + resume, tuneINFO['DATA'], (len(info['GPUS']) + 1) // 2, trainINFO['ALIGN'])) if not exists('logs'): os.makedirs('logs') os.system( 'python -u ./tracking/tune_tpe.py --arch {0} --resume {1} --dataset {2} --gpu_nums {3} --align {4}\ 2>&1 | tee logs/tpe_tune.log'.format( trainINFO['MODEL'], 'snapshot/' + resume, tuneINFO['DATA'], (len(info['GPUS']) + 1) // 2, trainINFO['ALIGN']))
def main(): args = parse_args() # train - test - tune information info = yaml.load(open(args.cfg, 'r').read()) info = info['SIAMFC'] trainINFO = info['TRAIN'] testINFO = info['TEST'] tuneINFO = info['TUNE'] dataINFO = info['DATASET'] # epoch training -- train 50 or more epochs if trainINFO['ISTRUE']: print('==> train phase') print( 'python ./siamese_tracking/train_siamfc.py --cfg {0} --gpus {1} --workers {2} 2>&1 | tee logs/siamfc_train.log' .format(args.cfg, info['GPUS'], info['WORKERS'])) if not exists('logs'): os.makedirs('logs') os.system( 'python ./siamese_tracking/train_siamfc.py --cfg {0} --gpus {1} --workers {2} 2>&1 | tee logs/siamrpn_train.log' .format(args.cfg, info['GPUS'], info['WORKERS'])) # epoch testing -- test 30-50 epochs (or more) if testINFO['ISTRUE']: print('==> test phase') print( 'mpiexec -n {0} python ./siamese_tracking/test_epochs.py --arch {1} --start_epoch {2} --end_epoch {3} --gpu_nums={4} \ --threads {0} --dataset {5} 2>&1 | tee logs/siamfc_epoch_test.log' .format(testINFO['THREADS'], trainINFO['MODEL'], testINFO['START_EPOCH'], testINFO['END_EPOCH'], (len(info['GPUS']) + 1) // 2, testINFO['DATA'])) if not exists('logs'): os.makedirs('logs') os.system( 'mpiexec -n {0} python ./siamese_tracking/test_epochs.py --arch {1} --start_epoch {2} --end_epoch {3} --gpu_nums={4} \ --threads {0} --dataset {5} 2>&1 | tee logs/siamfc_epoch_test.log' .format(testINFO['THREADS'], trainINFO['MODEL'], testINFO['START_EPOCH'], testINFO['END_EPOCH'], (len(info['GPUS']) + 1) // 2, testINFO['DATA'])) # test on vot or otb benchmark if 'OTB' in testINFO['DATA']: os.system( 'python ./lib/core/eval_otb.py {0} ./result SiamFC* 0 100 2>&1 | tee logs/siamfc_eval_epochs.log' .format(testINFO['DATA'])) elif 'VOT' in testINFO['DATA']: os.system( 'python ./lib/core/eval_vot.py {0} ./result 2>&1 | tee logs/siamfc_eval_epochs.log' .format(testINFO['DATA'])) else: raise ValueError('not supported') # tuning -- with TPE if tuneINFO['ISTRUE']: if 'OTB' in testINFO['DATA']: pass elif 'VOT' in testINFO['DATA'] and 'LT' not in testINFO[ 'DATA']: # for vot real-time and baseline resume = extract_logs('logs/siamfc_eval_epochs.log', 'VOT') elif 'LT' in testINFO['DATA']: # for vot longterm pass else: raise ValueError('not supported now') print('==> tune phase') print( 'python -u ./siamese_tracking/tune_tpe.py --arch {0} --resume {1} --dataset {2} --gpu_nums {3} \ 2>&1 | tee logs/tpe_tune_fc.log'.format( trainINFO['MODEL'], 'snapshot/' + resume, tuneINFO['DATA'], (len(info['GPUS']) + 1) // 2)) if not exists('logs'): os.makedirs('logs') os.system( 'python -u ./siamese_tracking/tune_tpe.py --arch {0} --resume {1} --dataset {2} --gpu_nums {3}\ 2>&1 | tee logs/tpe_tune_fc.log'.format( trainINFO['MODEL'], 'snapshot/' + resume, tuneINFO['DATA'], (len(info['GPUS']) + 1) // 2))
def main(): args = parse_args() # train - test - tune information info = yaml.load(open(args.cfg, 'r').read()) prefix = args.cfg.split('/')[-1].split('.')[0] prefix2 = prefix.upper() info = info[prefix2] trainINFO = info['TRAIN'] testINFO = info['TEST'] tuneINFO = info['TUNE'] dataINFO = info['DATASET'] # parser model_name = trainINFO['MODEL'] suffix = model_name.lower() train_log_name = '{}_train.log'.format(suffix) test_log_name = '{}_epoch_test.log'.format(suffix) eval_log_name = '{}_eval_epochs.log'.format(suffix) train_script_name = 'train_{}.py'.format(suffix) # some additional arg align = trainINFO['ALIGN'] if model_name == 'Ocean' else False # epoch training -- train 50 or more epochs if trainINFO['ISTRUE']: print('==> train phase') print( 'python ./tracking/{0} --cfg {1} --gpus {2} --workers {3} 2>&1 | tee logs/{4}' .format(train_script_name, args.cfg, info['GPUS'], info['WORKERS'], train_log_name)) if not exists('logs'): os.makedirs('logs') os.system( 'python ./tracking/{0} --cfg {1} --gpus {2} --workers {3} 2>&1 | tee logs/{4}' .format(train_script_name, args.cfg, info['GPUS'], info['WORKERS'], train_log_name)) # epoch testing -- test 30-50 epochs (or more) if testINFO['ISTRUE']: print('==> test phase') print( 'mpiexec -n {0} python ./tracking/test_epochs.py --arch {1} --start_epoch {2} --end_epoch {3} --gpu_nums={4} \ --threads {0} --dataset {5} --align {6} 2>&1 | tee logs/{7}' .format(testINFO['THREADS'], trainINFO['MODEL'], testINFO['START_EPOCH'], testINFO['END_EPOCH'], (len(info['GPUS']) + 1) // 2, testINFO['DATA'], align, test_log_name)) if not exists('logs'): os.makedirs('logs') os.system( 'mpiexec -n {0} python ./tracking/test_epochs.py --arch {1} --start_epoch {2} --end_epoch {3} --gpu_nums={4} \ --threads {0} --dataset {5} --align {6} 2>&1 | tee logs/{7}' .format(testINFO['THREADS'], trainINFO['MODEL'], testINFO['START_EPOCH'], testINFO['END_EPOCH'], (len(info['GPUS']) + 1) // 2, testINFO['DATA'], align, test_log_name)) # test on vot or otb benchmark print('====> use new testing toolkit') trackers = os.listdir(os.path.join('./result', testINFO['DATA'])) trackers = " ".join(trackers) if 'VOT' in testINFO['DATA']: print( 'python lib/eval_toolkit/bin/eval.py --dataset_dir dataset --dataset {0} --tracker_result_dir result/{0} --trackers {1}' .format(testINFO['DATA'], trackers)) os.system( 'python lib/eval_toolkit/bin/eval.py --dataset_dir dataset --dataset {0} --tracker_result_dir result/{0} --trackers {1} 2>&1 | tee logs/{3}' .format(testINFO['DATA'], trackers, eval_log_name)) elif 'OTB' in testINFO['DATA']: os.system('python ./lib/core/eval_otb.py {0} ./result {1}* 0 1000'. format(testINFO['DATA'], prefix)) else: raise ValueError('not supported now, please add new dataset') # tuning -- with TPE if tuneINFO['ISTRUE']: if 'VOT' in testINFO['DATA']: # for vot real-time and baseline resume = extract_logs('logs/ocean_eval_epochs.log', 'VOT') else: raise ValueError('not supported now') print('==> tune phase') print( 'python -u ./tracking/tune_tpe.py --arch {0} --resume {1} --dataset {2} --gpu_nums {3} --align {4}\ 2>&1 | tee logs/tpe_tune.log'.format( trainINFO['MODEL'], 'snapshot/' + resume, tuneINFO['DATA'], (len(info['GPUS']) + 1) // 2, trainINFO['ALIGN'])) if not exists('logs'): os.makedirs('logs') os.system( 'python -u ./tracking/tune_tpe.py --arch {0} --resume {1} --dataset {2} --gpu_nums {3} --align {4}\ 2>&1 | tee logs/tpe_tune.log'.format( trainINFO['MODEL'], 'snapshot/' + resume, tuneINFO['DATA'], (len(info['GPUS']) + 1) // 2, trainINFO['ALIGN']))