

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

# 机器学习组件
<a name="machine-learning-components"></a>

AWS IoT Greengrass 提供了以下机器学习组件，您可以将这些组件部署到支持的设备上，以便使用在 Amazon A SageMaker I 中训练的模型或存储在 Amazon S3 中的您自己的预训练模型来[执行机器学习推理](perform-machine-learning-inference.md)。<a name="ml-component-types"></a>

AWS 提供以下类别的机器学习组件：
+ **模型组件** – 包含作为 Greengrass 构件的机器学习模型。
+ **运行时组件** – 包含用于在 Greengrass 核心设备上安装机器学习框架及其依赖关系的脚本。
+ **推理组件** – 包含推理代码并包括组件依赖关系，用于安装机器学习框架和下载预训练的机器学习模型。

您可以使用 AWS提供的机器学习组件中的示例推理代码和预训练模型，使用 DLR 和 Lite 执行图像分类和目标检测。 TensorFlow 要使用存储在 Amazon S3 中的您自己的模型执行自定义机器学习推理，或者使用其他机器学习框架，您可以使用这些公有组件的配方作为模板来创建自定义机器学习组件。有关更多信息，请参阅 [自定义您的机器学习组件](ml-customization.md)。

AWS IoT Greengrass 还包括一个 AWS提供的组件，用于管理 Greengrass 核心设备上的 SageMaker AI Edge Manager 代理的安装和生命周期。借助 SageMaker AI Edge Manager，你可以直接在核心设备上使用 SageMaker Amazon AI Neo 编译的模型。有关更多信息，请参阅 [在 Greengrass 核心设备上使用亚马逊 SageMaker AI 边缘管理器](use-sagemaker-edge-manager.md)。

下表列出了中可用的机器学习组件 AWS IoT Greengrass。

**注意**  <a name="component-nucleus-dependency-update-note"></a>
 AWS提供的几个组件依赖于 Greengrass 核的特定次要版本。由于这种依赖关系，当您将 Greengrass Nucleus 更新到新的次要版本时，您需要更新这些组件。有关每个组件所依赖的特定内核版本的信息，请参阅相应的组件主题。有关更新 Nucleus 的更多信息，请参阅 [更新 AWS IoT Greengrass Core 软件（OTA）](update-greengrass-core-v2.md)。

<a name="component-table-type-description"></a>当组件同时具有通用和 Lambda 组件类型时，该组件的当前版本为通用类型，而该组件的之前版本为 Lambda 类型。


| 组件 | 描述 | [组件类型](develop-greengrass-components.md#component-types) | 支持的操作系统 | [开源](open-source.md) | 
| --- | --- | --- | --- | --- | 
| [SageMaker AI 边缘管理器](sagemaker-edge-manager-component.md) | 在 Greengrass 核心设备上部署 SageMaker Amazon AI Edge Manager 代理。 | 通用 | Linux、Windows | 否 | 
| [DLR 图像分类](dlr-image-classification-component.md) | 推理组件，使用 DLR 图像分类模型存储和 DLR 运行时组件作为依赖关系，在支持的设备上安装 DLR、下载示例图像分类模型和执行图像分类推理。 | 通用 | Linux、Windows | 否 | 
| [DLR 对象检测](dlr-object-detection-component.md) | 推理组件，使用 DLR 对象检测模型存储和 DLR 运行时组件作为依赖关系，在支持的设备上安装 DLR、下载示例对象检测模型和执行对象检测推理。 | 通用 | Linux、Windows | 否 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | 包含作为 Greengrass 伪影的样本 ResNet -50 图像分类模型的模型组件。 | 通用 | Linux、Windows | 否 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | 包含样本 YOLOv3 对象检测模型的模型组件，如 Greengrass 工件。 | 通用 | Linux、Windows | 否 | 
| [DLR 运行时](dlr-component.md) | 运行时组件，其中包含用于在 Greengrass 核心设备上安装 DLR 及其依赖关系的安装脚本。 | 通用 | Linux、Windows | 否 | 
| [TensorFlow 精简版图像分类](tensorflow-lite-image-classification-component.md) | 推理组件，使用 TensorFlow Lite 图像分类模型存储和 TensorFlow Lite 运行时组件作为依赖项，用于在支持的设备上安装 TensorFlow Lite、下载样本图像分类模型和执行图像分类推理。 | 通用 | Linux、Windows | 否 | 
| [TensorFlow 精简版物体检测](tensorflow-lite-object-detection-component.md) | 推理组件，使用 TensorFlow Lite 对象检测模型存储和 TensorFlow Lite 运行时组件作为依赖项，用于在支持的设备上安装 TensorFlow Lite、下载示例对象检测模型和执行对象检测推理。 | 通用 | Linux、Windows | 否 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | 包含作为 Greengrass 工件的示例 MobileNet v1 模型的模型组件。 | 通用 | Linux、Windows | 否 | 
| [TensorFlow 精简版物体检测模型存储](tensorflow-lite-object-detection-model-store-component.md) | 模型组件，其中包含作为 Greengrass 工件的样本单枪检测 (SSD) MobileNet 模型。 | 通用 | Linux、Windows | 否 | 
| [TensorFlow 精简版运行时](tensorflow-lite-component.md) | 包含用于安装 TensorFlow Lite 的安装脚本及其对 Greengrass 核心设备的依赖关系的运行时组件。 | 通用 | Linux、Windows | 否 | 

# SageMaker AI 边缘管理器
<a name="sagemaker-edge-manager-component"></a>

**重要**  
SageMaker AI 边缘管理器已于 2024 年 4 月 26 日停产。有关继续将模型部署到边缘设备的更多信息，请参阅 [SageMaker AI Edge Manager 生命周期终止](https://docs.aws.amazon.com/sagemaker/latest/dg/edge-eol.html)。

Amazon A SageMaker I Edge Manager 组件 (`aws.greengrass.SageMakerEdgeManager`) 安装 SageMaker AI Edge Manager 代理二进制文件。

SageMaker AI Edge Manager 为边缘设备提供模型管理，因此您可以优化、保护、监控和维护边缘设备队列上的机器学习模型。 SageMaker AI Edge Manager 组件在您的核心设备上安装和管理 SageMaker AI Edge Manager 代理的生命周期。您还可以使用 SageMaker AI Edge Manager 在 Greengrass 核心设备上打包和使用 SageMaker AI Neo 编译的模型作为模型组件。有关在核心设备上使用 SageMaker AI Edge Manager 代理的更多信息，请参阅[在 Greengrass 核心设备上使用亚马逊 SageMaker AI 边缘管理器](use-sagemaker-edge-manager.md)。

SageMaker AI Edge Manager 组件 v1.3.x 安装边缘管理器代理二进制 v1.20220822.836f3023。有关 Edge Manager 代理二进制文件版本的更多信息，请参阅 [Edge Manager 代理](https://docs.aws.amazon.com/sagemaker/latest/dg/edge-device-fleet-about)。

**注意**  
A SageMaker I 边缘管理器组件仅在以下版本中可用 AWS 区域：  
美国东部（俄亥俄州）
美国东部（弗吉尼亚州北部）
美国西部（俄勒冈州）
欧洲（法兰克福）
欧洲（爱尔兰）
亚太地区（东京）

**Topics**
+ [版本](#sagemaker-edge-manager-component-versions)
+ [Type](#sagemaker-edge-manager-component-type)
+ [操作系统](#sagemaker-edge-manager-component-os-support)
+ [要求](#sagemaker-edge-manager-component-requirements)
+ [依赖项](#sagemaker-edge-manager-component-dependencies)
+ [配置](#sagemaker-edge-manager-component-configuration)
+ [本地日志文件](#sagemaker-edge-manager-component-log-file)
+ [更改日志](#sagemaker-edge-manager-component-changelog)

## 版本
<a name="sagemaker-edge-manager-component-versions"></a>

此组件具有以下版本：
+ 1.3.x
+ 1.2.x
+ 1.1.x
+ 1.0.x

## Type
<a name="sagemaker-edge-manager-component-type"></a>

<a name="public-component-type-generic"></a>此<a name="public-component-type-generic-phrase"></a>组件是一个通用组件 (`aws.greengrass.generic`)。[Greengrass Nucleus](greengrass-nucleus-component.md) 运行组件的生命周期脚本。

<a name="public-component-type-more-information"></a>有关更多信息，请参阅[组件类型](develop-greengrass-components.md#component-types)。

## 操作系统
<a name="sagemaker-edge-manager-component-os-support"></a>

此组件可以安装在运行以下操作系统的核心设备上：
+ Linux
+ Windows

## 要求
<a name="sagemaker-edge-manager-component-requirements"></a>

此组件具有以下要求：<a name="sm-edge-manager-component-reqs"></a>
+ <a name="sm-req-core-device"></a>在 Amazon Linux 2、基于 Debian 的 Linux 平台（x86\$164 或 Armv8）或 Windows（x86\$164）上运行的 Greengrass 核心设备。如果没有，请参阅[教程：AWS IoT Greengrass V2 入门](getting-started.md)。
+ <a name="sm-req-python"></a>核心设备上已安装 [Python](https://www.python.org/downloads/) 3.6 或更高版本，包括适用于您的 Python 版本的 `pip`。
+ 已为 [Greengrass 设备角色](device-service-role.md)配置以下项：
  + <a name="sm-req-iam-trust-relationship"></a>允许 `credentials.iot.amazonaws.com` 和 `sagemaker.amazonaws.com` 担任该角色的信任关系，如以下 IAM 策略示例所示。

    ```
    { 
      "Version": "2012-10-17",		 	 	 
      "Statement": [ 
        { 
          "Effect": "Allow", 
          "Principal": {
            "Service": "credentials.iot.amazonaws.com"
           }, 
          "Action": "sts:AssumeRole" 
        },
        { 
          "Effect": "Allow", 
          "Principal": {
            "Service": "sagemaker.amazonaws.com"
          }, 
          "Action": "sts:AssumeRole" 
        } 
      ] 
    }
    ```
  + <a name="sm-req-iam-sagemanakeredgedevicefleetpolicy"></a>I [AmazonSageMakerEdgeDeviceFleetPolicy](https://console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/service-role/AmazonSageMakerEdgeDeviceFleetPolicy)AM 托管策略。
  + <a name="sm-req-iam-s3-putobject"></a>`s3:PutObject` 操作，如以下 IAM 策略示例所示。

    ```
    {
      "Version": "2012-10-17",		 	 	 
      "Statement": [
        {
          "Action": [
            "s3:PutObject"
          ],
          "Resource": [
            "*"
          ],
          "Effect": "Allow"
        }
      ]
    }
    ```
+ <a name="sm-req-s3-bucket"></a>与您的 Greengrass 核心设备 AWS 区域 相同 AWS 账户 且创建的 Amazon S3 存储桶。 SageMaker AI Edge Manager 需要一个 S3 存储桶来创建边缘设备队列，并存储在设备上运行推理的示例数据。有关创建 S3 存储桶的更多信息，请参阅 [Amazon S3 入门](https://docs.aws.amazon.com/AmazonS3/latest/userguide/GetStartedWithS3.html)。
+ <a name="sm-req-edge-device-fleet"></a>使用与 Greengrass 核心设备相同的 AWS IoT 角色别名的 SageMaker AI 边缘设备舰队。有关更多信息，请参阅 [创建边缘设备实例集](get-started-with-edge-manager-on-greengrass.md#create-edge-device-fleet-for-greengrass)。
+ <a name="sm-req-edge-device"></a>您的 Greengrass 核心设备在 AI Edge 设备群中注册为边缘设备。 SageMaker 边缘设备名称必须与核心设备 AWS IoT 的事物名称相匹配。有关更多信息，请参阅 [注册 Greengrass 核心设备](get-started-with-edge-manager-on-greengrass.md#register-greengrass-core-device-in-sme)。

### 端点和端口
<a name="sagemaker-edge-manager-component-endpoints"></a>

除基本操作所需的端点和端口外，此组件还必须能够对以下端点和端口执行出站请求。有关更多信息，请参阅 [允许设备流量通过代理或防火墙](allow-device-traffic.md)。


| 终端节点 | 端口 | 必需 | 描述 | 
| --- | --- | --- | --- | 
|  `edge.sagemaker.region.amazonaws.com`  | 443 | 是 |  检查设备注册状态并将指标发送给 SageMaker AI。  | 
|  `*.s3.amazonaws.com`  | 443 | 是 |  将捕获数据上传到您指定的 S3 存储桶。 您可以将 `*` 替换为将数据上传其中的每个存储桶的名称。  | 

## 依赖项
<a name="sagemaker-edge-manager-component-dependencies"></a>

部署组件时， AWS IoT Greengrass 还会部署其依赖项的兼容版本。这意味着您必须满足组件及其所有依赖关系的要求，才能成功部署组件。本部分列出了此组件的[已发布版本](#sagemaker-edge-manager-component-changelog)的依赖关系，以及定义每个依赖关系的组件版本的语义版本约束。您还可以在 [AWS IoT Greengrass 控制台](https://console.aws.amazon.com//greengrass)中查看每个组件版本的依赖关系。在组件详细信息页面上，查找**依赖关系**列表。

------
#### [ 1.3.5 and 1.3.6 ]

下表列出了此组件版本 1.3.5 和 1.3.6 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.13.0 | 软性 | 
| [令牌交换服务](token-exchange-service-component.md) | >=0.0.0 | 硬性 | 

------
#### [ 1.3.4 ]

下表列出了此组件版本 1.3.4 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.12.0 | 软性 | 
| [令牌交换服务](token-exchange-service-component.md) | >=0.0.0 | 硬性 | 

------
#### [ 1.3.3 ]

下表列出了此组件版本 1.3.3 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.11.0 | 软性 | 
| [令牌交换服务](token-exchange-service-component.md) | >=0.0.0 | 硬性 | 

------
#### [ 1.3.2 ]

下表列出了此组件版本 1.3.2 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.10.0 | 软性 | 
| [令牌交换服务](token-exchange-service-component.md) | >=0.0.0 | 硬性 | 

------
#### [ 1.3.1 ]

下表列出了此组件版本 1.3.1 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.9.0 | 软性 | 
| [令牌交换服务](token-exchange-service-component.md) | >=0.0.0 | 硬性 | 

------
#### [ 1.1.1 - 1.3.0 ]

下表列出了此组件版本 1.1.1 至 1.3.0 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.8.0 | 软性 | 
| [令牌交换服务](token-exchange-service-component.md) | >=0.0.0 | 硬性 | 

------
#### [ 1.1.0 ]

下表列出了此组件版本 1.1.0 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.6.0 | 软性 | 
| [令牌交换服务](token-exchange-service-component.md) | >=0.0.0 | 硬性 | 

------
#### [ 1.0.3 ]

下表列出了此组件版本 1.0.3 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.5.0 | 软性 | 
| [令牌交换服务](token-exchange-service-component.md) | >=0.0.0 | 硬性 | 

------
#### [ 1.0.1 and 1.0.2 ]

下表列出了此组件版本 1.0.1 和 1.0.2 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.4.0 | 软性 | 
| [令牌交换服务](token-exchange-service-component.md) | >=0.0.0 | 硬性 | 

------
#### [ 1.0.0 ]

下表列出了此组件的版本 1.0.0 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.3.0 | 软性 | 
| [令牌交换服务](token-exchange-service-component.md) | >=0.0.0 | 硬性 | 

------

有关组件依赖关系的更多信息，请参阅[组件配方参考](component-recipe-reference.md#recipe-reference-component-dependencies)。

## 配置
<a name="sagemaker-edge-manager-component-configuration"></a>

此组件提供您可以在部署组件时自定义的以下配置参数。

**注意**  
本节介绍了您在组件中设置的配置参数。有关相应的 SageMaker AI 边缘管理器配置的更多信息，请参阅 A *mazon A SageMaker I 开发者指南*中的[边缘管理器代理](https://docs.aws.amazon.com/sagemaker/latest/dg/edge-device-fleet-about.html#edge-device-fleet-running-agent)。

`DeviceFleetName`  
包含你的 Greengrass 核心设备的 SageMaker AI Edge Manager 设备队列的名称。  
部署此组件时，必须在配置更新中指定此参数的值。

`BucketName`  
将捕获的推理数据上传其中的 S3 存储桶的名称。存储桶名称必须包含字符串 `sagemaker`。  
如果将 `CaptureDataDestination` 设置为 `Cloud`，或者将 `CaptureDataPeriodicUpload` 设置为 `true`，则在部署此组件时，必须在配置更新中为此参数指定一个值。  
捕获数据是一项 SageMaker AI 功能，用于将推理输入、推理结果和其他推理数据上传到 S3 存储桶或本地目录以供将来分析。有关在 SageMaker AI Edge Manager 中使用捕获数据的更多信息，请参阅 *Amazon A SageMaker I 开发者指南*中的[管理模型](https://docs.aws.amazon.com/sagemaker/latest/dg/edge-manage-model.html#edge-manage-model-capturedata)。

`CaptureDataBatchSize`  
（可选）代理处理的捕获数据请求批次的大小。该值必须小于您在 `CaptureDataBufferSize` 中指定的缓冲区大小。我们建议不要超过缓冲区大小的一半。  
缓冲区中的请求数量达到 `CaptureDataBatchSize` 数量时，或者达到 `CaptureDataPushPeriodSeconds` 时间间隔时（以先发生者为准），代理会处理请求批次。  
默认值：`10`

`CaptureDataBufferSize`  
（可选）缓冲区中存储的捕获数据请求的最大数量。  
默认值：`30`

`CaptureDataDestination`  
（可选）存储捕获的数据的目标位置。此参数可能具有以下值：  
+ `Cloud` – 将捕获的数据上传到您在 `BucketName` 中指定的 S3 存储桶。
+ `Disk` – 将捕获的数据写入组件的工作目录。
如果您指定 `Disk`，也可以将 `CaptureDataPeriodicUpload` 设置为 `true`，来选择定期将捕获的数据上传到您的 S3 存储桶。  
默认值：`Cloud`

`CaptureDataPeriodicUpload`  
（可选）指定是否定期上传捕获的数据的字符串值。支持的值为 `true` 和 `false`。  
如果将 `CaptureDataDestination` 设置为 `Disk`，并且还希望代理定期将捕获的数据上传到您的 S3 存储桶，则将此参数设置为 `true`。  
默认值：`false`

`CaptureDataPeriodicUploadPeriodSeconds`  
（可选） SageMaker AI Edge Manager 代理将捕获的数据上传到 S3 存储桶的时间间隔（以秒为单位）。如果将 `CaptureDataPeriodicUpload` 设置为 `true`，则使用此参数。  
默认值：`8`

`CaptureDataPushPeriodSeconds`  
（可选） SageMaker AI Edge Manager 代理处理来自缓冲区的一批捕获数据请求的时间间隔（以秒为单位）。  
缓冲区中的请求数量达到 `CaptureDataBatchSize` 数量时，或者达到 `CaptureDataPushPeriodSeconds` 时间间隔时（以先发生者为准），代理会处理请求批次。  
默认值：`4`

`CaptureDataBase64EmbedLimit`  
（可选） SageMaker AI Edge Manager 代理上传的最大捕获数据大小（以字节为单位）。  
默认值：`3072`

`FolderPrefix`  
（可选）代理将捕获的数据写入其中的文件夹的名称。如果将 `CaptureDataDestination` 设置为 `Disk`，则代理将在 `CaptureDataDiskPath` 指定的目录中创建文件夹。如果您将 `CaptureDataDestination` 设置为 `Cloud`，或者将 `CaptureDataPeriodicUpload` 设置为 `true`，则代理将在您的 S3 存储桶中创建文件夹。  
默认值：`sme-capture`

`CaptureDataDiskPath`  
此功能在 v1.1.0 及更高版本的 SageMaker AI Edge Manager 组件中可用。  
（可选）代理创建捕获的数据文件夹的文件夹路径。如果将 `CaptureDataDestination` 设置为 `Disk`，则代理将在此目录中创建捕获的数据文件夹。如果您未指定此值，则代理将在组件的工作目录中创建捕获的数据文件夹。使用 `FolderPrefix` 参数指定捕获的数据文件夹的名称。  
默认值：`/greengrass/v2/work/aws.greengrass.SageMakerEdgeManager/capture`

`LocalDataRootPath`  
此功能在 v1.2.0 及更高版本的 SageMaker AI Edge Manager 组件中可用。  
（可选）此组件在核心设备上存储以下数据的路径：  
+ 将 `DbEnable` 设置为 `true` 时，运行时数据的本地数据库。
+ SageMaker AI 新编译模型，当您设置`DeploymentEnable`为时，此组件会自动下载这些模型。`true`
默认值：`/greengrass/v2/work/aws.greengrass.SageMakerEdgeManager`

`DbEnable`  
（可选）您可以启用此组件，将运行时数据存储在本地数据库中，以便在组件出现故障或设备断电时保留数据。  
此数据库在核心设备的文件系统上需要 5 MB 的存储空间。  
默认值：`false`

`DeploymentEnable`  
此功能在 v1.2.0 及更高版本的 SageMaker AI Edge Manager 组件中可用。  
（可选）您可以启用此组件以自动检索您上传到 Amazon S3 的 SageMaker AI Neo 编译模型。将新模型上传到 Amazon S3 后，使用 SageMaker AI Studio 或 SageMaker AI API 将新模型部署到该核心设备。启用此功能后，无需创建 AWS IoT Greengrass 部署即可将新模型部署到核心设备。  
要使用此功能，必须将 `DbEnable` 设置为 `true`。此功能使用本地数据库来跟踪从 AWS 云中检索的模型。
默认值：`false`

`DeploymentPollInterval`  
此功能在 v1.2.0 及更高版本的 SageMaker AI Edge Manager 组件中可用。  
（可选）此组件检查要下载的新模型之间的间隔时间（以分钟为单位）。此选项适用于将 `DeploymentEnable` 设置为 `true` 时。  
默认值：`1440`（1 天）。

`DLRBackendOptions`  
此功能在 v1.2.0 及更高版本的 SageMaker AI Edge Manager 组件中可用。  
（可选）在此组件使用的 DLR 运行时中设置的 DLR 运行时标志。您可以使用以下标志：  
+ `TVM_TENSORRT_CACHE_DIR` – 启用 TensorRT 模型缓存。指定具有读/写权限的现有文件夹的绝对路径。
+ `TVM_TENSORRT_CACHE_DISK_SIZE_MB` – 指定 TensorRT 模型缓存文件夹的上限。目录大小超过此限制时，将会删除使用最少的缓存引擎。默认值为 512 MB。
例如，您可以将此参数设置为以下值，以启用 TensorRT 模型缓存并将缓存大小限制为 800 MB。  

```
TVM_TENSORRT_CACHE_DIR=/data/secured_folder/trt/cache; TVM_TENSORRT_CACHE_DISK_SIZE_MB=800
```

`SagemakerEdgeLogVerbose`  
（可选）指定是否启用调试日志记录的字符串值。支持的值为 `true` 和 `false`。  
默认值：`false`

`UnixSocketName`  
（可选） SageMaker AI Edge Manager 套接字文件描述符在核心设备上的位置。  
默认值：`/tmp/aws.greengrass.SageMakerEdgeManager.sock`

**Example 示例：配置合并更新**  
以下示例配置指定核心设备是的一部分，*MyEdgeDeviceFleet*并且代理将捕获数据写入设备和 S3 存储桶。此配置还会启用调试日志记录。  

```
{
    "DeviceFleetName": "MyEdgeDeviceFleet",
    "BucketName": "amzn-s3-demo-bucket",
    "CaptureDataDestination": "Disk",
    "CaptureDataPeriodicUpload": "true",
    "SagemakerEdgeLogVerbose": "true"    
}
```

## 本地日志文件
<a name="sagemaker-edge-manager-component-log-file"></a>

此组件使用以下日志文件。

------
#### [ Linux ]

```
/greengrass/v2/logs/aws.greengrass.SageMakerEdgeManager.log
```

------
#### [ Windows ]

```
C:\greengrass\v2\logs\aws.greengrass.SageMakerEdgeManager.log
```

------

**查看此组件的日志**
+ 在核心设备上运行以下命令可实时查看此组件的日志文件。将`/greengrass/v2`或*C:\$1greengrass\$1v2*替换为 AWS IoT Greengrass 根文件夹的路径。

------
#### [ Linux ]

  ```
  sudo tail -f /greengrass/v2/logs/aws.greengrass.SageMakerEdgeManager.log
  ```

------
#### [ Windows (PowerShell) ]

  ```
  Get-Content C:\greengrass\v2\logs\aws.greengrass.SageMakerEdgeManager.log -Tail 10 -Wait
  ```

------

## 更改日志
<a name="sagemaker-edge-manager-component-changelog"></a>

下表介绍每个组件版本的更改。


|  **版本**  |  **更改**  | 
| --- | --- | 
|  1.3.6  |  对 Greengrass Nucleus 2.12.5 发行版进行了版本更新。  | 
|  1.3.5  | 版本更新为 Greengrass Nucleus 版本 2.12.0 发布版。 | 
|  1.3.4  | 版本更新为 Greengrass Nucleus 版本 2.11.0 发布版。 | 
|  1.3.3  | 版本更新为 Greengrass Nucleus 版本 2.10.0 发布版。 | 
|  1.3.2  | 对 Greengrass Nucleus版本 2.9.0 发行版进行了版本更新。 | 
|  1.3.1  | 版本更新为 Greengrass Nucleus 版本 2.8.0 发布版。 | 
|  1.3.0  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/sagemaker-edge-manager-component.html)  | 
|  1.2.0  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/sagemaker-edge-manager-component.html)  | 
|  1.1.1  |  版本更新为 Greengrass Nucleus 版本 2.7.0 发布版。  | 
|  1.1.0  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/sagemaker-edge-manager-component.html)  | 
|  1.0.3  |  版本更新为 Greengrass Nucleus 版本 2.4.0 发布版。  | 
|  1.0.2  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/sagemaker-edge-manager-component.html)  | 
|  1.0.1  |  版本更新为 Greengrass Nucleus 版本 2.3.0 发布版。  | 
|  1.0.0  |  初始版本。  | 

# DLR 图像分类
<a name="dlr-image-classification-component"></a>

DLR 图像分类组件 (`aws.greengrass.DLRImageClassification`) 包含示例推理代码，用于使用[深度学习运行时](https://github.com/neo-ai/neo-ai-dlr)和 resnet-50 模型执行图像分类推理。此组件使用变体 [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) 和 [DLR 运行时](dlr-component.md) 组件作为依赖关系来下载 DLR 和示例模型。

要将此推理组件与自定义训练的 DLR 模型一起使用，请[创建依赖模型存储组件的自定义版本](ml-customization.md#override-public-model-store)。要使用自己的自定义推理代码，您可以使用此组件的配方作为模板来[创建自定义推理组件](ml-customization.md#create-inference-component)。

**Topics**
+ [版本](#dlr-image-classification-component-versions)
+ [Type](#dlr-image-classification-component-type)
+ [操作系统](#dlr-image-classification-component-os-support)
+ [要求](#dlr-image-classification-component-requirements)
+ [依赖项](#dlr-image-classification-component-dependencies)
+ [配置](#dlr-image-classification-component-configuration)
+ [本地日志文件](#dlr-image-classification-component-log-file)
+ [更改日志](#dlr-image-classification-component-changelog)

## 版本
<a name="dlr-image-classification-component-versions"></a>

此组件具有以下版本：
+ 2.1.x
+ 2.0.x

## Type
<a name="dlr-image-classification-component-type"></a>

<a name="public-component-type-generic"></a>此<a name="public-component-type-generic-phrase"></a>组件是一个通用组件 (`aws.greengrass.generic`)。[Greengrass Nucleus](greengrass-nucleus-component.md) 运行组件的生命周期脚本。

<a name="public-component-type-more-information"></a>有关更多信息，请参阅[组件类型](develop-greengrass-components.md#component-types)。

## 操作系统
<a name="dlr-image-classification-component-os-support"></a>

此组件可以安装在运行以下操作系统的核心设备上：
+ Linux
+ Windows

## 要求
<a name="dlr-image-classification-component-requirements"></a>

此组件具有以下要求：<a name="ml-component-requirements"></a>
+ 在运行 Amazon Linux 2 或 Ubuntu 18.04 的 Greengrass 核心设备上，[GNU C 库](https://www.gnu.org/software/libc/)（glibc）版本 2.27 或更高版本已安装在设备上。
+ 在 Armv7l 设备（例如 Raspberry Pi）上，OpenCV-Python 的依赖关系已安装在设备上。运行以下命令以安装依赖关系。

  ```
  sudo apt-get install libopenjp2-7 libilmbase23 libopenexr-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk-3-0 libwebp-dev
  ```
+ 运行 Raspberry Pi OS Bullseye 的 Raspberry Pi 设备必须满足以下要求：
  + NumPy 设备上安装了 1.22.4 或更高版本。Raspberry Pi OS Bullseye 包含的早期版本 NumPy，因此你可以运行以下命令在设备 NumPy 上升级。

    ```
    pip3 install --upgrade numpy
    ```
  + 旧摄像机堆栈已在设备上启用。Raspberry Pi OS Bullseye 包含一个新摄像机堆栈，该堆栈默认处于启用状态且不兼容，因此您必须启用旧摄像机堆栈。<a name="raspberry-pi-bullseye-enable-legacy-camera-stack"></a>

**启用旧摄像机堆栈**

    1. 运行以下命令以打开 Raspberry Pi 配置工具。

       ```
       sudo raspi-config
       ```

    1. 选择**接口选项**。

    1. 选择**旧摄像机**以启用旧摄像机堆栈。

    1. 重启 Raspberry Pi。

## 依赖项
<a name="dlr-image-classification-component-dependencies"></a>

部署组件时， AWS IoT Greengrass 还会部署其依赖项的兼容版本。这意味着您必须满足组件及其所有依赖关系的要求，才能成功部署组件。本部分列出了此组件的[已发布版本](#dlr-image-classification-component-changelog)的依赖关系，以及定义每个依赖关系的组件版本的语义版本约束。您还可以在 [AWS IoT Greengrass 控制台](https://console.aws.amazon.com//greengrass)中查看每个组件版本的依赖关系。在组件详细信息页面上，查找**依赖关系**列表。

------
#### [ 2.1.13 and 2.1.14 ]

下表列出了此组件的版本 2.1.13 和 2.1.14 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.13.0 | 软性 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.12 ]

下表列出了此组件的版本 2.1.12 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.12.0 | 软性 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.11 ]

下表列出了此组件的版本 2.1.11 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.11.0 | 软性 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.10 ]

下表列出了此组件的版本 2.1.10 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.10.0 | 软性 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.9 ]

下表列出了此组件的版本 2.1.9 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.9.0 | 软性 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.8 ]

下表列出了此组件的版本 2.1.8 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.8.0 | 软性 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.7 ]

下表列出了此组件的版本 2.1.7 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.7.0 | 软性 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.6 ]

下表列出了此组件的版本 2.1.6 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.6.0 | 软性 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.4 - 2.1.5 ]

下表列出了此组件的版本 2.1.4 至 2.1.5 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.5.0 | 软性 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.3 ]

下表列出了此组件的版本 2.1.3 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.4.0 | 软性 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.2 ]

下表列出了此组件的版本 2.1.2 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.3.0 | 软性 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.1 ]

下表列出了此组件的版本 2.1.1 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.2.0 | 软性 | 
| [DLR 图像分类模型存储](dlr-image-classification-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.0.x ]

下表列出了此组件的版本 2.0.x 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | \$12.0.0 | 软性 | 
| DLR 图像分类模型存储 | \$12.0.0 | 硬性 | 
| DLR | \$11.3.0 | 软性 | 

------

## 配置
<a name="dlr-image-classification-component-configuration"></a>

此组件提供您可以在部署组件时自定义的以下配置参数。

------
#### [ 2.1.x ]

`accessControl`  
<a name="ml-config-accesscontrol-desc"></a>（可选）包含允许组件将消息发布到默认通知主题的[授权策略](interprocess-communication.md#ipc-authorization-policies)的对象。  
默认值：  

```
{
   "aws.greengrass.ipc.mqttproxy": {
      "aws.greengrass.DLRImageClassification:mqttproxy:1": {
         "policyDescription": "Allows access to publish via topic ml/dlr/image-classification.",
         "operations": [
            "aws.greengrass#PublishToIoTCore"
         ],
         "resources": [
            "ml/dlr/image-classification"
         ]
      }
   }
}
```

`PublishResultsOnTopic`  
<a name="ml-config-publishresultsontopic-desc"></a>（可选）要将推理结果发布到的主题。如果修改此值，则还必须修改 `accessControl` 参数中 `resources` 的值，以匹配您的自定义主题名称。  
默认值：`ml/dlr/image-classification`

`Accelerator`  <a name="ml-config-accelerator"></a>
要使用的加速器。支持的值为 `cpu` 和 `gpu`。  
依赖模型组件中的示例模型仅支持 CPU 加速。要对不同的自定义模型使用 GPU 加速，请[创建自定义模型组件](ml-customization.md#override-public-model-store)以覆盖公共模型组件。  
默认值：`cpu`

`ImageDirectory`  
<a name="ml-config-imagedirectory-desc"></a>（可选）设备上推理组件读取图像的文件夹路径。您可以将此值修改为设备上您有权 read/write 访问的任何位置。  
<a name="ml-config-imagedirectory-img-default"></a>默认值：`/greengrass/v2/packages/artifacts-unarchived/component-name/image_classification/sample_images/`  
如果将 `UseCamera` 的值设置为 `true`，则忽略此配置参数。

`ImageName`  
<a name="ml-config-imagename-desc"></a>（可选）推理组件用作预测输入的图像名称。该组件可在 `ImageDirectory` 中指定的文件夹中查找图像。默认情况下，该组件使用默认图像目录中的示例图像。 AWS IoT Greengrass 支持以下图像格式：`jpeg`、`jpg``png`、和`npy`。  
<a name="ml-config-imagename-img-default"></a>默认值：`cat.jpeg`  
如果将 `UseCamera` 的值设置为 `true`，则忽略此配置参数。

`InferenceInterval`  <a name="ml-config-inferenceinterval"></a>
（可选）推理代码进行的每次预测之间的时间（以秒为单位）。示例推理代码无限期运行，并在指定的时间间隔内重复其预测。例如，如果您想使用摄像机拍摄的图像进行实时预测，则可以将其更改为较短的间隔。  
默认值：`3600`

`ModelResourceKey`  <a name="ml-config-modelresourcekey"></a>
<a name="ml-config-modelresourcekey-desc"></a>（可选）在依赖的公共模型组件中使用的模型。仅当使用自定义组件覆盖公共模型组件时，才修改此参数。  
默认值：  

```
{
    "armv7l": "DLR-resnet50-armv7l-cpu-ImageClassification",
    "aarch64": "DLR-resnet50-aarch64-cpu-ImageClassification",
    "x86_64": "DLR-resnet50-x86_64-cpu-ImageClassification",
    "windows": "DLR-resnet50-win-cpu-ImageClassification"
}
```

`UseCamera`  <a name="ml-config-usecamera"></a>
（可选）字符串值，用于定义是否使用连接到 Greengrass 核心设备的摄像机拍摄的图像。支持的值为 `true` 和 `false`。  
当您将此值设置为 `true` 时，示例推理代码将访问设备上的摄像机，并在本地对捕获的图像运行推理。`ImageName` 和 `ImageDirectory` 参数的值将被忽略。确保运行此组件的用户 read/write 可以访问相机存储捕获图像的位置。  
默认值：`false`  
当您查看此组件的配方时，`UseCamera` 配置参数不会显示在默认配置中。但是，在部署组件时，可以在[配置合并更新](update-component-configurations.md)中修改此参数的值。  
如果将 `UseCamera` 设置为 `true`，则还必须创建符号链接，以使推理组件能够从运行时组件创建的虚拟环境中访问您的摄像机。有关将摄像机与示例推理组件结合使用的更多信息，请参阅 [更新组件配置](ml-tutorial-image-classification-camera.md)。

------
#### [ 2.0.x ]

`MLRootPath`  <a name="ml-config-mlrootpath"></a>
<a name="ml-config-mlrootpath-desc"></a>（可选）Linux 核心设备上推理组件读取图像和写入推理结果的文件夹路径。您可以将此值修改为设备上运行此组件的用户有权 read/write 访问的任何位置。  
<a name="ml-config-mlrootpath-default-dlr"></a>默认值：`/greengrass/v2/work/variant.DLR/greengrass_ml`  
<a name="ml-config-mlrootpath-default-tfl"></a>默认值：`/greengrass/v2/work/variant.TensorFlowLite/greengrass_ml`

`Accelerator`  <a name="ml-config-accelerator"></a>
要使用的加速器。支持的值为 `cpu` 和 `gpu`。  
依赖模型组件中的示例模型仅支持 CPU 加速。要对不同的自定义模型使用 GPU 加速，请[创建自定义模型组件](ml-customization.md#override-public-model-store)以覆盖公共模型组件。  
默认值：`cpu`

`ImageName`  
<a name="ml-config-imagename-desc-dlr-1.3.0"></a>（可选）推理组件用作预测输入的图像名称。该组件可在 `ImageDirectory` 中指定的文件夹中查找图像。默认位置是`MLRootPath/images`。 AWS IoT Greengrass 支持以下图像格式：`jpeg`、`jpg``png`、和`npy`。  
<a name="ml-config-imagename-img-default"></a>默认值：`cat.jpeg`

`InferenceInterval`  <a name="ml-config-inferenceinterval"></a>
（可选）推理代码进行的每次预测之间的时间（以秒为单位）。示例推理代码无限期运行，并在指定的时间间隔内重复其预测。例如，如果您想使用摄像机拍摄的图像进行实时预测，则可以将其更改为较短的间隔。  
默认值：`3600`

`ModelResourceKey`  <a name="ml-config-modelresourcekey"></a>
<a name="ml-config-modelresourcekey-desc"></a>（可选）在依赖的公共模型组件中使用的模型。仅当使用自定义组件覆盖公共模型组件时，才修改此参数。  
默认值：  

```
armv7l: "DLR-resnet50-armv7l-cpu-ImageClassification"
x86_64: "DLR-resnet50-x86_64-cpu-ImageClassification"
```

------

## 本地日志文件
<a name="dlr-image-classification-component-log-file"></a>

此组件使用以下日志文件。

------
#### [ Linux ]

```
/greengrass/v2/logs/aws.greengrass.DLRImageClassification.log
```

------
#### [ Windows ]

```
C:\greengrass\v2\logs\aws.greengrass.DLRImageClassification.log
```

------

**查看此组件的日志**
+ 在核心设备上运行以下命令可实时查看此组件的日志文件。将`/greengrass/v2`或*C:\$1greengrass\$1v2*替换为 AWS IoT Greengrass 根文件夹的路径。

------
#### [ Linux ]

  ```
  sudo tail -f /greengrass/v2/logs/aws.greengrass.DLRImageClassification.log
  ```

------
#### [ Windows (PowerShell) ]

  ```
  Get-Content C:\greengrass\v2\logs\aws.greengrass.DLRImageClassification.log -Tail 10 -Wait
  ```

------

## 更改日志
<a name="dlr-image-classification-component-changelog"></a>

下表介绍每个组件版本的更改。


|  **版本**  |  **更改**  | 
| --- | --- | 
|  2.1.14  | 对 Greengrass Nucleus 2.12.5 发布版进行了版本更新。 | 
|  2.1.13  | 版本更新为 Greengrass Nucleus 版本 2.12.0 发布版。 | 
|  2.1.12  | 版本更新为 Greengrass Nucleus 版本 2.11.0 发布版。 | 
|  2.1.11  | 版本更新为 Greengrass Nucleus 版本 2.10.0 发布版。 | 
|  2.1.10  | 对 Greengrass Nucleus版本 2.9.0 发行版进行了版本更新。 | 
|  2.1.9  | 版本更新为 Greengrass Nucleus 版本 2.8.0 发布版。 | 
|  2.1.8  |  版本更新为 Greengrass Nucleus 版本 2.7.0 发布版。  | 
|  2.1.7  |  版本更新为 Greengrass Nucleus 版本 2.6.0 发布版。  | 
|  2.1.6  |  版本更新为 Greengrass Nucleus 版本 2.5.0 发布版。  | 
|  2.1.5  |  组件全部发布 AWS 区域。  | 
|  2.1.4  |  版本更新为 Greengrass Nucleus 版本 2.4.0 发布版。 此版本不适用于欧洲地区（伦敦）(`eu-west-2`)。  | 
|  2.1.3  |  版本更新为 Greengrass Nucleus 版本 2.3.0 发布版。  | 
|  2.1.2  |  对 Greengrass Nucleus 版本 2.2.0 发行版进行了版本更新。  | 
|  2.1.1  |  <a name="changelog-dlr-image-classification-2.1.1"></a>[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/dlr-image-classification-component.html)  | 
|  2.0.4  |  初始版本。  | 

# DLR 对象检测
<a name="dlr-object-detection-component"></a>

DLR 对象检测组件 (`aws.greengrass.DLRObjectDetection`) 包含示例推理代码，以使用[深度学习运行时](https://github.com/neo-ai/neo-ai-dlr)和示例预训练模型执行对象检测推理。此组件使用变体 [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) 和 [DLR 运行时](dlr-component.md) 组件作为依赖关系来下载 DLR 和示例模型。

要将此推理组件与自定义训练的 DLR 模型一起使用，请[创建依赖模型存储组件的自定义版本](ml-customization.md#override-public-model-store)。要使用自己的自定义推理代码，您可以使用此组件的配方作为模板来[创建自定义推理组件](ml-customization.md#create-inference-component)。

**Topics**
+ [版本](#dlr-object-detection-component-versions)
+ [Type](#dlr-object-detection-component-type)
+ [操作系统](#dlr-object-detection-component-os-support)
+ [要求](#dlr-object-detection-component-requirements)
+ [依赖项](#dlr-object-detection-component-dependencies)
+ [配置](#dlr-object-detection-component-configuration)
+ [本地日志文件](#dlr-object-detection-component-log-file)
+ [更改日志](#dlr-object-detection-component-changelog)

## 版本
<a name="dlr-object-detection-component-versions"></a>

此组件具有以下版本：
+ 2.1.x
+ 2.0.x

## Type
<a name="dlr-object-detection-component-type"></a>

<a name="public-component-type-generic"></a>此<a name="public-component-type-generic-phrase"></a>组件是一个通用组件 (`aws.greengrass.generic`)。[Greengrass Nucleus](greengrass-nucleus-component.md) 运行组件的生命周期脚本。

<a name="public-component-type-more-information"></a>有关更多信息，请参阅[组件类型](develop-greengrass-components.md#component-types)。

## 操作系统
<a name="dlr-object-detection-component-os-support"></a>

此组件可以安装在运行以下操作系统的核心设备上：
+ Linux
+ Windows

## 要求
<a name="dlr-object-detection-component-requirements"></a>

此组件具有以下要求：<a name="ml-component-requirements"></a>
+ 在运行 Amazon Linux 2 或 Ubuntu 18.04 的 Greengrass 核心设备上，[GNU C 库](https://www.gnu.org/software/libc/)（glibc）版本 2.27 或更高版本已安装在设备上。
+ 在 Armv7l 设备（例如 Raspberry Pi）上，OpenCV-Python 的依赖关系已安装在设备上。运行以下命令以安装依赖关系。

  ```
  sudo apt-get install libopenjp2-7 libilmbase23 libopenexr-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk-3-0 libwebp-dev
  ```
+ 运行 Raspberry Pi OS Bullseye 的 Raspberry Pi 设备必须满足以下要求：
  + NumPy 设备上安装了 1.22.4 或更高版本。Raspberry Pi OS Bullseye 包含的早期版本 NumPy，因此你可以运行以下命令在设备 NumPy 上进行升级。

    ```
    pip3 install --upgrade numpy
    ```
  + 旧摄像机堆栈已在设备上启用。Raspberry Pi OS Bullseye 包含一个新摄像机堆栈，该堆栈默认处于启用状态且不兼容，因此您必须启用旧摄像机堆栈。<a name="raspberry-pi-bullseye-enable-legacy-camera-stack"></a>

**启用旧摄像机堆栈**

    1. 运行以下命令以打开 Raspberry Pi 配置工具。

       ```
       sudo raspi-config
       ```

    1. 选择**接口选项**。

    1. 选择**旧摄像机**以启用旧摄像机堆栈。

    1. 重启 Raspberry Pi。

## 依赖项
<a name="dlr-object-detection-component-dependencies"></a>

部署组件时， AWS IoT Greengrass 还会部署其依赖项的兼容版本。这意味着您必须满足组件及其所有依赖关系的要求，才能成功部署组件。本部分列出了此组件的[已发布版本](#dlr-object-detection-component-changelog)的依赖关系，以及定义每个依赖关系的组件版本的语义版本约束。您还可以在 [AWS IoT Greengrass 控制台](https://console.aws.amazon.com//greengrass)中查看每个组件版本的依赖关系。在组件详细信息页面上，查找**依赖关系**列表。

------
#### [ 2.1.13 and 2.1.14 ]

下表列出了此组件的版本 2.1.13 和 2.1.14 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.13.0 | 软性 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.12 ]

下表列出了此组件的版本 2.1.12 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.12.0 | 软性 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.11 ]

下表列出了此组件的版本 2.1.11 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.11.0 | 软性 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.10 ]

下表列出了此组件的版本 2.1.10 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.10.0 | 软性 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.9 ]

下表列出了此组件的版本 2.1.9 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.9.0 | 软性 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.8 ]

下表列出了此组件的版本 2.1.8 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.8.0 | 软性 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.7 ]

下表列出了此组件的版本 2.1.7 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.7.0 | 软性 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.6 ]

下表列出了此组件的版本 2.1.6 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.6.0 | 软性 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.4 - 2.1.5 ]

下表列出了此组件的版本 2.1.4 至 2.1.5 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.5.0 | 软性 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.3 ]

下表列出了此组件的版本 2.1.3 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.4.0 | 软性 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.2 ]

下表列出了此组件的版本 2.1.2 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.3.0 | 软性 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.1.1 ]

下表列出了此组件的版本 2.1.1 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.2.0 | 软性 | 
| [DLR 对象检测模型存储](dlr-object-detection-model-store-component.md) | \$12.1.0 | 硬性 | 
| [DLR](dlr-component.md) | \$11.6.0 | 硬性 | 

------
#### [ 2.0.x ]

下表列出了此组件的版本 2.0.x 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | \$12.0.0 | 软性 | 
| DLR 对象检测模型存储 | \$12.0.0 | 硬性 | 
| DLR | \$11.3.0 | 软性 | 

------

## 配置
<a name="dlr-object-detection-component-configuration"></a>

此组件提供您可以在部署组件时自定义的以下配置参数。

------
#### [ 2.1.x ]

`accessControl`  
<a name="ml-config-accesscontrol-desc"></a>（可选）包含允许组件将消息发布到默认通知主题的[授权策略](interprocess-communication.md#ipc-authorization-policies)的对象。  
默认值：  

```
{
   "aws.greengrass.ipc.mqttproxy": {
      "aws.greengrass.DLRObjectDetection:mqttproxy:1": {
         "policyDescription": "Allows access to publish via topic ml/dlr/object-detection.",
         "operations": [
            "aws.greengrass#PublishToIoTCore"
         ],
         "resources": [
            "ml/dlr/object-detection"
         ]
      }
   }
}
```

`PublishResultsOnTopic`  
<a name="ml-config-publishresultsontopic-desc"></a>（可选）要将推理结果发布到的主题。如果修改此值，则还必须修改 `accessControl` 参数中 `resources` 的值，以匹配您的自定义主题名称。  
默认值：`ml/dlr/object-detection`

`Accelerator`  <a name="ml-config-accelerator"></a>
要使用的加速器。支持的值为 `cpu` 和 `gpu`。  
依赖模型组件中的示例模型仅支持 CPU 加速。要对不同的自定义模型使用 GPU 加速，请[创建自定义模型组件](ml-customization.md#override-public-model-store)以覆盖公共模型组件。  
默认值：`cpu`

`ImageDirectory`  
<a name="ml-config-imagedirectory-desc"></a>（可选）设备上推理组件读取图像的文件夹路径。您可以将此值修改为设备上您有权 read/write 访问的任何位置。  
<a name="ml-config-imagedirectory-obj-default"></a>默认值：`/greengrass/v2/packages/artifacts-unarchived/component-name/object_detection/sample_images/`  
如果将 `UseCamera` 的值设置为 `true`，则忽略此配置参数。

`ImageName`  
<a name="ml-config-imagename-desc"></a>（可选）推理组件用作预测输入的图像名称。该组件可在 `ImageDirectory` 中指定的文件夹中查找图像。默认情况下，该组件使用默认图像目录中的示例图像。 AWS IoT Greengrass 支持以下图像格式：`jpeg`、`jpg``png`、和`npy`。  
<a name="ml-config-imagename-obj-default"></a>默认值：`objects.jpg`  
如果将 `UseCamera` 的值设置为 `true`，则忽略此配置参数。

`InferenceInterval`  <a name="ml-config-inferenceinterval"></a>
（可选）推理代码进行的每次预测之间的时间（以秒为单位）。示例推理代码无限期运行，并在指定的时间间隔内重复其预测。例如，如果您想使用摄像机拍摄的图像进行实时预测，则可以将其更改为较短的间隔。  
默认值：`3600`

`ModelResourceKey`  <a name="ml-config-modelresourcekey"></a>
<a name="ml-config-modelresourcekey-desc"></a>（可选）在依赖的公共模型组件中使用的模型。仅当使用自定义组件覆盖公共模型组件时，才修改此参数。  
默认值：  

```
{
    "armv7l": "DLR-yolo3-armv7l-cpu-ObjectDetection",
    "aarch64": "DLR-yolo3-aarch64-gpu-ObjectDetection",
    "x86_64": "DLR-yolo3-x86_64-cpu-ObjectDetection",
    "windows": "DLR-resnet50-win-cpu-ObjectDetection"
}
```

`UseCamera`  <a name="ml-config-usecamera"></a>
（可选）字符串值，用于定义是否使用连接到 Greengrass 核心设备的摄像机拍摄的图像。支持的值为 `true` 和 `false`。  
当您将此值设置为 `true` 时，示例推理代码将访问设备上的摄像机，并在本地对捕获的图像运行推理。`ImageName` 和 `ImageDirectory` 参数的值将被忽略。确保运行此组件的用户 read/write 可以访问相机存储捕获图像的位置。  
默认值：`false`  
当您查看此组件的配方时，`UseCamera` 配置参数不会显示在默认配置中。但是，在部署组件时，可以在[配置合并更新](update-component-configurations.md)中修改此参数的值。  
如果将 `UseCamera` 设置为 `true`，则还必须创建符号链接，以使推理组件能够从运行时组件创建的虚拟环境中访问您的摄像机。有关将摄像机与示例推理组件结合使用的更多信息，请参阅 [更新组件配置](ml-tutorial-image-classification-camera.md)。

------
#### [ 2.0.x ]

`MLRootPath`  <a name="ml-config-mlrootpath"></a>
<a name="ml-config-mlrootpath-desc"></a>（可选）Linux 核心设备上推理组件读取图像和写入推理结果的文件夹路径。您可以将此值修改为设备上运行此组件的用户有权 read/write 访问的任何位置。  
<a name="ml-config-mlrootpath-default-dlr"></a>默认值：`/greengrass/v2/work/variant.DLR/greengrass_ml`  
<a name="ml-config-mlrootpath-default-tfl"></a>默认值：`/greengrass/v2/work/variant.TensorFlowLite/greengrass_ml`

`Accelerator`  
请勿修改。目前，加速器唯一支持的值是 `cpu`，因为依赖模型组件中的模型仅针对 CPU 加速器进行编译。

`ImageName`  
<a name="ml-config-imagename-desc-dlr-1.3.0"></a>（可选）推理组件用作预测输入的图像名称。该组件可在 `ImageDirectory` 中指定的文件夹中查找图像。默认位置是`MLRootPath/images`。 AWS IoT Greengrass 支持以下图像格式：`jpeg`、`jpg``png`、和`npy`。  
<a name="ml-config-imagename-obj-default"></a>默认值：`objects.jpg`

`InferenceInterval`  <a name="ml-config-inferenceinterval"></a>
（可选）推理代码进行的每次预测之间的时间（以秒为单位）。示例推理代码无限期运行，并在指定的时间间隔内重复其预测。例如，如果您想使用摄像机拍摄的图像进行实时预测，则可以将其更改为较短的间隔。  
默认值：`3600`

`ModelResourceKey`  <a name="ml-config-modelresourcekey"></a>
<a name="ml-config-modelresourcekey-desc"></a>（可选）在依赖的公共模型组件中使用的模型。仅当使用自定义组件覆盖公共模型组件时，才修改此参数。  
默认值：  

```
{
    armv7l: "DLR-yolo3-armv7l-cpu-ObjectDetection",
    x86_64: "DLR-yolo3-x86_64-cpu-ObjectDetection"
}
```

------

## 本地日志文件
<a name="dlr-object-detection-component-log-file"></a>

此组件使用以下日志文件。

------
#### [ Linux ]

```
/greengrass/v2/logs/aws.greengrass.DLRObjectDetection.log
```

------
#### [ Windows ]

```
C:\greengrass\v2\logs\aws.greengrass.DLRObjectDetection.log
```

------

**查看此组件的日志**
+ 在核心设备上运行以下命令可实时查看此组件的日志文件。将`/greengrass/v2`或*C:\$1greengrass\$1v2*替换为 AWS IoT Greengrass 根文件夹的路径。

------
#### [ Linux ]

  ```
  sudo tail -f /greengrass/v2/logs/aws.greengrass.DLRObjectDetection.log
  ```

------
#### [ Windows (PowerShell) ]

  ```
  Get-Content C:\greengrass\v2\logs\aws.greengrass.DLRObjectDetection.log -Tail 10 -Wait
  ```

------

## 更改日志
<a name="dlr-object-detection-component-changelog"></a>

下表介绍每个组件版本的更改。


|  **版本**  |  **更改**  | 
| --- | --- | 
|  2.1.14  | 对 Greengrass Nucleus 2.12.5 发布版进行了版本更新。 | 
|  2.1.13  | 版本更新为 Greengrass Nucleus 版本 2.12.0 发布版。 | 
|  2.1.12  | 版本更新为 Greengrass Nucleus 版本 2.11.0 发布版。 | 
|  2.1.11  | 版本更新为 Greengrass Nucleus 版本 2.10.0 发布版。 | 
|  2.1.10  | 对 Greengrass Nucleus版本 2.9.0 发行版进行了版本更新。 | 
|  2.1.9  | 版本更新为 Greengrass Nucleus 版本 2.8.0 发布版。 | 
|  2.1.8  |  版本更新为 Greengrass Nucleus 版本 2.7.0 发布版。  | 
|  2.1.7  |  版本更新为 Greengrass Nucleus 版本 2.6.0 发布版。  | 
|  2.1.6  |  版本更新为 Greengrass Nucleus 版本 2.5.0 发布版。  | 
|  2.1.5  |  组件全部发布 AWS 区域。  | 
|  2.1.4  |  版本更新为 Greengrass Nucleus 版本 2.4.0 发布版。 此版本不适用于欧洲地区（伦敦）(`eu-west-2`)。  | 
|  2.1.3  |  版本更新为 Greengrass Nucleus 版本 2.3.0 发布版。  | 
|  2.1.2  |  <a name="changelog-dlr-object-detection-2.1.2"></a>[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/dlr-object-detection-component.html)  | 
|  2.1.1  |  <a name="changelog-dlr-object-detection-2.1.1"></a>[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/dlr-object-detection-component.html)  | 
|  2.0.4  |  初始版本。  | 

# DLR 图像分类模型存储
<a name="dlr-image-classification-model-store-component"></a>

DLR 图像分类模型存储库是一个机器学习模型组件，其中包含预训练的 ResNet -50 个模型作为 Greengrass 工件。[此组件中使用的预训练模型从 [GluonCV 模型](https://cv.gluon.ai/model_zoo/index.html)库中获取，并使用 SageMaker AI Neo 深度学习运行时进行编译。](https://github.com/neo-ai/neo-ai-dlr)

[DLR 图像分类](dlr-image-classification-component.md)推理组件使用此组件作为模型来源的依赖关系。要使用自定义训练的 DLR 模型，请[创建此模型组件的自定义版本](ml-customization.md#override-public-model-store)，并将您的自定义模型作为组件构件包括在内。您可以使用此组件的配方作为模板来创建自定义模型组件。

**注意**  
DLR 图像分类模型存储组件的名称因版本而异。版本 2.1.x 及更高版本的组件名称为 `variant.DLR.ImageClassification.ModelStore`。版本 2.0.x 的组件名称为 `variant.ImageClassification.ModelStore`。

**Topics**
+ [版本](#dlr-image-classification-model-store-component-versions)
+ [Type](#dlr-image-classification-model-store-component-type)
+ [操作系统](#dlr-image-classification-model-store-component-os-support)
+ [要求](#dlr-image-classification-model-store-component-requirements)
+ [依赖项](#dlr-image-classification-model-store-component-dependencies)
+ [配置](#dlr-image-classification-model-store-component-configuration)
+ [本地日志文件](#dlr-image-classification-model-store-component-log-file)
+ [更改日志](#dlr-image-classification-model-store-component-changelog)

## 版本
<a name="dlr-image-classification-model-store-component-versions"></a>

此组件具有以下版本：
+ 2.1.x (`variant.DLR.ImageClassification.ModelStore`) 
+ 2.0.x (`variant.ImageClassification.ModelStore`) 

## Type
<a name="dlr-image-classification-model-store-component-type"></a>

<a name="public-component-type-generic"></a>此<a name="public-component-type-generic-phrase"></a>组件是一个通用组件 (`aws.greengrass.generic`)。[Greengrass Nucleus](greengrass-nucleus-component.md) 运行组件的生命周期脚本。

<a name="public-component-type-more-information"></a>有关更多信息，请参阅[组件类型](develop-greengrass-components.md#component-types)。

## 操作系统
<a name="dlr-image-classification-model-store-component-os-support"></a>

此组件可以安装在运行以下操作系统的核心设备上：
+ Linux
+ Windows

## 要求
<a name="dlr-image-classification-model-store-component-requirements"></a>

此组件具有以下要求：<a name="ml-component-requirements"></a>
+ 在运行 Amazon Linux 2 或 Ubuntu 18.04 的 Greengrass 核心设备上，[GNU C 库](https://www.gnu.org/software/libc/)（glibc）版本 2.27 或更高版本已安装在设备上。
+ 在 Armv7l 设备（例如 Raspberry Pi）上，OpenCV-Python 的依赖关系已安装在设备上。运行以下命令以安装依赖关系。

  ```
  sudo apt-get install libopenjp2-7 libilmbase23 libopenexr-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk-3-0 libwebp-dev
  ```
+ 运行 Raspberry Pi OS Bullseye 的 Raspberry Pi 设备必须满足以下要求：
  + NumPy 设备上安装了 1.22.4 或更高版本。Raspberry Pi OS Bullseye 包含的早期版本 NumPy，因此你可以运行以下命令在设备 NumPy 上升级。

    ```
    pip3 install --upgrade numpy
    ```
  + 旧摄像机堆栈已在设备上启用。Raspberry Pi OS Bullseye 包含一个新摄像机堆栈，该堆栈默认处于启用状态且不兼容，因此您必须启用旧摄像机堆栈。<a name="raspberry-pi-bullseye-enable-legacy-camera-stack"></a>

**启用旧摄像机堆栈**

    1. 运行以下命令以打开 Raspberry Pi 配置工具。

       ```
       sudo raspi-config
       ```

    1. 选择**接口选项**。

    1. 选择**旧摄像机**以启用旧摄像机堆栈。

    1. 重启 Raspberry Pi。

## 依赖项
<a name="dlr-image-classification-model-store-component-dependencies"></a>

部署组件时， AWS IoT Greengrass 还会部署其依赖项的兼容版本。这意味着您必须满足组件及其所有依赖关系的要求，才能成功部署组件。本部分列出了此组件的[已发布版本](#dlr-image-classification-model-store-component-changelog)的依赖关系，以及定义每个依赖关系的组件版本的语义版本约束。您还可以在 [AWS IoT Greengrass 控制台](https://console.aws.amazon.com//greengrass)中查看每个组件版本的依赖关系。在组件详细信息页面上，查找**依赖关系**列表。

------
#### [ 2.1.12 - 2.1.14 ]

下表列出了此组件的版本 2.1.12 和 2.1.13 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.13.0 | 软性 | 

------
#### [ 2.1.11 ]

下表列出了此组件的版本 2.1.11 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.12.0 | 软性 | 

------
#### [ 2.1.10 ]

下表列出了此组件的版本 2.1.10 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.11.0 | 软性 | 

------
#### [ 2.1.9 ]

下表列出了此组件的版本 2.1.9 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.10.0 | 软性 | 

------
#### [ 2.1.8 ]

下表列出了此组件的版本 2.1.8 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.9.0 | 软性 | 

------
#### [ 2.1.7 ]

下表列出了此组件的版本 2.1.7 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.8.0 | 软性 | 

------
#### [ 2.1.6 ]

下表列出了此组件的版本 2.1.6 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.7.0 | 软性 | 

------
#### [ 2.1.5 ]

下表列出了此组件的版本 2.1.5 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.6.0 | 软性 | 

------
#### [ 2.1.4 ]

下表列出了此组件的版本 2.1.4 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.5.0 | 软性 | 

------
#### [ 2.1.3 ]

下表列出了此组件的版本 2.1.3 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.4.0 | 软性 | 

------
#### [ 2.1.2 ]

下表列出了此组件的版本 2.1.2 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.3.0 | 软性 | 

------
#### [ 2.1.1 ]

下表列出了此组件的版本 2.1.1 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.2.0 | 软性 | 

------
#### [ 2.0.x ]

下表列出了此组件的版本 2.0.x 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | \$12.0.0 | 软性 | 

------

## 配置
<a name="dlr-image-classification-model-store-component-configuration"></a>

此组件没有任何配置参数。

## 本地日志文件
<a name="dlr-image-classification-model-store-component-log-file"></a>

此组件不输出日志。

## 更改日志
<a name="dlr-image-classification-model-store-component-changelog"></a>

下表介绍每个组件版本的更改。


|  **版本**  |  **更改**  | 
| --- | --- | 
|  2.1.13  | 对 Greengrass Nucleus 2.12.5 发布版进行了版本更新。 | 
|  2.1.12  | 版本更新为 Greengrass Nucleus 版本 2.12.0 发布版。 | 
|  2.1.11  | 版本更新为 Greengrass Nucleus 版本 2.11.0 发布版。 | 
|  2.1.10  | 版本更新为 Greengrass Nucleus 版本 2.10.0 发布版。 | 
|  2.1.9  | 对 Greengrass Nucleus版本 2.9.0 发行版进行了版本更新。 | 
|  2.1.8  | 版本更新为 Greengrass Nucleus 版本 2.8.0 发布版。 | 
|  2.1.7  |  版本更新为 Greengrass Nucleus 版本 2.7.0 发布版。  | 
|  2.1.6  |  版本更新为 Greengrass Nucleus 版本 2.6.0 发布版。  | 
|  2.1.5  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/dlr-image-classification-model-store-component.html)  | 
|  2.1.4  |  版本更新为 Greengrass Nucleus 版本 2.4.0 发布版。  | 
|  2.1.3  |  版本更新为 Greengrass Nucleus 版本 2.3.0 发布版。  | 
|  2.1.2  |  对 Greengrass Nucleus 版本 2.2.0 发行版进行了版本更新。  | 
|  2.1.1  |  <a name="changelog-dlr-image-classification-model-store-2.1.1"></a>[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/dlr-image-classification-model-store-component.html)  | 
|  2.0.4  |  初始版本。  | 

# DLR 对象检测模型存储
<a name="dlr-object-detection-model-store-component"></a>

DLR 对象检测模型存储库是一个机器学习模型组件，其中包含作为 Greengrass 工件的预训练 YOLOv3 模型。此组件中使用的示例模型从 [GluonCV 模型](https://cv.gluon.ai/model_zoo/index.html)库中获取，并使用 SageMaker AI Neo [深度](https://github.com/neo-ai/neo-ai-dlr)学习运行时进行编译。

[DLR 对象检测](dlr-object-detection-component.md)推理组件使用此组件作为模型来源的依赖关系。要使用自定义训练的 DLR 模型，请[创建此模型组件的自定义版本](ml-customization.md#override-public-model-store)，并将您的自定义模型作为组件构件包括在内。您可以使用此组件的配方作为模板来创建自定义模型组件。

**注意**  
DLR 对象检测模型存储组件的名称因其版本而异。版本 2.1.x 及更高版本的组件名称为 `variant.DLR.ObjectDetection.ModelStore`。版本 2.0.x 的组件名称为 `variant.ObjectDetection.ModelStore`。

**Topics**
+ [版本](#dlr-object-detection-model-store-component-versions)
+ [Type](#dlr-object-detection-model-store-component-type)
+ [操作系统](#dlr-object-detection-model-store-component-os-support)
+ [要求](#dlr-object-detection-model-store-component-requirements)
+ [依赖项](#dlr-object-detection-model-store-component-dependencies)
+ [配置](#dlr-object-detection-model-store-component-configuration)
+ [本地日志文件](#dlr-object-detection-model-store-component-log-file)
+ [更改日志](#dlr-object-detection-model-store-component-changelog)

## 版本
<a name="dlr-object-detection-model-store-component-versions"></a>

此组件具有以下版本：
+ 2.1.x 
+ 2.0.x

## Type
<a name="dlr-object-detection-model-store-component-type"></a>

<a name="public-component-type-generic"></a>此<a name="public-component-type-generic-phrase"></a>组件是一个通用组件 (`aws.greengrass.generic`)。[Greengrass Nucleus](greengrass-nucleus-component.md) 运行组件的生命周期脚本。

<a name="public-component-type-more-information"></a>有关更多信息，请参阅[组件类型](develop-greengrass-components.md#component-types)。

## 操作系统
<a name="dlr-object-detection-model-store-component-os-support"></a>

此组件可以安装在运行以下操作系统的核心设备上：
+ Linux
+ Windows

## 要求
<a name="dlr-object-detection-model-store-component-requirements"></a>

此组件具有以下要求：<a name="ml-component-requirements"></a>
+ 在运行 Amazon Linux 2 或 Ubuntu 18.04 的 Greengrass 核心设备上，[GNU C 库](https://www.gnu.org/software/libc/)（glibc）版本 2.27 或更高版本已安装在设备上。
+ 在 Armv7l 设备（例如 Raspberry Pi）上，OpenCV-Python 的依赖关系已安装在设备上。运行以下命令以安装依赖关系。

  ```
  sudo apt-get install libopenjp2-7 libilmbase23 libopenexr-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk-3-0 libwebp-dev
  ```
+ 运行 Raspberry Pi OS Bullseye 的 Raspberry Pi 设备必须满足以下要求：
  + NumPy 设备上安装了 1.22.4 或更高版本。Raspberry Pi OS Bullseye 包含的早期版本 NumPy，因此你可以运行以下命令在设备 NumPy 上进行升级。

    ```
    pip3 install --upgrade numpy
    ```
  + 旧摄像机堆栈已在设备上启用。Raspberry Pi OS Bullseye 包含一个新摄像机堆栈，该堆栈默认处于启用状态且不兼容，因此您必须启用旧摄像机堆栈。<a name="raspberry-pi-bullseye-enable-legacy-camera-stack"></a>

**启用旧摄像机堆栈**

    1. 运行以下命令以打开 Raspberry Pi 配置工具。

       ```
       sudo raspi-config
       ```

    1. 选择**接口选项**。

    1. 选择**旧摄像机**以启用旧摄像机堆栈。

    1. 重启 Raspberry Pi。

## 依赖项
<a name="dlr-object-detection-model-store-component-dependencies"></a>

部署组件时， AWS IoT Greengrass 还会部署其依赖项的兼容版本。这意味着您必须满足组件及其所有依赖关系的要求，才能成功部署组件。本部分列出了此组件的[已发布版本](#dlr-object-detection-model-store-component-changelog)的依赖关系，以及定义每个依赖关系的组件版本的语义版本约束。您还可以在 [AWS IoT Greengrass 控制台](https://console.aws.amazon.com//greengrass)中查看每个组件版本的依赖关系。在组件详细信息页面上，查找**依赖关系**列表。

------
#### [ 2.1.13 and 2.1.14 ]

下表列出了此组件的版本 2.1.13 和 2.1.14 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.13.0 | 软性 | 

------
#### [ 2.1.12 ]

下表列出了此组件的版本 2.1.12 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.12.0 | 软性 | 

------
#### [ 2.1.11 ]

下表列出了此组件的版本 2.1.11 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.11.0 | 软性 | 

------
#### [ 2.1.10 ]

下表列出了此组件的版本 2.1.10 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.10.0 | 软性 | 

------
#### [ 2.1.9 ]

下表列出了此组件的版本 2.1.9 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.9.0 | 软性 | 

------
#### [ 2.1.8 ]

下表列出了此组件的版本 2.1.8 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.8.0 | 软性 | 

------
#### [ 2.1.7 ]

下表列出了此组件的版本 2.1.7 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.7.0 | 软性 | 

------
#### [ 2.1.5 and 2.1.6 ]

下表列出了此组件的版本 2.1.5 和 2.1.6 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.6.0 | 软性 | 

------
#### [ 2.1.4 ]

下表列出了此组件的版本 2.1.4 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.5.0 | 软性 | 

------
#### [ 2.1.3 ]

下表列出了此组件的版本 2.1.3 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.4.0 | 软性 | 

------
#### [ 2.1.2 ]

下表列出了此组件的版本 2.1.2 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.3.0 | 软性 | 

------
#### [ 2.1.1 ]

下表列出了此组件的版本 2.1.1 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.2.0 | 软性 | 

------
#### [ 2.0.x ]

下表列出了此组件的版本 2.0.x 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | \$12.0.0 | 软性 | 

------

## 配置
<a name="dlr-object-detection-model-store-component-configuration"></a>

此组件没有任何配置参数。

## 本地日志文件
<a name="dlr-object-detection-model-store-component-log-file"></a>

此组件不输出日志。

## 更改日志
<a name="dlr-object-detection-model-store-component-changelog"></a>

下表介绍每个组件版本的更改。


|  **版本**  |  **更改**  | 
| --- | --- | 
|  2.1.14  |  对 Greengrass Nucleus 2.12.5 发布版进行了版本更新。  | 
|  2.1.13  | 版本更新为 Greengrass Nucleus 版本 2.12.0 发布版。 | 
|  2.1.12  | 版本更新为 Greengrass Nucleus 版本 2.11.0 发布版。 | 
|  2.1.11  | 版本更新为 Greengrass Nucleus 版本 2.10.0 发布版。 | 
|  2.1.10  | 对 Greengrass Nucleus版本 2.9.0 发行版进行了版本更新。 | 
|  2.1.9  | 版本更新为 Greengrass Nucleus 版本 2.8.0 发布版。 | 
|  2.1.8  |  版本更新为 Greengrass Nucleus 版本 2.7.0 发布版。  | 
|  2.1.7  |  版本更新为 Greengrass Nucleus 版本 2.6.0 发布版。  | 
|  2.1.6  |  添加 CPU 型号以修复 Armv8 (AArch64) 设备上的问题。  | 
|  2.1.5  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/dlr-object-detection-model-store-component.html)  | 
|  2.1.4  |  版本更新为 Greengrass Nucleus 版本 2.4.0 发布版。  | 
|  2.1.3  |  版本更新为 Greengrass Nucleus 版本 2.3.0 发布版。  | 
|  2.1.2  |  对 Greengrass Nucleus 版本 2.2.0 发行版进行了版本更新。  | 
|  2.1.1  |  <a name="changelog-dlr-object-detection-model-store-2.1.1"></a>[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/dlr-object-detection-model-store-component.html) | 
|  2.0.4  |  初始版本。  | 

# DLR 运行时
<a name="dlr-component"></a>

DLR 运行时组件 (`variant.DLR`) 包含一个脚本，用于在设备上的虚拟环境中安装[深度学习运行时](https://github.com/neo-ai/neo-ai-dlr)（DLR）及其依赖关系。[DLR 图像分类](dlr-image-classification-component.md) 和 [DLR 对象检测](dlr-object-detection-component.md) 组件使用此组件作为安装 DLR 的依赖关系。组件版本 1.6.x 安装了 DLR v1.6.0，组件版本 1.3.x 安装了 DLR v1.3.0。

要使用不同的运行时，您可以使用此组件的配方作为模板来[创建自定义机器学习组件](ml-customization.md)。

**Topics**
+ [版本](#dlr-component-versions)
+ [Type](#dlr-component-type)
+ [操作系统](#dlr-component-os-support)
+ [要求](#dlr-component-requirements)
+ [依赖项](#dlr-component-dependencies)
+ [配置](#dlr-component-configuration)
+ [使用量](#dlr-component-usage)
+ [本地日志文件](#dlr-component-log-file)
+ [更改日志](#dlr-component-changelog)

## 版本
<a name="dlr-component-versions"></a>

此组件具有以下版本：
+ 1.6.x
+ 1.3.x

## Type
<a name="dlr-component-type"></a>

<a name="public-component-type-generic"></a>此<a name="public-component-type-generic-phrase"></a>组件是一个通用组件 (`aws.greengrass.generic`)。[Greengrass Nucleus](greengrass-nucleus-component.md) 运行组件的生命周期脚本。

<a name="public-component-type-more-information"></a>有关更多信息，请参阅[组件类型](develop-greengrass-components.md#component-types)。

## 操作系统
<a name="dlr-component-os-support"></a>

此组件可以安装在运行以下操作系统的核心设备上：
+ Linux
+ Windows

## 要求
<a name="dlr-component-requirements"></a>

此组件具有以下要求：<a name="ml-component-requirements"></a>
+ 在运行 Amazon Linux 2 或 Ubuntu 18.04 的 Greengrass 核心设备上，[GNU C 库](https://www.gnu.org/software/libc/)（glibc）版本 2.27 或更高版本已安装在设备上。
+ 在 Armv7l 设备（例如 Raspberry Pi）上，OpenCV-Python 的依赖关系已安装在设备上。运行以下命令以安装依赖关系。

  ```
  sudo apt-get install libopenjp2-7 libilmbase23 libopenexr-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk-3-0 libwebp-dev
  ```
+ 运行 Raspberry Pi OS Bullseye 的 Raspberry Pi 设备必须满足以下要求：
  + NumPy 设备上安装了 1.22.4 或更高版本。Raspberry Pi OS Bullseye 包含的早期版本 NumPy，因此你可以运行以下命令在设备 NumPy 上进行升级。

    ```
    pip3 install --upgrade numpy
    ```
  + 旧摄像机堆栈已在设备上启用。Raspberry Pi OS Bullseye 包含一个新摄像机堆栈，该堆栈默认处于启用状态且不兼容，因此您必须启用旧摄像机堆栈。<a name="raspberry-pi-bullseye-enable-legacy-camera-stack"></a>

**启用旧摄像机堆栈**

    1. 运行以下命令以打开 Raspberry Pi 配置工具。

       ```
       sudo raspi-config
       ```

    1. 选择**接口选项**。

    1. 选择**旧摄像机**以启用旧摄像机堆栈。

    1. 重启 Raspberry Pi。

### 端点和端口
<a name="dlr-component-endpoints"></a>

默认情况下，此组件使用安装程序脚本通过 `apt`、`yum`、`brew` 和 `pip` 命令来安装程序包，具体取决于核心设备使用的平台。此组件必须能够对各种程序包索引和存储库执行出站请求才能运行安装程序脚本。要允许此组件的出站流量通过代理或防火墙，您必须确定核心设备连接安装的程序包索引和存储库的端点。

在确定此组件的安装脚本所需的端点时，请考虑以下几点：
+ 端点取决于核心设备的平台。例如，运行 Ubuntu 的核心设备使用 `apt`，而不是 `yum` 或 `brew`。此外，使用相同程序包索引的设备可能具有不同的源列表，因此它们可能会从不同的存储库中检索软件包。
+ 使用相同程序包索引的多台设备之间的端点可能有所不同，因为每台设备都有自己的源列表，用于定义检索程序包的位置。
+ 端点可能会随时间而变化。每个软件包索引都提供您下载软件包的存储库，软件包的所有者可以更改软件包索引提供的内容 URLs 。 URLs 

有关此组件安装的依赖项以及如何禁用安装程序脚本的更多信息，请参阅[UseInstaller](#dlr-component-config-useinstaller-term)配置参数。

有关基本操作所需的端点和端口的更多信息，请参阅[允许设备流量通过代理或防火墙](allow-device-traffic.md)。

## 依赖项
<a name="dlr-component-dependencies"></a>

部署组件时， AWS IoT Greengrass 还会部署其依赖项的兼容版本。这意味着您必须满足组件及其所有依赖关系的要求，才能成功部署组件。本部分列出了此组件的[已发布版本](#dlr-component-changelog)的依赖关系，以及定义每个依赖关系的组件版本的语义版本约束。您还可以在 [AWS IoT Greengrass 控制台](https://console.aws.amazon.com//greengrass)中查看每个组件版本的依赖关系。在组件详细信息页面上，查找**依赖关系**列表。

------
#### [ 1.6.11 - 1.6.16 ]

下表列出了此组件的版本 1.6.11 至 1.6.16 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <3.0.0 | 软性 | 

------
#### [ 1.6.10 ]

下表列出了此组件的版本 1.6.10 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.9.0 | 软性 | 

------
#### [ 1.6.9 ]

下表列出了此组件的版本 1.6.9 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.8.0 | 软性 | 

------
#### [ 1.6.8 ]

下表列出了此组件的版本 1.6.8 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.7.0 | 软性 | 

------
#### [ 1.6.6 and 1.6.7 ]

下表列出了此组件的版本 1.6.6 和 1.6.7 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.6.0 | 软性 | 

------
#### [ 1.6.4 and 1.6.5 ]

下表列出了此组件的版本 1.6.4 和 1.6.5 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.5.0 | 软性 | 

------
#### [ 1.6.3 ]

下表列出了此组件的版本 1.6.3 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.4.0 | 软性 | 

------
#### [ 1.6.2 ]

下表列出了此组件的版本 1.6.2 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.3.0 | 软性 | 

------
#### [ 1.6.1 ]

下表列出了此组件的版本 1.6.1 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.2.0 | 软性 | 

------
#### [ 1.3.x ]

下表列出了此组件的版本 1.3.x 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | \$12.0.0 | 软性 | 

------

有关组件依赖关系的更多信息，请参阅[组件配方参考](component-recipe-reference.md#recipe-reference-component-dependencies)。

## 配置
<a name="dlr-component-configuration"></a>

此组件提供您可以在部署组件时自定义的以下配置参数。

`MLRootPath`  
<a name="ml-config-mlrootpath-desc"></a>（可选）Linux 核心设备上推理组件读取图像和写入推理结果的文件夹路径。您可以将此值修改为设备上运行此组件的用户有权 read/write 访问的任何位置。  
<a name="ml-config-mlrootpath-default-dlr"></a>默认值：`/greengrass/v2/work/variant.DLR/greengrass_ml`

`WindowsMLRootPath`  
此组件的 v1.6.6 及更高版本中提供了此功能。  
<a name="ml-config-windowsmlrootpath-desc"></a>（可选）Windows 核心设备上推理组件读取图像和写入推理结果的文件夹路径。您可以将此值修改为设备上运行此组件的用户有权 read/write 访问的任何位置。  
<a name="ml-config-windowsmlrootpath-default-dlr"></a>默认值：`C:\greengrass\v2\\work\\variant.DLR\\greengrass_ml`

  `UseInstaller`   
<a name="ml-config-useinstaller-desc-dlr"></a>（可选）字符串值，用于定义是否使用此组件中的安装程序脚本来安装 DLR 及其依赖关系。支持的值为 `true` 和 `false`。  <a name="ml-config-useinstaller-libraries-dlr"></a>

如果您想使用自定义脚本进行 DLR 安装，或者想要在预构建的 Linux 映像中包含运行时依赖关系，请将此值设置为 `false`。要将此组件与 AWS提供的 DLR 推理组件一起使用，请安装以下库（包括所有依赖项），并将其提供给运行 ML 组件的系统用户（例如`ggc_user`）。
+ [Python](https://www.python.org/downloads/) 3.7 或更高版本，包括适用于您的 Python 版本的 `pip`。
+ [深度学习运行时](https://github.com/neo-ai/neo-ai-dlr) v1.6.0
+ [NumPy](https://numpy.org/install/).
+ [OpenCV-Python](https://pypi.org/project/opencv-python/)。
+ [AWS IoT Device SDK 适用于 Python 的 v2。](https://github.com/aws/aws-iot-device-sdk-python-v2)
+ [AWS 通用运行时 (CRT) Python](https://github.com/awslabs/aws-crt-python)。
+ [Picamera](https://picamera.readthedocs.io/en/release-1.13/)（仅适用于 Raspberry Pi 设备）。
+ [`awscam`模块](https://docs.aws.amazon.com/deeplens/latest/dg/deeplens-library-awscam-module.html)（用于 AWS DeepLens 设备）。
+ libGL（适用于 Linux 设备）
<a name="ml-config-useinstaller-default"></a>默认值：`true`

## 使用量
<a name="dlr-component-usage"></a>

使用此组件并将 `UseInstaller` 配置参数设置为 `true`，以在设备上安装 DLR 及其依赖关系。该组件在您的设备上设置一个虚拟环境，其中包括 OpenCV 和 DLR 所需的 NumPy 库。

**注意**  <a name="ml-installer-component-usage-note"></a>
此组件中的安装程序脚本还会安装其他系统库的最新版本，这是在设备上配置虚拟环境和使用已安装的机器学习框架时所需要的。这可能会升级您设备上的现有系统库。查看下表，了解此组件为每个受支持的操作系统安装的库列表。如果要自定义此安装过程，请将 `UseInstaller` 配置参数设置为 `false`，然后开发自己的安装程序脚本。


| 平台 | 安装在设备系统上的库 | 安装在虚拟环境中的库 | 
| --- | --- | --- | 
| Armv7l | build-essential, cmake, ca-certificates, git | setuptools, wheel | 
| Amazon Linux 2 | mesa-libGL | 无 | 
| Ubuntu | wget | 无 | 

部署推理组件时，此运行时组件会首先验证您的设备是否已安装 DLR 及其依赖关系，如果没有，则会为您安装。

## 本地日志文件
<a name="dlr-component-log-file"></a>

此组件使用以下日志文件。

------
#### [ Linux ]

```
/greengrass/v2/logs/variant.DLR.log
```

------
#### [ Windows ]

```
C:\greengrass\v2\logs\variant.DLR.log
```

------

**查看此组件的日志**
+ 在核心设备上运行以下命令可实时查看此组件的日志文件。将`/greengrass/v2`或*C:\$1greengrass\$1v2*替换为 AWS IoT Greengrass 根文件夹的路径。

------
#### [ Linux ]

  ```
  sudo tail -f /greengrass/v2/logs/variant.DLR.log
  ```

------
#### [ Windows (PowerShell) ]

  ```
  Get-Content C:\greengrass\v2\logs\variant.DLR.log -Tail 10 -Wait
  ```

------

## 更改日志
<a name="dlr-component-changelog"></a>

下表介绍每个组件版本的更改。


|  **版本**  |  **更改**  | 
| --- | --- | 
|  1.6.16  |  对 Greengrass Nucleus 版本 2.12.5 进行了版本更新。  | 
|  1.6.12  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/dlr-component.html)  | 
|  1.6.11  | 对 Greengrass Nucleus版本 2.9.0 发行版进行了版本更新。 | 
|  1.6.10  | 版本更新为 Greengrass Nucleus 版本 2.8.0 发布版。 | 
|  1.6.9  |  版本更新为 Greengrass Nucleus 版本 2.7.0 发布版。  | 
|  1.6.8  |  版本更新为 Greengrass Nucleus 版本 2.6.0 发布版。  | 
|  1.6.7  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/dlr-component.html)  | 
|  1.6.6  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/dlr-component.html)  | 
|  1.6.5  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/dlr-component.html)  | 
|  1.6.4  |  版本更新为 Greengrass Nucleus 版本 2.4.0 发布版。  | 
|  1.6.3  |  版本更新为 Greengrass Nucleus 版本 2.3.0 发布版。  | 
|  1.6.2  |  对 Greengrass Nucleus 版本 2.2.0 发行版进行了版本更新。  | 
|  1.6.1  |  <a name="changelog-dlr-1.6.1"></a>[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/dlr-component.html)  | 
|  1.3.2  |  初始版本。安装 DLR v1.3.0。  | 

# TensorFlow 精简版图像分类
<a name="tensorflow-lite-image-classification-component"></a>

 TensorFlow Lite 图像分类组件 (`aws.greengrass.TensorFlowLiteImageClassification`) 包含示例推理代码，用于使用 [TensorFlow Lite](https://www.tensorflow.org/lite/guide/python) 运行时和样本预训练的 MobileNet 1.0 量化模型执行图像分类推理。此组件使用变体[TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md)和[TensorFlow 精简版运行时](tensorflow-lite-component.md)组件作为依赖项来下载 TensorFlow Lite 运行时和示例模型。

要将此推理组件与自定义训练的 TensorFlow Lite 模型一起使用，[请创建依赖模型存储组件的自定义版本](ml-customization.md#override-public-model-store)。要使用自己的自定义推理代码，您可以使用此组件的配方作为模板来[创建自定义推理组件](ml-customization.md#create-inference-component)。

**Topics**
+ [版本](#tensorflow-lite-image-classification-component-versions)
+ [Type](#tensorflow-lite-image-classification-component-type)
+ [操作系统](#tensorflow-lite-image-classification-component-os-support)
+ [要求](#tensorflow-lite-image-classification-component-requirements)
+ [依赖项](#tensorflow-lite-image-classification-component-dependencies)
+ [配置](#tensorflow-lite-image-classification-component-configuration)
+ [本地日志文件](#tensorflow-lite-image-classification-component-log-file)
+ [更改日志](#tensorflow-lite-image-classification-component-changelog)

## 版本
<a name="tensorflow-lite-image-classification-component-versions"></a>

此组件具有以下版本：
+ 2.1.x

## Type
<a name="tensorflow-lite-image-classification-component-type"></a>

<a name="public-component-type-generic"></a>此<a name="public-component-type-generic-phrase"></a>组件是一个通用组件 (`aws.greengrass.generic`)。[Greengrass Nucleus](greengrass-nucleus-component.md) 运行组件的生命周期脚本。

<a name="public-component-type-more-information"></a>有关更多信息，请参阅[组件类型](develop-greengrass-components.md#component-types)。

## 操作系统
<a name="tensorflow-lite-image-classification-component-os-support"></a>

此组件可以安装在运行以下操作系统的核心设备上：
+ Linux
+ Windows

## 要求
<a name="tensorflow-lite-image-classification-component-requirements"></a>

此组件具有以下要求：<a name="ml-component-requirements"></a>
+ 在运行 Amazon Linux 2 或 Ubuntu 18.04 的 Greengrass 核心设备上，[GNU C 库](https://www.gnu.org/software/libc/)（glibc）版本 2.27 或更高版本已安装在设备上。
+ 在 Armv7l 设备（例如 Raspberry Pi）上，OpenCV-Python 的依赖关系已安装在设备上。运行以下命令以安装依赖关系。

  ```
  sudo apt-get install libopenjp2-7 libilmbase23 libopenexr-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk-3-0 libwebp-dev
  ```
+ 运行 Raspberry Pi OS Bullseye 的 Raspberry Pi 设备必须满足以下要求：
  + NumPy 设备上安装了 1.22.4 或更高版本。Raspberry Pi OS Bullseye 包含的早期版本 NumPy，因此你可以运行以下命令在设备 NumPy 上升级。

    ```
    pip3 install --upgrade numpy
    ```
  + 旧摄像机堆栈已在设备上启用。Raspberry Pi OS Bullseye 包含一个新摄像机堆栈，该堆栈默认处于启用状态且不兼容，因此您必须启用旧摄像机堆栈。<a name="raspberry-pi-bullseye-enable-legacy-camera-stack"></a>

**启用旧摄像机堆栈**

    1. 运行以下命令以打开 Raspberry Pi 配置工具。

       ```
       sudo raspi-config
       ```

    1. 选择**接口选项**。

    1. 选择**旧摄像机**以启用旧摄像机堆栈。

    1. 重启 Raspberry Pi。

## 依赖项
<a name="tensorflow-lite-image-classification-component-dependencies"></a>

部署组件时， AWS IoT Greengrass 还会部署其依赖项的兼容版本。这意味着您必须满足组件及其所有依赖关系的要求，才能成功部署组件。本部分列出了此组件的[已发布版本](#tensorflow-lite-image-classification-component-changelog)的依赖关系，以及定义每个依赖关系的组件版本的语义版本约束。您还可以在 [AWS IoT Greengrass 控制台](https://console.aws.amazon.com//greengrass)中查看每个组件版本的依赖关系。在组件详细信息页面上，查找**依赖关系**列表。

------
#### [ 2.1.11 and 2.1.12 ]

下表列出了此组件的版本 2.1.11 和 2.1.12 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.13.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.10 ]

下表列出了此组件的版本 2.1.10 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.12.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.9 ]

下表列出了此组件的版本 2.1.9 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.11.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.8 ]

下表列出了此组件的版本 2.1.8 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.10.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.7 ]

下表列出了此组件的版本 2.1.7 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.9.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.6 ]

下表列出了此组件的版本 2.1.6 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.8.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.5 ]

下表列出了此组件的版本 2.1.5 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.7.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.4 ]

下表列出了此组件的版本 2.1.4 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.6.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.3 ]

下表列出了此组件的版本 2.1.3 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.5.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.2 ]

下表列出了此组件的版本 2.1.2 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.4.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.1 ]

下表列出了此组件的版本 2.1.1 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.3.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.0 ]

下表列出了此组件版本 2.1.0 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.2.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------

## 配置
<a name="tensorflow-lite-image-classification-component-configuration"></a>

此组件提供您可以在部署组件时自定义的以下配置参数。

`accessControl`  
<a name="ml-config-accesscontrol-desc"></a>（可选）包含允许组件将消息发布到默认通知主题的[授权策略](interprocess-communication.md#ipc-authorization-policies)的对象。  
默认值：  

```
{
   "aws.greengrass.ipc.mqttproxy": {
      "aws.greengrass.TensorFlowLiteImageClassification:mqttproxy:1": {
         "policyDescription": "Allows access to publish via topic ml/tflite/image-classification.",
         "operations": [
            "aws.greengrass#PublishToIoTCore"
         ],
         "resources": [
            "ml/tflite/image-classification"
         ]
      }
   }
}
```

`PublishResultsOnTopic`  
<a name="ml-config-publishresultsontopic-desc"></a>（可选）要将推理结果发布到的主题。如果修改此值，则还必须修改 `accessControl` 参数中 `resources` 的值，以匹配您的自定义主题名称。  
默认值：`ml/tflite/image-classification`

`Accelerator`  <a name="ml-config-accelerator"></a>
要使用的加速器。支持的值为 `cpu` 和 `gpu`。  
依赖模型组件中的示例模型仅支持 CPU 加速。要对不同的自定义模型使用 GPU 加速，请[创建自定义模型组件](ml-customization.md#override-public-model-store)以覆盖公共模型组件。  
默认值：`cpu`

`ImageDirectory`  
<a name="ml-config-imagedirectory-desc"></a>（可选）设备上推理组件读取图像的文件夹路径。您可以将此值修改为设备上您有权 read/write 访问的任何位置。  
<a name="ml-config-imagedirectory-img-default"></a>默认值：`/greengrass/v2/packages/artifacts-unarchived/component-name/image_classification/sample_images/`  
如果将 `UseCamera` 的值设置为 `true`，则忽略此配置参数。

`ImageName`  
<a name="ml-config-imagename-desc"></a>（可选）推理组件用作预测输入的图像名称。该组件可在 `ImageDirectory` 中指定的文件夹中查找图像。默认情况下，该组件使用默认图像目录中的示例图像。 AWS IoT Greengrass 支持以下图像格式：`jpeg`、`jpg``png`、和`npy`。  
<a name="ml-config-imagename-img-default"></a>默认值：`cat.jpeg`  
如果将 `UseCamera` 的值设置为 `true`，则忽略此配置参数。

`InferenceInterval`  <a name="ml-config-inferenceinterval"></a>
（可选）推理代码进行的每次预测之间的时间（以秒为单位）。示例推理代码无限期运行，并在指定的时间间隔内重复其预测。例如，如果您想使用摄像机拍摄的图像进行实时预测，则可以将其更改为较短的间隔。  
默认值：`3600`

`ModelResourceKey`  <a name="ml-config-modelresourcekey"></a>
<a name="ml-config-modelresourcekey-desc"></a>（可选）在依赖的公共模型组件中使用的模型。仅当使用自定义组件覆盖公共模型组件时，才修改此参数。  
默认值：  

```
{
    "model": "TensorFlowLite-Mobilenet"
}
```

`UseCamera`  <a name="ml-config-usecamera"></a>
（可选）字符串值，用于定义是否使用连接到 Greengrass 核心设备的摄像机拍摄的图像。支持的值为 `true` 和 `false`。  
当您将此值设置为 `true` 时，示例推理代码将访问设备上的摄像机，并在本地对捕获的图像运行推理。`ImageName` 和 `ImageDirectory` 参数的值将被忽略。确保运行此组件的用户 read/write 可以访问相机存储捕获图像的位置。  
默认值：`false`  
当您查看此组件的配方时，`UseCamera` 配置参数不会显示在默认配置中。但是，在部署组件时，可以在[配置合并更新](update-component-configurations.md)中修改此参数的值。  
如果将 `UseCamera` 设置为 `true`，则还必须创建符号链接，以使推理组件能够从运行时组件创建的虚拟环境中访问您的摄像机。有关将摄像机与示例推理组件结合使用的更多信息，请参阅 [更新组件配置](ml-tutorial-image-classification-camera.md)。

## 本地日志文件
<a name="tensorflow-lite-image-classification-component-log-file"></a>

此组件使用以下日志文件。

------
#### [ Linux ]

```
/greengrass/v2/logs/aws.greengrass.TensorFlowLiteImageClassification.log
```

------
#### [ Windows ]

```
C:\greengrass\v2\logs\aws.greengrass.TensorFlowLiteImageClassification.log
```

------

**查看此组件的日志**
+ 在核心设备上运行以下命令可实时查看此组件的日志文件。将`/greengrass/v2`或*C:\$1greengrass\$1v2*替换为 AWS IoT Greengrass 根文件夹的路径。

------
#### [ Linux ]

  ```
  sudo tail -f /greengrass/v2/logs/aws.greengrass.TensorFlowLiteImageClassification.log
  ```

------
#### [ Windows (PowerShell) ]

  ```
  Get-Content C:\greengrass\v2\logs\aws.greengrass.TensorFlowLiteImageClassification.log -Tail 10 -Wait
  ```

------

## 更改日志
<a name="tensorflow-lite-image-classification-component-changelog"></a>

下表介绍每个组件版本的更改。


|  版本  |  更改  | 
| --- | --- | 
|  2.1.12  |  对 Greengrass Nucleus 版本 2.12.5 发行版进行了版本更新。  | 
|  2.1.11  | 版本更新为 Greengrass Nucleus 版本 2.12.0 发布版。 | 
|  2.1.10  | 版本更新为 Greengrass Nucleus 版本 2.11.0 发布版。 | 
|  2.1.9  | 版本更新为 Greengrass Nucleus 版本 2.10.0 发布版。 | 
|  2.1.8  | 对 Greengrass Nucleus版本 2.9.0 发行版进行了版本更新。 | 
|  2.1.7  | 版本更新为 Greengrass Nucleus 版本 2.8.0 发布版。 | 
|  2.1.6  |  版本更新为 Greengrass Nucleus 版本 2.7.0 发布版。  | 
|  2.1.5  |  版本更新为 Greengrass Nucleus 版本 2.6.0 发布版。  | 
|  2.1.4  |  版本更新为 Greengrass Nucleus 版本 2.5.0 发布版。  | 
|  2.1.3  |  版本更新为 Greengrass Nucleus 版本 2.4.0 发布版。  | 
|  2.1.2  |  版本更新为 Greengrass Nucleus 版本 2.3.0 发布版。  | 
|  2.1.1  |  对 Greengrass Nucleus 版本 2.2.0 发行版进行了版本更新。  | 
|  2.1.0  |  初始版本。  | 

# TensorFlow 精简版物体检测
<a name="tensorflow-lite-object-detection-component"></a>

 TensorFlow Lite 对象检测组件 (`aws.greengrass.TensorFlowLiteObjectDetection`) 包含使用 L [TensorFlow it](https://www.tensorflow.org/lite/guide/python) e 执行对象检测推理的示例推理代码和预训练的单枪检测 (SSD) MobileNet 1.0 模型示例。此组件使用变体[TensorFlow 精简版物体检测模型存储](tensorflow-lite-object-detection-model-store-component.md)和[TensorFlow 精简版运行时](tensorflow-lite-component.md)组件作为依赖项来下载 TensorFlow Lite 和示例模型。

要将此推理组件与自定义训练的 TensorFlow Lite 模型一起使用，您可以[创建依赖模型存储组件的自定义版本](ml-customization.md#override-public-model-store)。要使用自己的自定义推理代码，请使用此组件的配方作为模板来[创建自定义推理组件](ml-customization.md#create-inference-component)。

**Topics**
+ [版本](#tensorflow-lite-object-detection-component-versions)
+ [Type](#tensorflow-lite-object-detection-component-type)
+ [操作系统](#tensorflow-lite-object-detection-component-os-support)
+ [要求](#tensorflow-lite-object-detection-component-requirements)
+ [依赖项](#tensorflow-lite-object-detection-component-dependencies)
+ [配置](#tensorflow-lite-object-detection-component-configuration)
+ [本地日志文件](#tensorflow-lite-object-detection-component-log-file)
+ [更改日志](#tensorflow-lite-object-detection-component-changelog)

## 版本
<a name="tensorflow-lite-object-detection-component-versions"></a>

此组件具有以下版本：
+ 2.1.x

## Type
<a name="tensorflow-lite-object-detection-component-type"></a>

<a name="public-component-type-generic"></a>此<a name="public-component-type-generic-phrase"></a>组件是一个通用组件 (`aws.greengrass.generic`)。[Greengrass Nucleus](greengrass-nucleus-component.md) 运行组件的生命周期脚本。

<a name="public-component-type-more-information"></a>有关更多信息，请参阅[组件类型](develop-greengrass-components.md#component-types)。

## 操作系统
<a name="tensorflow-lite-object-detection-component-os-support"></a>

此组件可以安装在运行以下操作系统的核心设备上：
+ Linux
+ Windows

## 要求
<a name="tensorflow-lite-object-detection-component-requirements"></a>

此组件具有以下要求：<a name="ml-component-requirements"></a>
+ 在运行 Amazon Linux 2 或 Ubuntu 18.04 的 Greengrass 核心设备上，[GNU C 库](https://www.gnu.org/software/libc/)（glibc）版本 2.27 或更高版本已安装在设备上。
+ 在 Armv7l 设备（例如 Raspberry Pi）上，OpenCV-Python 的依赖关系已安装在设备上。运行以下命令以安装依赖关系。

  ```
  sudo apt-get install libopenjp2-7 libilmbase23 libopenexr-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk-3-0 libwebp-dev
  ```
+ 运行 Raspberry Pi OS Bullseye 的 Raspberry Pi 设备必须满足以下要求：
  + NumPy 设备上安装了 1.22.4 或更高版本。Raspberry Pi OS Bullseye 包含的早期版本 NumPy，因此你可以运行以下命令在设备 NumPy 上进行升级。

    ```
    pip3 install --upgrade numpy
    ```
  + 旧摄像机堆栈已在设备上启用。Raspberry Pi OS Bullseye 包含一个新摄像机堆栈，该堆栈默认处于启用状态且不兼容，因此您必须启用旧摄像机堆栈。<a name="raspberry-pi-bullseye-enable-legacy-camera-stack"></a>

**启用旧摄像机堆栈**

    1. 运行以下命令以打开 Raspberry Pi 配置工具。

       ```
       sudo raspi-config
       ```

    1. 选择**接口选项**。

    1. 选择**旧摄像机**以启用旧摄像机堆栈。

    1. 重启 Raspberry Pi。

## 依赖项
<a name="tensorflow-lite-object-detection-component-dependencies"></a>

部署组件时， AWS IoT Greengrass 还会部署其依赖项的兼容版本。这意味着您必须满足组件及其所有依赖关系的要求，才能成功部署组件。本部分列出了此组件的[已发布版本](#tensorflow-lite-object-detection-component-changelog)的依赖关系，以及定义每个依赖关系的组件版本的语义版本约束。您还可以在 [AWS IoT Greengrass 控制台](https://console.aws.amazon.com//greengrass)中查看每个组件版本的依赖关系。在组件详细信息页面上，查找**依赖关系**列表。

------
#### [ 2.1.11 and 2.1.12 ]

下表列出了此组件的版本 2.1.11 和 2.1.12 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.13.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.10 ]

下表列出了此组件的版本 2.1.10 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.12.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.9 ]

下表列出了此组件的版本 2.1.9 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.11.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.8 ]

下表列出了此组件的版本 2.1.8 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.10.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.7 ]

下表列出了此组件的版本 2.1.7 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.9.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.6 ]

下表列出了此组件的版本 2.1.6 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.8.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.5 ]

下表列出了此组件的版本 2.1.5 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.7.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.4 ]

下表列出了此组件的版本 2.1.4 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.6.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.3 ]

下表列出了此组件的版本 2.1.3 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.5.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.2 ]

下表列出了此组件的版本 2.1.2 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.4.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.1 ]

下表列出了此组件的版本 2.1.1 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.3.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------
#### [ 2.1.0 ]

下表列出了此组件版本 2.1.0 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.2.0 | 软性 | 
| [TensorFlow 精简版图像分类模型存储](tensorflow-lite-image-classification-model-store-component.md) | >=2.1.0 <2.2.0 | 硬性 | 
| [TensorFlow 精简版](tensorflow-lite-component.md) | >=2.5.0 <2.6.0 | 硬性 | 

------

## 配置
<a name="tensorflow-lite-object-detection-component-configuration"></a>

此组件提供您可以在部署组件时自定义的以下配置参数。

`accessControl`  
<a name="ml-config-accesscontrol-desc"></a>（可选）包含允许组件将消息发布到默认通知主题的[授权策略](interprocess-communication.md#ipc-authorization-policies)的对象。  
默认值：  

```
{
   "aws.greengrass.ipc.mqttproxy": {
      "aws.greengrass.TensorFlowLiteObjectDetection:mqttproxy:1": {
         "policyDescription": "Allows access to publish via topic ml/tflite/object-detection.",
         "operations": [
            "aws.greengrass#PublishToIoTCore"
         ],
         "resources": [
            "ml/tflite/object-detection"
         ]
      }
   }
}
```

`PublishResultsOnTopic`  
<a name="ml-config-publishresultsontopic-desc"></a>（可选）要将推理结果发布到的主题。如果修改此值，则还必须修改 `accessControl` 参数中 `resources` 的值，以匹配您的自定义主题名称。  
默认值：`ml/tflite/object-detection`

`Accelerator`  <a name="ml-config-accelerator"></a>
要使用的加速器。支持的值为 `cpu` 和 `gpu`。  
依赖模型组件中的示例模型仅支持 CPU 加速。要对不同的自定义模型使用 GPU 加速，请[创建自定义模型组件](ml-customization.md#override-public-model-store)以覆盖公共模型组件。  
默认值：`cpu`

`ImageDirectory`  
<a name="ml-config-imagedirectory-desc"></a>（可选）设备上推理组件读取图像的文件夹路径。您可以将此值修改为设备上您有权 read/write 访问的任何位置。  
<a name="ml-config-imagedirectory-obj-default"></a>默认值：`/greengrass/v2/packages/artifacts-unarchived/component-name/object_detection/sample_images/`  
如果将 `UseCamera` 的值设置为 `true`，则忽略此配置参数。

`ImageName`  
<a name="ml-config-imagename-desc"></a>（可选）推理组件用作预测输入的图像名称。该组件可在 `ImageDirectory` 中指定的文件夹中查找图像。默认情况下，该组件使用默认图像目录中的示例图像。 AWS IoT Greengrass 支持以下图像格式：`jpeg`、`jpg``png`、和`npy`。  
<a name="ml-config-imagename-obj-default"></a>默认值：`objects.jpg`  
如果将 `UseCamera` 的值设置为 `true`，则忽略此配置参数。

`InferenceInterval`  <a name="ml-config-inferenceinterval"></a>
（可选）推理代码进行的每次预测之间的时间（以秒为单位）。示例推理代码无限期运行，并在指定的时间间隔内重复其预测。例如，如果您想使用摄像机拍摄的图像进行实时预测，则可以将其更改为较短的间隔。  
默认值：`3600`

`ModelResourceKey`  <a name="ml-config-modelresourcekey"></a>
<a name="ml-config-modelresourcekey-desc"></a>（可选）在依赖的公共模型组件中使用的模型。仅当使用自定义组件覆盖公共模型组件时，才修改此参数。  
默认值：  

```
{
    "model": "TensorFlowLite-SSD"
}
```

`UseCamera`  <a name="ml-config-usecamera"></a>
（可选）字符串值，用于定义是否使用连接到 Greengrass 核心设备的摄像机拍摄的图像。支持的值为 `true` 和 `false`。  
当您将此值设置为 `true` 时，示例推理代码将访问设备上的摄像机，并在本地对捕获的图像运行推理。`ImageName` 和 `ImageDirectory` 参数的值将被忽略。确保运行此组件的用户 read/write 可以访问相机存储捕获图像的位置。  
默认值：`false`  
当您查看此组件的配方时，`UseCamera` 配置参数不会显示在默认配置中。但是，在部署组件时，可以在[配置合并更新](update-component-configurations.md)中修改此参数的值。  
如果将 `UseCamera` 设置为 `true`，则还必须创建符号链接，以使推理组件能够从运行时组件创建的虚拟环境中访问您的摄像机。有关将摄像机与示例推理组件结合使用的更多信息，请参阅 [更新组件配置](ml-tutorial-image-classification-camera.md)。

**注意**  <a name="ml-config-not-visible-note"></a>
当您查看此组件的配方时，`UseCamera` 配置参数不会显示在默认配置中。但是，在部署组件时，可以在[配置合并更新](update-component-configurations.md)中修改此参数的值。  
如果将 `UseCamera` 设置为 `true`，则还必须创建符号链接，以使推理组件能够从运行时组件创建的虚拟环境中访问您的摄像机。有关将摄像机与示例推理组件结合使用的更多信息，请参阅 [更新组件配置](ml-tutorial-image-classification-camera.md)。

## 本地日志文件
<a name="tensorflow-lite-object-detection-component-log-file"></a>

此组件使用以下日志文件。

------
#### [ Linux ]

```
/greengrass/v2/logs/aws.greengrass.TensorFlowLiteObjectDetection.log
```

------
#### [ Windows ]

```
C:\greengrass\v2\logs\aws.greengrass.TensorFlowLiteObjectDetection.log
```

------

**查看此组件的日志**
+ 在核心设备上运行以下命令可实时查看此组件的日志文件。将`/greengrass/v2`或*C:\$1greengrass\$1v2*替换为 AWS IoT Greengrass 根文件夹的路径。

------
#### [ Linux ]

  ```
  sudo tail -f /greengrass/v2/logs/aws.greengrass.TensorFlowLiteObjectDetection.log
  ```

------
#### [ Windows (PowerShell) ]

  ```
  Get-Content C:\greengrass\v2\logs\aws.greengrass.TensorFlowLiteObjectDetection.log -Tail 10 -Wait
  ```

------

## 更改日志
<a name="tensorflow-lite-object-detection-component-changelog"></a>

下表介绍每个组件版本的更改。


|  版本  |  更改  | 
| --- | --- | 
|  2.1.12  |  对 Greengrass Nucleus 版本 2.12.5 发行版进行了版本更新。  | 
|  2.1.11  | 版本更新为 Greengrass Nucleus 版本 2.12.0 发布版。 | 
|  2.1.10  | 版本更新为 Greengrass Nucleus 版本 2.11.0 发布版。 | 
|  2.1.9  | 版本更新为 Greengrass Nucleus 版本 2.10.0 发布版。 | 
|  2.1.8  | 对 Greengrass Nucleus版本 2.9.0 发行版进行了版本更新。 | 
|  2.1.7  | 版本更新为 Greengrass Nucleus 版本 2.8.0 发布版。 | 
|  2.1.6  |  版本更新为 Greengrass Nucleus 版本 2.7.0 发布版。  | 
|  2.1.5  |  版本更新为 Greengrass Nucleus 版本 2.6.0 发布版。  | 
|  2.1.4  |  版本更新为 Greengrass Nucleus 版本 2.5.0 发布版。  | 
|  2.1.3  |  版本更新为 Greengrass Nucleus 版本 2.4.0 发布版。  | 
|  2.1.2  |  版本更新为 Greengrass Nucleus 版本 2.3.0 发布版。  | 
|  2.1.1  |  <a name="changelog-tensorflow-lite-object-detection-2.1.1"></a>[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/tensorflow-lite-object-detection-component.html)  | 
|  2.1.0  |  初始版本。  | 

# TensorFlow 精简版图像分类模型存储
<a name="tensorflow-lite-image-classification-model-store-component"></a>

 TensorFlow 精简版图像分类模型存储 (`variant.TensorFlowLite.ImageClassification.ModelStore`) 是一个机器学习模型组件，其中包含一个作为 Greengrass 工件的预训练的 MobileNet v1 模型。此组件中使用的示例模型是从 [TensorFlowHub](https://tfhub.dev/) 获取的，并使用 [TensorFlow Lite](https://www.tensorflow.org/lite/guide/python) 实现。

[TensorFlow 精简版图像分类](tensorflow-lite-image-classification-component.md) 推理组件使用此组件作为模型来源的依赖关系。要使用自定义训练的 TensorFlow Lite 模型，请[创建此模型组件的自定义版本](ml-customization.md#override-public-model-store)，并将您的自定义模型作为组件构件包括在内。您可以使用此组件的配方作为模板来创建自定义模型组件。

**Topics**
+ [版本](#tensorflow-lite-image-classification-model-store-component-versions)
+ [Type](#tensorflow-lite-image-classification-model-store-component-type)
+ [操作系统](#tensorflow-lite-image-classification-model-store-component-os-support)
+ [要求](#tensorflow-lite-image-classification-model-store-component-requirements)
+ [依赖项](#tensorflow-lite-image-classification-model-store-component-dependencies)
+ [配置](#tensorflow-lite-image-classification-model-store-component-configuration)
+ [本地日志文件](#tensorflow-lite-image-classification-model-store-component-log-file)
+ [更改日志](#tensorflow-lite-image-classification-model-store-component-changelog)

## 版本
<a name="tensorflow-lite-image-classification-model-store-component-versions"></a>

此组件具有以下版本：
+ 2.1.x

## Type
<a name="tensorflow-lite-image-classification-model-store-component-type"></a>

<a name="public-component-type-generic"></a>此<a name="public-component-type-generic-phrase"></a>组件是一个通用组件 (`aws.greengrass.generic`)。[Greengrass Nucleus](greengrass-nucleus-component.md) 运行组件的生命周期脚本。

<a name="public-component-type-more-information"></a>有关更多信息，请参阅[组件类型](develop-greengrass-components.md#component-types)。

## 操作系统
<a name="tensorflow-lite-image-classification-model-store-component-os-support"></a>

此组件可以安装在运行以下操作系统的核心设备上：
+ Linux
+ Windows

## 要求
<a name="tensorflow-lite-image-classification-model-store-component-requirements"></a>

此组件具有以下要求：<a name="ml-component-requirements"></a>
+ 在运行 Amazon Linux 2 或 Ubuntu 18.04 的 Greengrass 核心设备上，[GNU C 库](https://www.gnu.org/software/libc/)（glibc）版本 2.27 或更高版本已安装在设备上。
+ 在 Armv7l 设备（例如 Raspberry Pi）上，OpenCV-Python 的依赖关系已安装在设备上。运行以下命令以安装依赖关系。

  ```
  sudo apt-get install libopenjp2-7 libilmbase23 libopenexr-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk-3-0 libwebp-dev
  ```
+ 运行 Raspberry Pi OS Bullseye 的 Raspberry Pi 设备必须满足以下要求：
  + NumPy 设备上安装了 1.22.4 或更高版本。Raspberry Pi OS Bullseye 包含的早期版本 NumPy，因此你可以运行以下命令在设备 NumPy 上进行升级。

    ```
    pip3 install --upgrade numpy
    ```
  + 旧摄像机堆栈已在设备上启用。Raspberry Pi OS Bullseye 包含一个新摄像机堆栈，该堆栈默认处于启用状态且不兼容，因此您必须启用旧摄像机堆栈。<a name="raspberry-pi-bullseye-enable-legacy-camera-stack"></a>

**启用旧摄像机堆栈**

    1. 运行以下命令以打开 Raspberry Pi 配置工具。

       ```
       sudo raspi-config
       ```

    1. 选择**接口选项**。

    1. 选择**旧摄像机**以启用旧摄像机堆栈。

    1. 重启 Raspberry Pi。

## 依赖项
<a name="tensorflow-lite-image-classification-model-store-component-dependencies"></a>

部署组件时， AWS IoT Greengrass 还会部署其依赖项的兼容版本。这意味着您必须满足组件及其所有依赖关系的要求，才能成功部署组件。本部分列出了此组件的[已发布版本](#tensorflow-lite-image-classification-model-store-component-changelog)的依赖关系，以及定义每个依赖关系的组件版本的语义版本约束。您还可以在 [AWS IoT Greengrass 控制台](https://console.aws.amazon.com//greengrass)中查看每个组件版本的依赖关系。在组件详细信息页面上，查找**依赖关系**列表。

------
#### [ 2.1.11 and 2.1.12  ]

下表列出了此组件的版本 2.1.11 和 2.1.12 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.13.0 | 软性 | 

------
#### [ 2.1.10 ]

下表列出了此组件的版本 2.1.10 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.12.0 | 软性 | 

------
#### [ 2.1.9 ]

下表列出了此组件的版本 2.1.9 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.11.0 | 软性 | 

------
#### [ 2.1.8 ]

下表列出了此组件的版本 2.1.8 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.10.0 | 软性 | 

------
#### [ 2.1.7 ]

下表列出了此组件的版本 2.1.7 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.9.0 | 软性 | 

------
#### [ 2.1.6 ]

下表列出了此组件的版本 2.1.6 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.8.0 | 软性 | 

------
#### [ 2.1.5 ]

下表列出了此组件的版本 2.1.5 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.7.0 | 软性 | 

------
#### [ 2.1.4 ]

下表列出了此组件的版本 2.1.4 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.6.0 | 软性 | 

------
#### [ 2.1.3 ]

下表列出了此组件的版本 2.1.3 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.5.0 | 软性 | 

------
#### [ 2.1.2 ]

下表列出了此组件的版本 2.1.2 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.4.0 | 软性 | 

------
#### [ 2.1.1 ]

下表列出了此组件的版本 2.1.1 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.3.0 | 软性 | 

------
#### [ 2.1.0 ]

下表列出了此组件版本 2.1.0 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.2.0 | 软性 | 

------

## 配置
<a name="tensorflow-lite-image-classification-model-store-component-configuration"></a>

此组件没有任何配置参数。

## 本地日志文件
<a name="tensorflow-lite-image-classification-model-store-component-log-file"></a>

此组件不输出日志。

## 更改日志
<a name="tensorflow-lite-image-classification-model-store-component-changelog"></a>

下表介绍每个组件版本的更改。


|  版本  |  更改  | 
| --- | --- | 
|  2.1.12  |  对 Greengrass Nucleus 版本 2.12.5 发行版进行了版本更新。  | 
|  2.1.11  | 版本更新为 Greengrass Nucleus 版本 2.12.0 发布版。 | 
|  2.1.10  | 版本更新为 Greengrass Nucleus 版本 2.11.0 发布版。 | 
|  2.1.9  | 版本更新为 Greengrass Nucleus 版本 2.10.0 发布版。 | 
|  2.1.8  | 对 Greengrass Nucleus版本 2.9.0 发行版进行了版本更新。 | 
|  2.1.7  | 版本更新为 Greengrass Nucleus 版本 2.8.0 发布版。 | 
|  2.1.6  |  版本更新为 Greengrass Nucleus 版本 2.7.0 发布版。  | 
|  2.1.5  |  版本更新为 Greengrass Nucleus 版本 2.6.0 发布版。  | 
|  2.1.4  |  版本更新为 Greengrass Nucleus 版本 2.5.0 发布版。  | 
|  2.1.3  |  版本更新为 Greengrass Nucleus 版本 2.4.0 发布版。  | 
|  2.1.2  |  版本更新为 Greengrass Nucleus 版本 2.3.0 发布版。  | 
|  2.1.1  |  对 Greengrass Nucleus 版本 2.2.0 发行版进行了版本更新。  | 
|  2.1.0  |  初始版本。  | 

# TensorFlow 精简版物体检测模型存储
<a name="tensorflow-lite-object-detection-model-store-component"></a>

 TensorFlow Lite 对象检测模型存储 (`variant.TensorFlowLite.ObjectDetection.ModelStore`) 是一个机器学习模型组件，其中包含作为 Greengrass 工件的预训练单枪检测 (SSD) MobileNet 模型。此组件中使用的示例模型是从 [TensorFlow Hub](https://tfhub.dev/) 获取的，并使用 [TensorFlow Lite](https://www.tensorflow.org/lite/guide/python) 实现。

L [TensorFlow ite 对象检测](tensorflow-lite-object-detection-component.md)推理组件使用此组件作为模型源的依赖项。要使用自定义训练的 TensorFlow Lite 模型，请[创建此模型组件的自定义版本](ml-customization.md#override-public-model-store)，并将您的自定义模型作为组件构件包括在内。您可以使用此组件的配方作为模板来创建自定义模型组件。

**Topics**
+ [版本](#tensorflow-lite-object-detection-model-store-component-versions)
+ [Type](#tensorflow-lite-object-detection-model-store-component-type)
+ [操作系统](#tensorflow-lite-object-detection-model-store-component-os-support)
+ [要求](#tensorflow-lite-object-detection-model-store-component-requirements)
+ [依赖项](#tensorflow-lite-object-detection-model-store-component-dependencies)
+ [配置](#tensorflow-lite-object-detection-model-store-component-configuration)
+ [本地日志文件](#tensorflow-lite-object-detection-model-store-component-log-file)
+ [更改日志](#tensorflow-lite-object-detection-model-store-component-changelog)

## 版本
<a name="tensorflow-lite-object-detection-model-store-component-versions"></a>

此组件具有以下版本：
+ 2.1.x

## Type
<a name="tensorflow-lite-object-detection-model-store-component-type"></a>

<a name="public-component-type-generic"></a>此<a name="public-component-type-generic-phrase"></a>组件是一个通用组件 (`aws.greengrass.generic`)。[Greengrass Nucleus](greengrass-nucleus-component.md) 运行组件的生命周期脚本。

<a name="public-component-type-more-information"></a>有关更多信息，请参阅[组件类型](develop-greengrass-components.md#component-types)。

## 操作系统
<a name="tensorflow-lite-object-detection-model-store-component-os-support"></a>

此组件可以安装在运行以下操作系统的核心设备上：
+ Linux
+ Windows

## 要求
<a name="tensorflow-lite-object-detection-model-store-component-requirements"></a>

此组件具有以下要求：<a name="ml-component-requirements"></a>
+ 在运行 Amazon Linux 2 或 Ubuntu 18.04 的 Greengrass 核心设备上，[GNU C 库](https://www.gnu.org/software/libc/)（glibc）版本 2.27 或更高版本已安装在设备上。
+ 在 Armv7l 设备（例如 Raspberry Pi）上，OpenCV-Python 的依赖关系已安装在设备上。运行以下命令以安装依赖关系。

  ```
  sudo apt-get install libopenjp2-7 libilmbase23 libopenexr-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk-3-0 libwebp-dev
  ```
+ 运行 Raspberry Pi OS Bullseye 的 Raspberry Pi 设备必须满足以下要求：
  + NumPy 设备上安装了 1.22.4 或更高版本。Raspberry Pi OS Bullseye 包含的早期版本 NumPy，因此你可以运行以下命令在设备 NumPy 上进行升级。

    ```
    pip3 install --upgrade numpy
    ```
  + 旧摄像机堆栈已在设备上启用。Raspberry Pi OS Bullseye 包含一个新摄像机堆栈，该堆栈默认处于启用状态且不兼容，因此您必须启用旧摄像机堆栈。<a name="raspberry-pi-bullseye-enable-legacy-camera-stack"></a>

**启用旧摄像机堆栈**

    1. 运行以下命令以打开 Raspberry Pi 配置工具。

       ```
       sudo raspi-config
       ```

    1. 选择**接口选项**。

    1. 选择**旧摄像机**以启用旧摄像机堆栈。

    1. 重启 Raspberry Pi。

## 依赖项
<a name="tensorflow-lite-object-detection-model-store-component-dependencies"></a>

部署组件时， AWS IoT Greengrass 还会部署其依赖项的兼容版本。这意味着您必须满足组件及其所有依赖关系的要求，才能成功部署组件。本部分列出了此组件的[已发布版本](#tensorflow-lite-object-detection-model-store-component-changelog)的依赖关系，以及定义每个依赖关系的组件版本的语义版本约束。您还可以在 [AWS IoT Greengrass 控制台](https://console.aws.amazon.com//greengrass)中查看每个组件版本的依赖关系。在组件详细信息页面上，查找**依赖关系**列表。

------
#### [ 2.1.11 and 2.1.12 ]

下表列出了此组件的版本 2.1.11 和 2.1.12 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.13.0 | 软性 | 

------
#### [ 2.1.10 ]

下表列出了此组件的版本 2.1.10 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.12.0 | 软性 | 

------
#### [ 2.1.9 ]

下表列出了此组件的版本 2.1.9 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.11.0 | 软性 | 

------
#### [ 2.1.8 ]

下表列出了此组件的版本 2.1.8 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.10.0 | 软性 | 

------
#### [ 2.1.7 ]

下表列出了此组件的版本 2.1.7 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.9.0 | 软性 | 

------
#### [ 2.1.6 ]

下表列出了此组件的版本 2.1.6 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.8.0 | 软性 | 

------
#### [ 2.1.5 ]

下表列出了此组件的版本 2.1.5 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.7.0 | 软性 | 

------
#### [ 2.1.4 ]

下表列出了此组件的版本 2.1.4 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.6.0 | 软性 | 

------
#### [ 2.1.3 ]

下表列出了此组件的版本 2.1.3 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.5.0 | 软性 | 

------
#### [ 2.1.2 ]

下表列出了此组件的版本 2.1.2 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.4.0 | 软性 | 

------
#### [ 2.1.1 ]

下表列出了此组件的版本 2.1.1 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.3.0 | 软性 | 

------
#### [ 2.1.0 ]

下表列出了此组件版本 2.1.0 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.2.0 | 软性 | 

------

## 配置
<a name="tensorflow-lite-object-detection-model-store-component-configuration"></a>

此组件没有任何配置参数。

## 本地日志文件
<a name="tensorflow-lite-object-detection-model-store-component-log-file"></a>

此组件不输出日志。

## 更改日志
<a name="tensorflow-lite-object-detection-model-store-component-changelog"></a>

下表介绍每个组件版本的更改。


|  版本  |  更改  | 
| --- | --- | 
|  2.1.12  |  对 Greengrass Nucleus 版本 2.12.5 发行版进行了版本更新。  | 
|  2.1.11  | 版本更新为 Greengrass Nucleus 版本 2.12.0 发布版。 | 
|  2.1.10  | 版本更新为 Greengrass Nucleus 版本 2.11.0 发布版。 | 
|  2.1.9  | 版本更新为 Greengrass Nucleus 版本 2.10.0 发布版。 | 
|  2.1.8  | 对 Greengrass Nucleus版本 2.9.0 发行版进行了版本更新。 | 
|  2.1.7  | 版本更新为 Greengrass Nucleus 版本 2.8.0 发布版。 | 
|  2.1.6  |  版本更新为 Greengrass Nucleus 版本 2.7.0 发布版。  | 
|  2.1.5  |  版本更新为 Greengrass Nucleus 版本 2.6.0 发布版。  | 
|  2.1.4  |  版本更新为 Greengrass Nucleus 版本 2.5.0 发布版。  | 
|  2.1.3  |  版本更新为 Greengrass Nucleus 版本 2.4.0 发布版。  | 
|  2.1.2  |  版本更新为 Greengrass Nucleus 版本 2.3.0 发布版。  | 
|  2.1.1  |  对 Greengrass Nucleus 版本 2.2.0 发行版进行了版本更新。  | 
|  2.1.0  |  初始版本。  | 

# TensorFlow 精简版运行时
<a name="tensorflow-lite-component"></a>

 TensorFlow Lite 运行时组件 (`variant.TensorFlowLite`) 包含一个脚本，用于在设备上的虚拟环境中安装 [TensorFlow Lite](https://www.tensorflow.org/lite/guide/python) 版本 2.5.0 及其依赖项。[TensorFlow Lite 图像分类](tensorflow-lite-image-classification-component.md)和 [TensorFlow Lite 对象检测](tensorflow-lite-object-detection-component.md)组件使用此运行时组件作为安装 TensorFlow Lite 的依赖项。

**注意**  
TensorFlow 精简版运行时组件 v2.5.6 及更高版本会重新安装 TensorFlow Lite 运行时及其依赖项的现有安装。重新安装有助于确保核心设备运行兼容版本的 TensorFlow Lite 及其依赖项。

要使用不同的运行时，您可以使用此组件的配方作为模板来[创建自定义机器学习组件](ml-customization.md)。

**Topics**
+ [版本](#tensorflow-lite-component-versions)
+ [Type](#tensorflow-lite-component-type)
+ [操作系统](#tensorflow-lite-component-os-support)
+ [要求](#tensorflow-lite-component-requirements)
+ [依赖项](#tensorflow-lite-component-dependencies)
+ [配置](#tensorflow-lite-component-configuration)
+ [使用量](#tensorflow-lite-component-usage)
+ [本地日志文件](#tensorflow-lite-component-log-file)
+ [更改日志](#tensorflow-lite-component-changelog)

## 版本
<a name="tensorflow-lite-component-versions"></a>

此组件具有以下版本：
+ 2.5.x

## Type
<a name="tensorflow-lite-component-type"></a>

<a name="public-component-type-generic"></a>此<a name="public-component-type-generic-phrase"></a>组件是一个通用组件 (`aws.greengrass.generic`)。[Greengrass Nucleus](greengrass-nucleus-component.md) 运行组件的生命周期脚本。

<a name="public-component-type-more-information"></a>有关更多信息，请参阅[组件类型](develop-greengrass-components.md#component-types)。

## 操作系统
<a name="tensorflow-lite-component-os-support"></a>

此组件可以安装在运行以下操作系统的核心设备上：
+ Linux
+ Windows

## 要求
<a name="tensorflow-lite-component-requirements"></a>

此组件具有以下要求：<a name="ml-component-requirements"></a>
+ 在运行 Amazon Linux 2 或 Ubuntu 18.04 的 Greengrass 核心设备上，[GNU C 库](https://www.gnu.org/software/libc/)（glibc）版本 2.27 或更高版本已安装在设备上。
+ 在 Armv7l 设备（例如 Raspberry Pi）上，OpenCV-Python 的依赖关系已安装在设备上。运行以下命令以安装依赖关系。

  ```
  sudo apt-get install libopenjp2-7 libilmbase23 libopenexr-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk-3-0 libwebp-dev
  ```
+ 运行 Raspberry Pi OS Bullseye 的 Raspberry Pi 设备必须满足以下要求：
  + NumPy 设备上安装了 1.22.4 或更高版本。Raspberry Pi OS Bullseye 包含的早期版本 NumPy，因此你可以运行以下命令在设备 NumPy 上进行升级。

    ```
    pip3 install --upgrade numpy
    ```
  + 旧摄像机堆栈已在设备上启用。Raspberry Pi OS Bullseye 包含一个新摄像机堆栈，该堆栈默认处于启用状态且不兼容，因此您必须启用旧摄像机堆栈。<a name="raspberry-pi-bullseye-enable-legacy-camera-stack"></a>

**启用旧摄像机堆栈**

    1. 运行以下命令以打开 Raspberry Pi 配置工具。

       ```
       sudo raspi-config
       ```

    1. 选择**接口选项**。

    1. 选择**旧摄像机**以启用旧摄像机堆栈。

    1. 重启 Raspberry Pi。

### 端点和端口
<a name="tensorflow-lite-component-endpoints"></a>

默认情况下，此组件使用安装程序脚本通过 `apt`、`yum`、`brew` 和 `pip` 命令来安装程序包，具体取决于核心设备使用的平台。此组件必须能够对各种程序包索引和存储库执行出站请求才能运行安装程序脚本。要允许此组件的出站流量通过代理或防火墙，您必须确定核心设备连接安装的程序包索引和存储库的端点。

在确定此组件的安装脚本所需的端点时，请考虑以下几点：
+ 端点取决于核心设备的平台。例如，运行 Ubuntu 的核心设备使用 `apt`，而不是 `yum` 或 `brew`。此外，使用相同程序包索引的设备可能具有不同的源列表，因此它们可能会从不同的存储库中检索软件包。
+ 使用相同程序包索引的多台设备之间的端点可能有所不同，因为每台设备都有自己的源列表，用于定义检索程序包的位置。
+ 端点可能会随时间而变化。每个软件包索引都提供您下载软件包的存储库，软件包的所有者可以更改软件包索引提供的内容 URLs 。 URLs 

有关此组件安装的依赖项以及如何禁用安装程序脚本的更多信息，请参阅[UseInstaller](#tensorflow-lite-component-config-useinstaller-term)配置参数。

有关基本操作所需的端点和端口的更多信息，请参阅[允许设备流量通过代理或防火墙](allow-device-traffic.md)。

## 依赖项
<a name="tensorflow-lite-component-dependencies"></a>

部署组件时， AWS IoT Greengrass 还会部署其依赖项的兼容版本。这意味着您必须满足组件及其所有依赖关系的要求，才能成功部署组件。本部分列出了此组件的[已发布版本](#tensorflow-lite-component-changelog)的依赖关系，以及定义每个依赖关系的组件版本的语义版本约束。您还可以在 [AWS IoT Greengrass 控制台](https://console.aws.amazon.com//greengrass)中查看每个组件版本的依赖关系。在组件详细信息页面上，查找**依赖关系**列表。

------
#### [ 2.5.14 and 2.5.15 ]

下表列出了此组件的版本 2.5.14 和 2.5.15 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.13.0 | 软性 | 

------
#### [ 2.5.13 ]

下表列出了此组件的版本 2.5.13 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.12.0 | 软性 | 

------
#### [ 2.5.12 ]

下表列出了此组件的版本 2.5.12 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.11.0 | 软性 | 

------
#### [ 2.5.11 ]

下表列出了此组件的版本 2.5.11 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.10.0 | 软性 | 

------
#### [ 2.5.10 ]

下表列出了此组件的版本 2.5.10 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.9.0 | 软性 | 

------
#### [ 2.5.9 ]

下表列出了此组件的版本 2.5.9 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.8.0 | 软性 | 

------
#### [ 2.5.8 ]

下表列出了此组件的版本 2.5.8 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.7.0 | 软性 | 

------
#### [ 2.5.5 - 2.5.7 ]

下表列出了此组件的版本 2.5.5 到 2.5.7 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.6.0 | 软性 | 

------
#### [ 2.5.3 and 2.5.4 ]

下表列出了此组件的版本 2.5.3 和 2.5.4 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.5.0 | 软性 | 

------
#### [ 2.5.2 ]

下表列出了此组件的版本 2.5.2 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.4.0 | 软性 | 

------
#### [ 2.5.1 ]

下表列出了此组件版本 2.5.1 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.3.0 | 软性 | 

------
#### [ 2.5.0 ]

下表列出了此组件的版本 2.5.0 的依赖关系。


| 依赖关系 | 兼容版本 | 依赖关系类型 | 
| --- | --- | --- | 
| [Greengrass Nucleus](greengrass-nucleus-component.md) | >=2.0.0 <2.2.0 | 软性 | 

------

有关组件依赖关系的更多信息，请参阅[组件配方参考](component-recipe-reference.md#recipe-reference-component-dependencies)。

## 配置
<a name="tensorflow-lite-component-configuration"></a>

此组件提供您可以在部署组件时自定义的以下配置参数。

`MLRootPath`  
<a name="ml-config-mlrootpath-desc"></a>（可选）Linux 核心设备上推理组件读取图像和写入推理结果的文件夹路径。您可以将此值修改为设备上运行此组件的用户有权 read/write 访问的任何位置。  
<a name="ml-config-mlrootpath-default-tfl"></a>默认值：`/greengrass/v2/work/variant.TensorFlowLite/greengrass_ml`

`WindowsMLRootPath`  
此组件的 v1.6.6 及更高版本中提供了此功能。  
<a name="ml-config-windowsmlrootpath-desc"></a>（可选）Windows 核心设备上推理组件读取图像和写入推理结果的文件夹路径。您可以将此值修改为设备上运行此组件的用户有权 read/write 访问的任何位置。  
<a name="ml-config-windowsmlrootpath-default-dlr"></a>默认值：`C:\greengrass\v2\\work\\variant.DLR\\greengrass_ml`

  `UseInstaller`   
<a name="ml-config-useinstaller-desc-tfl"></a>（可选）字符串值，用于定义是否使用此组件中的安装程序脚本来安装 TensorFlow Lite 及其依赖项。支持的值为 `true` 和 `false`。  <a name="ml-config-useinstaller-libraries-tfl"></a>

`false`如果要使用自定义脚本进行 TensorFlow 精简版安装，或者想要在预构建的 Linux 映像中包含运行时依赖关系，请将此值设置为。要将此组件与 AWS提供的 TensorFlow Lite 推理组件一起使用，请安装以下库（包括所有依赖项），并将其提供给运行 ML 组件的系统用户（例如`ggc_user`）。
+ [Python](https://www.python.org/downloads/) 3.8 或更高版本，包括适用于您的 Python 版本的 `pip`
+ [TensorFlow 精简版 v2.](https://www.tensorflow.org/lite/guide/python) 5.0
+ [NumPy](https://numpy.org/install/)
+ [OpenCV-Python](https://pypi.org/project/opencv-python/)
+ [AWS IoT Device SDK 适用于 Python 的 v2](https://github.com/aws/aws-iot-device-sdk-python-v2)
+ [AWS 公共运行时 (CRT) Python](https://github.com/awslabs/aws-crt-python)
+ [Picamera](https://picamera.readthedocs.io/en/release-1.13/)（适用于 Raspberry Pi 设备）
+ [`awscam`模块](https://docs.aws.amazon.com/deeplens/latest/dg/deeplens-library-awscam-module.html)（用于 AWS DeepLens 设备）
+ libGL（适用于 Linux 设备）
<a name="ml-config-useinstaller-default"></a>默认值：`true`

## 使用量
<a name="tensorflow-lite-component-usage"></a>

使用此组件，将`UseInstaller`配置参数设置`true`为，在您的设备上安装 TensorFlow Lite 及其依赖项。该组件在您的设备上设置了一个虚拟环境，其中包括精简版所需的 TensorFlow OpenCV和 NumPy 库。

**注意**  <a name="ml-installer-component-usage-note"></a>
此组件中的安装程序脚本还会安装其他系统库的最新版本，这是在设备上配置虚拟环境和使用已安装的机器学习框架时所需要的。这可能会升级您设备上的现有系统库。查看下表，了解此组件为每个受支持的操作系统安装的库列表。如果要自定义此安装过程，请将 `UseInstaller` 配置参数设置为 `false`，然后开发自己的安装程序脚本。


| 平台 | 安装在设备系统上的库 | 安装在虚拟环境中的库 | 
| --- | --- | --- | 
| Armv7l | build-essential, cmake, ca-certificates, git | setuptools, wheel | 
| Amazon Linux 2 | mesa-libGL | 无 | 
| Ubuntu | wget | 无 | 

部署推理组件时，此运行时组件会首先验证您的设备是否已安装 TensorFlow Lite 及其依赖项。如果没有，则运行时组件会为您安装。

## 本地日志文件
<a name="tensorflow-lite-component-log-file"></a>

此组件使用以下日志文件。

------
#### [ Linux ]

```
/greengrass/v2/logs/variant.TensorFlowLite.log
```

------
#### [ Windows ]

```
C:\greengrass\v2\logs\variant.TensorFlowLite.log
```

------

**查看此组件的日志**
+ 在核心设备上运行以下命令可实时查看此组件的日志文件。将`/greengrass/v2`或*C:\$1greengrass\$1v2*替换为 AWS IoT Greengrass 根文件夹的路径。

------
#### [ Linux ]

  ```
  sudo tail -f /greengrass/v2/logs/variant.TensorFlowLite.log
  ```

------
#### [ Windows (PowerShell) ]

  ```
  Get-Content C:\greengrass\v2\logs\variant.TensorFlowLite.log -Tail 10 -Wait
  ```

------

## 更改日志
<a name="tensorflow-lite-component-changelog"></a>

下表介绍每个组件版本的更改。


|  版本  |  更改  | 
| --- | --- | 
|  2.5.15  |  对 Greengrass Nucleus 版本 2.12.5 发行版进行了版本更新。  | 
|  2.5.14  | 版本更新为 Greengrass Nucleus 版本 2.12.0 发布版。 | 
|  2.5.13  | 版本更新为 Greengrass Nucleus 版本 2.11.0 发布版。 | 
|  2.5.12  | 版本更新为 Greengrass Nucleus 版本 2.10.0 发布版。 | 
|  2.5.11  | 对 Greengrass Nucleus版本 2.9.0 发行版进行了版本更新。 | 
|  2.5.10  | 版本更新为 Greengrass Nucleus 版本 2.8.0 发布版。 | 
|  2.5.9  |  版本更新为 Greengrass Nucleus 版本 2.7.0 发布版。  | 
|  2.5.8  |  版本更新为 Greengrass Nucleus 版本 2.6.0 发布版。  | 
|  2.5.7  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/tensorflow-lite-component.html)  | 
|  2.5.6  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/tensorflow-lite-component.html)  | 
|  2.5.5  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/tensorflow-lite-component.html)  | 
|  2.5.4  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/greengrass/v2/developerguide/tensorflow-lite-component.html)  | 
|  2.5.3  |  版本更新为 Greengrass Nucleus 版本 2.4.0 发布版。  | 
|  2.5.2  |  版本更新为 Greengrass Nucleus 版本 2.3.0 发布版。  | 
|  2.5.1  |  对 Greengrass Nucleus 版本 2.2.0 发行版进行了版本更新。  | 
|  2.5.0  |  初始版本。  | 