All Products
Search
Document Center

Platform For AI:Image semantic segmentation

Last Updated:Mar 12, 2024

EasyVision of Machine Learning Platform for AI allows you to perform model training and prediction in image semantic segmentation. 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 semantic segmentation based on existing training models.

Data format

For more information, see Input data formats.

Offline prediction in image semantic segmentation

You can run the following Machine Learning Platform for AI command to start offline prediction in image semantic segmentation based on existing files: 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='segmentor'
             -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.

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:

{
  "probs" : [[[0.8, 0.8], [0.6, 0.7]],[[0.8, 0.5], [0.4, 0.3]]],
  "preds" : [[[1,1], [0, 0]], [[0, 0], [1,1]]]
}

The following table describes the parameters in the JSON string.

Parameter

Description

Shape

Data type

probs

The probability that each pixel obtained through segmentation belongs to a specific category.

[output_height, output_width, num_classes]

FLOAT

preds

The ID of the category to which the pixel obtained through segmentation belongs.

[output_height, output_widths]

INT