This topic describes how to configure image classification in the procedure of creating instances, labeling images, training models, and evaluating and testing models.

Prerequisites

If you want to configure image classification as a Resource Access Management (RAM) user, you must first use your Alibaba Cloud account to authorize the RAM user. For more information, see RAM user authorization.

Step 1: Create an instance

  1. Log on to the Machine Learning Platform for AI console.
  2. In the left-side navigation pane, choose AutoLearning > General Purpose Model Training.
  3. On the AutoLearning page, click Create Instance.
  4. On the Create Instance page, set the following parameters.
    Parameter Description
    Instance Type Set the Instance type to Image Classification. AutoLearning supports the following instance types:
    • Image Classification
    • Rec-Matching System
    Instance Name The instance name must be 1 to 20 characters in length and can contain letters, underscores (_), and digits. It must start with a letter.
    Example Description The description of the instance, which helps distinguish different instances.
    Data Training In the Two ways to mark pictures section, select a method to label images, and enter the Object Storage Service (OSS) path where the images for model training are stored. AutoLearning allows you to label images in the following ways:
    • Online Image Labeling. If the training set contains less than 50 images, you can label the images online.
      Note All images must be stored in the same folder. Supported image formats are JPEG, JPG, PNG, BMP, and TIFF.
    • Import Labeling Information File. If the training set contains a large number of images, you can choose to import a labeling data file. The following example shows the format of a labeling data file:
      id,oss data,label
      0,"{""tfspath"":""oss://autodl/yuyi/t4.jpeg""}","{""option"":""tiger""}"
      1,"{""tfspath"":""oss://autodl/yuyi/pb5.jpeg""}","{""option"":""polar bear""}"
      2,"{""tfspath"":""oss://autodl/yuyi/cat4.jpeg""}","{""option"":""cat""}"
      Note All images and labeling data files must be stored in the same folder. Supported image formats are JPEG, JPG, PNG, BMP and TIFF.
  5. Click Confirm.

Step 2: Label images

  1. On the AutoLearning page, click Open in the Operation column.
  2. In the Data Annotation wizard, label all images.
  3. Click Complete labeling.

Step 3: Train and evaluate the model

  1. In the Start training dialog box, navigate to the Training settings section, and specify the Maximum training duration.
    AutoLearning supports Early Stopping, which can prevent overfitting.
    Note The Maximum training duration is measured in minutes. Enter a value from 10 to 60.
  2. Optional:Select the Incremental training check box, and select a model version from the drop-down list.
  3. Click Start training.
  4. In the Model Training and Evaluation wizard, view the Training progress and Latest Assessment Results.
  5. Optional:In the Model Training List section, click the 2 icon and select an existing training model. You can view the evaluation results, including the accuracy, precision, recall rate, and F1 score.
  6. In the Model Training and Evaluation wizard, navigate to the Operation section to manage the trained model.
    You can perform the following operations:
    • Trial: use the model five times free of charge within 24 hours after the model is generated.
    • Deploy: deploy the model to Elastic Algorithm Service (EAS).
    • Delete: delete the model.
    • View logs: view logs that record model training details.

Step 4: Test the model

  1. In the Model Training and Evaluation wizard, navigate to the Operation section. Then, click Trial.
  2. In the Model trial wizard, upload local files to test the model.
    If this is the first time you use the model, it may take 3 to 5 minutes to produce prediction results.
  3. If the results meet your requirements, click Go to EAS deployment to deploy the model as a RESTful API. EAS charges deployment fees.