def test_task():
    dataset = Task.Dataset.from_voc('https://autogluon.s3.amazonaws.com/datasets/tiny_motorbike.zip')
    train_data, _, test_data = dataset.random_split()

    detector = Task()
    detector.fit(train_data, num_trials=1, hyperparameters={'batch_size': 4, 'epochs': 5, 'early_stop_max_value': 0.2})
    test_result = detector.predict(test_data)
    print('test result', test_result)
    detector.save('detector.ag')
    detector2 = Task.load('detector.ag')
    fit_summary = detector2.fit_summary()
    test_map = detector2.evaluate(test_data)
    test_result2 = detector2.predict(test_data)
    assert test_result2.equals(test_result)
Esempio n. 2
0
def test_task():
    dataset = Task.Dataset.from_voc('https://autogluon.s3.amazonaws.com/datasets/tiny_motorbike.zip')
    train_data, _, test_data = dataset.random_split()

    detector = Task()
    detector.fit(train_data, hyperparameters={'batch_size': 4, 'epochs': 5, 'early_stop_max_value': 0.2}, hyperparameter_tune_kwargs={'num_trials': 1})
    test_result = detector.predict(test_data)
    detector.save('detector.ag')
    detector2 = Task.load('detector.ag')
    fit_summary = detector2.fit_summary()
    test_map = detector2.evaluate(test_data)
    test_result2 = detector2.predict(test_data)
    assert test_result2.equals(test_result), f'{test_result2} != \n {test_result}'
    # to numpy
    test_result2 = detector2.predict(test_data, as_pandas=False)
Esempio n. 3
0
                           [30, 35], [20]),
            'warmup_iters':
            ag.Int(5, 500),
            'wd':
            ag.Categorical(1e-4, 5e-4, 2.5e-4),
            'syncbn':
            True,
            'label_smooth':
            False,
            'epochs':
            ag.Categorical(30, 40, 50, 60),
            'transfer':
            transfer
        }
        kwargs = {
            'num_trials': args.num_trials,
            'nthreads_per_trial': 16,
            'ngpus_per_trial': 8,
            'time_limit': time_limit,
            'dist_ip_addrs': [],
            'hyperparameters': hyperparameters
        }
    else:
        raise NotImplementedError('%s is not implemented.', args.meta_arch)
    detector = ObjectDetector()
    detector.fit(dataset_train, **kwargs)
    test_map = detector.evaluate(dataset_test)
    print("mAP on test dataset: {}".format(test_map[-1][-1]))
    print(test_map)
    detector.save('final_model.model')
Esempio n. 4
0
from autogluon.vision import ObjectDetector

dataset_train = ObjectDetector.Dataset.from_voc('train_data', splits='train')

time_limit = 5 * 60 * 60  # 5 hour
detector = ObjectDetector()
hyperparameters = {'batch_size': 4, 'epochs': 2}
detector.fit(dataset_train,
             time_limit=time_limit,
             hyperparameters=hyperparameters)

detector.save('enemy_detector.ag')