.. _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 `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: .. code:: python import autogluon as ag from autogluon 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 Downloading ./tiny_motorbike.zip from https://autogluon.s3.amazonaws.com/datasets/tiny_motorbike.zip... 21273KB [00:00, 63855.33KB/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',)) .. parsed-literal:: :class: output >>> 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. .. 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_options: Key 'training_history_callback_delta_secs': Imputing default value 60 scheduler_options: Key 'delay_get_config': Imputing default value True Starting Experiments Num of Finished Tasks is 0 Num of Pending Tasks is 2 .. parsed-literal:: :class: output scheduler: FIFOScheduler( DistributedResourceManager{ (Remote: Remote REMOTE_ID: 0, , Resource: NodeResourceManager(8 CPUs, 1 GPUs)) }) .. parsed-literal:: :class: output HBox(children=(FloatProgress(value=0.0, max=2.0), HTML(value=''))) .. parsed-literal:: :class: output Time out (secs) is 18000 {'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} [Epoch 0] Training cost: 4.034, ObjLoss=1185.217,BoxCenterLoss=3.940,BoxScaleLoss=2.663,ClassLoss=1.021 [Epoch 0] Validation: motorbike=0.0 mAP=0.0 [Epoch 1] Training cost: 3.890, ObjLoss=25.490,BoxCenterLoss=3.734,BoxScaleLoss=1.601,ClassLoss=0.782 [Epoch 1] Validation: motorbike=0.5588900194040035 mAP=0.5588900194040035 [Epoch 2] Training cost: 3.416, ObjLoss=50.647,BoxCenterLoss=3.593,BoxScaleLoss=1.289,ClassLoss=0.701 [Epoch 2] Validation: motorbike=0.0 mAP=0.0 [Epoch 3] Training cost: 4.176, ObjLoss=20.256,BoxCenterLoss=3.633,BoxScaleLoss=1.283,ClassLoss=0.644 [Epoch 3] Validation: motorbike=0.17442694951988633 mAP=0.17442694951988633 [Epoch 4] Training cost: 3.161, ObjLoss=116.038,BoxCenterLoss=3.773,BoxScaleLoss=1.335,ClassLoss=0.720 [Epoch 4] Validation: motorbike=0.0 mAP=0.0 [Epoch 5] Training cost: 4.379, ObjLoss=87.389,BoxCenterLoss=3.578,BoxScaleLoss=1.357,ClassLoss=0.724 [Epoch 5] Validation: motorbike=0.0 mAP=0.0 [Epoch 6] Training cost: 5.599, ObjLoss=91.643,BoxCenterLoss=3.810,BoxScaleLoss=1.413,ClassLoss=0.713 [Epoch 6] Validation: motorbike=0.0 mAP=0.0 [Epoch 7] Training cost: 3.517, ObjLoss=133.975,BoxCenterLoss=3.670,BoxScaleLoss=1.680,ClassLoss=0.640 [Epoch 7] Validation: motorbike=0.0 mAP=0.0 [Epoch 8] Training cost: 5.224, ObjLoss=70.906,BoxCenterLoss=3.741,BoxScaleLoss=1.317,ClassLoss=0.608 [Epoch 8] Validation: motorbike=0.15612750885478158 mAP=0.15612750885478158 [Epoch 9] Training cost: 6.614, ObjLoss=65.956,BoxCenterLoss=3.740,BoxScaleLoss=1.300,ClassLoss=0.532 [Epoch 9] Validation: motorbike=0.09090909090909091 mAP=0.09090909090909091 [Epoch 10] Training cost: 3.731, ObjLoss=71.480,BoxCenterLoss=3.451,BoxScaleLoss=1.202,ClassLoss=0.467 [Epoch 10] Validation: motorbike=0.08712121212121211 mAP=0.08712121212121211 [Epoch 11] Training cost: 4.940, ObjLoss=54.174,BoxCenterLoss=3.718,BoxScaleLoss=1.193,ClassLoss=0.512 [Epoch 11] Validation: motorbike=0.11931818181818182 mAP=0.11931818181818182 [Epoch 12] Training cost: 5.803, ObjLoss=34.542,BoxCenterLoss=3.703,BoxScaleLoss=1.328,ClassLoss=0.471 [Epoch 12] Validation: motorbike=0.0 mAP=0.0 [Epoch 13] Training cost: 7.044, ObjLoss=37.074,BoxCenterLoss=3.675,BoxScaleLoss=1.296,ClassLoss=0.417 [Epoch 13] Validation: motorbike=0.0 mAP=0.0 [Epoch 14] Training cost: 4.408, ObjLoss=55.561,BoxCenterLoss=3.736,BoxScaleLoss=1.335,ClassLoss=0.472 [Epoch 14] Validation: motorbike=0.1717171717171717 mAP=0.1717171717171717 [Epoch 15] Training cost: 7.194, ObjLoss=29.910,BoxCenterLoss=3.576,BoxScaleLoss=1.222,ClassLoss=0.373 [Epoch 15] Validation: motorbike=0.0 mAP=0.0 [Epoch 16] Training cost: 6.375, ObjLoss=17.327,BoxCenterLoss=3.625,BoxScaleLoss=1.290,ClassLoss=0.375 [Epoch 16] Validation: motorbike=0.0 mAP=0.0 [Epoch 17] Training cost: 4.887, ObjLoss=25.160,BoxCenterLoss=3.754,BoxScaleLoss=1.141,ClassLoss=0.440 [Epoch 17] Validation: motorbike=0.2049062049062049 mAP=0.2049062049062049 [Epoch 18] Training cost: 3.632, ObjLoss=35.540,BoxCenterLoss=3.609,BoxScaleLoss=1.102,ClassLoss=0.406 [Epoch 18] Validation: motorbike=0.30627705627705626 mAP=0.30627705627705626 [Epoch 19] Training cost: 5.949, ObjLoss=22.838,BoxCenterLoss=3.623,BoxScaleLoss=1.207,ClassLoss=0.358 [Epoch 19] Validation: motorbike=0.056818181818181816 mAP=0.056818181818181816 [Epoch 20] Training cost: 3.285, ObjLoss=30.893,BoxCenterLoss=3.770,BoxScaleLoss=1.306,ClassLoss=0.431 [Epoch 20] Validation: motorbike=0.12330198537095088 mAP=0.12330198537095088 [Epoch 21] Training cost: 3.463, ObjLoss=20.622,BoxCenterLoss=3.521,BoxScaleLoss=1.111,ClassLoss=0.403 [Epoch 21] Validation: motorbike=0.1722879165404378 mAP=0.1722879165404378 [Epoch 22] Training cost: 3.107, ObjLoss=19.934,BoxCenterLoss=3.618,BoxScaleLoss=1.129,ClassLoss=0.426 [Epoch 22] Validation: motorbike=0.12182415226686343 mAP=0.12182415226686343 [Epoch 23] Training cost: 3.484, ObjLoss=29.429,BoxCenterLoss=3.687,BoxScaleLoss=1.134,ClassLoss=0.396 [Epoch 23] Validation: motorbike=0.09841564398661365 mAP=0.09841564398661365 [Epoch 24] Training cost: 4.745, ObjLoss=28.395,BoxCenterLoss=3.692,BoxScaleLoss=1.320,ClassLoss=0.348 [Epoch 24] Validation: motorbike=0.06617432910339088 mAP=0.06617432910339088 [Epoch 25] Training cost: 6.836, ObjLoss=19.171,BoxCenterLoss=3.686,BoxScaleLoss=1.204,ClassLoss=0.339 [Epoch 25] Validation: motorbike=0.09090909090909091 mAP=0.09090909090909091 [Epoch 26] Training cost: 2.721, ObjLoss=28.323,BoxCenterLoss=3.541,BoxScaleLoss=1.335,ClassLoss=0.349 [Epoch 26] Validation: motorbike=0.2464212616651641 mAP=0.2464212616651641 [Epoch 27] Training cost: 3.556, ObjLoss=17.724,BoxCenterLoss=3.567,BoxScaleLoss=1.037,ClassLoss=0.361 [Epoch 27] Validation: motorbike=0.24432935695626054 mAP=0.24432935695626054 [Epoch 28] Training cost: 5.316, ObjLoss=17.224,BoxCenterLoss=3.650,BoxScaleLoss=1.249,ClassLoss=0.293 [Epoch 28] Validation: motorbike=0.09090909090909091 mAP=0.09090909090909091 [Epoch 29] Training cost: 2.901, ObjLoss=21.231,BoxCenterLoss=3.568,BoxScaleLoss=1.070,ClassLoss=0.347 [Epoch 29] Validation: motorbike=0.16666666666666666 mAP=0.16666666666666666 .. parsed-literal:: :class: output .. parsed-literal:: :class: output {'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} [Epoch 0] Training cost: 4.145, ObjLoss=1303.660,BoxCenterLoss=4.054,BoxScaleLoss=3.054,ClassLoss=1.040 [Epoch 0] Validation: motorbike=0.0 mAP=0.0 [Epoch 1] Training cost: 4.086, ObjLoss=18.977,BoxCenterLoss=3.802,BoxScaleLoss=2.028,ClassLoss=0.884 [Epoch 1] Validation: motorbike=0.0 mAP=0.0 [Epoch 2] Training cost: 3.443, ObjLoss=17.977,BoxCenterLoss=3.654,BoxScaleLoss=1.749,ClassLoss=0.771 [Epoch 2] Validation: motorbike=0.045454545454545456 mAP=0.045454545454545456 [Epoch 3] Training cost: 3.961, ObjLoss=14.015,BoxCenterLoss=3.645,BoxScaleLoss=1.410,ClassLoss=0.720 [Epoch 3] Validation: motorbike=0.47242559302927334 mAP=0.47242559302927334 [Epoch 4] Training cost: 3.079, ObjLoss=9.740,BoxCenterLoss=3.755,BoxScaleLoss=1.580,ClassLoss=0.727 [Epoch 4] Validation: motorbike=0.5515416026054325 mAP=0.5515416026054325 [Epoch 5] Training cost: 4.030, ObjLoss=6.502,BoxCenterLoss=3.415,BoxScaleLoss=1.198,ClassLoss=0.636 [Epoch 5] Validation: motorbike=0.4423017074609205 mAP=0.4423017074609205 [Epoch 6] Training cost: 5.774, ObjLoss=7.807,BoxCenterLoss=3.738,BoxScaleLoss=1.310,ClassLoss=0.598 [Epoch 6] Validation: motorbike=0.6652825582928499 mAP=0.6652825582928499 [Epoch 7] Training cost: 3.497, ObjLoss=6.690,BoxCenterLoss=3.581,BoxScaleLoss=1.210,ClassLoss=0.622 [Epoch 7] Validation: motorbike=0.5548156943631082 mAP=0.5548156943631082 [Epoch 8] Training cost: 5.486, ObjLoss=6.064,BoxCenterLoss=3.444,BoxScaleLoss=1.082,ClassLoss=0.535 [Epoch 8] Validation: motorbike=0.6811780654537491 mAP=0.6811780654537491 [Epoch 9] Training cost: 6.508, ObjLoss=6.202,BoxCenterLoss=3.467,BoxScaleLoss=1.014,ClassLoss=0.493 [Epoch 9] Validation: motorbike=0.7360412068783946 mAP=0.7360412068783946 [Epoch 10] Training cost: 3.568, ObjLoss=6.030,BoxCenterLoss=3.587,BoxScaleLoss=1.074,ClassLoss=0.522 [Epoch 10] Validation: motorbike=0.6530085225864186 mAP=0.6530085225864186 [Epoch 11] Training cost: 4.953, ObjLoss=5.437,BoxCenterLoss=3.492,BoxScaleLoss=0.948,ClassLoss=0.488 [Epoch 11] Validation: motorbike=0.6946110036535568 mAP=0.6946110036535568 [Epoch 12] Training cost: 6.075, ObjLoss=5.664,BoxCenterLoss=3.608,BoxScaleLoss=0.960,ClassLoss=0.429 [Epoch 12] Validation: motorbike=0.7142443654111463 mAP=0.7142443654111463 [Epoch 13] Training cost: 7.100, ObjLoss=5.779,BoxCenterLoss=3.665,BoxScaleLoss=0.977,ClassLoss=0.402 [Epoch 13] Validation: motorbike=0.7507746208820162 mAP=0.7507746208820162 [Epoch 14] Training cost: 4.646, ObjLoss=5.230,BoxCenterLoss=3.580,BoxScaleLoss=1.019,ClassLoss=0.411 [Epoch 14] Validation: motorbike=0.7440053357052976 mAP=0.7440053357052976 [Epoch 15] Training cost: 6.953, ObjLoss=5.444,BoxCenterLoss=3.356,BoxScaleLoss=0.875,ClassLoss=0.325 [Epoch 15] Validation: motorbike=0.7407067332843742 mAP=0.7407067332843742 [Epoch 16] Training cost: 6.244, ObjLoss=5.266,BoxCenterLoss=3.497,BoxScaleLoss=0.917,ClassLoss=0.341 [Epoch 16] Validation: motorbike=0.7274098818619367 mAP=0.7274098818619367 [Epoch 17] Training cost: 4.895, ObjLoss=4.782,BoxCenterLoss=3.424,BoxScaleLoss=0.843,ClassLoss=0.355 [Epoch 17] Validation: motorbike=0.7940913424604141 mAP=0.7940913424604141 [Epoch 18] Training cost: 3.486, ObjLoss=4.659,BoxCenterLoss=3.441,BoxScaleLoss=0.941,ClassLoss=0.383 [Epoch 18] Validation: motorbike=0.796597584511044 mAP=0.796597584511044 [Epoch 19] Training cost: 5.967, ObjLoss=5.125,BoxCenterLoss=3.501,BoxScaleLoss=0.918,ClassLoss=0.312 [Epoch 19] Validation: motorbike=0.8493848842779325 mAP=0.8493848842779325 [Epoch 20] Training cost: 3.307, ObjLoss=4.772,BoxCenterLoss=3.404,BoxScaleLoss=1.011,ClassLoss=0.391 [Epoch 20] Validation: motorbike=0.8166645948983149 mAP=0.8166645948983149 [Epoch 21] Training cost: 3.465, ObjLoss=5.128,BoxCenterLoss=3.601,BoxScaleLoss=0.949,ClassLoss=0.398 [Epoch 21] Validation: motorbike=0.7641235143572228 mAP=0.7641235143572228 [Epoch 22] Training cost: 3.009, ObjLoss=4.729,BoxCenterLoss=3.506,BoxScaleLoss=1.043,ClassLoss=0.377 [Epoch 22] Validation: motorbike=0.7866091715871296 mAP=0.7866091715871296 [Epoch 23] Training cost: 3.549, ObjLoss=4.760,BoxCenterLoss=3.579,BoxScaleLoss=0.948,ClassLoss=0.364 [Epoch 23] Validation: motorbike=0.8000176940079923 mAP=0.8000176940079923 [Epoch 24] Training cost: 4.454, ObjLoss=4.502,BoxCenterLoss=3.598,BoxScaleLoss=0.888,ClassLoss=0.269 [Epoch 24] Validation: motorbike=0.8558406686859255 mAP=0.8558406686859255 [Epoch 25] Training cost: 6.569, ObjLoss=4.890,BoxCenterLoss=3.504,BoxScaleLoss=0.885,ClassLoss=0.250 [Epoch 25] Validation: motorbike=0.8592319495783018 mAP=0.8592319495783018 [Epoch 26] Training cost: 2.797, ObjLoss=5.539,BoxCenterLoss=3.533,BoxScaleLoss=1.000,ClassLoss=0.414 [Epoch 26] Validation: motorbike=0.8383713061132416 mAP=0.8383713061132416 [Epoch 27] Training cost: 3.721, ObjLoss=4.566,BoxCenterLoss=3.427,BoxScaleLoss=0.890,ClassLoss=0.333 [Epoch 27] Validation: motorbike=0.8428781744571218 mAP=0.8428781744571218 [Epoch 28] Training cost: 5.259, ObjLoss=4.672,BoxCenterLoss=3.477,BoxScaleLoss=0.817,ClassLoss=0.232 [Epoch 28] Validation: motorbike=0.8424766963560069 mAP=0.8424766963560069 [Epoch 29] Training cost: 2.789, ObjLoss=4.792,BoxCenterLoss=3.457,BoxScaleLoss=0.897,ClassLoss=0.348 [Epoch 29] Validation: motorbike=0.821923124689518 mAP=0.821923124689518 {'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} [Epoch 0] Training cost: 3.623, ObjLoss=713.615,BoxCenterLoss=3.949,BoxScaleLoss=2.808,ClassLoss=1.037 [Epoch 1] Training cost: 4.708, ObjLoss=14.703,BoxCenterLoss=3.554,BoxScaleLoss=2.094,ClassLoss=0.843 [Epoch 2] Training cost: 5.762, ObjLoss=13.461,BoxCenterLoss=3.758,BoxScaleLoss=1.760,ClassLoss=0.810 [Epoch 3] Training cost: 8.396, ObjLoss=9.850,BoxCenterLoss=3.700,BoxScaleLoss=1.504,ClassLoss=0.674 [Epoch 4] Training cost: 4.820, ObjLoss=7.862,BoxCenterLoss=3.493,BoxScaleLoss=1.343,ClassLoss=0.632 [Epoch 5] Training cost: 6.758, ObjLoss=7.202,BoxCenterLoss=3.677,BoxScaleLoss=1.222,ClassLoss=0.555 [Epoch 6] Training cost: 6.828, ObjLoss=6.528,BoxCenterLoss=3.723,BoxScaleLoss=1.219,ClassLoss=0.521 [Epoch 7] Training cost: 4.294, ObjLoss=6.355,BoxCenterLoss=3.714,BoxScaleLoss=1.233,ClassLoss=0.558 [Epoch 8] Training cost: 6.434, ObjLoss=6.147,BoxCenterLoss=3.665,BoxScaleLoss=1.110,ClassLoss=0.430 [Epoch 9] Training cost: 5.659, ObjLoss=5.550,BoxCenterLoss=3.567,BoxScaleLoss=1.037,ClassLoss=0.410 [Epoch 10] Training cost: 4.124, ObjLoss=5.315,BoxCenterLoss=3.383,BoxScaleLoss=1.037,ClassLoss=0.406 [Epoch 11] Training cost: 5.632, ObjLoss=5.180,BoxCenterLoss=3.396,BoxScaleLoss=1.005,ClassLoss=0.381 [Epoch 12] Training cost: 5.513, ObjLoss=5.084,BoxCenterLoss=3.541,BoxScaleLoss=0.957,ClassLoss=0.383 [Epoch 13] Training cost: 7.636, ObjLoss=5.296,BoxCenterLoss=3.392,BoxScaleLoss=0.946,ClassLoss=0.293 [Epoch 14] Training cost: 6.281, ObjLoss=5.358,BoxCenterLoss=3.791,BoxScaleLoss=1.142,ClassLoss=0.372 [Epoch 15] Training cost: 4.594, ObjLoss=4.673,BoxCenterLoss=3.477,BoxScaleLoss=0.910,ClassLoss=0.341 [Epoch 16] Training cost: 3.635, ObjLoss=5.486,BoxCenterLoss=3.679,BoxScaleLoss=0.977,ClassLoss=0.442 [Epoch 17] Training cost: 3.600, ObjLoss=5.304,BoxCenterLoss=3.523,BoxScaleLoss=1.047,ClassLoss=0.414 [Epoch 18] Training cost: 6.790, ObjLoss=5.369,BoxCenterLoss=3.383,BoxScaleLoss=0.904,ClassLoss=0.257 [Epoch 19] Training cost: 3.657, ObjLoss=4.882,BoxCenterLoss=3.478,BoxScaleLoss=0.987,ClassLoss=0.352 [Epoch 20] Training cost: 4.995, ObjLoss=4.705,BoxCenterLoss=3.409,BoxScaleLoss=0.839,ClassLoss=0.297 [Epoch 21] Training cost: 5.371, ObjLoss=4.506,BoxCenterLoss=3.447,BoxScaleLoss=0.848,ClassLoss=0.256 [Epoch 22] Training cost: 4.947, ObjLoss=4.658,BoxCenterLoss=3.589,BoxScaleLoss=0.914,ClassLoss=0.289 [Epoch 23] Training cost: 4.855, ObjLoss=4.183,BoxCenterLoss=3.423,BoxScaleLoss=0.826,ClassLoss=0.262 [Epoch 24] Training cost: 5.724, ObjLoss=5.043,BoxCenterLoss=3.685,BoxScaleLoss=0.965,ClassLoss=0.284 [Epoch 25] Training cost: 7.008, ObjLoss=4.453,BoxCenterLoss=3.427,BoxScaleLoss=0.852,ClassLoss=0.199 [Epoch 26] Training cost: 4.986, ObjLoss=4.588,BoxCenterLoss=3.475,BoxScaleLoss=0.869,ClassLoss=0.224 [Epoch 27] Training cost: 5.462, ObjLoss=4.406,BoxCenterLoss=3.308,BoxScaleLoss=0.849,ClassLoss=0.210 [Epoch 28] Training cost: 7.345, ObjLoss=5.062,BoxCenterLoss=3.483,BoxScaleLoss=0.884,ClassLoss=0.181 [Epoch 29] Training cost: 3.962, ObjLoss=4.510,BoxCenterLoss=3.538,BoxScaleLoss=1.031,ClassLoss=0.269 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> finish model fitting The best config: {'lr.choice': 1, 'net.choice': 0} 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 >>> create dataset(VOC format) .. parsed-literal:: :class: output mAP on test dataset: 0.8208385260190646 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 import Detector new_detector = Detector.load(savefile)