EasyVision of Machine Learning Platform for AI (PAI) allows you to perform model training and prediction in image object detection. You can also use EasyVision to perform distributed training and prediction on multiple servers. This topic describes how to use a trained model of EasyVision to perform offline object detection.
Data formats
For more information, see Input data formats.
Image object detection
Based on the generated file list, you can start prediction tasks of image object detection by running the PAI command. You can call the PAI command by using the SQL Script component, the MaxCompute client, or an ODPS SQL node of DataWorks. For more information, see MaxCompute client (odpscmd) or Develop a MaxCompute SQL task.
pai -name ev_predict_ext
-Dmodel_path='OSS path of your model'
-Dmodel_type='detector'
-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 folder'
-Darn='Alibaba Cloud Resource Name (ARN) of your role'
-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 OSS path and a JSON sting. The OSS path indicates the path of the original image, whereas the JSON string indicates the prediction result. The entries are in the following format:
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:
{
"detection_boxes": [[243.5308074951172, 197.69570922851562, 385.59625244140625, 247.7247772216797], [292.1929931640625, 114.28043365478516, 571.2748413085938, 165.09771728515625]],
"detection_scores": [0.9942291975021362, 0.9940272569656372],
"detection_classes": [1, 1],
"detection_classe_names": ["text", "text"]
}
The following table describes the parameters in the JSON string.
Parameter | Description | Shape | Type |
detection_boxes | The detected area with coordinates in the following order: [top, left, bottom, right]. | [num_detections, 4] | FLOAT |
detection_scores | The detection probability of the object. | num_detections | FLOAT |
detection_classes | The ID of the class to which the object belongs. | num_detections | INT |
detection_class_names | The name of the class to which the object belongs. | num_detections | STRING |