Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅
中国的 Amazon Web Services 服务入门
(PDF)。
Amazon IoT Greengrass Version 12023 年 6 月 30 日进入延长寿命阶段。有关更多信息,请参阅Amazon IoT Greengrass V1维护政策。在此日期之后,Amazon IoT Greengrass V1不会发布提供功能、增强功能、错误修复或安全补丁的更新。在上运行的设备Amazon IoT Greengrass V1不会受到干扰,将继续运行并连接到云端。我们强烈建议你迁移到Amazon IoT Greengrass Version 2,它补充说重要的新功能和支持其他平台。
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
ML 映像分类连接器
ML 映像分类连接器提供在上运行的机器学习 (ML) 推理服务Amazon IoT Greengrass核心。此本地推理服务使用由 SageMaker 图像分类算法。
用户定义的 Lambda 函数使用Amazon IoT Greengrass用于将推理请求提交给本地推理服务。该服务在本地运行推理,并返回输入映像属于特定类别的概率。
Amazon IoT Greengrass 提供此连接器的以下版本,可用于多个平台。
- Version 2
-
连接器 |
描述和 ARN |
ML 映像分类 Aarch64 JTX2 |
适用于 NVIDIA Jetson TX2 的映像分类推理服务。支持 GPU 加速。
ARN:arn:aws:greengrass:region ::/connectors/ImageClassificationAarch64JTX2/versions/2 |
ML 映像分类 x86_64 |
适用于 x86_64 平台的映像分类推理服务。
ARN:arn:aws:greengrass:region ::/connectors/ImageClassificationx86-64/versions/2 |
ML 图像分类 armv7 |
适用于 ARMv7 平台的映像分类推理服务。
ARN:arn:aws:greengrass:region ::/connectors/ImageClassificationARMv7/versions/2 |
- Version 1
-
连接器 |
描述和 ARN |
ML 映像分类 Aarch64 JTX2 |
适用于 NVIDIA Jetson TX2 的映像分类推理服务。支持 GPU 加速。
ARN:arn:aws:greengrass:region ::/connectors/ImageClassificationAarch64JTX2/versions/1 |
ML 映像分类 x86_64 |
适用于 x86_64 平台的映像分类推理服务。
ARN:arn:aws:greengrass:region ::/connectors/ImageClassificationx86-64/versions/1 |
ML 图像分类 armv7 |
适用于 ARMv7 平台的映像分类推理服务。
ARN:arn:aws:greengrass:region ::/connectors/ImageClassificationARMv7/versions/1 |
有关版本更改的信息,请参阅更改日志。
要求
这些连接器具有以下要求:
- Version 2
-
-
Amazon IoT Greengrass核心软件 v1.9.3 版或更高版本。
-
Python在核心设备上安装了 3.7 或 3.8 版,并添加到 PATH 环境变量中。
要使用 Python 3.8,请运行以下命令创建从默认 Python 3.7 安装文件夹到已安装的 Python 3.8 二进制文件的符号链接。
sudo ln -s path-to-python-3.8
/python3.8 /usr/bin/python3.7
这会将设备配置为满足 Amazon IoT Greengrass 的 Python 要求。
-
安装在核心设备上的 Apache MXNet 框架的依赖项。有关更多信息,请参阅 在 Amazon IoT Greengrass 核心上安装 MXNet 依赖项。
-
网络 ACL 和安全组都允许 (因此可到达您的实例) 的发起 ping 的ML 资源Greengrass 组中引用 SageMaker 模型源。该模型必须由 SageMaker 图像分类算法。有关更多信息,请参阅 。映像分类算法中的亚马逊 SageMaker 开发人员指南.
-
这些区域有:ML 反馈连接器添加到 Greengrass 组且已配置。仅当您要使用此连接器上传模型输入数据并将预测发布到 MQTT 主题时,这才是必需的。
-
这些区域有:Greengrass 组角色配置为允许sagemaker:DescribeTrainingJob
对目标培训作业执行操作,如以下示例 IAM 策略中所示。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sagemaker:DescribeTrainingJob"
],
"Resource": "arn:aws:sagemaker:region
:account-id
:training-job:training-job-name
"
}
]
}
对于组角色要求,您必须将角色配置为授予所需权限,并确保角色已添加到组中。有关更多信息,请参阅 管理 Greengrass 组角色(控制台) 或 管理 Greengrass 组角色 (CLI)。
您可以授予对资源的具体或条件访问权限(例如,通过使用通配符*命名方案)。如果将来要更改目标训练任务,请务必更新组角色。
-
Amazon IoT GreengrassMachine Learning SDK与此连接器进行交互时需要 v1.1.0。
- Version 1
-
-
Amazon IoT Greengrass核心软件 v1.7 或更高版本。
-
Python安装在核心设备上并添加到 PATH 环境变量中的版本 2.7。
-
安装在核心设备上的 Apache MXNet 框架的依赖项。有关更多信息,请参阅 在 Amazon IoT Greengrass 核心上安装 MXNet 依赖项。
-
网络 ACL 和安全组都允许 (因此可到达您的实例) 的发起 ping 的ML 资源Greengrass 组中引用 SageMaker 模型源。该模型必须由 SageMaker 图像分类算法。有关更多信息,请参阅 。映像分类算法中的亚马逊 SageMaker 开发人员指南.
-
这些区域有:Greengrass 组角色配置为允许sagemaker:DescribeTrainingJob
对目标培训作业执行操作,如以下示例 IAM 策略中所示。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sagemaker:DescribeTrainingJob"
],
"Resource": "arn:aws:sagemaker:region
:account-id
:training-job:training-job-name
"
}
]
}
对于组角色要求,您必须将角色配置为授予所需权限,并确保角色已添加到组中。有关更多信息,请参阅 管理 Greengrass 组角色(控制台) 或 管理 Greengrass 组角色 (CLI)。
您可以授予对资源的具体或条件访问权限(例如,通过使用通配符*命名方案)。如果将来要更改目标训练任务,请务必更新组角色。
-
Amazon IoT GreengrassMachine Learning SDK与此连接器进行交互时需要 v1.0.0 或更高版本。
连接器参数
这些连接器提供以下参数。
- Version 2
-
MLModelDestinationPath
-
Lambda 环境中 ML 资源的本地绝对路径。这是为 ML 资源指定的目标路径。
如果您在控制台中创建了 ML 资源,这便是本地路径。
中的显示名称Amazon IoT控制台:模型目标路径
:必需true
类型:string
有效模式:.+
MLModelResourceId
-
引用源模型的 ML 资源的 ID。
中的显示名称Amazon IoT控制台:SageMaker 作业 ARN 资源
:必需true
类型:string
有效模式:[a-zA-Z0-9:_-]+
MLModelSageMakerJobArn
-
的 ARN SageMaker 代表 SageMaker 模型源。该模型必须由 SageMaker 图像分类算法。
在中的显示名称Amazon IoT控制台:SageMaker 作业 ARN
:必需true
类型:string
有效模式:^arn:aws:sagemaker:[a-zA-Z0-9-]+:[0-9]+:training-job/[a-zA-Z0-9][a-zA-Z0-9-]+$
LocalInferenceServiceName
-
本地推理服务的名称。用户定义的 Lambda 函数将该服务的名称传递给invoke_inference_service
的函数Amazon IoT GreengrassMachine Learning SDK。有关示例,请参阅使用示例:
中的显示名称Amazon IoT控制台:本地推理服务名称
:必需true
类型:string
有效模式:[a-zA-Z0-9][a-zA-Z0-9-]{1,62}
LocalInferenceServiceTimeoutSeconds
-
在推理请求终止之前经过的时间(以秒为单位)。最小值为 1。
在中的显示名称Amazon IoT控制台:超时(秒)
:必需true
类型:string
有效模式:[1-9][0-9]*
LocalInferenceServiceMemoryLimitKB
-
该服务有权访问的内存量(以 KB 为单位)。最小值为 1。
在中的显示名称Amazon IoT控制台:内存限制 (KB)
:必需true
类型:string
有效模式:[1-9][0-9]*
GPUAcceleration
-
CPU 或 GPU(加速)计算上下文。此属性仅适用于 ML 映像分类 Aarch64 JTX2 连接器。
在中的显示名称Amazon IoT控制台:GPU 加速
:必需true
类型:string
有效值:CPU
或 GPU
MLFeedbackConnectorConfigId
-
用于上传模型输入数据的反馈配置的 ID。这必须与为 ML 反馈连接器定义的反馈配置的 ID 匹配。
该仅当您要使用 ML 反馈连接器上传模型输入数据并将预测发布到 MQTT 主题时,这才是必需的。
在中的显示名称Amazon IoT控制台:ML 反馈连接器配置 ID
:必需false
类型:string
有效模式:^$|^[a-zA-Z0-9][a-zA-Z0-9-]{1,62}$
- Version 1
-
MLModelDestinationPath
-
Lambda 环境中 ML 资源的本地绝对路径。这是为 ML 资源指定的目标路径。
如果您在控制台中创建了 ML 资源,这便是本地路径。
在中的显示名称Amazon IoT控制台:模型目标路径
:必需true
类型:string
有效模式:.+
MLModelResourceId
-
引用源模型的 ML 资源的 ID。
在中的显示名称Amazon IoT控制台:SageMaker 作业 ARN 资源
:必需true
类型:string
有效模式:[a-zA-Z0-9:_-]+
MLModelSageMakerJobArn
-
的 ARN SageMaker 代表 SageMaker 模型源。该模型必须由 SageMaker 图像分类算法。
在中的显示名称Amazon IoT控制台:SageMaker 作业 ARN
:必需true
类型:string
有效模式:^arn:aws:sagemaker:[a-zA-Z0-9-]+:[0-9]+:training-job/[a-zA-Z0-9][a-zA-Z0-9-]+$
LocalInferenceServiceName
-
本地推理服务的名称。用户定义的 Lambda 函数将该服务的名称传递给invoke_inference_service
的函数Amazon IoT GreengrassMachine Learning SDK。有关示例,请参阅使用示例:
在中的显示名称Amazon IoT控制台:本地推理服务名称
:必需true
类型:string
有效模式:[a-zA-Z0-9][a-zA-Z0-9-]{1,62}
LocalInferenceServiceTimeoutSeconds
-
在推理请求终止之前经过的时间(以秒为单位)。最小值为 1。
在中的显示名称Amazon IoT控制台:超时(秒)
:必需true
类型:string
有效模式:[1-9][0-9]*
LocalInferenceServiceMemoryLimitKB
-
该服务有权访问的内存量(以 KB 为单位)。最小值为 1。
在中的显示名称Amazon IoT控制台:内存限制 (KB)
:必需true
类型:string
有效模式:[1-9][0-9]*
GPUAcceleration
-
CPU 或 GPU(加速)计算上下文。此属性仅适用于 ML 映像分类 Aarch64 JTX2 连接器。
在中的显示名称Amazon IoT控制台:GPU 加速
:必需true
类型:string
有效值:CPU
或 GPU
创建连接器示例 (Amazon CLI)
以下 CLI 命令创建ConnectorDefinition
它具有包含 ML 映像分类连接器的初始版本。
- 示例:CPU 实例
-
以下示例创建 ML 映像分类 ARMv7l 连接器的实例。
aws greengrass create-connector-definition --name MyGreengrassConnectors --initial-version '{
"Connectors": [
{
"Id": "MyImageClassificationConnector",
"ConnectorArn": "arn:aws:greengrass:region
::/connectors/ImageClassificationARMv7/versions/2",
"Parameters": {
"MLModelDestinationPath": "/path-to-model",
"MLModelResourceId": "my-ml-resource",
"MLModelSageMakerJobArn": "arn:aws:sagemaker:us-west-2:123456789012:training-job:MyImageClassifier",
"LocalInferenceServiceName": "imageClassification",
"LocalInferenceServiceTimeoutSeconds": "10",
"LocalInferenceServiceMemoryLimitKB": "500000",
"MLFeedbackConnectorConfigId": "MyConfig0"
}
}
]
}'
- 示例:GPU 实例
-
此示例创建 ML 映像分类 Aarch64 JTX2 连接器的实例,该实例在 NVIDIA Jetson TX2 面板上支持 GPU 加速。
aws greengrass create-connector-definition --name MyGreengrassConnectors --initial-version '{
"Connectors": [
{
"Id": "MyImageClassificationConnector",
"ConnectorArn": "arn:aws:greengrass:region
::/connectors/ImageClassificationAarch64JTX2/versions/2",
"Parameters": {
"MLModelDestinationPath": "/path-to-model",
"MLModelResourceId": "my-ml-resource",
"MLModelSageMakerJobArn": "arn:aws:sagemaker:us-west-2:123456789012:training-job:MyImageClassifier",
"LocalInferenceServiceName": "imageClassification",
"LocalInferenceServiceTimeoutSeconds": "10",
"LocalInferenceServiceMemoryLimitKB": "500000",
"GPUAcceleration": "GPU",
"MLFeedbackConnectorConfigId": "MyConfig0"
}
}
]
}'
这些连接器中的 Lambda 函数有长时间生存生命周期。
在Amazon IoT Greengrass控制台,您可以从组中添加连接器连接器页. 有关更多信息,请参阅 Greengrass 连接器入门(控制台)。
这些连接器接受一个图像文件作为输入。输入图像文件必须为 jpeg
或 png
格式。有关更多信息,请参阅 使用示例。
这些连接器不接受 MQTT 消息作为输入数据。
输出数据
这些连接器返回输入图像中识别的对象的格式化预测:
[0.3,0.1,0.04,...]
预测包含值列表,这些值与模型训练期间训练数据集中使用的类别相对应。每个值代表图像落入相应类别的概率。概率最高的类别是主导预测。
这些连接器不会将 MQTT 消息作为输出数据发布。
使用示例
以下示例 Lambda 函数使用Amazon IoT GreengrassMachine Learning SDK以与 ML 图像分类连接器进行交互。
该示例初始化一个开发工具包客户端,并同步调用该开发工具包的 invoke_inference_service
函数来调用本地推理服务。它会传入算法类型、服务名称、映像类型和映像内容。然后,该示例会解析服务响应以获取概率结果(预测)。
- Python 3.7
-
import logging
from threading import Timer
import numpy as np
import greengrass_machine_learning_sdk as ml
# We assume the inference input image is provided as a local file
# to this inference client Lambda function.
with open('/test_img/test.jpg', 'rb') as f:
content = bytearray(f.read())
client = ml.client('inference')
def infer():
logging.info('invoking Greengrass ML Inference service')
try:
resp = client.invoke_inference_service(
AlgoType='image-classification',
ServiceName='imageClassification',
ContentType='image/jpeg',
Body=content
)
except ml.GreengrassInferenceException as e:
logging.info('inference exception {}("{}")'.format(e.__class__.__name__, e))
return
except ml.GreengrassDependencyException as e:
logging.info('dependency exception {}("{}")'.format(e.__class__.__name__, e))
return
logging.info('resp: {}'.format(resp))
predictions = resp['Body'].read().decode("utf-8")
logging.info('predictions: {}'.format(predictions))
# The connector output is in the format: [0.3,0.1,0.04,...]
# Remove the '[' and ']' at the beginning and end.
predictions = predictions[1:-1]
count = len(predictions.split(','))
predictions_arr = np.fromstring(predictions, count=count, sep=',')
# Perform business logic that relies on the predictions_arr, which is an array
# of probabilities.
# Schedule the infer() function to run again in one second.
Timer(1, infer).start()
return
infer()
def function_handler(event, context):
return
- Python 2.7
-
import logging
from threading import Timer
import numpy
import greengrass_machine_learning_sdk as gg_ml
# The inference input image.
with open('/test_img/test.jpg', 'rb') as f:
content = f.read()
client = gg_ml.client('inference')
def infer():
logging.info('Invoking Greengrass ML Inference service')
try:
resp = client.invoke_inference_service(
AlgoType='image-classification',
ServiceName='imageClassification',
ContentType='image/jpeg',
Body=content)
except gg_ml.GreengrassInferenceException as e:
logging.info('Inference exception %s("%s")', e.__class__.__name__, e)
return
except gg_ml.GreengrassDependencyException as e:
logging.info('Dependency exception %s("%s")', e.__class__.__name__, e)
return
logging.info('Response: %s', resp)
predictions = resp['Body'].read()
logging.info('Predictions: %s', predictions)
# The connector output is in the format: [0.3,0.1,0.04,...]
# Remove the '[' and ']' at the beginning and end.
predictions = predictions[1:-1]
predictions_arr = numpy.fromstring(predictions, sep=',')
logging.info("Split into %s predictions.", len(predictions_arr))
# Perform business logic that relies on predictions_arr, which is an array
# of probabilities.
# Schedule the infer() function to run again in one second.
Timer(1, infer).start()
infer()
# In this example, the required AWS Lambda handler is never called.
def function_handler(event, context):
return
这些区域有:invoke_inference_service
中的函数Amazon IoT GreengrassMachine Learning 开发工具包接受以下参数。
参数 |
描述 |
AlgoType
|
要用于推理的算法类型的名称。目前仅支持 image-classification 。
:必需true
类型:string
有效值:image-classification |
ServiceName
|
本地推理服务的名称。在配置了连接器时,使用为 LocalInferenceServiceName 参数指定的名称。
:必需true
类型:string |
ContentType
|
输入映像的 mime 类型。
:必需true
类型:string
有效值:image/jpeg, image/png |
Body
|
输入映像文件的内容。
:必需true
类型:binary |
在 Amazon IoT Greengrass 核心上安装 MXNet 依赖项
要使用 ML 映像分类连接器,您必须在核心设备上安装 Apache MXNet 框架的依赖项。连接器使用该框架来处理 ML 模型。
这些连接器捆绑到预编译的 MXNet 库,因此无需在核心设备上安装 MXNet 框架。
Amazon IoT Greengrass 提供了脚本来安装以下常见平台和设备的依赖项(或用作安装参考)。如果使用的是其他平台或设备,请参阅 MXNet 文档以了解您的配置。
安装 MXNet 依赖项之前,请确保设备上存在所需的系统库(具有指定的最低版本)。
- NVIDIA Jetson TX2
-
-
安装 CUDA Toolkit 9.0 和 cuDNN 7.0。您可以按照入门教程中设置其他设备中的说明进行操作。
-
启用通用存储库,以便连接器可以安装社区维护的开放软件。有关更多信息,请参阅 Ubuntu 文档中的 Repositories/Ubuntu。
-
打开 /etc/apt/sources.list
文件。
-
确保以下各行已取消注释。
deb http://ports.ubuntu.com/ubuntu-ports/ xenial universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial universe
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates universe
-
将以下安装脚本的副本保存到核心设备上一个名为 nvidiajtx2.sh
的文件。
Python 3.7Python 2.7
- Python 3.7
#!/bin/bash
set -e
echo "Installing dependencies on the system..."
echo 'Assuming that universe repos are enabled and checking dependencies...'
apt-get -y update
apt-get -y dist-upgrade
apt-get install -y liblapack3 libopenblas-dev liblapack-dev libatlas-base-dev
apt-get install -y python3.7 python3.7-dev
python3.7 -m pip install --upgrade pip
python3.7 -m pip install numpy==1.15.0
python3.7 -m pip install opencv-python || echo 'Error: Unable to install OpenCV with pip on this platform. Try building the latest OpenCV from source (https://github.com/opencv/opencv).'
echo 'Dependency installation/upgrade complete.'
- Python 2.7
#!/bin/bash
set -e
echo "Installing dependencies on the system..."
echo 'Assuming that universe repos are enabled and checking dependencies...'
apt-get -y update
apt-get -y dist-upgrade
apt-get install -y liblapack3 libopenblas-dev liblapack-dev libatlas-base-dev python-dev
echo 'Install latest pip...'
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
rm get-pip.py
pip install numpy==1.15.0 scipy
echo 'Dependency installation/upgrade complete.'
-
从保存文件的目录中,键入以下命令:
sudo nvidiajtx2.sh
- x86_64 (Ubuntu or Amazon Linux)
-
-
将以下安装脚本的副本保存到核心设备上一个名为 x86_64.sh
的文件。
Python 3.7Python 2.7
- Python 3.7
#!/bin/bash
set -e
echo "Installing dependencies on the system..."
release=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
if [ "$release" == '"Ubuntu"' ]; then
# Ubuntu. Supports EC2 and DeepLens. DeepLens has all the dependencies installed, so
# this is mostly to prepare dependencies on Ubuntu EC2 instance.
apt-get -y update
apt-get -y dist-upgrade
apt-get install -y libgfortran3 libsm6 libxext6 libxrender1
apt-get install -y python3.7 python3.7-dev
elif [ "$release" == '"Amazon Linux"' ]; then
# Amazon Linux. Expect python to be installed already
yum -y update
yum -y upgrade
yum install -y compat-gcc-48-libgfortran libSM libXrender libXext
else
echo "OS Release not supported: $release"
exit 1
fi
python3.7 -m pip install --upgrade pip
python3.7 -m pip install numpy==1.15.0
python3.7 -m pip install opencv-python || echo 'Error: Unable to install OpenCV with pip on this platform. Try building the latest OpenCV from source (https://github.com/opencv/opencv).'
echo 'Dependency installation/upgrade complete.'
- Python 2.7
#!/bin/bash
set -e
echo "Installing dependencies on the system..."
release=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
if [ "$release" == '"Ubuntu"' ]; then
# Ubuntu. Supports EC2 and DeepLens. DeepLens has all the dependencies installed, so
# this is mostly to prepare dependencies on Ubuntu EC2 instance.
apt-get -y update
apt-get -y dist-upgrade
apt-get install -y libgfortran3 libsm6 libxext6 libxrender1 python-dev python-pip
elif [ "$release" == '"Amazon Linux"' ]; then
# Amazon Linux. Expect python to be installed already
yum -y update
yum -y upgrade
yum install -y compat-gcc-48-libgfortran libSM libXrender libXext python-pip
else
echo "OS Release not supported: $release"
exit 1
fi
pip install numpy==1.15.0 scipy opencv-python
echo 'Dependency installation/upgrade complete.'
-
从保存文件的目录中,键入以下命令:
sudo x86_64.sh
- Armv7 (Raspberry Pi)
-
-
将以下安装脚本的副本保存到核心设备上一个名为 armv7l.sh
的文件。
Python 3.7Python 2.7
- Python 3.7
#!/bin/bash
set -e
echo "Installing dependencies on the system..."
apt-get update
apt-get -y upgrade
apt-get install -y liblapack3 libopenblas-dev liblapack-dev
apt-get install -y python3.7 python3.7-dev
python3.7 -m pip install --upgrade pip
python3.7 -m pip install numpy==1.15.0
python3.7 -m pip install opencv-python || echo 'Error: Unable to install OpenCV with pip on this platform. Try building the latest OpenCV from source (https://github.com/opencv/opencv).'
echo 'Dependency installation/upgrade complete.'
- Python 2.7
#!/bin/bash
set -e
echo "Installing dependencies on the system..."
apt-get update
apt-get -y upgrade
apt-get install -y liblapack3 libopenblas-dev liblapack-dev python-dev
# python-opencv depends on python-numpy. The latest version in the APT repository is python-numpy-1.8.2
# This script installs python-numpy first so that python-opencv can be installed, and then install the latest
# numpy-1.15.x with pip
apt-get install -y python-numpy python-opencv
dpkg --remove --force-depends python-numpy
echo 'Install latest pip...'
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
rm get-pip.py
pip install --upgrade numpy==1.15.0 picamera scipy
echo 'Dependency installation/upgrade complete.'
-
从保存文件的目录中,键入以下命令:
sudo bash armv7l.sh
在 Raspberry Pi 上,使用 pip
安装机器学习依赖项是一项内存密集型操作,可能会导致设备用尽内存,变得无法响应。解决办法是临时增加交换空间大小:
在 /etc/dphys-swapfile
中,增加 CONF_SWAPSIZE
变量的值,然后运行以下命令重启 dphys-swapfile
。
/etc/init.d/dphys-swapfile restart
日志记录和排除
根据您的组设置,事件和错误日志将写入到 CloudWatch 日志、本地文件系统或两者。此连接器中的日志使用前缀 LocalInferenceServiceName
。如果连接器出现异常行为,请检查连接器日志。其中经常包含有用的调试信息,例如缺失 ML 库依赖项或连接器启动故障的原因。
如果Amazon IoT Greengrass组被配置为写入本地日志,连接器将日志文件写入greengrass-root
/ggc/var/log/user/region
/aws/
. 有关 Greengrass 日志记录的更多信息,请参阅利用 Amazon IoT Greengrass 日志进行监控.
可以使用以下信息帮助解决 ML 映像分类连接器代理问题。
所需系统库
以下选项卡列出了每个 ML 映像分类连接器所需的系统库。
- ML Image Classification Aarch64 JTX2
-
Library |
最低版本 |
ld-linux-aarch64.so.1 | GLIBC_2.17 |
libc.so.6 | GLIBC_2.17 |
libcublas.so.9.0 | 不适用 |
libcudart.so.9.0 | 不适用 |
libcudnn.so.7 | 不适用 |
libcufft.so.9.0 | 不适用 |
libcurand.so.9.0 | 不适用 |
libcusolver.so.9.0 | 不适用 |
libgcc_s.so.1 | GCC_4.2.0 |
libgomp.so.1 | GOMP_4.0,OMP_1.0 |
libm.so.6 | GLIBC_2.23 |
libpthread.so.0 | GLIBC_2.17 |
librt.so.1 | GLIBC_2.17 |
libstdc++.so.6 | GLIBCXX_3.4.21,CXXABI_1.3.8 |
- ML Image Classification x86_64
-
Library |
最低版本 |
ld-linux-x86-64.so.2 | GCC_4.0.0 |
libc.so.6 | GLIBC_2.4 |
libgfortran.so.3 | GFORTRAN_1.0 |
libm.so.6 | GLIBC_2.23 |
libpthread.so.0 | GLIBC_2.2.5 |
librt.so.1 | GLIBC_2.2.5 |
libstdc++.so.6 | CXXABI_1.3.8,GLIBCXX_3.4.21 |
- ML Image Classification Armv7
-
Library |
最低版本 |
ld-linux-armhf.so.3 | GLIBC_2.4 |
libc.so.6 | GLIBC_2.7 |
libgcc_s.so.1 | GCC_4.0.0 |
libgfortran.so.3 | GFORTRAN_1.0 |
libm.so.6 | GLIBC_2.4 |
libpthread.so.0 | GLIBC_2.4 |
librt.so.1 | GLIBC_2.4 |
libstdc++.so.6 | CXXABI_1.3.8,CXXABI_ARM_1.3.3,GLIBCXX_3.4.20 |
问题
症状 |
解决方案 |
在 Raspberry Pi 上,记录了以下错误消息,并且您没有使用摄像机:Failed to initialize libdc1394
|
运行以下命令以显示驱动程序:
sudo ln /dev/null /dev/raw1394
此操作是临时的,符号链接将在重启后消失。请参阅您的 OS 分发手册以了解如何在重启时自动创建链接。
|
许可证
ML 映像分类连接器包含以下第三方软件/许可:
Intel OpenMP 运行时库许可。Intel® OpenMP* 运行时经过双重许可,具有商业 (COM) 许可证(作为 Intel® Parallel Studio XE Suite 产品的一部分)和 BSD 开源 (OSS) 许可证。
此连接器在Greengrass 核心软件许可协议.
更改日志
下表介绍每个版本的连接器中的更改。
版本 |
更改 |
2 |
添加了MLFeedbackConnectorConfigId 参数来支持使用ML 反馈连接器以上传模型输入数据、将预测发布到 MQTT 主题以及将指标发布到 Amazon CloudWatch。
|
1 |
首次发布。
|
Greengrass 组每次只能包含一个版本的连接器。有关升级连接器版本的信息,请参阅升级连接器版本。
另请参阅