def main(args): ## set the gpu if args.gpu: os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu ## check the ckpt path path_create('ckpt') ## check the model path path_create('models') ## check the data path path_create('data') ## check the log path path_create('log') if args.type == 'train': train_main(args) elif args.type == 'eval': eval_main(args)
def voc_test(eval_steps): train_main('latest.pth', split='trainaug') eval_main('best_trainaug.pth', eval_steps, 'best') eval_main('final_trainaug.pth', eval_steps, 'final') settings.LR = settings.LR / 10 settings.ITER_MAX = settings.TEST_ITER_MAX settings.ITER_SAVE = settings.TEST_ITER_SAVE settings.ITER_VAL = settings.TEST_ITER_VAL train_main('final_trainaug.pth', split='trainval', val=True, reset_steps=True) eval_steps = [5, 6, 7] eval_main('best.pth', eval_steps, 'trainval_best') eval_main('final.pth', eval_steps, 'trainval_final')
parser.add_argument("--log", type=int, default=log) # float parser.add_argument("--lr", type=float, default=lr) parser.add_argument("--beta", type=float, default=beta) parser.add_argument("--dropout_prob", type=float, default=dropout_prob) args = parser.parse_args() # overwrite params midi_op = args.midi_op process_collate = args.process_collate input_type = args.input_type band = args.band split = args.split score_choose = args.score_choose batch_size = args.batch_size sample_num = args.sample_num chunk_size = args.chunk_size lr = args.lr log = bool(args.log) beta = args.beta num_rec_layers = args.num_rec_layers z_dim = args.z_dim kernel_size = args.kernel_size stride = args.stride num_conv_features = args.num_conv_features train_main() eval_main()
#Run eval #Always use all hand annotations experiment = Experiment(api_key="ypQZhYfs3nSyKzOfz13iuJpj2", project_name='deeplidar', log_code=False) experiment.log_parameter("mode", "evaluation_grid") experiment.log_parameters(DeepForest_config) args = [ "--batch-size", str(DeepForest_config['batch_size']), '--score-threshold', str(DeepForest_config['score_threshold']), '--suppression-threshold', '0.1', '--save-path', 'snapshots/images/', '--model', model, '--convert-model' ] stem_recall, mAP = eval_main(data=data, DeepForest_config=DeepForest_config, experiment=experiment, args=args) results.append({ "Evaluation Site": site, "Pretraining Site": pretraining_site, "Stem Recall": stem_recall, "mAP": mAP }) results = pd.DataFrame(results) results.to_csv("analysis/site_grid" + ".csv")
def voc_val(eval_steps): train_main('latest.pth', split='trainaug') eval_main('best_trainaug.pth', eval_steps, 'best') eval_main('final_trainaug.pth', eval_steps, 'final')
data, DeepForest_config, experiment=experiment) #Format output experiment = Experiment(api_key="ypQZhYfs3nSyKzOfz13iuJpj2", project_name='deeplidar', log_code=False) experiment.log_parameter("mode", "retrain_sequence_evaluation") #pass an args object instead of using command line retinanet_args = [ "--batch-size", str(DeepForest_config['batch_size']), '--score-threshold', str(DeepForest_config['score_threshold']), '--suppression-threshold', '0.1', '--save-path', 'snapshots/images/', '--model', trained_model, '--convert-model' ] mAP = eval_main(data=data, DeepForest_config=DeepForest_config, experiment=experiment, args=retinanet_args) model_name = os.path.splitext(os.path.basename(model))[0] results.append({"Model": model_name, "mAP": mAP}) results = pd.DataFrame(results) print(results) results.to_csv("pretraining_size" + ".csv")