All Products
Document Center

Platform For AI:Image classification

Last Updated:Feb 05, 2024

EasyVision of Platform for AI (PAI) allows you to perform model training and prediction in image classification. In addition, you can use EasyVision to perform distributed training and prediction on multiple servers. This topic describes how to use EasyVision to achieve offline prediction in image classification based on existing training models.

Data format

For more information, see Input data formats.

Offline prediction in image classification

You can run the following PAI command to start the offline prediction task in image classification based on existing files:

pai -name ev_predict_ext
             -Dmodel_path='OSS path of your model'
             -Dbuckets='Your OSS directory'
             -Darn='Alibaba Cloud Resource Name (ARN) of the role that you are assuming'
             -DossHost='Your OSS domain'

For more information, see Parameters.


Prediction results are written to an output file. Each entry in the file consists of an Object Storage Service (OSS) path and a JSON string. The OSS path indicates the path of the original image, whereas the JSON string indicates the prediction result. For example, the output file contains the following information:

oss://path/to/your/image1.jpg,  JSON string
oss://path/to/your/image1.jpg,  JSON string
oss://path/to/your/image1.jpg,  JSON string

The JSON string is in the following format:

"class": 3,
"class_name": "coho4",
"class_probs": {"coho1": 4.028851974258174e-10,
          "coho2": 0.48115724325180054,
          "coho3": 5.116515922054532e-07,
          "coho4": 0.5188422446937221}

The following table describes the parameters in the JSON string.




Data type


The ID of the category.


INT 32


The name of the category.




The probabilities for all categories.