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 m
2 2
400 m
2
House Pricing Problem
300 m
2
Y = W X + b
150 100
250 200
400
450
=
=
=
+
+
+
? ?
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
400
450
=
=
=
+
+
+
0.5 x
0.5 x
0.5 x
100
100
100
Y = W X + b
150 100
250 200
400
450
=
=
=
+
+
+
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 2
1 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
3 4 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

Integrating Artificial Intelligence with IoT

  • 1.
  • 2.
    Agenda Intro to Machine Learning FirstTask Second Task Tensorflow Lite Intro to Neural Networks Intro to Convolutional Neural Networks
  • 3.
    Intro to Machine Learning Learn,Adapt, Innovate: Your Guide to Machine Learning Let’s start ?
  • 4.
  • 5.
    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.
  • 6.
  • 7.
    The simple definitionof "Artificially intelligent" is attempting to simulate human intelligence, including aspects that involve learning, which we aim to replicate through Machine Learning techniques.
  • 8.
    Thank You Types OfMachine Learning
  • 10.
    UnSupervised Learning Unsupervised learningis 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
  • 11.
    Clustering The process ofgrouping 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
  • 12.
    Supervised Learning Supervised learningis 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
  • 13.
    Two main categoriesof 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
  • 14.
    In Conclusion, Thekey 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
  • 15.
    450$ 150$ 250$ 100 m200 m 2 2 400 m 2 House Pricing Problem
  • 16.
  • 17.
    Y = WX + b 150 100 250 200 400 450 = = = + + + ? ?
  • 18.
    100 m² 200m² 300 m² 400 m² 0 100 200 300 400 500 Linear Regression
  • 19.
  • 20.
    W We ght 100 m200 m 2 2 400 m 2 300 m 2
  • 21.
  • 22.
    Model is tryingto get the best parameters... What is Training ?
  • 23.
    Y = WX + b 150 100 250 200 400 450 = = = + + + 0.5 x 0.5 x 0.5 x 100 100 100
  • 24.
    Y = WX + b 150 100 250 200 400 450 = = = + + + 1 x 1 x 1 x 50 50 50
  • 25.
    Solving these equations,We get Model adjusted its parameters M=100, C=50
  • 26.
    Y = WX + B ? = 1 x 300 + 50 = 350 a 300 m house would cost you 350$ 2
  • 27.
    Our Model has finishedtraining successfully
  • 28.
    What if wehave Multiple Features ?
  • 29.
    W We ght 100 m200 m 2 2 400 m 2 300 m 2 1
  • 30.
  • 31.
    100 m 200m 2 2 400 m 2 300 m 2 Y = W X + W X + b 1 2 1 2 Multiple Linear Regression
  • 32.
    What is gradientdescent? 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.
  • 33.
    it's like walkingdown 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
  • 34.
  • 35.
    Instruction For instance, astudent 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
  • 36.
    student exploring differenttypes 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
  • 37.
    •A student startsat 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
  • 38.
    Machine learning & Internetof 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...
  • 39.
    Thank You Types OfAI Learning Algorithms
  • 40.
    Types Of AILearning 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
  • 41.
  • 42.
    Task 1: Developinga 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 ?
  • 43.
    Intro to Neural Networks FromData to Decisions: Understanding Neural Networks Let’s start ?
  • 44.
    Single Layer Neural NetworkArchitecture Input Layer Hidden Layer Output Layer Neuron Weight Y Z
  • 45.
    Neural Network Architecture Hidden Layer YZ Y = W X + b Z = F ( x ) Activation Functions
  • 46.
    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.
  • 47.
    Hidden Layer Y Z Z= F ( x ) Activation Functions
  • 48.
    Activation Functions Mainly usedfor Binary Classification 1 0
  • 49.
    Neural Network Architecture Input LayerHidden Layer Output Layer x1 x2
  • 50.
    Why Not Linear ActivationFunction? Input Layer Hidden Layer Output Layer x1 x2 Result of Activation Function The Actual Value of a Perceptron
  • 51.
  • 52.
  • 53.
    Intro to CNN Convolutional NeuralNetworks Where Vision Meets Intelligence Let’s start ?
  • 54.
    •The MNIST databaseof handwritten digits has a training set of 60,000 examples, and a test set of 10,000 examples. . MNIST Dataset
  • 55.
    The kernel isa 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
  • 56.
  • 57.
    Slide the Kernelover the image to Extract Features
  • 58.
    Main Component inthe CNN Architecture is Conv Layer!! Conv Layer is a set of kernels!!
  • 59.
  • 60.
    So... What isthe difference between Neural Networks (NN) and Convolution Neural Networks (CNN)?
  • 61.
  • 62.
    How can wetake 2D input and insert it as input for NN ? Let’s squeeze them into 1D Array !!
  • 63.
    The image, insteadof appearing as a 3D matrix, now appears as a single row of numbers representing the pixel values.
  • 64.
    Is that Efficient? True& False at the same time
  • 65.
    0 -1 0-1 5 -1 0 -1 0 Because we lose the relationships between surrounding pixels.
  • 66.
    What about inCNN ? We don’t, that’s why the accuracy shoots up!
  • 67.
  • 68.
  • 70.
    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.
  • 71.
    Key Features Optimized foron-device machine learning Multi-platform support Multi-framework model options Diverse language support High performance
  • 72.
  • 73.
  • 74.
    Project Overview Simple ClassificationModel 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
  • 75.
    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
  • 77.
    Supervised Unsupervised Classification Clustering Other types ofRegression Gradient Descent Feed Forward Backpropagation