SlideShare a Scribd company logo
Open Source x AI
2020-11-28
Open Source Conference
2020 Online/Fukuoka
Yuta Ishibashi & Tsukasa Kato
Profile
• Yuta Ishibashi / 石橋 裕太
• TOYOTA MOTOR KYUSHU, INC.
Future technology & Business DEV.
• xAI Meetup 主催
• https://rupic.hatenablog.com/
• https://www2.slideshare.net/rupic
Profile
• Tsukasa Kato / 加藤 司
• 日本ビジネスシステムズ株式会社
シニアエキスパート
• Microsoft MVP for Microsoft Azure
• https://tsukatoh.hatenablog.com/
• https://www.slideshare.net/tsukasakatou9
Open Source x AI
38 Categories
296 Services + more
Open Source x AI
Open Source x AI
AIって難しい…😢
Open Source x AI
Open Source x AI
Open Source x AI
AIってお金がかかる…😢
Open Source x AI
Open Source x AI
Open Source x AI
Open Source x AI
AI をもっと身近に
もっと簡単に
自分の得意な分野に
”AI という手段” を
掛け合わせてみよう!!
AI is for everyone
it's so easy
Agenda
• Azure Cognitive Services
• Custom Vision
• Kubernetes
• Kubernetes-based Serverless
• KEDA
OpenSource x AI の実現方法を知っていただく
Azure Cognitive Services
• Microsoft が提供するAIサービス群。
• 開発者が直接的なAIやデータサイエンスのスキルや知識がな
くても利用できるAPI、SDKを提供。
• 現状サービスカタログとしては意思決定、視覚、音声、言語、
Web検索の5つに分類される
Cognitive Services
Cognitive Services
22
Decision Language Speech Vision Web Search
Bing SearchComputer Vision
Custom Vision
Face
Form Recognizer
Video Indexer
Speech to Text
Text to Speech
Speech Translation
Speaker Recognition
Immersive Reader
Language
Understanding
QnA Maker
Text Analytics
Translator Text
Anomaly Detector
Content Moderator
Personalizer
Metrics Advizor
↑
Marcketplace
から作成
• コンピュータービジョンモデルを自分好みにカスタマイズし
て作成するサービス
• 画像をアップロードしてラベル付けするだけでトレーニング
を開始することができる
• 生成したモデルデータはエクスポートが可能
• CoreML (iOS)
• TensorFlow (Android)
• ONNX (Windows)
• Dockerfile
• Vision AI Dev Kit
• エクスポートはDomainsをcompactにする必要がある
Custom Vision
Custom Vision
• TensorFlow でエクスポートできるオプション
• TensorFlow
• TensorFlow Lite
• TensorFlow Lite Float16
• TensorFlow.js
• SavedModel
TensorFlow export
TensorFlow Download Files
• Cvexport.manifest
• Labels.txt
• Metadata_properties.json
• Model.pb
• Dockerfile でエクスポートできるオプション
• Linux
• Windows
• ARM (Raspberry Pi 3)
Dockerfile export
Dockerfile(Linux) Download Files
• app
• app.py
• cvexport.manifest
• labels.txt
• metadata_properties.json
• model.pb
• predict.py
• azureml
• README.txt
• score.py
• Dockerfile
• README.txt
Dockerfile
FROM python:3.7-slim
RUN pip install -U pip
RUN pip install --no-cache-dir numpy~=1.17.5 tensorflow~=2.0.2 flask~=1.1.2 pillow~=7.2.0
COPY app /app
# By default, we run manual image resizing to maintain parity with CVS webservice prediction results.
# If parity is not required, you can enable faster image resizing by uncommenting the following lines.
# RUN apt-get update && apt-get install -y --no-install-recommends libglib2.0-bin
# RUN pip install opencv-python-headless
# Expose the port
EXPOSE 80
# Set the working directory
WORKDIR /app
# Run the flask server for the endpoints
CMD python -u app.py
Docker Build
> docker build -t customvision .
[+] Building 4.3s (10/10) FINISHED
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.2s
=> => transferring dockerfile: 673B 0.1s
=> [internal] load metadata for docker.io/library/python:3.7-slim 3.5s
=> [internal] load build context 0.4s
=> => transferring context: 5.12MB 0.4s
=> [1/5] FROM docker.io/library/python:3.7-slim@sha256:ac0c17ada735be16aae9f4b91ba564a6566c 0.0s
=> CACHED [2/5] RUN pip install -U pip 0.0s
=> CACHED [3/5] RUN pip install --no-cache-dir numpy~=1.17.5 tensorflow~=2.0.2 flask~=1.1.2 0.0s
=> CACHED [4/5] COPY app /app 0.0s
=> CACHED [5/5] WORKDIR /app 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:0c4e8db0777165b012e0d54d549f19292bc5a2b94e8d55861b1f4eabf694d067 0.0s
=> => naming to docker.io/library/customvision 0.0s
Kubernetes
Kubernetes
• コンテナーアプリケーションを管理するためのオーケスト
レーションツール
• 自動デプロイ、スケーリング、アプリ・コンテナーの運用
自動化
• Webコンソールが用意されており、GUIでの管理が可能
• Google が社内のオーケストレーションツール「Borg」を
元に開発
• CNCFに寄贈され管理されておりオープンソースで提供さ
れている
• マイクロサービスを構築する基盤として採用される事が多
い
Kubernetes Architecture
Kubernetes
managed
services
Google Kubernetes Engine
Azure Kubernetes Service
Amazon Elastic Container Service for Kubernetes
IBM Cloud Kubernetes Service
Alibaba Cloud Container Service for Kubernetes
Rancher
NetApp Kubernetes Service
Cluster Autoscaler
• 追加容量が必要になった場合は新しいノードが自動的に追
加され、不要になれば削除される
• 実行するワークロードの量に基づいてクラスタのサイズを
自動的に変更
• リソース制約のためにノードでスケジュールできないPod
を監視
• ノードプール単位で機能
• Horizontal Pod Autoscaler(HPA)と連携して機能してノー
ドとポッドの管理を行う
Horizontal Pod Autoscaler(HPA)
• Kubernetes クラスターのメトリック サーバーを使用して、
Podのリソースの需要をモニターし、 アプリケーションで
必要なリソースが増えるとその需要を満たすためにレプリ
ケーションコントローラー、デプロイ、レプリカセット内
のポッドの数を自動的にスケーリング
• また、リソースが不要になったときにスケールインできる
• Kubernetes 標準APIオブジェクトとコントローラとして実
装されている
Kubernetes-based
Serverless
Knative KEDA Virtual Kubelet
Kubernetes-based Serverless
Knative
• Serverless ワークロードをビルド、デプロイ、管理機能を提
供するKubernetesベースのプラットフォーム
• Scale-to-zero、自動
スケーリング、クラ
スタ内ビルド、
Kubernetes 上のク
ラウド ネイティブ
アプリケーション用
のイベント フレーム
ワークなどの機能が
ある
https://github.com/knative
Knative Components
Serving
•スケール
•カナリアリース
•ルーティング
•リクエスト受信
Building
•コンテナのビルド
•パッケージング
Eventing
•イベントソースの抽
象化
•コードの発火
Virtual Kubelet
• Kubeletの仮想実装で、汎用的にk8sクラスタから外部リソー
スを利用できる
• バースティングなど
を目的として利用す
るのがベター
• Microsoftが始めた
OSSプロジェクトで、
現在はCNCFによっ
て管理されている
https://github.com/virtual-kubelet/virtual-kubelet
Virtual
Kubelet
Alibaba Cloud ECI Provider
Azure Container Instances Provider
Azure Batch GPU Provider
AWS Fargate Provider
HashiCorp Nomad
OpenStack Zun
Serverless Container
Serverless Containers = Nodeless Containers
VM、クラスタ
(ノード)が不要
コンピュート課金
オンデマンド実行
可能
AWS FargateAzureContainer
Instances
Alibaba Elastic
Container Instance
KEDA
KEDA
(Kubernetes-based Event Driven Autoscaling Component)
K8sでイベント駆動型の
Podレベルオートスケールを可能にするフレームワーク
• Red HatとMicrosoftのエンジニアリングチームのコラボ
レーションの結果として開始されたプロジェクト
• Kubernetesクラスターにインストールしてイベントベース
のコンテナースケーリングを有効にすることができるオープ
ンソースコンポーネントとして定義される
• CPUメトリックスとメモリを活用してコンテナをゼロからス
ケーリングし、Kubernetes機能を拡張する
KEDAの特徴
イベント
ドリブン
オート
スケーリング
ビルトイン
スケーラー
複数のワーク
ロードタイプ
非ベンダー依存
Azure Functions
サポート
Architecture
• Scaler:選択したソースに接続
して、メトリックを読み取る
• Metrics adapter:Scalerに
よって読み取られたメトリック
をHorizontal Pod Autoscaler
に転送して、アプリの自動ス
ケーリングを有効にする
• Controller:0⇔1のスケーリン
グを提供する
https://keda.sh/concepts/overview/#how-keda-works
KEDA
• Kubernetesのスケーリング「Horizontal pod autoscaler
(HPA)」はPodのCPUやメモリ消費量で調整される
• KEDAは非HTTPなイベントに連動してクラスターへのデプロ
イを自動スケールできる
• HPAなどのKubernetesコンポーネントとネイティブに統合
され、クラウドとエッジの両方で実行できる
• KEDAがZero Scale in/outを行い、他はHPAがScale in/out
する
• 様々なスケーラーが用意されており、今後も追加予定
Scalers
Scalers
• ActiveMQ Artemis
• Apache Kafka
• AWS CloudWatch
• AWS Kinesis Stream
• AWS SQS Queue
• Azure Bob Storage
• Azure Event Hubs
• Azure Log Analytics
• Azure Monitor
• Azure Service Bus
• Azure Storage Queue
• CPU
• Cron
• External
• External Push
• Google Cloud Platform
Pub/Sub
• Huawei Cloudeye
• IBM MQ
• Liiklus Topic
• Memory
• Metrics API
• MySQL
• NATS Streaming
• PostgreSQL
• Prometheus
• RabbitMQ Queue
• Redis Lists
• Redis Streams
KEDAを使用するには
以下の方法でデプロイすることで利用可能
• HelmでKEDAをデプロイ
→通常はこちら
• Kubectlでyamlからのデプロイ
→minikubeなどHelmを使わない場合はこちら
HelmでKEDAをデプロイ
1. Helm repoを追加
2. Helm repoをアップデート
3. KEDAのHelm chartをインストール
$ helm repo add kedacore https://kedacore.github.io/charts
$ helm repo update
$ kubectl create namespace keda
$ helm install keda kedacore/keda --namespace keda
Kubectlでyamlからのデプロイ
1. Githubからサンプルをダウンロードしてインストール
https://github.com/kedacore/keda
$ kubectl apply -f https://github.com/kedacore/keda/releases/download/v2.0.0/keda-2.0.0.yaml
KEDAをデプロイ
• keda-operator podやカスタムリソースが追加される
Azure Functions Core Toolsのインストール
• Azure Functions Core Toolsをインストールすることで
Kubernetes上でAzure Functionsが利用可能となる
• 以前はスケールも自分での実装が必要だったが、KEDAを使
うことでスケールの実装が不要となった
• インストールするには以下のコマンドを投入する
※要作業端末へのAzure Functions Core Toolsインストール
$ func kubernetes install --namespace keda
Azure Functions Core Toolsをデプロイ
• Functionsを実行するのに必要なapiserverなどの podが追
加される
DEMO
DEMO Architecture
Azure Kubernetes Service
Nodes
Web Application
(Pod)
Custom Vision
(Pod)
Storage Account
BLOB
Model
download
Container build/Deploy Custom
Vision
Image upload Webhook
image recognition
Upload
Send slack
BLOB
trigger
BLOB URL
まとめ
• Custom Visionを使うことで簡単に画像判定のモデルが作成
できる
• エクスポートして使うことでクラウドに接続せず、オンプレ
ミスやスマホアプリの中でも利用可能
• KubernetesやServerlessと組み合わせてコンテナアプリとし
て構築することでインターネットに接続できないポリシーの
企業でも利用検討が視野に入ってくる
• まずは試して実践してみてください
• Azure Cognitive Services
• https://docs.microsoft.com/ja-jp/azure/cognitive-services/
• モバイルデバイスで使用するためにモデルをエクスポートする
• https://docs.microsoft.com/ja-jp/azure/cognitive-services/custom-
vision-service/export-your-model
• Custom Vision Serviceを使用してエッジで画像の分類を実行する
• https://docs.microsoft.com/ja-jp/azure/iot-edge/tutorial-deploy-
custom-vision
• KEDA
• https://keda.sh
• Azure Functions Core Tools
• https://docs.microsoft.com/ja-jp/azure/azure-functions/functions-
run-local?tabs=macos%2Ccsharp%2Cbash
参考URL
ご清聴ありがとうございました

More Related Content

PPTX
Ml.NET
PDF
Container x AI
PPTX
Fukuten 20200117 up
PDF
ノーコーディングでAIサービスを使ってみた話
PDF
Vs code conf2020-11-21-extensions-for-microservices-app-dev
PDF
New Features of DotNet 6 Blazor WASM
PDF
Building asp.net core blazor and elasticsearch elasticsearch using visual stu...
PDF
.NET 6 と Blazor で作るクロスプラットフォームアプリ概要
Ml.NET
Container x AI
Fukuten 20200117 up
ノーコーディングでAIサービスを使ってみた話
Vs code conf2020-11-21-extensions-for-microservices-app-dev
New Features of DotNet 6 Blazor WASM
Building asp.net core blazor and elasticsearch elasticsearch using visual stu...
.NET 6 と Blazor で作るクロスプラットフォームアプリ概要

What's hot (20)

PDF
Smart store servlerless-20191030-40min
PDF
[TL04] .NET 15 周年の今こそ考えるクラウドネイティブ アプリケーションと .NET の活用
PDF
.NET 6の期待の新機能とアップデート
PDF
IoT Edge and Serverless playground with Node.js ~ IoT EdgeとサーバレスをNode.jsで遊ぶ実験ノート
PDF
Azure Cosmos DB Emulator on Docker を GitHub Codespaces で動かす!
PPTX
SB TechNight #5 ~AVD構築のアレコレ~
PDF
[AC09] Azure Stack パート1 ~今知っておくべき開発者/インフラ担当者の最新ハイブリッドクラウドとの向きあい方~
PDF
[AC02] Cloud Robotics Azure Platform って何だ!?~ IoT をもっと簡単に、Cloud AI の活用をもっと気軽にや...
PDF
JAZUG Nagoya Windows Azure Update 20140301
PDF
[第50回 Machine Learning 15minutes! Broadcast] Azure Machine Learning - Ignite ...
PDF
20190427 global azurebootcamp
PPTX
Azure Cosmos DB + App Serviceの良い関係
PDF
Building simple-app-using-.net 6 asp.net core web api-blazor web assembly-ela...
PDF
Vs2013 multi device shosuz
PPTX
PythonによるAzureサーバレスアプリケーション開発 / Serverless Application Development with Python
PDF
はじめよう Azure Functions
PDF
Microsoft Azure Update 20151112
PPTX
Logic Apps/Flow Update Summary
PDF
Smart Tennis Lesson Serverless Design
PDF
【de:code 2020】 Azure Cosmos DB - Build 2020 アップデート
Smart store servlerless-20191030-40min
[TL04] .NET 15 周年の今こそ考えるクラウドネイティブ アプリケーションと .NET の活用
.NET 6の期待の新機能とアップデート
IoT Edge and Serverless playground with Node.js ~ IoT EdgeとサーバレスをNode.jsで遊ぶ実験ノート
Azure Cosmos DB Emulator on Docker を GitHub Codespaces で動かす!
SB TechNight #5 ~AVD構築のアレコレ~
[AC09] Azure Stack パート1 ~今知っておくべき開発者/インフラ担当者の最新ハイブリッドクラウドとの向きあい方~
[AC02] Cloud Robotics Azure Platform って何だ!?~ IoT をもっと簡単に、Cloud AI の活用をもっと気軽にや...
JAZUG Nagoya Windows Azure Update 20140301
[第50回 Machine Learning 15minutes! Broadcast] Azure Machine Learning - Ignite ...
20190427 global azurebootcamp
Azure Cosmos DB + App Serviceの良い関係
Building simple-app-using-.net 6 asp.net core web api-blazor web assembly-ela...
Vs2013 multi device shosuz
PythonによるAzureサーバレスアプリケーション開発 / Serverless Application Development with Python
はじめよう Azure Functions
Microsoft Azure Update 20151112
Logic Apps/Flow Update Summary
Smart Tennis Lesson Serverless Design
【de:code 2020】 Azure Cosmos DB - Build 2020 アップデート
Ad

Similar to Open Source x AI (20)

PDF
これから始めるAzure Kubernetes Service入門
PPTX
SIGMOD 2022 Amazon Redshift Re-invented を読んで
PDF
Node.jsアプリの開発をモダン化するために取り組んできたこと
PDF
[Japan Tech summit 2017] DEP 005
PPTX
AKS と ACI を組み合わせて使ってみた
PDF
Azure Batch Renderingではじめるクラウドレンダリング
PDF
Azure Batch Renderingではじめるクラウドレンダリング
PDF
Amazon EC2 Container Service Deep dive
PPTX
はじめてのAzure Web App for Containers! -コンテナの基礎から DevOps 環境の構築まで-
PDF
【de:code 2020】 「あつまれ フロントエンドエンジニア」 Azure Static Web Apps がやってきた
PDF
Build Windows ラップアップ
PPTX
2019年度 CaaS ワークショップ @ NTTコム
PDF
kubernetes on Azure 最新情報
PPTX
Container x azure x kubernetes
PDF
Server side Swift & Photo Booth
PDF
Azureをフル活用したサーバーレスの潮流について
PDF
Microsoft azureで実装するwebserviceondocker
PDF
成長を加速する minne の技術基盤戦略
PDF
2021/03/19 パブリッククラウドを活かす運用プロセス自動化
PDF
クラウド時代のものづくり(分散アーキテクチャ時代におけるWebシステムの開発と運用) #seccamp
これから始めるAzure Kubernetes Service入門
SIGMOD 2022 Amazon Redshift Re-invented を読んで
Node.jsアプリの開発をモダン化するために取り組んできたこと
[Japan Tech summit 2017] DEP 005
AKS と ACI を組み合わせて使ってみた
Azure Batch Renderingではじめるクラウドレンダリング
Azure Batch Renderingではじめるクラウドレンダリング
Amazon EC2 Container Service Deep dive
はじめてのAzure Web App for Containers! -コンテナの基礎から DevOps 環境の構築まで-
【de:code 2020】 「あつまれ フロントエンドエンジニア」 Azure Static Web Apps がやってきた
Build Windows ラップアップ
2019年度 CaaS ワークショップ @ NTTコム
kubernetes on Azure 最新情報
Container x azure x kubernetes
Server side Swift & Photo Booth
Azureをフル活用したサーバーレスの潮流について
Microsoft azureで実装するwebserviceondocker
成長を加速する minne の技術基盤戦略
2021/03/19 パブリッククラウドを活かす運用プロセス自動化
クラウド時代のものづくり(分散アーキテクチャ時代におけるWebシステムの開発と運用) #seccamp
Ad

More from Tsukasa Kato (20)

PDF
すぐにでも使える Windows Virtual Desktop
PDF
ニューノーマルな働き方!?Teams投稿をセンチメント分析!
PDF
WVD運用に欠かせない5つのポイント
PDF
ARM版Windows Virtual Desktop事始め
PDF
Power Automate with kintone
PDF
Azure DevOps と開発管理
PDF
ぼうけんにでかけよう Kubernetes KEDA
PDF
Azure Private Linkのご紹介
PDF
Azure Vnet の拡張と強化
PDF
マネージドBastion​ Azure Bastion​
PDF
SendGridを使ったスマホアプリ運用
PDF
よりお手軽なBotへ 〜APIで効率的なBotを〜
PDF
Container deployment on Azure
PDF
AKS+KEDAで実現!Container Functions Pipeline
PDF
Azuredevopsakskeda
PDF
Build2019発表情報一気見せ
PDF
俺のセキュリティを超えてゆけ
PDF
今後のContainerの行く末の感じたこと、思ったこと 〜JKD参加報告〜
PDF
Azure serverlesssummit2018
PDF
はたらく認証
すぐにでも使える Windows Virtual Desktop
ニューノーマルな働き方!?Teams投稿をセンチメント分析!
WVD運用に欠かせない5つのポイント
ARM版Windows Virtual Desktop事始め
Power Automate with kintone
Azure DevOps と開発管理
ぼうけんにでかけよう Kubernetes KEDA
Azure Private Linkのご紹介
Azure Vnet の拡張と強化
マネージドBastion​ Azure Bastion​
SendGridを使ったスマホアプリ運用
よりお手軽なBotへ 〜APIで効率的なBotを〜
Container deployment on Azure
AKS+KEDAで実現!Container Functions Pipeline
Azuredevopsakskeda
Build2019発表情報一気見せ
俺のセキュリティを超えてゆけ
今後のContainerの行く末の感じたこと、思ったこと 〜JKD参加報告〜
Azure serverlesssummit2018
はたらく認証

Open Source x AI