Japan 5 AWSのパートナーネットワークに登録している企業が参加した「AWS Partner Summit Tokyo」の中で、数あるアワードの中で最も実績 をあげたパートナーであることを⽰す『APN Consulting Partner of the Year 2019 – Japan』を受賞しました。cloudpackは、同賞を5度 ⽬の受賞となります。 『APN Consulting Partner of the Year 2019 – Japan』は、AWSが年間を通じて営業・技術・マーケティング分野においてパートナーと しての総合⼒を判断し、AWSのビジネスに最も貢献したパートナーに贈られるものです。cloudpackは、2013年から継続的にプレミアコン サルティングパートナーとして認定されているほか、業界に影響を与える多数のお客様事例のリリースや、数千台規模のマイグレーション 案件、基幹システムの移⾏を⼿掛けるなど、さらなるAWSビジネスの拡⼤に貢献しました。 また、サーバーレスやマシンラーニングなどの新サービスも積極的に採⽤して成功させる⼀⽅で、エンタープライズ案件も推進してきた結 果、著しい売り上げ伸び率を達成 したことが評価されました。
Greengrass is an open source Internet of Things (IoT) edge runtime and cloud service that helps you build, deploy and manage IoT applications on your devices. *1 *1) https://docs.aws.amazon.com/greengrass/v2/developerguide/what-is-iot-greengrass.html *2) https://docs.aws.amazon.com/greengrass/v2/developerguide/how-it-works.html *3) https://aws.amazon.com/jp/about-aws/whats-new/2021/11/aws-iot-greengrass-support-windows-devices/ 構成イメージ *2 • サポートされる OS は、Windows *3, Linux (Ubuntu, Raspberry Pi OS など) • サポートされる CPU は x86, ARM • Lambda Function を実行可能 • DLR (Deep Learning Runtime) を利用し たエッジAI推論が可能
Train model Evaluate model Deploy to production Monitor SageMaker Studio (IDE) SageMaker Projects (CI/CD) SageMaker Model Building Pipelines (CI/CD) SageMaker Studio Notebooks (Jupyter Notebook) SageMaker Notebook Instances (Jupyter Notebook) SageMaker ML Lineage Tracking (Collecting Information) SageMaker Data Wrangler (Feature of SageMaker Studio) SageMaker Processing (SDK) SageMaker Debugger SageMaker Experiments SageMaker Edge Manager
Train model Evaluate model Deploy to production Monitor SageMaker Clarify (Improving Models) Amazon Augmented AI (Workflow for Human Reviews) SageMaker Ground Truth (Labeling) SageMaker Ground Truth Plus (Labeling) SageMaker Feature Store SageMaker Training Compiler SageMaker Autopilot (Auto ML) SageMaker Canvas (Auto ML) SageMaker Hosting Services SageMaker Serverless Endpoints (Preview) SageMaker Elastic Inference SageMaker Inference Recommender SageMaker Model Registry SageMaker Neo (Compile) SageMaker Model Monitor
is a capability of Amazon SageMaker that enables machine learning models to train once and run anywhere in the cloud and at the edge. *1 Amazon SageMaker Neo を使用すると、デベロッパーは、クラウド内の SageMaker とエッジでサポー トされているデバイスで推論するために機械学習 (ML) モデルを最適化できます。 *2 SageMaker Neo は、シングルクリックでトレーニングされたモデルを最適化し、実行可能ファイルにコン パイルします。コンパイラは、機械学習モデルを使用して、クラウドインスタンスまたはエッジデバイス上の モデルの可能な限り最高のパフォーマンスを引き出すパフォーマンス最適化を適用します。 *2 *1) https://docs.aws.amazon.com/sagemaker/latest/dg/neo.html *2) https://aws.amazon.com/jp/sagemaker/neo/
Amazon SageMaker Edge Manager provides model management for edge devices so you can optimize, secure, monitor, and maintain machine learning models on fleets of edge devices such as smart cameras, robots, personal computers, and mobile devices. *1 エッジにある機械学習モデルを管理・監視できます。(今回のサンプルでは監視はしません) *1) https://docs.aws.amazon.com/sagemaker/latest/dg/edge.html
にアップロードしましたので、あわせてご参照ください。 https://github.com/iwstkhr/aws-iot-greengrass-edge-inference-sample 1. 事前準備 a. AWS リソース準備 b. 訓練スクリプト作成 c. 推論スクリプト作成 2. SageMaker a. SageMaker 訓練 b. SageMaker Neo コンパイル c. SageMaker Edge Manager パッケージング 3. Greengrass a. Greengrass Core セットアップ b. Greengrass Component 登録 (推論用) c. Greengrass Component デプロイ 4. エッジAI推論動作確認
User greengrass-core-setup-user Greengrass Core セットアップ用 IAM Role sagemaker-execution-role SageMaker 実行ロール IAM Role GreengrassV2TokenExchangeRole Greengrass Core 用ロール S3 sagemaker-ml-model-artifacts-{account_id}-{region} ML Model 配置用 事前に以下のAWSリソースを準備しておきます。 各リソースの詳細は、GitHub の CloudFormation Template を参照してください。 % aws cloudformation deploy --template-file ./cfn.yaml --stack-name greengrass-sample --capabilities CAPABILITY_NAMED_IAM Waiting for changeset to be created.. Waiting for stack create/update to complete Successfully created/updated stack - greengrass-sample
-> None: suffix = datetime.now().strftime('%Y-%m-%d_%H-%M-%S') path = os.path.join(path, f'model-{suffix}.pt') # If you use `model.state_dict()`, SageMaker compilation will fail. torch.save(model, path) def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser() # hyperparameters sent by the client are passed as command-line arguments to the script. # input data and model directories parser.add_argument('--model_dir', type=str) parser.add_argument('--sm_model_dir', type=str, default=os.environ.get('SM_MODEL_DIR')) parser.add_argument('--train', type=str, default=os.environ.get('SM_CHANNEL_TRAIN')) parser.add_argument('--test', type=str, default=os.environ.get('SM_CHANNEL_TEST')) args, _ = parser.parse_known_args() return args training.py
json import os import time import numpy as np from dlr import DLRModel def load_model() -> DLRModel: return DLRModel('/greengrass/v2/work/vgg16-component') inference.py
model.tar.gz の S3 URI データ入力設定 モデルの Input Shape *1 機械学習フレームワーク 今回は PyTorch フレームワークバージョン 1.8 *1) 訓練済みモデルの仕様は、公式ページを参照してくださ い。 All pre-trained models expect input images normalized in the same way, i.e. mini-batches of 3-channel RGB images of shape (3 x H x W), where H and W are expected to be at least 224. 入力設定