.. _sec_object_detection_quick: 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 :ref:`sec_imgquick` first to learn the basics of the AutoGluon API. Our goal is to detect motorbike in images by `YOLOv3 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.vision and ObjectDetection module as your task: .. code:: python import autogluon.core as ag from autogluon.vision import ObjectDetection as task 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``. .. code:: python root = './' filename_zip = ag.download('https://autogluon.s3.amazonaws.com/datasets/tiny_motorbike.zip', path=root) filename = ag.unzip(filename_zip, root=root) .. parsed-literal:: :class: output 21273KB [00:00, 66274.65KB/s] When we retrieve the dataset, we can create a dataset instance with its path and classes if it is a custom dataset. .. code:: python import os data_root = os.path.join(root, filename) dataset_train = task.Dataset(data_root, classes=('motorbike',)) 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 YOLOv3 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 epochs. .. code:: python time_limits = 5*60*60 # 5 hours epochs = 30 detector = task.fit(dataset_train, num_trials=2, epochs=epochs, lr=ag.Categorical(5e-4, 1e-4), ngpus_per_trial=1, time_limits=time_limits) .. parsed-literal:: :class: output scheduler: FIFOScheduler( DistributedResourceManager{ (Remote: Remote REMOTE_ID: 0, , Resource: NodeResourceManager(8 CPUs, 1 GPUs)) }) .. parsed-literal:: :class: output HBox(children=(HTML(value=''), FloatProgress(value=0.0, max=2.0), HTML(value=''))) .. parsed-literal:: :class: output INFO:root:{'meta_arch': 'yolo3', 'dataset': , '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, 'warmup_iters': 1000, 'warmup_factor': 0.3333333333333333, '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} INFO:root:[Epoch 0] Training cost: 7.106, ObjLoss=1358.454,BoxCenterLoss=3.919,BoxScaleLoss=2.720,ClassLoss=1.032 INFO:root:[Epoch 0] Validation: motorbike=0.0 mAP=0.0 INFO:root:[Epoch 1] Training cost: 5.514, ObjLoss=39.255,BoxCenterLoss=3.957,BoxScaleLoss=1.642,ClassLoss=0.805 INFO:root:[Epoch 1] Validation: motorbike=0.44603607224496983 mAP=0.44603607224496983 INFO:root:[Epoch 2] Training cost: 3.867, ObjLoss=31.065,BoxCenterLoss=3.659,BoxScaleLoss=1.319,ClassLoss=0.777 INFO:root:[Epoch 2] Validation: motorbike=0.04957947770930768 mAP=0.04957947770930768 INFO:root:[Epoch 3] Training cost: 3.867, ObjLoss=35.305,BoxCenterLoss=4.082,BoxScaleLoss=1.308,ClassLoss=0.797 INFO:root:[Epoch 3] Validation: motorbike=0.6182293139738779 mAP=0.6182293139738779 INFO:root:[Epoch 4] Training cost: 3.890, ObjLoss=32.265,BoxCenterLoss=3.770,BoxScaleLoss=1.037,ClassLoss=0.703 INFO:root:[Epoch 4] Validation: motorbike=0.6464725313371348 mAP=0.6464725313371348 INFO:root:[Epoch 5] Training cost: 5.672, ObjLoss=12.535,BoxCenterLoss=3.815,BoxScaleLoss=1.176,ClassLoss=0.546 INFO:root:[Epoch 5] Validation: motorbike=0.717876507357817 mAP=0.717876507357817 INFO:root:[Epoch 6] Training cost: 5.774, ObjLoss=12.610,BoxCenterLoss=3.704,BoxScaleLoss=0.989,ClassLoss=0.462 INFO:root:[Epoch 6] Validation: motorbike=0.757377347541282 mAP=0.757377347541282 INFO:root:[Epoch 7] Training cost: 6.937, ObjLoss=10.753,BoxCenterLoss=3.849,BoxScaleLoss=1.017,ClassLoss=0.428 INFO:root:[Epoch 7] Validation: motorbike=0.823455710955711 mAP=0.823455710955711 INFO:root:[Epoch 8] Training cost: 5.848, ObjLoss=8.181,BoxCenterLoss=3.675,BoxScaleLoss=0.939,ClassLoss=0.358 INFO:root:[Epoch 8] Validation: motorbike=0.7898042189324966 mAP=0.7898042189324966 INFO:root:[Epoch 9] Training cost: 4.952, ObjLoss=7.364,BoxCenterLoss=3.954,BoxScaleLoss=1.010,ClassLoss=0.440 INFO:root:[Epoch 9] Validation: motorbike=0.853459520126187 mAP=0.853459520126187 INFO:root:[Epoch 10] Training cost: 5.070, ObjLoss=7.179,BoxCenterLoss=3.615,BoxScaleLoss=0.877,ClassLoss=0.356 INFO:root:[Epoch 10] Validation: motorbike=0.8415839428770464 mAP=0.8415839428770464 INFO:root:[Epoch 11] Training cost: 3.575, ObjLoss=11.616,BoxCenterLoss=3.640,BoxScaleLoss=0.970,ClassLoss=0.385 INFO:root:[Epoch 11] Validation: motorbike=0.8411259934770908 mAP=0.8411259934770908 INFO:root:[Epoch 12] Training cost: 7.036, ObjLoss=10.896,BoxCenterLoss=3.804,BoxScaleLoss=1.014,ClassLoss=0.295 INFO:root:[Epoch 12] Validation: motorbike=0.8073952517654488 mAP=0.8073952517654488 INFO:root:[Epoch 13] Training cost: 3.860, ObjLoss=9.136,BoxCenterLoss=3.559,BoxScaleLoss=0.960,ClassLoss=0.331 INFO:root:[Epoch 13] Validation: motorbike=0.875990913726763 mAP=0.875990913726763 INFO:root:[Epoch 14] Training cost: 5.434, ObjLoss=6.175,BoxCenterLoss=3.622,BoxScaleLoss=0.911,ClassLoss=0.235 INFO:root:[Epoch 14] Validation: motorbike=0.8038413914245399 mAP=0.8038413914245399 INFO:root:[Epoch 15] Training cost: 5.730, ObjLoss=6.320,BoxCenterLoss=3.662,BoxScaleLoss=0.999,ClassLoss=0.275 INFO:root:[Epoch 15] Validation: motorbike=0.8376111173579529 mAP=0.8376111173579529 INFO:root:[Epoch 16] Training cost: 5.274, ObjLoss=5.820,BoxCenterLoss=3.763,BoxScaleLoss=0.846,ClassLoss=0.245 INFO:root:[Epoch 16] Validation: motorbike=0.8810039986510576 mAP=0.8810039986510576 INFO:root:[Epoch 17] Training cost: 6.999, ObjLoss=5.879,BoxCenterLoss=3.757,BoxScaleLoss=0.942,ClassLoss=0.201 INFO:root:[Epoch 17] Validation: motorbike=0.8522316951938208 mAP=0.8522316951938208 INFO:root:[Epoch 18] Training cost: 7.126, ObjLoss=5.751,BoxCenterLoss=3.752,BoxScaleLoss=0.894,ClassLoss=0.201 INFO:root:[Epoch 18] Validation: motorbike=0.80052458824219 mAP=0.80052458824219 INFO:root:[Epoch 19] Training cost: 5.386, ObjLoss=6.532,BoxCenterLoss=3.844,BoxScaleLoss=1.008,ClassLoss=0.241 INFO:root:[Epoch 19] Validation: motorbike=0.8693367238821785 mAP=0.8693367238821785 INFO:root:[Epoch 20] Training cost: 4.493, ObjLoss=5.704,BoxCenterLoss=3.893,BoxScaleLoss=0.964,ClassLoss=0.300 INFO:root:[Epoch 20] Validation: motorbike=0.7926055574426344 mAP=0.7926055574426344 INFO:root:[Epoch 21] Training cost: 7.234, ObjLoss=6.071,BoxCenterLoss=3.828,BoxScaleLoss=0.927,ClassLoss=0.199 INFO:root:[Epoch 21] Validation: motorbike=0.836043355608573 mAP=0.836043355608573 INFO:root:[Epoch 22] Training cost: 5.283, ObjLoss=5.306,BoxCenterLoss=3.622,BoxScaleLoss=0.880,ClassLoss=0.234 INFO:root:[Epoch 22] Validation: motorbike=0.8514525220407575 mAP=0.8514525220407575 INFO:root:[Epoch 23] Training cost: 5.315, ObjLoss=5.075,BoxCenterLoss=3.479,BoxScaleLoss=0.866,ClassLoss=0.212 INFO:root:[Epoch 23] Validation: motorbike=0.8568176775073327 mAP=0.8568176775073327 INFO:root:[Epoch 24] Training cost: 5.173, ObjLoss=5.307,BoxCenterLoss=3.729,BoxScaleLoss=0.985,ClassLoss=0.228 INFO:root:[Epoch 24] Validation: motorbike=0.8310404192598274 mAP=0.8310404192598274 INFO:root:[Epoch 25] Training cost: 7.116, ObjLoss=5.696,BoxCenterLoss=3.563,BoxScaleLoss=0.939,ClassLoss=0.137 INFO:root:[Epoch 25] Validation: motorbike=0.8228545192181556 mAP=0.8228545192181556 INFO:root:[Epoch 26] Training cost: 3.360, ObjLoss=8.115,BoxCenterLoss=3.844,BoxScaleLoss=1.148,ClassLoss=0.277 INFO:root:[Epoch 26] Validation: motorbike=0.5709956709956711 mAP=0.5709956709956711 INFO:root:[Epoch 27] Training cost: 7.421, ObjLoss=6.082,BoxCenterLoss=3.461,BoxScaleLoss=0.932,ClassLoss=0.127 INFO:root:[Epoch 27] Validation: motorbike=0.8291199883682892 mAP=0.8291199883682892 INFO:root:[Epoch 28] Training cost: 5.219, ObjLoss=5.362,BoxCenterLoss=3.509,BoxScaleLoss=0.886,ClassLoss=0.161 INFO:root:[Epoch 28] Validation: motorbike=0.8415531836584468 mAP=0.8415531836584468 INFO:root:[Epoch 29] Training cost: 5.466, ObjLoss=5.187,BoxCenterLoss=3.755,BoxScaleLoss=0.893,ClassLoss=0.196 INFO:root:[Epoch 29] Validation: motorbike=0.836625305416529 mAP=0.836625305416529 .. parsed-literal:: :class: output .. parsed-literal:: :class: output INFO:root:{'meta_arch': 'yolo3', 'dataset': , '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, 'warmup_iters': 1000, 'warmup_factor': 0.3333333333333333, '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} INFO:root:[Epoch 0] Training cost: 7.176, ObjLoss=1467.820,BoxCenterLoss=4.083,BoxScaleLoss=3.203,ClassLoss=1.173 INFO:root:[Epoch 0] Validation: motorbike=0.0 mAP=0.0 INFO:root:[Epoch 1] Training cost: 5.510, ObjLoss=21.950,BoxCenterLoss=4.166,BoxScaleLoss=2.233,ClassLoss=0.987 INFO:root:[Epoch 1] Validation: motorbike=0.0 mAP=0.0 INFO:root:[Epoch 2] Training cost: 4.103, ObjLoss=19.569,BoxCenterLoss=3.734,BoxScaleLoss=1.708,ClassLoss=0.803 INFO:root:[Epoch 2] Validation: motorbike=0.0 mAP=0.0 INFO:root:[Epoch 3] Training cost: 3.796, ObjLoss=16.683,BoxCenterLoss=4.016,BoxScaleLoss=1.689,ClassLoss=0.794 INFO:root:[Epoch 3] Validation: motorbike=0.37842480100544623 mAP=0.37842480100544623 INFO:root:[Epoch 4] Training cost: 3.555, ObjLoss=11.954,BoxCenterLoss=3.942,BoxScaleLoss=1.607,ClassLoss=0.827 INFO:root:[Epoch 4] Validation: motorbike=0.4970966533466533 mAP=0.4970966533466533 INFO:root:[Epoch 5] Training cost: 5.698, ObjLoss=10.325,BoxCenterLoss=3.954,BoxScaleLoss=1.436,ClassLoss=0.708 INFO:root:[Epoch 5] Validation: motorbike=0.6055006928434223 mAP=0.6055006928434223 INFO:root:[Epoch 6] Training cost: 6.059, ObjLoss=8.190,BoxCenterLoss=3.697,BoxScaleLoss=1.175,ClassLoss=0.608 INFO:root:[Epoch 6] Validation: motorbike=0.6133928571428572 mAP=0.6133928571428572 INFO:root:[Epoch 7] Training cost: 7.189, ObjLoss=7.883,BoxCenterLoss=3.834,BoxScaleLoss=1.154,ClassLoss=0.592 INFO:root:[Epoch 7] Validation: motorbike=0.6080205310782448 mAP=0.6080205310782448 INFO:root:[Epoch 8] Training cost: 6.351, ObjLoss=6.616,BoxCenterLoss=3.905,BoxScaleLoss=1.065,ClassLoss=0.594 INFO:root:[Epoch 8] Validation: motorbike=0.6057279853449484 mAP=0.6057279853449484 INFO:root:[Epoch 9] Training cost: 5.059, ObjLoss=6.333,BoxCenterLoss=4.008,BoxScaleLoss=1.188,ClassLoss=0.651 INFO:root:[Epoch 9] Validation: motorbike=0.6831495250467582 mAP=0.6831495250467582 INFO:root:[Epoch 10] Training cost: 5.167, ObjLoss=6.073,BoxCenterLoss=3.856,BoxScaleLoss=1.039,ClassLoss=0.554 INFO:root:[Epoch 10] Validation: motorbike=0.7448158916383953 mAP=0.7448158916383953 INFO:root:[Epoch 11] Training cost: 3.961, ObjLoss=5.569,BoxCenterLoss=3.614,BoxScaleLoss=1.040,ClassLoss=0.564 INFO:root:[Epoch 11] Validation: motorbike=0.7137443201959331 mAP=0.7137443201959331 INFO:root:[Epoch 12] Training cost: 7.190, ObjLoss=6.635,BoxCenterLoss=3.689,BoxScaleLoss=1.080,ClassLoss=0.445 INFO:root:[Epoch 12] Validation: motorbike=0.7407399797172525 mAP=0.7407399797172525 INFO:root:[Epoch 13] Training cost: 4.433, ObjLoss=5.654,BoxCenterLoss=3.639,BoxScaleLoss=1.149,ClassLoss=0.529 INFO:root:[Epoch 13] Validation: motorbike=0.7088508505151259 mAP=0.7088508505151259 INFO:root:[Epoch 14] Training cost: 5.661, ObjLoss=5.536,BoxCenterLoss=3.833,BoxScaleLoss=1.091,ClassLoss=0.458 INFO:root:[Epoch 14] Validation: motorbike=0.7556664193470496 mAP=0.7556664193470496 INFO:root:[Epoch 15] Training cost: 5.770, ObjLoss=5.246,BoxCenterLoss=3.597,BoxScaleLoss=0.968,ClassLoss=0.414 INFO:root:[Epoch 15] Validation: motorbike=0.7562661539934267 mAP=0.7562661539934267 INFO:root:[Epoch 16] Training cost: 5.313, ObjLoss=5.273,BoxCenterLoss=3.713,BoxScaleLoss=0.917,ClassLoss=0.446 INFO:root:[Epoch 16] Validation: motorbike=0.7452079163874167 mAP=0.7452079163874167 INFO:root:[Epoch 17] Training cost: 7.212, ObjLoss=5.492,BoxCenterLoss=3.708,BoxScaleLoss=1.004,ClassLoss=0.379 INFO:root:[Epoch 17] Validation: motorbike=0.6637584637584637 mAP=0.6637584637584637 INFO:root:[Epoch 18] Training cost: 7.234, ObjLoss=5.515,BoxCenterLoss=3.700,BoxScaleLoss=0.895,ClassLoss=0.331 INFO:root:[Epoch 18] Validation: motorbike=0.723618414106219 mAP=0.723618414106219 INFO:root:[Epoch 19] Training cost: 5.639, ObjLoss=5.435,BoxCenterLoss=3.797,BoxScaleLoss=0.998,ClassLoss=0.393 INFO:root:[Epoch 19] Validation: motorbike=0.6528679653679653 mAP=0.6528679653679653 INFO:root:[Epoch 20] Training cost: 4.245, ObjLoss=5.251,BoxCenterLoss=3.653,BoxScaleLoss=0.953,ClassLoss=0.386 INFO:root:[Epoch 20] Validation: motorbike=0.6933202997719127 mAP=0.6933202997719127 INFO:root:[Epoch 21] Training cost: 7.699, ObjLoss=5.590,BoxCenterLoss=3.766,BoxScaleLoss=0.945,ClassLoss=0.325 INFO:root:[Epoch 21] Validation: motorbike=0.7454308399323061 mAP=0.7454308399323061 INFO:root:[Epoch 22] Training cost: 5.612, ObjLoss=4.576,BoxCenterLoss=3.775,BoxScaleLoss=0.887,ClassLoss=0.326 INFO:root:[Epoch 22] Validation: motorbike=0.7912551337551338 mAP=0.7912551337551338 INFO:root:[Epoch 23] Training cost: 5.640, ObjLoss=4.546,BoxCenterLoss=3.722,BoxScaleLoss=0.915,ClassLoss=0.360 INFO:root:[Epoch 23] Validation: motorbike=0.8097566415118704 mAP=0.8097566415118704 INFO:root:[Epoch 24] Training cost: 5.395, ObjLoss=4.801,BoxCenterLoss=3.663,BoxScaleLoss=0.871,ClassLoss=0.307 INFO:root:[Epoch 24] Validation: motorbike=0.8304120377175236 mAP=0.8304120377175236 INFO:root:[Epoch 25] Training cost: 7.398, ObjLoss=5.274,BoxCenterLoss=3.854,BoxScaleLoss=0.888,ClassLoss=0.285 INFO:root:[Epoch 25] Validation: motorbike=0.7901496665773562 mAP=0.7901496665773562 INFO:root:[Epoch 26] Training cost: 3.109, ObjLoss=5.108,BoxCenterLoss=3.698,BoxScaleLoss=1.002,ClassLoss=0.365 INFO:root:[Epoch 26] Validation: motorbike=0.8208913670870194 mAP=0.8208913670870194 INFO:root:[Epoch 27] Training cost: 8.020, ObjLoss=4.841,BoxCenterLoss=3.569,BoxScaleLoss=0.873,ClassLoss=0.214 INFO:root:[Epoch 27] Validation: motorbike=0.8407473948975925 mAP=0.8407473948975925 INFO:root:[Epoch 28] Training cost: 5.353, ObjLoss=4.637,BoxCenterLoss=3.818,BoxScaleLoss=0.934,ClassLoss=0.307 INFO:root:[Epoch 28] Validation: motorbike=0.7948053680757586 mAP=0.7948053680757586 INFO:root:[Epoch 29] Training cost: 5.529, ObjLoss=4.525,BoxCenterLoss=3.522,BoxScaleLoss=0.761,ClassLoss=0.261 INFO:root:[Epoch 29] Validation: motorbike=0.8654545454545456 mAP=0.8654545454545456 INFO:root:{'meta_arch': 'yolo3', 'dataset': , '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, 'warmup_iters': 1000, 'warmup_factor': 0.3333333333333333, '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} INFO:root:[Epoch 0] Training cost: 6.274, ObjLoss=712.562,BoxCenterLoss=3.758,BoxScaleLoss=2.684,ClassLoss=0.990 INFO:root:[Epoch 1] Training cost: 5.198, ObjLoss=15.033,BoxCenterLoss=3.651,BoxScaleLoss=2.038,ClassLoss=0.904 INFO:root:[Epoch 2] Training cost: 6.324, ObjLoss=13.980,BoxCenterLoss=3.885,BoxScaleLoss=1.751,ClassLoss=0.770 INFO:root:[Epoch 3] Training cost: 9.264, ObjLoss=9.382,BoxCenterLoss=3.629,BoxScaleLoss=1.487,ClassLoss=0.645 INFO:root:[Epoch 4] Training cost: 5.560, ObjLoss=8.358,BoxCenterLoss=3.747,BoxScaleLoss=1.362,ClassLoss=0.685 INFO:root:[Epoch 5] Training cost: 7.625, ObjLoss=6.944,BoxCenterLoss=3.461,BoxScaleLoss=1.218,ClassLoss=0.488 INFO:root:[Epoch 6] Training cost: 7.633, ObjLoss=6.621,BoxCenterLoss=3.591,BoxScaleLoss=1.148,ClassLoss=0.464 INFO:root:[Epoch 7] Training cost: 5.040, ObjLoss=6.148,BoxCenterLoss=3.598,BoxScaleLoss=1.167,ClassLoss=0.531 INFO:root:[Epoch 8] Training cost: 7.542, ObjLoss=6.056,BoxCenterLoss=3.633,BoxScaleLoss=1.085,ClassLoss=0.451 INFO:root:[Epoch 9] Training cost: 6.398, ObjLoss=5.272,BoxCenterLoss=3.299,BoxScaleLoss=1.011,ClassLoss=0.389 INFO:root:[Epoch 10] Training cost: 4.594, ObjLoss=5.219,BoxCenterLoss=3.439,BoxScaleLoss=1.021,ClassLoss=0.384 INFO:root:[Epoch 11] Training cost: 6.370, ObjLoss=5.250,BoxCenterLoss=3.556,BoxScaleLoss=1.080,ClassLoss=0.398 INFO:root:[Epoch 12] Training cost: 6.104, ObjLoss=5.063,BoxCenterLoss=3.560,BoxScaleLoss=0.994,ClassLoss=0.378 INFO:root:[Epoch 13] Training cost: 8.592, ObjLoss=5.499,BoxCenterLoss=3.377,BoxScaleLoss=0.951,ClassLoss=0.291 INFO:root:[Epoch 14] Training cost: 6.770, ObjLoss=4.963,BoxCenterLoss=3.609,BoxScaleLoss=0.925,ClassLoss=0.339 INFO:root:[Epoch 15] Training cost: 5.675, ObjLoss=5.261,BoxCenterLoss=3.643,BoxScaleLoss=0.974,ClassLoss=0.391 INFO:root:[Epoch 16] Training cost: 3.965, ObjLoss=4.692,BoxCenterLoss=3.362,BoxScaleLoss=0.928,ClassLoss=0.376 INFO:root:[Epoch 17] Training cost: 4.168, ObjLoss=5.091,BoxCenterLoss=3.590,BoxScaleLoss=1.013,ClassLoss=0.383 INFO:root:[Epoch 18] Training cost: 8.076, ObjLoss=5.539,BoxCenterLoss=3.511,BoxScaleLoss=1.004,ClassLoss=0.293 INFO:root:[Epoch 19] Training cost: 4.371, ObjLoss=5.188,BoxCenterLoss=3.462,BoxScaleLoss=1.027,ClassLoss=0.352 INFO:root:[Epoch 20] Training cost: 5.804, ObjLoss=4.698,BoxCenterLoss=3.492,BoxScaleLoss=0.920,ClassLoss=0.303 INFO:root:[Epoch 21] Training cost: 6.161, ObjLoss=4.452,BoxCenterLoss=3.478,BoxScaleLoss=0.918,ClassLoss=0.242 INFO:root:[Epoch 22] Training cost: 5.714, ObjLoss=4.320,BoxCenterLoss=3.377,BoxScaleLoss=0.927,ClassLoss=0.268 INFO:root:[Epoch 23] Training cost: 5.698, ObjLoss=4.507,BoxCenterLoss=3.483,BoxScaleLoss=0.889,ClassLoss=0.251 INFO:root:[Epoch 24] Training cost: 6.257, ObjLoss=4.375,BoxCenterLoss=3.377,BoxScaleLoss=0.879,ClassLoss=0.195 INFO:root:[Epoch 25] Training cost: 8.196, ObjLoss=4.459,BoxCenterLoss=3.451,BoxScaleLoss=0.803,ClassLoss=0.192 INFO:root:[Epoch 26] Training cost: 5.943, ObjLoss=4.334,BoxCenterLoss=3.467,BoxScaleLoss=0.857,ClassLoss=0.206 INFO:root:[Epoch 27] Training cost: 5.964, ObjLoss=4.255,BoxCenterLoss=3.273,BoxScaleLoss=0.837,ClassLoss=0.200 INFO:root:[Epoch 28] Training cost: 8.796, ObjLoss=4.684,BoxCenterLoss=3.332,BoxScaleLoss=0.856,ClassLoss=0.161 INFO:root:[Epoch 29] Training cost: 4.322, ObjLoss=4.642,BoxCenterLoss=3.586,BoxScaleLoss=0.924,ClassLoss=0.250 Note that ``num_trials=2`` above is only used to speed up the tutorial. In normal practice, it is common to only use ``time_limits`` and drop ``num_trials``. 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(). .. code:: python 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])) .. parsed-literal:: :class: output mAP on test dataset: 0.752336066414773 Below, we randomly select an image from test dataset and show the predicted box and probability over the origin image. .. code:: python image = '000467.jpg' image_path = os.path.join(data_root, 'JPEGImages', image) ind, prob, loc = detector.predict(image_path) .. figure:: output_beginner_1fd7a6_11_0.png We can also save the trained model, and use it later. .. code:: python savefile = 'model.pkl' detector.save(savefile) from autogluon.vision import Detector new_detector = Detector.load(savefile)