Object Detection - Quick Start

Object detection is the process of identifying and localizing objects in an image and is an important task in computer vision. Follow this tutorial to learn how to use AutoGluon for object detection.

Tip: If you are new to AutoGluon, review Image Classification - Quick Start first to learn the basics of the AutoGluon API.

Our goal is to detect motorbike in images by YOLO3 model. A tiny dataset is collected from VOC dataset, which only contains the motorbike category. The model pretrained on the COCO dataset is used to fine-tune our small dataset. With the help of AutoGluon, we are able to try many models with different hyperparameters automatically, and return the best one as our final model.

To start, import autogluon and ObjectDetection module as your task:

import autogluon as ag
from autogluon import ObjectDetection as task
/var/lib/jenkins/miniconda3/envs/autogluon_docs/lib/python3.7/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.metrics.classification module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.metrics. Anything that cannot be imported from sklearn.metrics is now part of the private API.
  warnings.warn(message, FutureWarning)

Tiny_motorbike Dataset

We collect a toy dataset for detecting motorbikes in images. From the VOC dataset, images are randomly selected for training, validation, and testing - 120 images for training, 50 images for validation, and 50 for testing. This tiny dataset follows the same format as VOC.

Using the commands below, we can download this dataset, which is only 23M. The variable root specifies the path to store the dataset in. The name of unzipped folder is called tiny_motorbike.

root = './'
filename_zip = ag.download('https://autogluon.s3.amazonaws.com/datasets/tiny_motorbike.zip',
filename = ag.unzip(filename_zip, root=root)
Downloading ./tiny_motorbike.zip from https://autogluon.s3.amazonaws.com/datasets/tiny_motorbike.zip...
21273KB [00:00, 65407.39KB/s]

When we retrieve the dataset, we can create a dataset instance with its path and classes if it is a custom dataset.

import os
data_root = os.path.join(root, filename)
dataset_train = task.Dataset(data_root, classes=('motorbike',))
>>> create dataset(VOC format)

Fit Models by AutoGluon

In this section, we demonstrate how to apply AutoGluon to fit our detection models. We use mobilenet as the backbone for the YOLO3 model. Two different learning rates are used to fine-tune the network. The best model is the one that obtains the best performance on the validation dataset. You can also try using more networks and hyperparameters to create a larger searching space.

We fit a classifier using AutoGluon as follows. In each experiment (one trial in our searching space), we train the model for 30 epoches.

time_limits = 5*60*60  # 5 hours
epochs = 30
detector = task.fit(dataset_train,
                    lr=ag.Categorical(5e-4, 1e-4),
Starting Experiments
Num of Finished Tasks is 0
Num of Pending Tasks is 2
scheduler: FIFOScheduler(
(Remote: Remote REMOTE_ID: 0,
    <Remote: 'inproc://' processes=1 threads=8, memory=33.24 GB>, Resource: NodeResourceManager(8 CPUs, 1 GPUs))
HBox(children=(FloatProgress(value=0.0, max=2.0), HTML(value='')))
{'dataset': <autogluon.task.object_detection.dataset.voc.CustomVOCDetection object at 0x7f1c664435d0>, 'net': 'mobilenet1.0', 'lr': 0.0005, 'loss': SoftmaxCrossEntropyLoss(batch_axis=0, w=None), 'num_gpus': 1, 'batch_size': 16, 'split_ratio': 0.8, 'epochs': 30, 'num_workers': 8, 'hybridize': True, 'verbose': False, 'final_fit': False, 'seed': 223, 'data_shape': 416, 'start_epoch': 0, 'transfer': 'coco', 'lr_mode': 'step', 'lr_decay': 0.1, 'lr_decay_period': 0, 'lr_decay_epoch': '160,180', 'warmup_lr': 0.0, 'warmup_epochs': 2, 'momentum': 0.9, 'wd': 0.0005, 'log_interval': 100, 'save_prefix': 'yolo3_mobilenet1.0_custom', 'save_interval': 10, 'val_interval': 1, 'num_samples': -1, 'no_random_shape': False, 'no_wd': False, 'mixup': False, 'no_mixup_epochs': 20, 'label_smooth': False, 'resume': '', 'syncbn': False, 'reuse_pred_weights': True, 'task_id': 0}
[Epoch 0] Training cost: 4.505, ObjLoss=1357.888, BoxCenterLoss=4.032, BoxScaleLoss=2.701, ClassLoss=0.984
[Epoch 0] Validation: motorbike=0.0 mAP=0.0
[Epoch 1] Training cost: 4.643, ObjLoss=652.826, BoxCenterLoss=3.854, BoxScaleLoss=1.995, ClassLoss=0.885
[Epoch 1] Validation: motorbike=0.4319764539517356 mAP=0.4319764539517356
[Epoch 2] Training cost: 6.204, ObjLoss=453.437, BoxCenterLoss=3.803, BoxScaleLoss=1.751, ClassLoss=0.819
[Epoch 2] Validation: motorbike=0.28906725580661635 mAP=0.28906725580661635
[Epoch 3] Training cost: 4.361, ObjLoss=339.127, BoxCenterLoss=3.819, BoxScaleLoss=1.629, ClassLoss=0.776
[Epoch 3] Validation: motorbike=0.6097572461208824 mAP=0.6097572461208824
[Epoch 4] Training cost: 3.135, ObjLoss=284.916, BoxCenterLoss=3.803, BoxScaleLoss=1.548, ClassLoss=0.740
[Epoch 4] Validation: motorbike=0.017212298364405042 mAP=0.017212298364405042
[Epoch 5] Training cost: 5.258, ObjLoss=244.074, BoxCenterLoss=3.772, BoxScaleLoss=1.488, ClassLoss=0.720
[Epoch 5] Validation: motorbike=0.01900172292935181 mAP=0.01900172292935181
[Epoch 6] Training cost: 6.191, ObjLoss=216.877, BoxCenterLoss=3.797, BoxScaleLoss=1.470, ClassLoss=0.692
[Epoch 6] Validation: motorbike=0.07193593678009337 mAP=0.07193593678009337
[Epoch 7] Training cost: 6.886, ObjLoss=190.910, BoxCenterLoss=3.780, BoxScaleLoss=1.427, ClassLoss=0.652
[Epoch 7] Validation: motorbike=0.23380500096918008 mAP=0.23380500096918008
[Epoch 8] Training cost: 5.583, ObjLoss=174.596, BoxCenterLoss=3.798, BoxScaleLoss=1.417, ClassLoss=0.631
[Epoch 8] Validation: motorbike=0.22672201086313704 mAP=0.22672201086313704
[Epoch 9] Training cost: 3.862, ObjLoss=161.609, BoxCenterLoss=3.788, BoxScaleLoss=1.390, ClassLoss=0.612
[Epoch 9] Validation: motorbike=0.3335017119638748 mAP=0.3335017119638748
[Epoch 10] Training cost: 2.578, ObjLoss=153.493, BoxCenterLoss=3.781, BoxScaleLoss=1.372, ClassLoss=0.602
[Epoch 10] Validation: motorbike=0.15154643906631196 mAP=0.15154643906631196
[Epoch 11] Training cost: 6.555, ObjLoss=142.530, BoxCenterLoss=3.788, BoxScaleLoss=1.361, ClassLoss=0.581
[Epoch 11] Validation: motorbike=0.32252978979783103 mAP=0.32252978979783103
[Epoch 12] Training cost: 6.526, ObjLoss=134.473, BoxCenterLoss=3.799, BoxScaleLoss=1.348, ClassLoss=0.564
[Epoch 12] Validation: motorbike=0.5343314568611012 mAP=0.5343314568611012
[Epoch 13] Training cost: 3.048, ObjLoss=126.573, BoxCenterLoss=3.792, BoxScaleLoss=1.331, ClassLoss=0.551
[Epoch 13] Validation: motorbike=0.5580419851281094 mAP=0.5580419851281094
[Epoch 14] Training cost: 2.725, ObjLoss=120.344, BoxCenterLoss=3.796, BoxScaleLoss=1.314, ClassLoss=0.544
[Epoch 14] Validation: motorbike=0.5806350422073826 mAP=0.5806350422073826
[Epoch 15] Training cost: 4.702, ObjLoss=113.316, BoxCenterLoss=3.795, BoxScaleLoss=1.293, ClassLoss=0.528
[Epoch 15] Validation: motorbike=0.6375938875938876 mAP=0.6375938875938876
[Epoch 16] Training cost: 3.635, ObjLoss=107.604, BoxCenterLoss=3.798, BoxScaleLoss=1.287, ClassLoss=0.514
[Epoch 16] Validation: motorbike=0.6539248630157721 mAP=0.6539248630157721
[Epoch 17] Training cost: 4.691, ObjLoss=102.165, BoxCenterLoss=3.805, BoxScaleLoss=1.273, ClassLoss=0.503
[Epoch 17] Validation: motorbike=0.45907644621413113 mAP=0.45907644621413113
[Epoch 18] Training cost: 3.144, ObjLoss=98.200, BoxCenterLoss=3.797, BoxScaleLoss=1.266, ClassLoss=0.496
[Epoch 18] Validation: motorbike=0.43450830045410554 mAP=0.43450830045410554
[Epoch 19] Training cost: 6.589, ObjLoss=93.954, BoxCenterLoss=3.805, BoxScaleLoss=1.263, ClassLoss=0.485
[Epoch 19] Validation: motorbike=0.5577873977873978 mAP=0.5577873977873978
[Epoch 20] Training cost: 4.969, ObjLoss=90.483, BoxCenterLoss=3.804, BoxScaleLoss=1.253, ClassLoss=0.475
[Epoch 20] Validation: motorbike=0.5294877813618443 mAP=0.5294877813618443
[Epoch 21] Training cost: 3.183, ObjLoss=87.076, BoxCenterLoss=3.810, BoxScaleLoss=1.243, ClassLoss=0.469
[Epoch 21] Validation: motorbike=0.6009147761032788 mAP=0.6009147761032788
[Epoch 22] Training cost: 4.701, ObjLoss=83.964, BoxCenterLoss=3.800, BoxScaleLoss=1.236, ClassLoss=0.460
[Epoch 22] Validation: motorbike=0.45445916351258064 mAP=0.45445916351258064
[Epoch 23] Training cost: 4.258, ObjLoss=80.957, BoxCenterLoss=3.805, BoxScaleLoss=1.232, ClassLoss=0.453
[Epoch 23] Validation: motorbike=0.5639784252258897 mAP=0.5639784252258897
[Epoch 24] Training cost: 3.898, ObjLoss=78.428, BoxCenterLoss=3.803, BoxScaleLoss=1.223, ClassLoss=0.446
[Epoch 24] Validation: motorbike=0.5901298701298701 mAP=0.5901298701298701
[Epoch 25] Training cost: 6.274, ObjLoss=75.749, BoxCenterLoss=3.802, BoxScaleLoss=1.214, ClassLoss=0.438
[Epoch 25] Validation: motorbike=0.4975283360566407 mAP=0.4975283360566407
[Epoch 26] Training cost: 2.946, ObjLoss=73.889, BoxCenterLoss=3.803, BoxScaleLoss=1.212, ClassLoss=0.433
[Epoch 26] Validation: motorbike=0.6209926840471074 mAP=0.6209926840471074
[Epoch 27] Training cost: 4.599, ObjLoss=71.681, BoxCenterLoss=3.800, BoxScaleLoss=1.206, ClassLoss=0.427
[Epoch 27] Validation: motorbike=0.5902283018270479 mAP=0.5902283018270479
[Epoch 28] Training cost: 4.464, ObjLoss=69.767, BoxCenterLoss=3.801, BoxScaleLoss=1.198, ClassLoss=0.421
[Epoch 28] Validation: motorbike=0.6637878787878789 mAP=0.6637878787878789
[Epoch 29] Training cost: 6.431, ObjLoss=67.694, BoxCenterLoss=3.797, BoxScaleLoss=1.189, ClassLoss=0.413
[Epoch 29] Validation: motorbike=0.6275659824046922 mAP=0.6275659824046922
Finished Task with config: {'lr.choice': 0, 'net.choice': 0} and reward: 0.6275659824046922
{'dataset': <autogluon.task.object_detection.dataset.voc.CustomVOCDetection object at 0x7f1c600dcf50>, 'net': 'mobilenet1.0', 'lr': 0.0001, 'loss': SoftmaxCrossEntropyLoss(batch_axis=0, w=None), 'num_gpus': 1, 'batch_size': 16, 'split_ratio': 0.8, 'epochs': 30, 'num_workers': 8, 'hybridize': True, 'verbose': False, 'final_fit': False, 'seed': 223, 'data_shape': 416, 'start_epoch': 0, 'transfer': 'coco', 'lr_mode': 'step', 'lr_decay': 0.1, 'lr_decay_period': 0, 'lr_decay_epoch': '160,180', 'warmup_lr': 0.0, 'warmup_epochs': 2, 'momentum': 0.9, 'wd': 0.0005, 'log_interval': 100, 'save_prefix': 'yolo3_mobilenet1.0_custom', 'save_interval': 10, 'val_interval': 1, 'num_samples': -1, 'no_random_shape': False, 'no_wd': False, 'mixup': False, 'no_mixup_epochs': 20, 'label_smooth': False, 'resume': '', 'syncbn': False, 'reuse_pred_weights': True, 'task_id': 1}
[Epoch 0] Training cost: 4.731, ObjLoss=1467.599, BoxCenterLoss=4.013, BoxScaleLoss=3.145, ClassLoss=1.056
[Epoch 0] Validation: motorbike=0.0 mAP=0.0
[Epoch 1] Training cost: 4.956, ObjLoss=700.981, BoxCenterLoss=4.016, BoxScaleLoss=2.642, ClassLoss=0.998
[Epoch 1] Validation: motorbike=0.0 mAP=0.0
[Epoch 2] Training cost: 6.627, ObjLoss=482.479, BoxCenterLoss=3.923, BoxScaleLoss=2.359, ClassLoss=0.946
[Epoch 2] Validation: motorbike=0.045454545454545456 mAP=0.045454545454545456
[Epoch 3] Training cost: 4.620, ObjLoss=359.544, BoxCenterLoss=3.948, BoxScaleLoss=2.196, ClassLoss=0.905
[Epoch 3] Validation: motorbike=0.34221598877980364 mAP=0.34221598877980364
[Epoch 4] Training cost: 3.238, ObjLoss=293.164, BoxCenterLoss=3.894, BoxScaleLoss=2.042, ClassLoss=0.872
[Epoch 4] Validation: motorbike=0.34429435275663517 mAP=0.34429435275663517
[Epoch 5] Training cost: 5.450, ObjLoss=242.982, BoxCenterLoss=3.905, BoxScaleLoss=1.907, ClassLoss=0.847
[Epoch 5] Validation: motorbike=0.42341076662371807 mAP=0.42341076662371807
[Epoch 6] Training cost: 6.911, ObjLoss=211.050, BoxCenterLoss=3.871, BoxScaleLoss=1.807, ClassLoss=0.814
[Epoch 6] Validation: motorbike=0.6125617673360548 mAP=0.6125617673360548
[Epoch 7] Training cost: 7.447, ObjLoss=184.083, BoxCenterLoss=3.857, BoxScaleLoss=1.736, ClassLoss=0.781
[Epoch 7] Validation: motorbike=0.6576226145889067 mAP=0.6576226145889067
[Epoch 8] Training cost: 5.898, ObjLoss=165.458, BoxCenterLoss=3.864, BoxScaleLoss=1.688, ClassLoss=0.759
[Epoch 8] Validation: motorbike=0.6950254371513218 mAP=0.6950254371513218
[Epoch 9] Training cost: 4.121, ObjLoss=148.597, BoxCenterLoss=3.820, BoxScaleLoss=1.622, ClassLoss=0.735
[Epoch 9] Validation: motorbike=0.76999874041381 mAP=0.76999874041381
[Epoch 10] Training cost: 2.733, ObjLoss=136.477, BoxCenterLoss=3.814, BoxScaleLoss=1.590, ClassLoss=0.728
[Epoch 10] Validation: motorbike=0.8432184680150889 mAP=0.8432184680150889
[Epoch 11] Training cost: 7.014, ObjLoss=125.080, BoxCenterLoss=3.813, BoxScaleLoss=1.549, ClassLoss=0.705
[Epoch 11] Validation: motorbike=0.8343225657627281 mAP=0.8343225657627281
[Epoch 12] Training cost: 6.831, ObjLoss=116.528, BoxCenterLoss=3.820, BoxScaleLoss=1.512, ClassLoss=0.687
[Epoch 12] Validation: motorbike=0.8279731662848546 mAP=0.8279731662848546
[Epoch 13] Training cost: 3.179, ObjLoss=108.236, BoxCenterLoss=3.810, BoxScaleLoss=1.484, ClassLoss=0.676
[Epoch 13] Validation: motorbike=0.7902407116692831 mAP=0.7902407116692831
[Epoch 14] Training cost: 2.909, ObjLoss=101.852, BoxCenterLoss=3.815, BoxScaleLoss=1.469, ClassLoss=0.673
[Epoch 14] Validation: motorbike=0.7871047612830958 mAP=0.7871047612830958
[Epoch 15] Training cost: 4.920, ObjLoss=95.483, BoxCenterLoss=3.809, BoxScaleLoss=1.438, ClassLoss=0.658
[Epoch 15] Validation: motorbike=0.8815555367279506 mAP=0.8815555367279506
[Epoch 16] Training cost: 3.669, ObjLoss=90.447, BoxCenterLoss=3.789, BoxScaleLoss=1.413, ClassLoss=0.642
[Epoch 16] Validation: motorbike=0.8805535025047221 mAP=0.8805535025047221
[Epoch 17] Training cost: 4.927, ObjLoss=85.452, BoxCenterLoss=3.788, BoxScaleLoss=1.387, ClassLoss=0.629
[Epoch 17] Validation: motorbike=0.8895866038723182 mAP=0.8895866038723182
[Epoch 18] Training cost: 3.082, ObjLoss=81.470, BoxCenterLoss=3.775, BoxScaleLoss=1.368, ClassLoss=0.619
[Epoch 18] Validation: motorbike=0.8800249458144195 mAP=0.8800249458144195
[Epoch 19] Training cost: 6.831, ObjLoss=77.480, BoxCenterLoss=3.771, BoxScaleLoss=1.344, ClassLoss=0.605
[Epoch 19] Validation: motorbike=0.9520583085176387 mAP=0.9520583085176387
[Epoch 20] Training cost: 4.941, ObjLoss=74.232, BoxCenterLoss=3.761, BoxScaleLoss=1.321, ClassLoss=0.591
[Epoch 20] Validation: motorbike=0.880074541608696 mAP=0.880074541608696
[Epoch 21] Training cost: 3.155, ObjLoss=70.918, BoxCenterLoss=3.758, BoxScaleLoss=1.306, ClassLoss=0.583
[Epoch 21] Validation: motorbike=0.8834927327574388 mAP=0.8834927327574388
[Epoch 22] Training cost: 4.534, ObjLoss=68.220, BoxCenterLoss=3.745, BoxScaleLoss=1.290, ClassLoss=0.571
[Epoch 22] Validation: motorbike=0.8965237660889835 mAP=0.8965237660889835
[Epoch 23] Training cost: 4.384, ObjLoss=65.434, BoxCenterLoss=3.739, BoxScaleLoss=1.272, ClassLoss=0.561
[Epoch 23] Validation: motorbike=0.9553030303030304 mAP=0.9553030303030304
[Epoch 24] Training cost: 3.853, ObjLoss=63.150, BoxCenterLoss=3.729, BoxScaleLoss=1.258, ClassLoss=0.551
[Epoch 24] Validation: motorbike=0.9047619047619049 mAP=0.9047619047619049
[Epoch 25] Training cost: 6.648, ObjLoss=60.782, BoxCenterLoss=3.726, BoxScaleLoss=1.245, ClassLoss=0.541
[Epoch 25] Validation: motorbike=0.9303030303030303 mAP=0.9303030303030303
[Epoch 26] Training cost: 2.905, ObjLoss=58.837, BoxCenterLoss=3.730, BoxScaleLoss=1.235, ClassLoss=0.535
[Epoch 26] Validation: motorbike=0.8981078729882558 mAP=0.8981078729882558
[Epoch 27] Training cost: 4.692, ObjLoss=56.797, BoxCenterLoss=3.729, BoxScaleLoss=1.223, ClassLoss=0.527
[Epoch 27] Validation: motorbike=0.8983067929852853 mAP=0.8983067929852853
[Epoch 28] Training cost: 4.645, ObjLoss=55.113, BoxCenterLoss=3.731, BoxScaleLoss=1.212, ClassLoss=0.519
[Epoch 28] Validation: motorbike=0.9629088421838081 mAP=0.9629088421838081
[Epoch 29] Training cost: 6.388, ObjLoss=53.347, BoxCenterLoss=3.728, BoxScaleLoss=1.201, ClassLoss=0.510
[Epoch 29] Validation: motorbike=0.9718614718614721 mAP=0.9718614718614721
Finished Task with config: {'lr.choice': 1, 'net.choice': 0} and reward: 0.9718614718614721
{'dataset': <autogluon.task.object_detection.dataset.voc.CustomVOCDetection object at 0x7f1c61574f50>, 'net': 'mobilenet1.0', 'lr': 0.0001, 'loss': SoftmaxCrossEntropyLoss(batch_axis=0, w=None), 'num_gpus': 1, 'batch_size': 16, 'split_ratio': 0.8, 'epochs': 30, 'num_workers': 8, 'hybridize': True, 'verbose': False, 'final_fit': True, 'seed': 223, 'data_shape': 416, 'start_epoch': 0, 'transfer': 'coco', 'lr_mode': 'step', 'lr_decay': 0.1, 'lr_decay_period': 0, 'lr_decay_epoch': '160,180', 'warmup_lr': 0.0, 'warmup_epochs': 2, 'momentum': 0.9, 'wd': 0.0005, 'log_interval': 100, 'save_prefix': 'yolo3_mobilenet1.0_custom', 'save_interval': 10, 'val_interval': 1, 'num_samples': -1, 'no_random_shape': False, 'no_wd': False, 'mixup': False, 'no_mixup_epochs': 20, 'label_smooth': False, 'resume': '', 'syncbn': False, 'reuse_pred_weights': True, 'task_id': 2}
[Epoch 0] Training cost: 3.844, ObjLoss=714.569, BoxCenterLoss=3.965, BoxScaleLoss=2.941, ClassLoss=1.062
[Epoch 1] Training cost: 4.763, ObjLoss=347.893, BoxCenterLoss=3.857, BoxScaleLoss=2.448, ClassLoss=0.955
[Epoch 2] Training cost: 5.929, ObjLoss=239.976, BoxCenterLoss=3.855, BoxScaleLoss=2.236, ClassLoss=0.898
[Epoch 3] Training cost: 8.702, ObjLoss=179.835, BoxCenterLoss=3.848, BoxScaleLoss=2.047, ClassLoss=0.840
[Epoch 4] Training cost: 4.720, ObjLoss=144.216, BoxCenterLoss=3.841, BoxScaleLoss=1.913, ClassLoss=0.809
[Epoch 5] Training cost: 7.491, ObjLoss=122.499, BoxCenterLoss=3.825, BoxScaleLoss=1.810, ClassLoss=0.778
[Epoch 6] Training cost: 7.077, ObjLoss=105.349, BoxCenterLoss=3.791, BoxScaleLoss=1.715, ClassLoss=0.736
[Epoch 7] Training cost: 4.427, ObjLoss=92.550, BoxCenterLoss=3.768, BoxScaleLoss=1.644, ClassLoss=0.709
[Epoch 8] Training cost: 6.948, ObjLoss=83.458, BoxCenterLoss=3.768, BoxScaleLoss=1.581, ClassLoss=0.682
[Epoch 9] Training cost: 5.716, ObjLoss=75.399, BoxCenterLoss=3.743, BoxScaleLoss=1.529, ClassLoss=0.657
[Epoch 10] Training cost: 4.308, ObjLoss=69.361, BoxCenterLoss=3.721, BoxScaleLoss=1.483, ClassLoss=0.637
[Epoch 11] Training cost: 5.626, ObjLoss=63.819, BoxCenterLoss=3.714, BoxScaleLoss=1.444, ClassLoss=0.618
[Epoch 12] Training cost: 5.755, ObjLoss=59.155, BoxCenterLoss=3.709, BoxScaleLoss=1.413, ClassLoss=0.600
[Epoch 13] Training cost: 8.114, ObjLoss=55.528, BoxCenterLoss=3.689, BoxScaleLoss=1.380, ClassLoss=0.579
[Epoch 14] Training cost: 6.109, ObjLoss=52.055, BoxCenterLoss=3.686, BoxScaleLoss=1.350, ClassLoss=0.562
[Epoch 15] Training cost: 4.831, ObjLoss=48.986, BoxCenterLoss=3.675, BoxScaleLoss=1.324, ClassLoss=0.548
[Epoch 16] Training cost: 3.626, ObjLoss=46.526, BoxCenterLoss=3.661, BoxScaleLoss=1.304, ClassLoss=0.538
[Epoch 17] Training cost: 3.540, ObjLoss=44.130, BoxCenterLoss=3.659, BoxScaleLoss=1.284, ClassLoss=0.529
[Epoch 18] Training cost: 7.263, ObjLoss=42.192, BoxCenterLoss=3.650, BoxScaleLoss=1.267, ClassLoss=0.516
[Epoch 19] Training cost: 3.583, ObjLoss=40.258, BoxCenterLoss=3.649, BoxScaleLoss=1.255, ClassLoss=0.508
[Epoch 20] Training cost: 5.295, ObjLoss=38.494, BoxCenterLoss=3.637, BoxScaleLoss=1.239, ClassLoss=0.498
[Epoch 21] Training cost: 5.547, ObjLoss=37.030, BoxCenterLoss=3.622, BoxScaleLoss=1.224, ClassLoss=0.488
[Epoch 22] Training cost: 5.016, ObjLoss=35.562, BoxCenterLoss=3.623, BoxScaleLoss=1.207, ClassLoss=0.479
[Epoch 23] Training cost: 5.020, ObjLoss=34.221, BoxCenterLoss=3.614, BoxScaleLoss=1.191, ClassLoss=0.470
[Epoch 24] Training cost: 5.849, ObjLoss=33.106, BoxCenterLoss=3.610, BoxScaleLoss=1.178, ClassLoss=0.461
[Epoch 25] Training cost: 7.730, ObjLoss=31.972, BoxCenterLoss=3.607, BoxScaleLoss=1.164, ClassLoss=0.450
[Epoch 26] Training cost: 5.523, ObjLoss=31.011, BoxCenterLoss=3.610, BoxScaleLoss=1.153, ClassLoss=0.443
[Epoch 27] Training cost: 5.803, ObjLoss=30.012, BoxCenterLoss=3.602, BoxScaleLoss=1.138, ClassLoss=0.435
[Epoch 28] Training cost: 7.965, ObjLoss=29.111, BoxCenterLoss=3.597, BoxScaleLoss=1.131, ClassLoss=0.426
[Epoch 29] Training cost: 4.118, ObjLoss=28.340, BoxCenterLoss=3.590, BoxScaleLoss=1.125, ClassLoss=0.421
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> finish model fitting
The best config: {'lr.choice': 1, 'net.choice': 0}

After fitting, AutoGluon automatically returns the best model among all models in the searching space. From the output, we know the best model is the one trained with the second learning rate. To see how well the returned model performed on test dataset, call detector.evaluate().

dataset_test = task.Dataset(data_root, index_file_name='test', classes=('motorbike',))

test_map = detector.evaluate(dataset_test)
print("mAP on test dataset: {}".format(test_map[1][1]))
>>> create dataset(VOC format)
mAP on test dataset: 0.8251996955464386

Below, we randomly select an image from test dataset and show the predicted box and probability over the origin image.

image = '000467.jpg'
image_path = os.path.join(data_root, 'JPEGImages', image)

ind, prob, loc = detector.predict(image_path)