1 of 58

2 of 58

Machine Learning in the Browser with TensorflowJS

Ekene Ashinze

3 of 58

Ekene Ashinze

Web Developer @OPay

GitHub, Twitter, LinkedIn

@ashinzekene

4 of 58

Ekene Ashinze

Web Developer @OPay

GitHub, Twitter, LinkedIn

@ashinzekene

I’m not a Machine Learning Engineer

5 of 58

Machine Learning

6 of 58

Machine Learning

Machine learning is simply the ability of computers to learn from data without being explicitly programmed.

7 of 58

8 of 58

Types of Machine Learning?

  • Supervised
  • Unsupervised
  • Reinforcement

9 of 58

TensorFlow?

TensorFlow is an end-to-end open source platform for machine learning with a comprehensive, flexible ecosystem of tools, libraries and community resources.

10 of 58

TensorFlow.js?

TensorFlow.js is an open-source hardware-accelerated JavaScript library for training and deploying machine learning models

11 of 58

12 of 58

TensorFlow.js?

  • TensorFlow.js Core, a flexible low-level API, formerly known as deeplearn.js.
  • TensorFlow.js Layers, a high-level API which implements functionality similar to Keras.
  • TensorFlow.js Data, a simple API to load and prepare data
  • TensorFlow.js Converter, tools to import a TensorFlow SavedModel to TensorFlow.js

13 of 58

TensorFlow.js Platform?

NodeJS

Browser

ReactNative

(coming soon)

WeChat

14 of 58

Why TensorFlow.js?

  • Write once, run everywhere
  • Privacy - User’s data remain on their machine
  • Easy to visualize, interactive
  • Sensors (accelerometer, gyroscope camera)
  • No drivers, no installs

15 of 58

Ways in using TensorFlow.js?

  • Predefined Models
  • Transfer Learning
  • Building your model

16 of 58

Terms

  • Tensors
  • Models
  • Epoch
  • Learning rate

17 of 58

Tensor

The central unit of value in tensorflow. A set of values shaped into an array of one or more dimensions

18 of 58

Tensor

19 of 58

Model

A set of functions that finds a relationship between the features and labels of data

20 of 58

Model

21 of 58

Epoch

22 of 58

Pretrained Models

23 of 58

Some Pretrained models in TensorFlow JS

Object detection

Image classification

Pose detection

Speech Commands

Text classification

24 of 58

Mobile Net

25 of 58

Mobile Net

26 of 58

Toxicity

27 of 58

Toxicity

28 of 58

Speech Commands

29 of 58

Speech Commands

30 of 58

Demo One

31 of 58

Building your model

32 of 58

Dataset - Iris

The dataset is a CSV file which contains a set of 150 records under 5 attributes - Petal Length, Petal Width, Sepal Length, Sepal width and Class(Species)

33 of 58

Import and format data

34 of 58

Import and format data

35 of 58

Import and format data

36 of 58

Create ML model

37 of 58

Create ML model

38 of 58

Create ML model

39 of 58

Create ML model

40 of 58

Train and Predict

41 of 58

Demo Two

42 of 58

Transfer Learning

43 of 58

Truncate the preloaded model

44 of 58

Truncate the preloaded model

45 of 58

Truncate the preloaded model

46 of 58

Our model

47 of 58

Our model

48 of 58

Our model

49 of 58

Our model

50 of 58

Merge and Predict

51 of 58

Demo Three

52 of 58

Limits

  • Needs large amount of data (except with pre-trained models)
  • Training on the web is slow. Can take a lot of time
  • Bias and ethics
  • Black boxes

53 of 58

Limits

54 of 58

Other tools

55 of 58

Links

56 of 58

Other links

57 of 58

The only limit to AI is human imagination

― Chris Duffey

58 of 58

Thank you