

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 了解训练和测试验证结果清单
<a name="tm-debugging-scope-json-line"></a>

在训练期间，Amazon Rekognition Custom Labels 会创建验证结果清单来保存非终止性 JSON 行错误。验证结果清单是添加了错误信息的训练和测试数据集的副本。训练完成后，您可以访问验证清单。有关更多信息，请参阅 [获取验证结果](tm-debugging-getting-validation-data.md)。Amazon Rekognition Custom Labels 还会创建一份清单摘要，其中包含 JSON 行错误的概要信息，例如错误位置和 JSON 行错误计数。有关更多信息，请参阅 [了解清单摘要](tm-debugging-summary.md)。

**注意**  
只有在没有[终止性清单文件错误列表](tm-debugging.md#tm-error-category-terminal)时，才会创建验证结果（训练和测试验证结果清单和清单摘要）。

清单包含数据集中每张图像的 JSON 行。在验证结果清单中，JSON 行错误信息会添加到发生错误的 JSON 行中。

JSON 行错误是指与单张图像相关的非终止性错误。非终止性验证错误可能会使整个 JSON 行或其中的一部分失效。例如，如果 JSON 行中引用的图像不是 PNG 或 JPG 格式，则会发生 [ERROR\$1INVALID\$1IMAGE](tm-debugging-json-line-errors.md#tm-error-ERROR_INVALID_IMAGE) 错误并将整个 JSON 行排除在训练之外。继续使用其他有效的 JSON 行进行训练。

在一个 JSON 行中，错误可能意味着该 JSON 行仍可用于训练。例如，如果与标签关联的四个边界框中有一个的左值为负，则仍将使用其他有效的边界框训练模型。系统会返回无效边界框的 JSON 行错误信息 ([ERROR\$1INVALID\$1BOUNDING\$1BOX](tm-debugging-json-line-errors.md#tm-error-ERROR_INVALID_BOUNDING_BOX))。在此示例中，错误信息会被添加到发生错误的 `annotation` 对象。

警告错误（例如 [WARNING\$1NO\$1ANNOTATIONS](tm-debugging-json-line-errors.md#tm-warning-WARNING_NO_ANNOTATIONS)）不会用于训练，并会在清单摘要中计为忽略的 JSON 行 (`ignored_json_lines`)。有关更多信息，请参阅 [了解清单摘要](tm-debugging-summary.md)。此外，忽略的 JSON 行也不会计入训练和测试的 20% 错误阈值。

 有关特定非终止性数据验证错误的信息，请参见[非终止性 JSON 行验证错误](tm-debugging-json-line-errors.md)。

**注意**  
如果数据验证错误太多，将会停止训练，并在清单摘要中报告 [ERROR\$1TOO\$1MANY\$1INVALID\$1ROWS\$1IN\$1MANIFEST](tm-debugging-aggregate-errors.md#tm-error-ERROR_TOO_MANY_INVALID_ROWS_IN_MANIFEST)终止性错误。

有关更正 JSON 行错误的信息，请参阅[修复训练错误](tm-debugging-fixing-validation-errors.md)。



## JSON 行错误格式
<a name="tm-json-line-error-format"></a>

Amazon Rekognition Custom Labels 会将非终止性验证错误信息添加到图像级和物体定位格式 JSON 行中。有关更多信息，请参阅 [创建清单文件](md-create-manifest-file.md)。

### 图像级错误
<a name="tm-debugging-image-level"></a>

以下示例显示了图像级 JSON 行中的 `Error` 数组。有两组错误。与标签属性元数据相关的错误（在本例中为 sport-metadata）以及与图像相关的错误。错误中包含错误代码 (code) 和错误消息 (message)。有关更多信息，请参阅 [在清单文件中导入图像级标签](md-create-manifest-file-classification.md)。

```
{
    "source-ref": String,
    "sport": Number,
    "sport-metadata": {
        "class-name": String,
        "confidence": Float,
        "type": String,
        "job-name": String,
        "human-annotated": String,
        "creation-date": String,
        "errors": [
            {
                "code": String, # error codes for label
                "message": String # Description and additional contextual details of the error
            }
        ] 
    },
    "errors": [
        {
            "code": String, # error codes for image
            "message": String # Description and additional contextual details of the error
        }
    ]
}
```

### 物体定位错误
<a name="tm-debugging-object-localization"></a>

以下示例显示了一个物体定位 JSON 行中的错误数组。该 JSON 行包含以下 JSON 行部分中的字段的 `Errors` 数组信息。每个 `Error` 对象都包含错误代码和错误消息。
+ *label attribute*：标签属性字段的错误。请参阅示例中的 `bounding-box`。
+ *annotations*：注释错误（边界框）存储在标签属性内的 `annotations` 数组中。
+ *label attribute-metadata*：标签属性元数据的错误。请参阅示例中的 `bounding-box-metadata`。
+ *image*：与标签属性、注释和标签属性元数据字段无关的错误。

有关更多信息，请参阅 [清单文件中的物体定位](md-create-manifest-file-object-detection.md)。

```
{
    "source-ref": String,
    "bounding-box": {
        "image_size": [
            {
                "width": Int,
                "height": Int,
                "depth":Int,
            }
        ],
        "annotations": [
            {
                "class_id": Int,
                "left": Int,
                "top": Int,
                "width": Int,
                "height": Int,
                "errors": [   # annotation field errors
                    {
                        "code": String, # annotation field error code
                        "message": String # Description and additional contextual details of the error
                    }
                ]
            }
        ],
        "errors": [ #label attribute field errors
            {
                "code": String, # error code
                "message": String # Description and additional contextual details of the error
            }
        ] 
    },
    "bounding-box-metadata": {
        "objects": [
            {
                "confidence": Float
            }
        ],
        "class-map": {
            String: String
        }, 
        "type": String,
        "human-annotated": String,
        "creation-date": String,
        "job-name": String,
        "errors": [  #metadata field errors
            {
                "code": String, # error code
                "message": String # Description and additional contextual details of the error
            }
        ] 
    },
   "errors": [  # image errors
        {
            "code": String, # error code
            "message": String # Description and additional contextual details of the error
        }
    ] 
 }
```

## JSON 行错误示例
<a name="tm-debugging-scope-json-line-example"></a>

以下物体定位 JSON 行（为便于阅读调整了格式）显示了 [ERROR\$1BOUNDING\$1BOX\$1TOO\$1SMALL](tm-debugging-json-line-errors.md#tm-error-ERROR_BOUNDING_BOX_TOO_SMALL) 错误。在本示例中，边界框尺寸（高度和宽度）不大于 1 x 1。

```
{
    "source-ref": "s3://bucket/Manifests/images/199940-1791.jpg",
    "bounding-box": {
        "image_size": [
            {
                "width": 3000,
                "height": 3000,
                "depth": 3
            }
        ],
        "annotations": [
            {
                "class_id": 1,
                "top": 0,
                "left": 0,
                "width": 1,
                "height": 1, 
                "errors": [
                    {
                        "code": "ERROR_BOUNDING_BOX_TOO_SMALL",
                        "message": "The height and width of the bounding box is too small."
                    }
                ]
            },
            {
                "class_id": 0,
                "top": 65,
                "left": 86,
                "width": 220,
                "height": 334
            }
        ]
    },
    "bounding-box-metadata": {
        "objects": [
            {
                "confidence": 1
            },
            {
                "confidence": 1
            }
        ],
        "class-map": {
            "0": "Echo",
            "1": "Echo Dot"
        },
        "type": "groundtruth/object-detection",
        "human-annotated": "yes",
        "creation-date": "2019-11-20T02:57:28.288286",
        "job-name": "my job"
    }
}
```