Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the...

27
1 Real-Time Image Recognition Nikita Shamgunov, CEO, MemSQL In-Memory Computing Summit 2017

Transcript of Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the...

Page 1: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

1

Real-Time Image Recognition Nikita Shamgunov, CEO, MemSQL

In-Memory Computing Summit 2017

Page 2: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

2

The future of computing is visual

Page 3: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

3

and also numerical :)

Page 4: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

4

Page 5: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

5

Page 6: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

6

Page 7: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

7

Page 8: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

Putting image recognition to work today

Page 9: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from
Page 10: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

10

How It Works

Page 11: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

11

Real-Time Image Recognition Workflow▪ Train the model with Spark, TensorFlow, and Gluon

▪ Use the Model to extract feature vectors from images • Model + Image => FV

▪ You can store every feature vector in a MemSQL table

CREATE TABLE features ( id bigint(11) NOT NULL AUTO_INCREMENT, image binary(4096) DEFAULT NULL, KEY id (id)USING CLUSTERED COLUMNSTORE )

Page 12: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

12

Working with Feature VectorsFor every image, we store an ID and a normalized feature vector in a MemSQL table called features.

ID | Feature Vector x | 4KB

To find similar images, we use this SQL querySELECT id FROM features WHERE DOT_PRODUCT(feature * <input>) > 0.9

Page 13: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

13

Understanding Dot Product▪ Dot Product is an algebraic operation

• SUM(Xi*Yi) TODO: Put a formula

▪ With the specific model and normalized feature vectors DOT PRODUCT results in a similarity score

• The closer the score is to 1 the more similar are the images

Page 14: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

14

Performance Enhancing TechniquesAchieving best-in-class Dot Product implementation ▪ SIMD-powered ▪ Data compression ▪ Query parallelism ▪ Scale out

▪ Result: Processing at Memory Bandwidth Speed

Page 15: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

15

Performance Numbers▪ Memory Speed: 50GB/sec ▪ Each vector 4K ▪ 12.5 Million Images a second per node

or ▪ 1 Billion images a second on 100 node cluster

Page 16: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

Demo

Page 17: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

17

Demo Architecture

Persistent, Queryable Format

Images ML Framework Model

ML Framework

Real-time image

recognition

Page 18: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

18

SELECT id FROM features WHERE DOT_PRODUCT(image, 0xa334efa…)

Page 19: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

About MemSQL

Page 20: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

▪ Scalable • Petabyte scale • High concurrency • System of record

▪ Real-time • Operational

▪ Compatible • ETL • Business Intelligence • Kafka • Spark

MemSQL: The Real-Time Data Warehouse▪ Deployment

• MemSQL Cloud • Any public cloud • On-premises

▪ Developer Edition • Unlimited scale • Limited high availability

and security features

20

Page 21: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

21

2017 Magic Quadrant for Data Management Solutions for Analytics

Page 22: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

About ML Training

Page 23: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

23

ML training is available through a variety of frameworks, including Spark MLlib,

TensorFlow, Gluon, and Caffe.

Page 24: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

24

Page 25: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

25

ML Frameworks MemSQL

Fast, large scale General processing engines Great for training

Fast, large scale Real-time data warehouse Great for real-time scoring

Understanding ML Frameworks and MemSQL

Page 26: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

Highly parallel, high throughput, bi-directional

26

Example: MemSQL Spark Connector

Page 27: Real-Time Image Recognition - imcsummit.org · 11 Real-Time Image Recognition Workflow Train the model with Spark, TensorFlow, and Gluon Use the Model to extract feature vectors from

Thank you!

@NikitaShamgunov

www.memsql.com