Integrating Artificial Intelligence with IoT

bplay2086 70 views 77 slides Sep 05, 2024
Slide 1
Slide 1 of 77
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77

About This Presentation

Topics discussed in these lecture:

Topic 1: Introduction to Machine Learning
Topic 2: Types of Machine Learning (Supervised, Unsupervised, Reinforcement)
Topic 3: Supervised Learning Techniques (Classification, Regression)
Topic 4: Unsupervised Learning Techniques (Clustering)
Topic 5: Neural Netwo...


Slide Content

Integrating Artificial
Intelligence with IoT

Agenda
Intro to Machine
Learning
First Task
Second Task
Tensorflow
Lite
Intro to Neural
Networks
Intro to
Convolutional
Neural Networks

Intro to Machine
Learning
Learn, Adapt, Innovate: Your Guide to
Machine Learning
Let’s start ?

How Humans learn ?

How Humans learn ?
Instruction Experience and
Practice
Feedback
Think of this as a
teacher providing clear
examples
Similar to discovering patterns
or groups in new information
without explicit guidance
Receiving feedback from the
environment or others about the
consequences of actions, which
helps in adjusting behaviors.

How Computer Learn ?

The simple definition of
"Artificially intelligent" is
attempting to simulate human
intelligence, including aspects
that involve learning, which we
aim to replicate through Machine
Learning techniques.

Thank You
Types Of Machine
Learning

UnSupervised Learning
Unsupervised learning is a type of machine
learning technique in which an algorithm
discovers patterns and relationships using
unlabeled data.
The primary goal of Unsupervised learning is often
to discover hidden patterns, similarities, or
clusters within the data which can help in data
exploration, visualization, dimensionality
reduction, and more

Clustering
The process of grouping data points into
clusters based on their similarity. This
technique is useful for identifying patterns
and relationships in data without the need
for labeled examples
Algorithms: K-means, Mean-shift..etc.
One main category of UnSupervised Learning

Supervised Learning
Supervised learning is defined as when a model
gets trained on a “Labelled Dataset”. Labelled
datasets have both input (X) and output
parameters (Y). In Supervised Learning,
algorithms learn to map points between inputs
and correct outputs.
Supervised Learning models have a baseline
understanding of what the correct output values
should be

Two main categories of Supervised Learning
Classification Regression
Deals with predicting categorical target
variables, which represent discrete
classes or labels. For instance, classifying
emails as spam or not spam, or
predicting whether a patient has a high
risk of heart disease.
Algorithms: Logistic Regression, SVM,
Decision Tree, KNN..etc
Deals with predicting continuous target
variables, which represent numerical
values. For example, predicting the
price of a house based on its size and
location, or forecasting the sales of a
product.
Algorithms: Linear Regression, Ridge
Regression, Lasso Regression..etc

In Conclusion, The key difference between supervised and unsupervised
Learning is the Type of data used, whether it’s Labelled or not
Here, the data is
labeled, so what we
did is draw the line
to separate the
classes from one
another
On the other hand,
the data isn’t labeled
so we’re grouping
similar points
together, based on its
attributes/features

450$150$ 250$
100 m
200 m2
2 400 m
2
House Pricing Problem

300 m
2

Y = W X + b
150 100
250 200
400450
=
=
=
+
+
+
? ?

100 m² 200 m² 300 m² 400 m²
0
100
200
300
400
500
Linear Regression

W
b
Parameters

W
We ght
100 m 200 m
2 2
400 m
2
300 m
2

b
Bias

Model is trying to get the best
parameters...
What is Training ?

Y = W X + b
150 100
250 200
400450
=
=
=
+
+
+
0.5 x
0.5 x
0.5 x
100
100
100

Y = W X + b
150 100
250 200
400450
=
=
=
+
+
+
1 x
1 x
1 x
50
50
50

Solving these equations, We get
Model adjusted its parameters
M=100, C=50

Y = W X + B
?
= 1 x 300 + 50
=
350
a 300 m house would cost you 350$
2

Our Model has
finished training
successfully

What if we have Multiple Features ?

W
We ght
100 m 200 m
2 2
400 m
2
300 m
2
1

W
Weight
2

100 m 200 m
2 2
400 m
2
300 m
2
Y = W X + W X + b
1 21 2
Multiple Linear Regression

What is gradient descent?
Gradient Descent is an optimization algorithm
used in machine learning to minimize the cost
function (or error) by iteratively adjusting the
model's parameters
It works by calculating the gradient (slope) of the
cost function with respect to the parameters and
then moving the parameters in the opposite
direction of the gradient to reduce the error. The
process continues until the model reaches the
lowest possible error.

it's like walking down a hill (the cost function)
to find the lowest point (the optimal solution)
by taking small steps in the direction that
decreases the slope the most.
In Simple Terms

Recap

Instruction
For instance, a student learns math by solving
problems with provided solutions to check
correctness.
Machine Learning Model is trained on a dataset
that includes input-output pairs, where the
correct output for each input is provided. This
process is similar to how a student learns math
problems with provided solutions

student exploring different types of plants
and identifying common characteristics
without prior knowledge.
Machine Learning Model produces clusters
or groupings of plants that share similar
characteristics. Each cluster represents a
group of plants with common features.
Experience & Practice

•A student starts at a new school and needs
to find their way to various locations like
classrooms, the cafeteria.
Machine Learning Model learns to
navigate the school (environment) by
exploring different routes (actions) and
receiving feedback (rewards) based on
their performance.
Feedback

Machine learning &
Internet of Things
Predictive Maintenance
Use Case: Predicting equipment
failures before they occur based on
sensor data (e.g., temperature,
vibration).
Smart Healthcare
Use Case: Remote patient monitoring
and early detection of health issues.
Smart Cities
Use Case: Optimizing traffic flow
based on real-time data from
sensors.
Etc...

Thank You
Types Of AI
Learning Algorithms

Types Of AI Learning
Algorithms
Machine Learning
(ML)
Deep Learning
(DL)
Natural Language
Processing
(NLP)
Supervised Learning
(Classification - Regression)
Unsupervised Learning
(Clustering)
Reinforcement Learning (RL)
Neural Network (NNs)
Convolutional Neural
Networks (CNNs)
Recurrent Neural Networks (RNNs)
Long Short-Term Memory (LSTMs)
Bidirectional LSTM (BiLSTM)
Transformers
(Encoders - Decoders)
(BERTs - GPTs )
Generative Adversarial
Networks
(GANs)
Diffusion Models
AI
ML
DL
NN

First
Kahoot

Task 1: Developing a Machine Learning
Model Using LDR Readings
In this task, we aim to develop a machine learning model that utilizes pre-
collected Infrared sensor (IR) readings to predict the distance in cm. The steps
involved include:
Data Preprocessing: 1.
Utilize the provided CSV file containing IR analog signal data (ranging from
0 to 4095) and preprocess it for training the model.
Model Training: 2.
Design and train a simple neural network using a Jupyter Notebook (.ipynb
file). The model will learn the relationship between the input readings and
the corresponding lighting conditions.
Deployment on ESP32: 3.
After training, the model will be converted and deployed onto an ESP32
microcontroller. The ESP32 will use the model to take real-time IR readings
and transform it into distance in cm.
Let’s start ?

Intro to Neural
Networks
From Data to Decisions: Understanding
Neural Networks
Let’s start ?

Single Layer Neural
Network Architecture
Input Layer Hidden Layer Output Layer
Neuron
Weight
Y Z

Neural Network
Architecture
Hidden Layer
Y Z
Y = W X + b
Z = F ( x )
Activation Functions

Hidden Layer
Y Z
Z = F ( x )
Why do we need
Activation Functions ?
Activation Functions
They introduce non-linearity into the model,
allowing it to learn and represent complex
patterns. Without activation functions, the
network would only be able to learn linear
relationships.

Hidden Layer
Y Z
Z = F ( x )
Activation Functions

Activation Functions
Mainly used for
Binary Classification
1
0

Neural Network
Architecture
Input Layer Hidden Layer Output Layer
x1
x2

Why Not Linear
Activation Function?
Input Layer
Hidden Layer Output Layer
x1
x2
Result of Activation
Function
The Actual Value of a
Perceptron

Deep Learning
Architecture

Deployment ?

Intro to CNN
Convolutional
Neural Networks
Where Vision Meets Intelligence
Let’s start ?

•The MNIST database of handwritten digits
has a training set of 60,000 examples, and a
test set of 10,000 examples. .
MNIST Dataset

The kernel is a filter that is used to extract the
features from the images.
The kernel is a matrix that moves over the input
data, performs the dot product with the sub-
region of input data, and gets the output as the
matrix of dot products.
What is a kernel ?
3x3

What Kernels do ?
x

Slide the Kernel over the image to
Extract Features

Main Component in the CNN
Architecture is Conv Layer!!
Conv Layer is a set of kernels!!

CNN Architecture

So... What is the difference between
Neural Networks (NN) and
Convolution Neural Networks
(CNN)?

1 2
3
4
28
.
.
.
1
2
34 28...
28x28

How can we take 2D input and insert it
as input for NN ?
Let’s squeeze them into 1D Array !!

The image, instead of appearing as a 3D
matrix, now appears as a single row of
numbers representing the pixel values.

Is that Efficient?
True & False at the same time

0 -1 0 -1 5 -1 0 -1 0
Because we lose the relationships
between surrounding pixels.

What about in CNN ?
We don’t, that’s why the
accuracy shoots up!

NN
Accuracy
93.0% 99.81%
CNN

Previously...

TensorFlow Lite (TFLite) is a
collection of tools to convert and
optimize TensorFlow models to run
on mobile and edge devices.
You can find ready-to-run
TensorFlow Lite models for a wide
range of ML/AI tasks, or convert and
run TensorFlow and PyTorch models
to the TFLite format using the AI
Edge conversion and optimization
tools.

Key Features
Optimized for on-device
machine learning
Multi-platform support
Multi-framework model
options
Diverse language support High performance

Second
Kahoot

Project

Project Overview
Simple Classification Model predicts the
state of a dependent variable
( ?????? ) Rain based on independent variable.
( x ) Humidity& Temperature.
Get Started
Step 1: Data Collection
Step 2: Train a Simple Model
Step 3: Export Our Model for tflite
Step 4: Convert Model to C++
Step 5: Add TensorFlow Lite Library
Step 6: Add TensorFlow Lite Model
Step 7: Build & Upload Code

Resources
Machine Learning Specialization 1.
https://www.coursera.org/specializations/machine-learning-introduction
1.2. Hands-on Machine Learning with
Scikit-Learn, Keras, and TensorFlow
2. Deep Learning Specialization
https://www.coursera.org/specializations/deeplearning
3. Natural Language Processing
https://www.coursera.org/specializations/natural-language-processing
4. Generative Adversarial Networks GANs
https://www.coursera.org/specializations/generative-adversarial-networks-gans

Supervised
Unsupervised
Classification
Clustering
Other types of Regression
Gradient Descent
Feed Forward
Backpropagation
Tags