1. By Othmane GacemBy Othmane Gacem
The magic behind
AI
By Othmane Gacem
ogacem@outlook.com
2. By Othmane GacemBy Othmane Gacem
Topics
Selected applications of Artificial Neural Network
• How can machines learn
• The difference between our neurones and an
artificial neural network
• Image recognition
• Facial recognition
• Self driving cars
• Handwriting recognition
• Art (neural style transfer)
• AI in business
“People worry that computers will get too smart and take over
the world, but the real problem is that they’re too stupid and
they’ve already taken over the world.”
- Pedro Domingos, author of “The Master Algorithm”
By Othmane Gacem
3. By Othmane GacemBy Othmane Gacem
Make sense of everything
Don’t know what is AI, machine learning, robotics, they similarities and differences ? I got you covered!
AI (Artificial Intelligence)ML (Machine Learning)
Robotics
And robotics in all this ? Isn’t AI something like a robot with human capabilities ? Indeed,
when one searches for AI on google image most pictures represent robots. AI is in fact a
computer algorithm based on statistical techniques and does not necessarily involves
robotics.
Oxford definition of robots: A machine capable of carrying out a complex series of actions
automatically, especially one programmable by a computer.
Robotics is much more about a predefined (pre-programmed) sets of actions while AI’s (in
fact ML) definition from Wikipedia clearly states “without being explicitly programmed”.
Example of robots without AI: robots assembling cars
Example of robots with AI: Sophia, a conversation-able-human looking robot
StatisticsOxford dictionary definition: The practice or
science of collecting and analysing numerical data in
large quantities, especially for the purpose of
inferring proportions in a whole from those in a
representative sample.
-> This is the science which underlies ML and AI
Oxford dictionary definition: The capacity of a
computer to learn from experience, i.e. to modify its
processing on the basis of newly acquired information.
Wikipedia: An interdisciplinary field that uses statistical
techniques to give computer systems the ability to
“learn” (e.g., progressively improve performance on a
specific task) from data, without being explicitly
programmed.
Tools: Supervised learning, Clustering, Dimensionality
reduction, neural networks
Oxford dictionary: The theory and development of computer
systems able to perform tasks normally requiring human
intelligence, such as visual perception, speech recognition, decision-
making, and translation between languages.
Or best: "AI is whatever hasn't been done yet.“ If you cannot
replicate what humans do then it’s not AI.
AI is not a technology in itself, it’s an application of ML for tasks
previously limited to humans.
4. By Othmane GacemBy Othmane Gacem
In more details...
• Artificial Intelligence (AI): AI is not a technology but rather a set of
computer algorithms which can mimic human capacities. For example self
driving car, facial recognition, chat-bot algorithms which all use machine
learning with statistical/mathematical origins. Although the capabilities are
somewhat similar to human capacities the way the computer achieves this is
most probably similar to the way the brain works for the very good reason
that we do not know how the brain works.
• Machine learning: This method is defined by the systematic use of
statistical methods in order to make predictions. But as explained in this
presentation, what is called “learning” is in fact only the ability of the
algorithm to find an equation which makes predictions sufficiently near the
real world data to have a practical use.
• Artificial Neural Networks: ANNs are several machine learning techniques
(mostly logistic regressions) stacked one after the other and very loosely look
like a network of brain neurons because the result of one regression is then
sent to the next steps, similarly to neurons sending chemicals to each others.
ANN are the basis of many applications which mimic human capabilities and
termed AI. They are used in self driving, playing Go and chess etc..
• Natural Language Processing: NLP is an ANN which is specialized in
learning how humans speak and then can form its own sentences and texts
and conduct an almost normal conversation with a human, this is called a
chat-bot. It’s ability to actually understand the meaning of words is extremely
limited.
• Any link to automatization ? Not in the strict sense. Automatization
implies several consecutive pre-programmed steps conducted by a ‘robot’ (a
computer program) for a specific action and can be repeated whenever
needed. So we, human, explicitly program the robot to do whatever we want,
it does not need to learn anything.
5. By Othmane GacemBy Othmane Gacem
Machine Learning: How can a machine “learn” ?
X
Y
Learning is: Cost (Error) minimization
The computer’s algorithm is finding the line which passes closest to the
black points. Here it starts with the red line (1), calculates the cost
(distance between the points and the line, length of the yellow lines)
and then tries to minimize the cost by moving the line to a better place,
here in green. We can see that the blue lines are shorter than the
yellow lines, this is the basic form of learning or training (both words
are used interchangeably here).
1
2
Gradient descent
In this 3D example, the cost, (presented as arrows on the left graph) is the
dependant variable and this time there are two independent variables (x1 & x2).
The algorithm starts at the non-optimal point A (where costs are high). This could be
the equivalent to the red line in example 1, it will then move slowly to the bottom
(local minimum) which is the position of the green line. The fact that the algorithm
gradually goes to the minimal cost point is the learning in machine learning. It
gradually descent to the local minimum.
Linear Regression Gradient Descent
Data points
These points represent the data
from the axis. The axis can
represent age, income, price,
costs, pixel values, location and
any other source of data.
Inspired from the courses “Machine Learning” and “Deep learning specialization” Mafrom Andrew Ng, Co-
founder, Coursera; Adjunct Professor, Stanford University; formerly head of Baidu AI Group/Google Brain
6. By Othmane GacemBy Othmane Gacem
NaturalNeuralNetworkArtificialNeuralNetwork
Neurons
Neurons are brain cells, allowing us to use
our senses and think. They are
interconnected between each other in the
brain and communicate with the help of
chemical signals. Depending on the signal a
neurone gets from its neighbours, it will
choose whether to emit a signal to another
neurone.
Artificial Neural Networks (ANN)
Artificial Neural Networks are a sequence
of mathematical calculations based on
statistical principles. The only reason we
call these Neural Network is simply
because these mathematical calculations
are connected in a way which loosly looks
like neurones in our brain.
Artificial Neurons
Each circle in the picture performs a
mathematical operation and sends the
result to the next circle. Simply as that.
Is AI built the same way as
our brain?
No.
Comparison between Natural and Artificial Neural Networks
7. By Othmane GacemBy Othmane Gacem
AI can see: Image recognition
What we see What a computer sees
Pixel values
The higher
the darker
RGB colors
Red, Green, Blue from
which all other colours
are produced.
Training phase
The neural network analyses
millions of these pixel numbers
(pictures) together with their
labels: “cat” and “No cat”.
New image
The computer sees this
picture for the first time
and must predict if the
picture is a cat or not.
Prediction Cat !
… millions
more
Cat No CatNo Cat CatCat
Prediction
The neural network trained on the pictures with labels
is used again to detect a cat in the new image. The
neural network will essentially compare the new image
with the images it already knows, if the similarity is high
enough it will label it as “cat”.
1 2 3
Artificial Neural Network
A series of regressions
(mathematical equations) which
outputs 1 or 0 at every nodes.
1: Cat
0: No Cat
1 or 0
Inspired from the courses “Machine Learning” and “Deep learning specialization” Mafrom Andrew Ng, Co-
founder, Coursera; Adjunct Professor, Stanford University; formerly head of Baidu AI Group/Google Brain
8. By Othmane GacemBy Othmane Gacem
AI recognises faces: Facial recognition
• Self-driving cars
• Facial recognition
• Augmented reality
• Emotions recognition
• Unlock your phone
• Criminal identification
• Medical diagnosis
• KYC process
Applications for image recognition
input Layer 1 Layer 2 Output
Abasicartificialneuralnetwork
Layer 1
At this level, only simple
features are recognized.
Generally, filters at the
beginning are specialised in
recognising simple features such
as vertical or horizontal lines.
Layer 2
Later, after the superposition
of layers, the neural network
can recognize more complex
features such as eyes, nose,
ears, as seen in the example
for layer 2.
Output
Finally, towards the end, the
neural network can recognize
entire faces allowing it to
confidently recognize a face
or predict whether there is a
cat in the picture.
Input
The image is first transformed
in series of pixel values and
fed into the neural network
as already seen in the image
recognition chapter.
Dive into an ANN
To understand in more details how image recognition is
done, it is important to add some details to our previous
cat example but this time taking the picture of a human.
Let’s dive into what each layer of the neural network
really does.
- Courses “Machine Learning” and “Deep learning specialization” Mafrom Andrew Ng, Co-founder, Coursera; Adjunct Professor, Stanford
University; formerly head of Baidu AI Group/Google Brain
- https://hackernoon.com/what-is-a-capsnet-or-capsule-network-2bfbe48769cc
9. By Othmane GacemBy Othmane Gacem
AI as a driver: Self-driving cars
Left Right
Left Right Left Right
Training Test
Human driver
A human is driving and the computer
observes and keeps in memory the
driving wheel’s position.
Image
The computer takes pictures of the
road ahead, let’s say every second.
Left Right
Learning by observing
The computer compares the pictures
with the driving wheel’s position it
observed while the human driver was
driving. This is how the neural network is
trained.
New road
The computer is now
driving on a new road.
Neural network
The neural network is the same. It
will compare the pictures of the
new road ahead with the ones it
learned.
2
1
3
1
2
3
Inspired from the courses “Machine Learning” and “Deep learning specialization” Mafrom Andrew Ng, Co-founder, Coursera;
Adjunct Professor, Stanford University; formerly head of Baidu AI Group/Google Brain
Prediction
The computer’s prediction (or
decision) is to turn the steering
wheel slightly to the left. It will
then give the order to the car’s
wheels. This process is done
thousand of times per seconds.
10. By Othmane GacemBy Othmane Gacem
Example from Tesla
Road detection
The Tesla car detects the road ahead and it
is demonstrated through this picture where
the road ahead is covered with pink points.
This is possible thanks to the method
described in the previous example!
Multiple cameras
In the previous example, the car used a single front camera taking
pictures of the road ahead. In real-life driving cars make the use of
multiple cameras, radars and other sensors in order to ensure the
detection of not only the road ahead but also the road signs, other
cars and people. But the intuition behind the neural network training
is the same regardless of the type of camera.
https://www.tesla.com/
11. By Othmane GacemBy Othmane Gacem
AI as a reader: Handwriting recognition (Optical Character Recognition)
H
e
l
l
o
W
o
r
l
d
Training Test
Large data base
This process needs to be repeated
for every letter in the alphabet as
well as the numbers and any special
characters.
Training
Once the training is complete,
the ANN contains a great
variety of fonts for each letter.
Trained ANN
After this extensive training, the ANN
is able to predict (read) other people’s
handwriting. In fact, it recognizes that
the H looks very similar to all the H it
has seen during the training and thus
recognizes it as an H, then moves to
the next letter and so on.
Treated as image
The different letters are
treated as pictures in a
similar way as image
recognition seen previously.
1
2
3 4
.
.
.
1 New
Never seen before
handwriting.
Character separation
The first step is to detect
every character and
separate them. This is done
with another neural
network which was trained
for this task, fairly similar to
the “cat not cat” example.
2 3
- Courses “Machine Learning” and “Deep learning specialization” Mafrom Andrew Ng, Co-founder, Coursera; Adjunct Professor,
Stanford University; formerly head of Baidu AI Group/Google Brain
- http://veniceatlas.epfl.ch/atlas/digitization/automatic-transcription/handwritten-text-recognition-with-the-rwth-ocr-system/
Wide range of fonts
First, every letter of the alphabet
needs to be learned. As everyone’s
handwriting is different, the artificial
neural networks also needs to get
used to the different fonts and
handwriting techniques hence the
different As.
12. By Othmane GacemBy Othmane Gacem
AI as an Artist: Style transfer
Content picture
This picture is the object
whose basic shapes will be
retained.
Style picture
This picture contains the
style that we want to
transfer to the content
picture.
Generated image
Starting image
The starting image is composed
of random colours. The goal
being to have a mix of both the
content and style picture.
Intermediate picture
Who said art is what separates humans from robots ?
This method is called “AI style transfer” and enables to create new art
with much less effort. In the future we might see this technique
integrated to augmented reality (AR) headsets and see the world in a
entirely different way !
- Courses “Machine Learning” and “Deep learning specialization” Mafrom Andrew Ng, Co-founder, Coursera; Adjunct
Professor, Stanford University; formerly head of Baidu AI Group/Google Brain
- source: https://github.com/ea167/code-fest
14. By Othmane GacemBy Othmane Gacem
AI in business
• Credit card fraud detection
Machine learning can learn your credit card usage habits, amount spent, where,
when, for what product or services. These are then compared with other people’s
expenses who are similar to you as well as comparing it with your historical
purchases. This data enables to predict if the purchase made right now with your
credit card is made by you or by a thief who stole your credit card information.
• Security thanks to facial recognition
We are all familiar with apple’s face ID, but companies might increasingly rely on
this technology. For instance, by using facial recognition instead of using the actual
entrance pass. This increases the security and avoids risks when a pass is stolen.
• Medical diagnosis
For instance: taking pictures of birth marks to detect a potential cancer.
Birthmarks are at risk of melomania and image recognition can detect this.
There are now apps doing this and often better than a trained doctor.
Business applications for AI are only recently emerging as the costs are going down and some applications are increasingly proving a real
return on investment
Using AI, with techniques explained in this presentation
Meaning the technology mimics human capabilities.
Using machine learning or statistical diagnosis
Not AI in the sense of mimic human capacities. Their application is as
valuable as AI, but AI is just not always necessary.
15. By Othmane GacemBy Othmane Gacem
Scared of AI ?
IS ARTIFICIAL INTELLIGENCE A
DANGER? MORE THAN HALF OF UK
FEARS ROBOTS WILL TAKE OVER
FORGET TERRORISM, CLIMATE CHANGE
AND PANDEMICS: ARTIFICIAL
INTELLIGENCE IS THE BIGGEST THREAT
TO HUMANITY
MICROSOFT’S NADELLA SAYS
AI CAN MAKE THE WORLD
MORE INCLUSIVE AI OFFERS A UNIQUE OPPORTUNITY
FOR SOCIAL PROGRESS
By Othmane Gacem
ogacem@outlook.com