reference
Training Parameters and Value Ranges
Table 1 describes the names, types, value ranges, default values, and descriptions of training parameters of the reference model.
Parameter |
Type |
Value Range |
Default Value |
Description |
|---|---|---|---|---|
--rgb_dir |
String |
- |
./xxx/ |
Path that stores RGB images. |
--batch_size |
Integer |
[1, 128] |
16 |
Training batch size. |
--epochs |
Integer |
[1, 100] |
50 |
Number of training epochs. |
--train_output_path |
String |
- |
'./ckpt' |
Path for saving the checkpoint. |
--chip_id |
String |
- |
"" |
Processor ID. |
--setupid |
String |
- |
"" |
Processor layer. |
--klarf_file |
String |
- |
"xxx" |
Name of a klarf file, which must be stored in rgb_dir. |
--gray_file |
String |
- |
"xxx" |
Name of a grayscale image file, which must be stored in rgb_dir. |
--device_num |
Integer |
1,2,4,8 |
1 |
Number of devices used for training. |
--device_id |
Integer |
[0, 7] |
0 |
Device ID for single-device training. |
--rank_table_file |
String |
- |
None |
rank_table_file path used for multi-device training. |
A new_image folder must be created in rgb_dir to store the images to be registered.
klarf_file must be a TXT file, which describes information about images photographed at a machine and must comply with the following rules:
- Each line corresponds to an image.
- Each line contains 12 fields.
- Fields are separated by a space.
For details about the fields, see Table 2. The following is a compilation example.
Create a data.txt file, which contains the following three lines of character strings:
img_1.jpg 001 M1 11224.435 12925.229 0 wafer_id1 01-08-22-13:09:22; device_id1 L21510106 model1 20 img_2.jpg 001 M1 13817.899 17822.569 0 wafer_id2 12-29-21-08:17:05; device_id1 L21510104 model2 20 img_3.jpg 001 M1 970.857 24809.092 0 wafer_id3 12-21-21-06:02:08; device_id3 L21510206 model3 20
Index |
Type |
Value Range |
Description |
|---|---|---|---|
0 |
String |
- |
Image path |
1 |
String |
- |
Processor ID. |
2 |
String |
- |
Processor layer. |
3 |
Float |
[0, 100000] |
X coordinate of an image |
4 |
Float |
[0, 100000] |
Y coordinate of an image |
5 |
Integer |
0 or 2 |
Image label |
6 |
String |
- |
Wafer ID |
7 |
String |
- |
Timestamp |
8 |
String |
- |
Device ID |
9 |
String |
- |
Batch number |
10 |
String |
- |
Device model |
11 |
Integer |
[1, 1000] |
Magnification ratio |
Training Command Reference
The command for training the reference model is as follows:
python3 reference_train.py --rgb_dir=<rgb_dir> --epochs=31 --chip_id=<chip_id> --setupid=<setupid> --gray_file= <gray_file> --klarf_file=<klarf_file>
- <rgb_dir>: path that stores RGB images to be inspected.
- <chip_id>: processor ID, indicating the type of the processor dataset to be trained.
- <setupid>: processor layer, indicating the specific processor diagram of a layer. This parameter and <chip_id> specify the training dataset.
- <gray_file>: grayscale image name.
- <klarf_file>: name of the klarf file.
The model training process is random, and the accuracy of different processor layers is different. The final evaluation accuracy prevails. The training accuracy is displayed as follows:

After the training is complete, a .ckpt model file is generated in the output directory specified by --train_output_path.
Evaluation Parameters and Value Ranges
Table 3 describes the names, types, value ranges, default values, and descriptions of evaluation parameters of the reference model.
Parameter |
Type |
Value Range |
Default Value |
Description |
|---|---|---|---|---|
--root_path |
String |
- |
"./xxx/yyy/zzz" |
Path for saving the generated evaluation file. |
--gray_image_path |
String |
- |
"" |
Path for saving the grayscale images. |
--mask_image_path |
String |
- |
"" |
Path for saving the mask images. |
--overlap |
Float |
[1,2] |
1.2 |
Overlapping rate of two images. |
--chip_id |
String |
- |
"" |
Processor ID. |
--setupid |
String |
- |
"" |
Processor layer. |
--model |
String |
- |
"" |
Path for saving the CKPT model. |
--gray_ref_scale |
Integer |
[1,1000] |
248 |
Cropping size of the grayscale image. |
--rgb_ref_scale |
Integer |
[1,1000] |
366 |
Cropping size of the RGB reference image. |
--device_target |
String |
"Ascend" or "GPU" |
"Ascend" |
Evaluation platform. |
Evaluation Command Reference
The command for evaluating the reference model is as follows:
python3 eval.py --root_path=<root_path> --gray_image_path <gray_image_path> --mask_image_path <mask_image_path> --chip_id <chip_id> --setupid=<setupid> --model <model_path>
- <root_path>: path for saving the generated evaluation file.
- <gray_image_path>: path for saving the grayscale images.
- <mask_image_path>: path for saving the mask images.
- <chip_id>: processor list, indicating the type of the processor dataset to be trained.
- <setupid>: processor layer, indicating the specific processor diagram of a layer. This parameter and <chip_id> specify the training dataset.
- <model_path>: path for storing the CKPT file generated during training.
The CKPT output during training is used to evaluate the model accuracy. The following is an example.

Generate RGB images in the directory specified by the --root_path parameter. gray_ref stores the grayscale images, mask_ref stores the mask images, and rgb_ref stores the color images.
