dataset_train, dataset_test = get_dataset(args) time_limits = 5 * 60 * 60 # 5 days epochs = 12 # use coco pre-trained model for custom datasets transfer = None if ('voc' in args.dataset_name) or ( 'coco' in args.dataset_name) else 'coco' detector = task.fit(dataset_train, num_trials=30, epochs=epochs, net=ag.Categorical('darknet53', 'mobilenet1.0'), meta_arch=args.meta_arch, lr=ag.Categorical(1e-2, 5e-3, 1e-3, 5e-4, 1e-4, 5e-5), transfer=transfer, data_shape=ag.Categorical(320, 416), nthreads_per_trial=16, ngpus_per_trial=1, batch_size=8, lr_decay_epoch=ag.Categorical('80,90', '85,95'), warmup_epochs=ag.Int(1, 10), warmup_iters=ag.Int(250, 1000), wd=ag.Categorical(1e-4, 5e-4, 2.5e-4), syncbn=ag.Bool(), label_smooth=ag.Bool(), time_limits=time_limits, dist_ip_addrs=[]) test_map = detector.evaluate(dataset_test) print("mAP on test dataset: {}".format(test_map[1][1]))
4, 'data_shape': [640, 800], 'lr_decay_epoch': ag.Categorical([24, 28], [35], [50, 55], [40], [45], [55], [30, 35], [20]), # 'warmup_epochs': 2, 'warmup_iters': ag.Int(5, 500), 'wd': ag.Categorical(5e-4, 2.5e-4, 1e-4), 'transfer': transfer, 'label_smooth': False, 'syncbn': ag.Bool(), 'num_trials': 30, 'time_limits': time_limits, 'dist_ip_addrs': None } elif args.meta_arch == 'yolo3': kwargs = { 'meta_arch': args.meta_arch, 'backbone': ag.Categorical('darknet53', 'mobilenet1.0'), 'lr': ag.Categorical(1e-2, 5e-3, 1e-3, 5e-4, 1e-4, 5e-5), 'batch_size': 32, 'epochs': epochs, 'nthreads_per_trial': 16,
'no_mixup_epochs': 20, 'reuse_pred_weights': True, 'horovod': False, 'grace_period': None, 'auto_search': True, 'seed': 223, 'wd': ag.Categorical(1e-4, 5e-4, 2.5e-4), 'syncbn': ag.Bool(), 'label_smooth': False, 'time_limits': time_limits, 'dist_ip_addrs': [] } # Construct a object detection task based on the config. task = ObjectDetection(search_args, FasterRCNNEstimator) # Automatically fit a model. estimator = task.fit() # Evaluate the final model on test set. test_map = estimator.evaluate()
dataset_train, dataset_test = get_dataset(args) time_limits = 5 * 24 * 60 * 60 # 5 days epochs = 20 # use coco pre-trained model for custom datasets transfer = None if ('voc' in args.dataset_name) or ('coco' in args.dataset_name) else 'coco' if args.meta_arch == 'yolo3': kwargs = {'num_trials': 30, 'epochs': epochs, 'net': ag.Categorical('darknet53', 'mobilenet1.0'), 'meta_arch': args.meta_arch, 'lr': ag.Categorical(1e-2, 5e-3, 1e-3, 5e-4, 1e-4, 5e-5), 'transfer': transfer, 'data_shape': ag.Categorical(320, 416), 'nthreads_per_trial': 16, 'ngpus_per_trial': 8, 'batch_size': 64, 'lr_decay_epoch': ag.Categorical('80,90', '85,95'), 'warmup_epochs': ag.Int(1, 10), 'warmup_iters': ag.Int(250, 1000), 'wd': ag.Categorical(1e-4, 5e-4, 2.5e-4), 'syncbn': ag.Bool(), 'label_smooth': ag.Bool(), 'time_limits': time_limits, 'dist_ip_addrs': []} elif args.meta_arch == 'faster_rcnn': kwargs = {'num_trials': 30, 'epochs': ag.Categorical(30, 40, 50, 60), 'net': ag.Categorical('resnest101', 'resnest50'), 'meta_arch': args.meta_arch, 'lr': ag.Categorical(0.02, 0.01, 0.005, 0.002, 2e-4, 5e-4), 'transfer': transfer, 'data_shape': (640, 800), 'nthreads_per_trial': 16, 'ngpus_per_trial': 8, 'batch_size': 16, 'lr_decay_epoch': ag.Categorical('24,28', '35', '50,55', '40', '45', '55', '30, 35', '20'), 'warmup_iters': ag.Int(5, 500), 'wd': ag.Categorical(1e-4, 5e-4, 2.5e-4), 'syncbn': True, 'label_smooth': False, 'time_limits': time_limits, 'dist_ip_addrs': []} else: raise NotImplementedError('%s is not implemented.', args.meta_arch)