Train object detection models using YOLOX, FCOS, YOLOv5, and YOLOv7 to identify and locate entities in images.
Prerequisites
OSS is activated, and Machine Learning Studio is authorized to access OSS. For more information, see Activate OSS and Grant required permissions to use Machine Learning Designer.
Limitations
-
Available only in Designer.
-
Only DLC engine supported.
Parameters
-
Input
Input port
Type
Upstream component
Required
Training data
OSS
No
If not connected, configure Annotation file path for training set on the Field settings tab.
Validation data
OSS
No
If not connected, configure Annotation file path for validation set on the Field settings tab.
Class list file
OSS
No
If not connected, configure Class list file OSS path on the Field settings tab.
-
Configuration
Tab
Parameter
Required
Description
Default
Field settings
Model type
Yes
Model type to use for training. Valid values:
-
FCOS
-
YOLOX
-
YOLOv5
-
YOLOv7
YOLOX
OSS directory for training
No
OSS directory to store the trained model. Example:
examplebucket.oss-cn-shanghai-internal.aliyuncs.com/test/ckpt/. If empty, uses default workspace path.None
Annotation file path for training set
No
-
If data format is DetSourcePAI, provide a file with a
.manifestextension. -
If data format is COCO, provide a file with a
.jsonextension.
If training data provided through an input port, leave this parameter empty. If both configured, the input port takes precedence.
None
Annotation file path for validation set
No
-
If data format is DetSourcePAI, provide a file with a
.manifestextension. -
If data format is COCO, provide a file with a
.jsonextension.
If validation data provided through an input port, leave this parameter empty. If both configured, the input port takes precedence.
None
Class list file OSS path
No
Specify a label list file with a
.txtextension.If class list file provided through an input port, leave this parameter empty. If both configured, the input port takes precedence.
None
Pre-trained model OSS path
No
To use a custom pre-trained model, set this parameter to its OSS path. If not specified, PAI uses a default pre-trained model.
None
Training data OSS path
Yes
Appears only when data format is COCO. Specify the path to training images in COCO format.
None
Validation data OSS path
Yes
Appears only when data format is COCO. Specify the path to evaluation images in COCO format.
None
Data format
Yes
Valid values:
-
COCO
-
DetSourcePAI (YOLOv5 and YOLOv7 models support only DetSourcePAI format.)
DetSourcePAI
Parameters
YOLOX model structure
Yes
Appears only when model type is YOLOX. Select the desired model structure from the drop-down list.
-
yolox-s
-
yolox-m
-
yolox-l
-
yolox-x
yolox-s
Number of classes
Yes
Class labels in the dataset.
20
Image scale
Yes
Size of the image after resizing. Separate height and width with a space. Example:
320 320.320 320
Optimizer
Yes
Configurable only when model type is YOLOX.
Optimizer for model training. Valid values:
-
momentum
-
adam
momentum
Initial learning rate
Yes
Initial learning rate.
0.01
Training batch size
Yes
Samples used in a single training iteration.
8
Validation batch size
Yes
Samples used in a single evaluation iteration.
8
Number of epochs
Yes
Training epochs to run.
NoteFor YOLOX models, total epochs must exceed the sum of warmup epochs and Last no augmented lr epochs.
20
Log loss frequency
No
Frequency, in training batches, to log the loss. A value of 200 logs loss every 200 batches.
200
Validation frequency
No
Validation interval in epochs. A value of 2 runs validation every two epochs.
2
Warmup epochs
No
Applies only to YOLOX models.
5
Last no augmented lr epochs
No
Applies only to YOLOX models.
5
Export model format
Yes
Format of the exported model. Valid values:
-
raw
-
jit (YOLOv5 and YOLOv7 models do not support this format.)
-
onnx
raw
Checkpoint saving frequency
No
Frequency, in epochs, for saving model checkpoints. A value of 1 saves a checkpoint after every epoch.
1
Tuning
GPU machine type
Yes
Requires a GPU instance to run.
4
Enable FP16
No
Enables FP16 half-precision training.
false
Execution mode
Yes
Supports only distributed training on DLC.
Distributed DLC
-
-
Output
Output port
Type
Downstream component
Output model
OSS path specified for OSS directory for training on the Field settings tab. Stores the trained model in SavedModel format.
Example
For FCOS, YOLOX, YOLOv5, and YOLOv7 models, use the Object detection (easycv) component to build a pipeline as shown below.

Configure the components by following these steps:
-
Use the iTAG module in PAI to label your images. For more information, see Create a dataset: for data labeling and Create a labeling job.
-
After creating a dataset, select the General Template template under Object Detection when creating the labeling job.
-

-
For Object Detection Label Configuration, select Single-label. Under Label Configuration, enter all your label names to simplify labeling.
-

-
After completing labeling, export the results in manifest format to OSS for the component to use.
-

-
-
Use the Read OSS data component to read the labeled result file xxx.manifest, and set OSS Data Path to the OSS path of the labeled result dataset. For example,
oss://examplebucket.oss-cn-shanghai.aliyuncs.com/ev_demo/xxx.manifest. -
Connect training data and validation data to the Object detection (easycv) component and configure its parameters. For details, see Configure component parameters.
For FCOS and YOLOX models, perform offline inference using the image prediction component. For more information, see image prediction.

Related documents
-
After training an object detection model, connect an image prediction component downstream of the Object detection (easycv) component to run predictions and evaluate model performance. For more information, see image prediction.
-
For more information about Designer components, see Designer overview.
-
Designer offers a variety of algorithm components. Select the component appropriate for your data processing scenario. For more information, see Designer component reference.