APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer...

44
Pierre Villard APACHE Running visual quality inspection at the edge with Apache NiFi & MiNiFi Pierre Villard - @pvillard31

Transcript of APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer...

Page 1: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Pierre VillardAPACHE

Running visual quality inspection at the edge with Apache NiFi & MiNiFi

Pierre Villard - @pvillard31

Page 2: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Pierre Villard // @pvillard31

Customer Engineer @

Committer and PMC member for Apache NiFi (in the community since 2015)

Twitter/Github – @pvillard31

Blog – https://www.pierrevillard.com/

Page 3: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

NiFi - a software developed 13y ago by the NSA

2006NiagaraFiles (NiFi) was first incepted at the National Security Agency (NSA)

November 2014NiFi is donated to the Apache Software Foundation (ASF) through NSA’s Technology Transfer Program and enters ASF’s incubator.

July 2015NiFi reaches ASF top-level project status

Page 5: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

The NiFi ecosystem

⬢ -

⬢ -

⬢ -

⬢ -

⬢ -

⬢ -

Page 6: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

300+ processors for deeper ecosystem integration

Page 7: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

The Apache way: community over codeSubscribe to the mailing lists: https://nifi.apache.org/mailing_lists.html

[email protected] & [email protected]

Open and comment JIRAs: https://issues.apache.org/jira/projects/NIFI

Contribute code: https://nifi.apache.org/developer-guide.htmlhttps://cwiki.apache.org/confluence/display/NIFI/Contributor+Guidehttps://issues.apache.org/jira/projects/NIFI/issues/

Get involved in the code review process: https://github.com/apache/nifihttps://github.com/apache/nifi-registryhttps://github.com/apache/nifi-minifihttps://github.com/apache/nifi-minifi-cpphttps://github.com/apache/nifi-fds

Page 8: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

The Apache NiFi community in few numbers

535+ members on the Slack channel

260+ contributors on Github across the repositories

45 committers in the Apache NiFi community

Apache NiFi 1.10.0 to be released soon (RC vote in progress!)

1M+ docker pulls of the Apache NiFi image

Page 9: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Visual quality inspection:Detect broken cookies

Page 10: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

The ML spectrum in GCP

Page 11: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Continuous model retrain

Ingest dataImage

processing & labeling

Model training / serving / export Detect defect

- Automatically train customized ML models in the cloud- Efficiently acquire images, label images, deploy model and run inference- Continuously refresh models using fresh data from the production lines

Page 12: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Architecture #1 - training & inference in the cloud

Google CloudIoT Core

Google CloudPub/Sub

Google CloudVision

MQTT

HTTPS

Page 13: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Architecture #2 - training in the cloud & inference at the edge

Google CloudIoT Core

Google CloudPub/Sub

Google CloudVisionMQTT

Page 14: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Collect & label data to initialize a dataset

Page 15: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Register my device in Google Cloud IoT Core

Page 16: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Take pictures and send over MQTT

MiNiFi

Page 17: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Ingest images into the dataset

NiFi in GCP

Google CloudIoT Core

Google CloudPub/Sub

Page 18: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github
Page 19: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Configure the device

Page 20: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Set device mode: edge/cloudMiNiFi

mode=edge|cloud

Page 21: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Configure NiFi running on GCP

Page 22: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Variables

Page 23: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Model training

Page 24: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Automate model training

NiFi in GCP

Model training/deploy is triggered every day at midnight

Page 25: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Automate model training

Page 26: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github
Page 27: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Architecture #1 - Model deployment

TL;DR - the model is running in the cloud

Page 28: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Cloud model deployment

NiFi in GCP

Page 29: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Update on the deviceMiNiFi

modelID=ICN147321363982450688

Page 30: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Architecture #2 - Model export

TL;DR - the model is running on the edge

Page 31: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Edge model export into Google Cloud Storage

NiFi in GCP

Page 32: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Update on the deviceMiNiFi

Page 33: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Inference

Page 34: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Inference with model in the cloud

MiNiFi

Page 35: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Inference with model on the edge

MiNiFi

Page 36: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Boosting your edge device with Google’s TPU

https://coral.ai/

https://developers.googleblog.com/2019/10/coral-moves-out-of-beta.html

Page 37: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Processing & Inference time

Architecture Processing time Inference time

Model in the cloud about 6 seconds about 2.5 seconds

Model on the edge about 750 milliseconds about 127 milliseconds

Model on the edge + Coral USB accelerator about 500 milliseconds about 9 milliseconds

Page 38: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Model optimized for Edge TPU

Model non optimized for Edge TPU

Model optimized for Edge TPU

Page 39: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Next steps

● Auto-labeling when confidence is over a given threshold (example: 0.90)○ Will drastically reduce human effort to label newly captured data

● Send inference results along with pictures○ Allow performance monitoring over time, detect outliers and inference performance

Page 40: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Sending inference results along with pictures

MiNiFi

Page 41: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Monitoring dashboards in Stackdriver

Processing timeinference in the cloud

inference on the edge (no TPU)

Scoreinference in the cloud

inference on the edge with low latency model (no TPU)

Score

on the edge with low latency model

(no TPU)

on the edge with Edge TPU optimized

model

Page 42: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Analytics in BigQuery

Page 43: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Conclusion - thanks to NiFi and GCP:

Ingest dataImage

processing & labeling

Model training / serving / export Detect defect

- Codeless deployment of customized ML models on the edge- Feedback loop and continuously updated models- Processing on the edge and optimization with TF Lite et Coral Edge TPU

Page 44: APACHE edge with Apache NiFi & MiNiFi Running …...Pierre Villard // @pvillard31 Customer Engineer @ Committer and PMC member for Apache NiFi (in the community since 2015) Twitter/Github

Pierre Villard - @pvillard31

https://nifi.apache.orghttps://github.com/pvillard31/aceu19

Running visual quality inspection at the edge with

Apache NiFi & MiNiFi

THANKS!

APACHE 2019