SlideShare a Scribd company logo
#iotsatpn
saturday 2019
Internet of Things
Custom Vision On Edge Device
#disatpn#iotsatpn
Alessio Biasiutti
Azure Solution Architect
alessiobiasiutti
abiasiutti@altitudo.com
@biasiuttiale
#iotsatpn
Agenda
• Edge device come, quando, perché?
• Demo
• Architettura
• Raspberry PI
• IoT Edge / IoT Hub
• Custom Vision
• Edge Stream Analytics
• Riepilogo
#iotsatpn
Edge device come, quando, perché?
• Necessità di comandi e controlli Low-latency
• Connettività limitata al cloud
• Bandwidth limitata
• Compliance
• Privacy
• Necessità di limitare i dati verso il cloud (immagini, video, audio)
• Si ha bisogno di AI/ML all’interno del device
#iotsatpn
Applicazioni
Articoli mancanti negli
scafali dei supermercati
#disatpn#iotsatpn
Applicazioni
Rilevamento persone in coda
o in una stanza
5 min10 min
20 min
#disatpn#iotsatpn
Applicazioni
Rilevamento traffico
Parcheggi
#disatpn#iotsatpn
Applicazioni
Analisi audio e vibrazioni per
rilevamento anomalie
#iotsatpn
Demo
#iotsatpn
Cosa Serve?
Camera Capture
Custom Vision
Stream Analytics
Power BI
IoT Edge Runtime
Raspberry Pi 3 B+
IoT Hub ASA
Azure
Azure
Container
Regestry
#iotsatpn
Hardware – Raspberry PI 3+
• Broadcom BCM2837B0, Cortex-A53 (ARMv8) 64-bit SoC @ 1.4GHz
• 1GB LPDDR2 SDRAM
• 2.4GHz and 5GHz IEEE 802.11.b/g/n/ac wireless LAN, Bluetooth
4.2, BLE
• Gigabit Ethernet over USB 2.0 (maximum throughput 300 Mbps)
• Full-size HDMI
• 4 USB 2.0 ports
• CSI camera port for connecting a Raspberry Pi camera
• DSI display port for connecting a Raspberry Pi touchscreen display
• 4-pole stereo output and composite video port
• Micro SD port for loading your operating system and storing data
• 5V/2.5A DC power input
• Power-over-Ethernet (PoE) support (requires separate PoE HAT)
#iotsatpn
IoT Edge
• Multiple architectures (Intel or ARM CPUs)
• Raspberry Pi
• Industrial PCs
• Dedicated field gateways
• Servers
• IoT Edge Runtime
• IoT Edge Hub
• IoT Edge Agent
• Edge Hub
• Si concentra sulla comunicazione
• Esterna (AMQP e MQTT)
• OT – Edge
• Edge – IoT Hub: in caso di perdita di connessione
bufferizza i dati in locale
• Ricezione comandi
#iotsatpn
IoT Edge - Modules
• Modulo IoT Edge
• Visual Studio o Visual Studio Code
• Container in cui gira un servizio di qualunque tipo
• C, C# (.Net Core 2.1), Java, Node.js, and Python
• Azure Functions in C# (.Net Core 2.1)
• Azure Stream Analytics Edge
• Machine Learning
• Deployment manifest
• Descrive come si colelgano fra loro e quali moduli/versione di container/variabili di ambiente)
• Max 20 moduli per deployment
• L’unico engine supportato in produzione è Moby (open source)
• Per sviluppo va bene anche Docker
• Module Twins
#iotsatpn
IoT Edge - Communication
• IoT Edge Hub
• Internal communication
• Collegamento tra output e
input dei moduli
• IoT Edge Agent
• Inizializza i moduli
• Controlla che siano running
• Download manifest
• Download Immagini dei
moduli
• Verifica delle immagini dei
moduli prima di eseguirli
#iotsatpn
IoT Hub - Firmware update / Monitor
#iotsatpn
Modulo Custom Vision
Pro
• Non serve sapere nulla di AI / Reti Neurali / Python
• Non serve HW dedicato
• Ideale per creare prototipi velocemente
• Ideale anche per ambienti di produzione
• Sicurezza e privacy
#iotsatpn
Custom Vision Object Detection
#iotsatpn
Custom Vision Container
• App
• App.py: start server http
• Labels.txt
• Model.pb: modello TensorFlow
• Object_detection.py: engine
• Predict.py: modulo per eseguire
l’evalute del modello
• DockerFile
• ReadMe.txt
• REST API per valutazione
immagini
#iotsatpn
Valutazione Immagine
• Molti risultati con probabilità
bassa
• Impostare un filtro
• Eliminare quelli sovrapposti
#iotsatpn
Camera Capture Container
• Modulo Python
• Utilizzo di OpenCV
• Chiama direttamente Custom Vision via HTTP
• Riquadra l’immagine con i bounding box di ritorno da
CV
• Emette l’immagine via WebSocket (debug)
• Ricompilare OpenCV per Arm32v7
#disatpn#iotsatpn
Stream Analytics Edge
• Query SQL
• Funzionalità simili alla versione
cloud
• UDF in C# (no JavaScript)
• Conta il numero di oggetti e
trasforma il risultato complesso di
Custom Vision
#disatpn#iotsatpn
Query
WITH
BBOX AS (
SELECT
C.Created,
P.arrayvalue.tagName as TagName,
P.arrayvalue.probability
FROM
camera as C Timestamp by Created
CROSS APPLY GetArrayElements(C.predictions) AS P
WHERE
P.arrayvalue.probability > 0.4
),
STATS AS (
SELECT
Created,
TagName,
COUNT(*) AS Quantity,
AVG(Probability) AS Probability
FROM
BBOX
GROUP BY
Created, TagName, TUMBLINGWINDOW(ss, 5)
)
SELECT
TagName,
System.Timestamp as TimeStamp,
AVG(Quantity) AS Quantity,
SUM(Quantity*Probability)/SUM(Quantity) as Probability
INTO
IoTHub
FROM
Stats
GROUP BY
TagName, TUMBLINGWINDOW(ss, 5)
• Input
#disatpn#iotsatpn
Stream Analytics Edge
• Input
• Output
#disatpn#iotsatpn
Deployment manifest
#disatpn#iotsatpn
Tips and Tricks
#disatpn#iotsatpn
Deploy
Container
Camera Capture
Stream Analytics
Engine
Deployment
manifest
Job Definition
Container
Custom Vision
#iotsatpn
Visual Studio Code
• Cosa si può fare
• Creare moduli
• Crare deployment descriptor
• Dubug
• Publish
• Gestire container
• Comandare docker
#disatpn#iotsatpn
Riepilogando
Camera Capture
Custom Vision
Stream Analytics
Power BI
IoT Edge Runtime
Raspberry Pi 3 B+
IoT Hub ASA
Azure
Azure
Container
Regestry
#iotsatpn
Power BI
• Streaming Dataset
• Dataset creato alla prima ricezione di un dato
• 1,000,000 rows per ora
• 15KB per pacchetto
• 1 una chiamata all’API per secondo
• Limitare l’invio dei dati altrimenti ci possono essere dei problemi con
l’aggiornamento del grafico
#disatpn#iotsatpn
Uno sguardo veloce al codice
#disatpn#iotsatpn
Question Time
#disatpn#iotsatpn
Grazie!

More Related Content

PDF
Azure day 2019 - Custom Vision on Edge device
PDF
PoC IoT in 1 ora
PPTX
Industrial Iot - IotSaturday
PPTX
Mobile e Smart Client
PPTX
Microsoft Azure per l'IT Pro
PPTX
Gam05 costruisci il tuo antifurto perfetto con kinect e gli azure mobile se...
PPTX
Industrial iot: dalle parole ai fatti
PDF
SkyMedia: La tecnologia al servizio dell'intrattenimento
Azure day 2019 - Custom Vision on Edge device
PoC IoT in 1 ora
Industrial Iot - IotSaturday
Mobile e Smart Client
Microsoft Azure per l'IT Pro
Gam05 costruisci il tuo antifurto perfetto con kinect e gli azure mobile se...
Industrial iot: dalle parole ai fatti
SkyMedia: La tecnologia al servizio dell'intrattenimento

Similar to IoT Saturday 2019 - Custom Vision on Edge device (20)

PPTX
Power BI Streaming Data Flow e Azure IoT Central
PPTX
ASP.NET MVC: Andare oltre il 100% (Web@work)
PDF
#dd12 Applicazioni a tre voci (Android e Domino)
PPTX
Slide typescript - xe dotnet - Codemotion Rome 2015
PPTX
Are you a Gadgeteer? - NetMF@Work
PPTX
ASP.NET Core Services e Linux per il Mobile - Pietro Libro - Codemotion Rome...
PPTX
.NET Core, ASP.NET Core e Linux per il Mobile
PPTX
TYPESCRIPT, ANGULAR E BOOTSTRAP ASSIEME PER APPLICAZIONI REAL WORLD
PPTX
Slide typescript - net campus
PPTX
Power BI Streaming Data Flow e Azure IoT Central
PDF
Meetup DotNetCode A.I. Bot Framework and Azure Functions
PPTX
Kivy Python Framework - di Gioele Gaggio
PDF
iot Saturday 2019 - PoC iot in 1 ora
PPTX
Predictive Maintenance per le aziende del nord-est con Azure e IoT
PPTX
Application insights - Meet{cast} - Meetup #AperiTech dotNET{podcast} - Marzo...
PPTX
Akka.net & Actor Model
PDF
Dynamic Language Programming For The Statically Typed Programmer
PDF
Azure Saturday Pordenone 2018 IoT real time processing for lazy developer
PPTX
Power BI data flow and Azure IoT Central
PDF
Meetup Azure DevOps
Power BI Streaming Data Flow e Azure IoT Central
ASP.NET MVC: Andare oltre il 100% (Web@work)
#dd12 Applicazioni a tre voci (Android e Domino)
Slide typescript - xe dotnet - Codemotion Rome 2015
Are you a Gadgeteer? - NetMF@Work
ASP.NET Core Services e Linux per il Mobile - Pietro Libro - Codemotion Rome...
.NET Core, ASP.NET Core e Linux per il Mobile
TYPESCRIPT, ANGULAR E BOOTSTRAP ASSIEME PER APPLICAZIONI REAL WORLD
Slide typescript - net campus
Power BI Streaming Data Flow e Azure IoT Central
Meetup DotNetCode A.I. Bot Framework and Azure Functions
Kivy Python Framework - di Gioele Gaggio
iot Saturday 2019 - PoC iot in 1 ora
Predictive Maintenance per le aziende del nord-est con Azure e IoT
Application insights - Meet{cast} - Meetup #AperiTech dotNET{podcast} - Marzo...
Akka.net & Actor Model
Dynamic Language Programming For The Statically Typed Programmer
Azure Saturday Pordenone 2018 IoT real time processing for lazy developer
Power BI data flow and Azure IoT Central
Meetup Azure DevOps
Ad

More from Alessio Biasiutti (6)

PPTX
Tutto quello che non vi hanno mai detto su Azure Integration Services (Logic ...
PPTX
Power Platform: AI Builder la democratizzazione di AI
PDF
SQL Saturday 2019 - Event Processing with Spark
PPTX
XE - Azure in the real world
PDF
Custom vision on edge device
PDF
Visual Studio for IoT Solutions
Tutto quello che non vi hanno mai detto su Azure Integration Services (Logic ...
Power Platform: AI Builder la democratizzazione di AI
SQL Saturday 2019 - Event Processing with Spark
XE - Azure in the real world
Custom vision on edge device
Visual Studio for IoT Solutions
Ad

IoT Saturday 2019 - Custom Vision on Edge device