EasyVision of Machine Learning Platform for AI 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 Machine Learning Platform for AI 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'
             -Dmodel_type='classifier'
             -Dinput_oss_file='oss://path/to/your/filelist.txt'
             -Doutput_oss_file='oss://path/to/your/result.txt'
             -Dimage_type='url'
             -Dnum_worker=2
             -DcpuRequired=800
             -DgpuRequired=100
             -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.

Output

Prediction results are written to an output file. Each entry in the file consists of an Object Storage Service (OSS) path and a JSON sting. 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.
Parameter Description Shape Data type
class The ID of the category. [] INT 32
class_name The name of the category. [] STRING
class_probs The probabilities for all categories. [num_classes] Dict{Key:STRING,Value:FLOAT}