Autogluon training

AutoGluon enables easy-to-use and easy-to-extend AutoML with a focus on deep learning and real-world applications.

As of today, Autogluon supports input data in tabular format, image classification, object detection, text classification and neural architecture search.

Common import statement for all task types

import autogluon as ag

Tabular Prediction

from autogluon import TabularPrediction as task

train_data = task.Dataset(file_path='path-to-your-csv-file')

label_column = 'class'

dir = 'agModels-predictClass' # specifies folder where to store trained models
predictor =, label=label_column, output_directory=dir)

Image Classification

from autogluon import ImageClassification as task

Make sure your image folders are organized as follows:

dataset = task.Dataset('data/train')
if ag.get_gpu_count() == 0:
    dataset = task.Dataset(name='mydataset')
    test_dataset = task.Dataset(name='mydataset', train=False)
classifier =,

Object detection

Note, try this if you already have annotations. Otherwise, go to Rekognition custom object detection.

Annotations are xml documents that look like…

       <database>The VOC2007 Database</database>
       <annotation>PASCAL VOC2007</annotation>
       <name>jun saitoh</name>

from autogluon import ObjectDetection as task

import os
data_root = os.path.join(root, filename)
dataset_train = task.Dataset(data_root, classes=('motorbike',))

time_limits = 5*60*60  # 5 hours
epochs = 30
detector =,
                   lr=ag.Categorical(5e-4, 1e-4),

Text Classification

from autogluon import TextClassification as task

Explore this toy dataset and use a similar format:

dataset = task.Dataset(name='ToySST')
predictor =, epochs=1, time_limits=30)