Joe | AI Engineer
from ai.backend import python
A (backend → AI) story and several thoughts about the future
Joe Tseng
• Backend (AI) engineer
• Tainan.py - organizer
• PyConTW 2015/2016 - speaker
Outline
About the story
Umbo Computer Vision intro
Develop and maintain CV services
Build our machine learning pipelines
What I have learned
About the future
My imagination
Outline
About the story
➡ Umbo Computer Vision intro
Develop and maintain CV services
Build our machine learning pipelines
What I have learned
About the future
My imagination
Autonomous video security systems
400 million cameras
ref: UK Police Scientific and Development Branch (PSDB)
12 or less cameras per
operator
- UK Police Scientific Department
Our Solution
Existing cameras
Umbo Learning
Cameras
Real-time alerts
Umbo Light
Infra
We use a lot of cloud services and have our own GPU clusters
Backend Languages
All our AI team members speak Python ❤
…
Flow
./enter_dev_env.sh + write code with unit tests + code review + CI/CD
Monitoring
We log, monitor and measure our services
Teams
Hardware, Dev, CV, Infra, Research, PoC, QA, FAE …
Develop and maintain all computer vision and
machine learning features
The definition of an AI Engineer
1. Develop and maintain CV services
2. Build our machine learning pipelines
Our jobs
Backend → AI
How ?
Outline
About the story
Umbo Computer Vision intro
➡ Develop and maintain CV services
Build our machine learning pipelines
What I have learned
About the future
My imagination
• On production in 2016
• From PoC projects to online services
Previously on SmartCloud and Umbo Light
The Simplified CV Architecture
Media
Server
CV
Forwarder
Load
Balancer
ZMQ
Stream
Router
Stream
Manager
Stream
Manager
Stream
Manager
Load
Balancer
CV
Worker
CV
Worker
CV
Worker
HTTP
Alert Endpoint
Where is AI?
Media
Server
CV
Forwarder
Load
Balancer
ZMQ
Stream
Router
Stream
Manager
Stream
Manager
Stream
Manager
Load
Balancer
CV
Worker
CV
Worker
CV
Worker
HTTP
Alert Endpoint
Media
Server
CV
Forwarder
Load
Balancer
ZMQ
Stream
Router
Stream
Manager
Stream
Manager
Stream
Manager
Load
Balancer
CV
Worker
CV
Worker
CV
Worker
HTTP
Alert Endpoint
+
How much can the backend do?
87%
How much the backend can do
• Infra
• LB / ASG / VPC …
• Monitoring
• PaperTrail, Cloud Watch …
• Development
• Add new features
• CI/CD
• Maintenance
• Upgrade packages
• Refactor
• Debug
87%
MS
CF
LB SR
SM
SM
SM
LB
CW
CW
CW
AE
• Infra
• LB / ASG / VPC …
• Monitoring
• PaperTrail, Cloud Watch …
• Development
• Add new features
• CI/CD
• Maintenance
• Upgrade packages
• Refactor
• Debug
87%
MS
CF
LB SR
SM
SM
SM
LB
CW
CW
CW
AE
• Stream Router/Manager was written by Python2 ❤ ❤
• Python2 => Python3
• byte string / decode
• isinstance
• format
• API changes
• Results
• Python3 ❤ ❤ ❤
• Enable a lot of cool features
• F-strings, typing, asyncio, tracemalloc, etc.
87%
• Refactor Stream Manager
• Happy to use async/await
• Use pipeline pattern
• Still use run_in_executor/
ThreadPoolExecutor if needed
• Results
• Cleaner architecture
• Performance boost
87%
• Refactor CV Worker
• Lua => Python
• Torch => PyTorch
• Use aiohttp server
• Results
• Easier to maintain/upgrade
• High performance
• GPU resources are the bottleneck
• Python package ecosystem 👍
87%
• Debug
• Use pyflame to profile the program
• Use tracemaclloc to find memory
usage
• Use Valgrind to check your C++
code
• Results
• Understand more and gotcha!
87%
Ping me if you want to listen this
story (and also give us a talk) in
Tainan.py 😼
13%
How much the backend cannot handle
• About Machine Learning
• Not so easy to learn
13%
More than 13%
In fact
• Computer Vision and Machine
Learning
• They are everywhere
• The learning curve is steep
More than 13%
MS
CF
LB SR
SM
SM
SM
LB
CW
CW
CW
AE
You need to delve really deep into
Computer Vision and Machine Learning to
build a self-improving system
Outline
About the story
Umbo Computer Vision intro
Develop and maintain CV services
➡ Build our machine learning pipelines
What I have learned
About the future
My imagination
Why machine learning pipelines?
Improve services => customers 😆
How to improve your services
Measure first
New models / heuristics approaches
Need to do training or redesigning
Need more (or specific) labeled data
Training!
Need to compare with the existing ones
Get the best on production
…
Measure again
👷
Machine Learning Pipelines
• Meet Michelangelo: Uber’s Machine
Learning Platform
• Machine Learning Pipeline for Real-
Time Forecasting @Uber Marketplace
Michelangelo (Uber)
How much can backend do?
0%~87%
Why 0%?
🐵 without domain knowledge
Why 87%?
With domain knowledge + good communication with others + speaking the same language (Python!)
Catch a glimpse of our pipelines
• Can dispatch tasks to
• Our own labelers
• Third-party partners
• MTurkers
• Backend:
• Flask + plugins
• NumPy
• Celery/Redis/Pymongo
• uWSGI
Labeling Platform
source: https://github.com/nightrome/cocostuff
• Can train you a lot of new
models with different parameters
• Backend:
• Airflow
• Celery
Training Pipeline
• Can visualize
• The ground truth data
• The evaluation results
• Backend:
• Flask + plugins
• NumPy
• SQLAlchemy
Visualization Platform
A faster pipeline means a shorter turnaround time!
Speed matters for a startup
Outline
About the story
Umbo Computer Vision intro
Develop and maintain CV services
Build our machine learning pipelines
➡ What I have learned
About the future
My imagination
Recap
Services & Pipelines
Collaboration
Researcher vs. Engineer
Domain Knowledge
Have a basic understanding of ML/CV with practical experience
Python
From different aspects
Outline
About the story
Umbo Computer Vision intro
Develop and maintain CV services
Build our machine learning pipelines
What I have learned
About the future
➡ My imagination
from ai.backend import *
Python, Golang, Java, C#, Javascript, PHP, Ruby, etc.
To build your pipelines, Python is the best
default language
Pipeline → Service
Every young engineer knows machine learning
But some of them may have not heard of GIL 😥
High-quality (ai) backends are needed
Thank you
• Backend, CV, Front-end, App,
QA, FAE, Firmware
• joe.tseng@umbocv.com
We are hiring
from ai.backend import python @ pycontw2018

from ai.backend import python @ pycontw2018