Optical Character Recognition (OCR) in Python
Optical Character Recognition (OCR) in Python
COURSE CONTENT
Source: https://www.pyimagesearch.com/2017/07/17/credit-card-ocr-with-opencv-and-python/
TEXT DETECTION – CONTROLLED SCENARIOS
TEXT DETECTION – NATURAL SCENARIOS
• Lighting conditions
• Blur
• Resolution What to do?
• Viewing angle
• Non-planar objects
• Objects that are not paper
• Noise in the image
• Unknown layout
• Slanted text
Source: https://www.rsipvision.com/real-time-ocr/
• Different letters
TESSERACT
To recognize an image
containing a single character,
we normally use a
Convolutional Neural
Network (CNN)
Source: Krut Patel
• Tesseract has a function to detect the orientation of the text in the image,
as well as the language it is written in
• This option is called OSD - Orientation and script detection
• Detect if the text in the image is rotated
• If it's rotated, we can apply some kind of preprocessing
THRESHOLDING
Example of a histogram of a
bimodal image
ADAPTIVE THRESHOLDING (GAUSSIAN)
Scale factor:
>1 increase
<1 decrease
sx = sy uniform scale factor (no distortion)
Increase 183%
OpenCV options
• INTER_NEAREST - a nearest neighbor interpolation. It is widely used because it is
the fastest
• INTER_LINEAR - a bilinear interpolation (it's used by default), generally good for
zooming in and out of images
• INTER_AREA - uses the pixel area ratio. May be a preferred method for image
reduction as it provides good results
• INTER_CUBIC - bicubic (4x4 neighboring pixels). It has better results
• INTER_LANCZOS4 - Lanczos interpolation (8x8 neighboring pixels). Among these
algorithms, it is the one with the best quality results
RESIZING
original (50x50) area (400x400) nearest (400x400) linear (400x400) cubic (400x400) lanczos4 (400x400)
http://tanbakuchi.com/posts/comparison-of-openv-interpolation-algorithms/
RESIZING
original (400x400) area (50x50) nearest (50x50) linear (50x50) cubic (50x50) lanczos4 (50x50)
http://tanbakuchi.com/posts/comparison-of-openv-interpolation-algorithms/
MORPHOLOGICAL OPERATIONS – EROSION AND
DILATION
EROSION
DILATION
MORPHOLOGICAL OPERATIONS – OPENING
AND CLOSING
DILATION
EROSION
OPENING
DILATION
CLOSING
NOISE REMOVAL WITH BLUR
Result
Original image
Kernel = average
GAUSSIAN BLUR
Graphic representation of
a 21x21 Gaussian filter
BLUR WITH MEDIAN
Median
EAST (Efficient Accurate Scene Text detector) is a deep learning model, officially published in
2017 by Zhou et al.
• Uses convolutional layers to extract features from images and thus detect the existence of
texts
• It only identifies the location of the text. It is not an OCR that will convert it to characters
• It is one of the most accurate text detection techniques
• It is also one of the best known and gained popularity after the release of version 3.4.2 of
OpenCV, which made it possible to implement it more easily through the DNN module
EAST – TEXT DETECTOR
EAST Paper
https://arxiv.org/abs/1704.03155v2
Mancas-Thillou e Gosselin
https://www.tcts.fpms.ac.be/publications/regpapers/2007/VS_cmtbg2007.pdf
Tesseract OCR
https://github.com/tesseract-ocr/tesseract
EAST geometry
https://stackoverflow.com/questions/55583306/decoding-geometry-output-of-east-text-detection
ARTIFICIAL NEURAL NETWORKS
ARTIFICIAL NEURAL NETWORKS
Axon terminals
Dendrites
Cell body
Axon
ARTIFICIAL NEURAL NETWORKS
Axon terminals
Dendrites Cell body
Axon
Synapse
ARTIFICIAL NEURON
$
𝑠𝑢𝑚 = % 𝑥𝑖 ∗ 𝑤𝑖
!"#
Weights
sum = 0.8 + 0.7 + 0
1 sum = 1.5
0.8
0
Greater or equal to 1 = 1
Sum Step Otherwise = 0
function function
5
ARTIFICIAL NEURON
𝑠𝑢𝑚 = % 𝑥𝑖 ∗ 𝑤𝑖
!"#
0.1
7 ∑ f Output = 0
0
Sum Step
function function
5
“AND” OPERATOR
X1 X2 Class
0 0 0
0 1 0
1 0 0
1 1 1
NEURÔNIO ARTIFICIAL x1 x2 Class
x1 0 0 0
0
0 0*0+0*0=0 0 1 0
x1 1 1 0 0
∑ f 0 0 1 1 1
1*0+0*0=0
0
x2 0 ∑ f 0
0
0–0=0
x2 0 0–0=0
0–0=0
x1 0 1–0=1
0
0*0+1*0=0
x1 1
∑ f 0 0
1*0+1*0=0
0
x2 1 ∑ f 0
0
x2 1
weight(n + 1) = weight(n) + (learningRate * input * error)
weight(n + 1) = 0 + (0.1 * 1 * 1) = 0.1
X1 X2 Class
0 0 0
x1 0 0 1 0
0.5 1 0 0
0 * 0.5 + 0 * 0.5 = 0
x1 1 1 1 1
∑ f 0 0.5
1 * 0.5 + 0 * 0.5 = 0.5
0.5
x2 0 ∑ f 0
0.5
0–0=0
x2 0 0–0=0
0–0=0
x1 0 1–1=0
0.5
0 * 0.5 + 1 * 0.5 = 0.5
x1 1
∑ f 0 0.5
1 * 0.5 + 1 * 0.5 = 1
0.5
x2 1 ∑ f 1
0.5
x2 1
SINGLE LAYER PERCEPTRON
y y
1 0 1 1 1 0
0 0 0
x 1 1 1 0 0 1
0 1 x
0 1
0 0 1
x
0 1
MULTILAYER PERCEPTRON
Hidden layer
Inputs Weights
∑ f Weights
x1
∑ f
∑ f Sum Activation
function function
x2
∑ f
SIGMOID FUNCTION
1
𝑦=
1 + 𝑒 !"
X1 X2 Class
0 0 0
0 1 1
1 0 1
1 1 0
NEURÔNIO
$
𝑠𝑢𝑚 = % 𝑥𝑖 ∗ 𝑤𝑖
ARTIFICIAL 𝑦=
1 x1 x2 Class
Sum = 0 0 0 0
1 + 𝑒 %&
!"# Activation = 0.5
0 1 1
0.5 1 0 1
-0.424
1 1 0
0.358
-0.740 0.5
-0.893 0 * (-0.740) + 0 * (-0.577) = 0
-0.577
0.148
0 * (-0.961) + 0 * (-0.469) = 0
0
Sum = 0
-0.961 Activation = 0.5
-0.469 0.5
NEURÔNIO ARTIFICIAL x1 x2 Class
Sum = 0.358 0 0 0
Activation = 0.589
0 1 1
0.589 1 0 1
-0.424
1 1 0
0.358
-0.740 0.360
-0.893 0 * (-0.740) + 1 * (-0.577) = -0.577
-0.577
0.148
0 * (-0.961) + 1 * (-0.469) = -0.469
1
Sum = -0.469
-0.961 Activation = 0.385
-0.469 0.385
NEURÔNIO ARTIFICIAL x1 x2 Class
Sum = -0.424 0 0 0
Activation = 0.396
0 1 1
0.396 1 0 1
-0.424
1 1 0
0.358
-0.740 0.323
-0.893 1 * (-0.740) + 0 * (-0.577) = -0.740
-0.577
0.148
1 * (-0.961) + 0 * (-0.469) = -0.961
0
Sum = -0.961
-0.961 Activation = 0.277
-0.469 0.277
NEURÔNIO ARTIFICIAL x1 x2 Class
Sum = -0.066 0 0 0
Activation = 0.484
0 1 1
0.484 1 0 1
-0.424
1 1 0
0.358
-0.740 0.211
-0.893 1 * (-0.740) + 1 * (-0.577) = -1.317
-0.577
0.148
1 * (-0.961) + 1 * (-0.469) = -1.430
1
Sum = -1.430
-0.961 Activation = 0.193
-0.469 0.193
NEURÔNIO
$
𝑠𝑢𝑚 = % 𝑥𝑖 ∗ 𝑤𝑖
ARTIFICIAL 𝑦=
1 x1 x2 Class
1 + 𝑒 %& 0 0 0
!"#
0.5 0 1 1
1 0 1
1 1 0
-0.017
0.148
0
0.5
NEURÔNIO ARTIFICIAL x1 x2 Class
0 0 0
0.589 0 1 1
1 0 1
1 1 0
-0.017
0.148
1
0.385
NEURÔNIO ARTIFICIAL x1 x2 Class
0 0 0
0.395 0 1 1
1 0 1
1 1 0
-0.017
0.148
0
0.277
NEURÔNIO ARTIFICIAL x1 x2 Class
0 0 0
0.483 0 1 1
1 0 1
1 1 0
-0.017
0.148
1
0.193
ERROR (LOSS)
• Simplest algorithm
• error = expectedOuput – prediction
0 0 0 0.406 -0.406
0 1 1 0.432 0.568
1 0 1 0.437 0.563
1 1 0 0.458 -0.458
Local minimum
Global minimum
w
GRADIENT (DERIVATIVE)
1
𝑦=
1 + 𝑒 !"
𝑑 = y * (1 – y)
DELTA PARAMETER
Activation function
Derivative
Delta
error
Gradient
w
NEURÔNIO ARTIFICIAL
𝐷𝑒𝑙𝑡𝑎𝑂𝑢𝑡𝑝𝑢𝑡 = 𝐸𝑟𝑟𝑜𝑟 ∗ 𝑆𝑖𝑔𝑚𝑜𝑖𝑑𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 x1 x2 Class
0 0 0
0.5 0 1 1
1 0 1
1 1 0
-0.017
0.5
NEURÔNIO ARTIFICIAL x1 x2 Class
𝐷𝑒𝑙𝑡𝑎𝑂𝑢𝑡𝑝𝑢𝑡 = 𝐸𝑟𝑟𝑜𝑟 ∗ 𝑆𝑖𝑔𝑚𝑜𝑖𝑑𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒
0 0 0
0.589 0 1 1
1 0 1
1 1 0
-0.017
0.385
NEURÔNIO ARTIFICIAL
𝐷𝑒𝑙𝑡𝑎𝑂𝑢𝑡𝑝𝑢𝑡 = 𝐸𝑟𝑟𝑜𝑟 ∗ 𝑆𝑖𝑔𝑚𝑜𝑖𝑑𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 x1 x2 Class
0 0 0
0.395 0 1 1
1 0 1
1 1 0
-0.017
0.277
NEURÔNIO ARTIFICIAL x1 x2 Class
𝐷𝑒𝑙𝑡𝑎𝑂𝑢𝑡𝑝𝑢𝑡 = 𝐸𝑟𝑟𝑜𝑟 ∗ 𝑆𝑖𝑔𝑚𝑜𝑖𝑑𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒
0 0 0
0.483 0 1 1
1 0 1
1 1 0
-0.017
0.193
NEURÔNIO
𝐷𝑒𝑙𝑡𝑎𝐻𝑖𝑑𝑑𝑒𝑛 = ARTIFICIAL
𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒𝑆𝑖𝑔𝑚𝑜𝑖𝑑 ∗ 𝑤𝑒𝑖𝑔ℎ𝑡 ∗ 𝐷𝑒𝑙𝑡𝑎𝑂𝑢𝑡𝑝𝑢𝑡 x1 x2 Class
Sum = 0 0 0 0
Derivative = 0.25
0 1 1
0.5 1 0 1
1 1 0
-0.017
0 Sum = 0
Derivative = 0.25
-0.893
0.5 DeltaOutput = -0.098
0.5
NEURÔNIO
𝐷𝑒𝑙𝑡𝑎𝐻𝑖𝑑𝑑𝑒𝑛 = ARTIFICIAL
𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒𝑆𝑖𝑔𝑚𝑜𝑖𝑑 ∗ 𝑤𝑒𝑖𝑔ℎ𝑡 ∗ 𝐷𝑒𝑙𝑡𝑎𝑂𝑢𝑡𝑝𝑢𝑡 x1 x2 Class
Sum = 0.358 0 0 0
Derivative = 0.242
0 1 1
0.589 1 0 1
1 1 0
-0.017
0 Sum = -0.577
Derivative = 0.230
-0.893
0.360 DeltaOutput = 0.139
0.385
NEURÔNIO
𝐷𝑒𝑙𝑡𝑎𝐻𝑖𝑑𝑑𝑒𝑛 = ARTIFICIAL
𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒𝑆𝑖𝑔𝑚𝑜𝑖𝑑 ∗ 𝑤𝑒𝑖𝑔ℎ𝑡 ∗ 𝐷𝑒𝑙𝑡𝑎𝑂𝑢𝑡𝑝𝑢𝑡 x1 x2 Class
Sum = -0.424 0 0 0
Derivative = 0.239
0 1 1
0.396 1 0 1
1 1 0
-0.017
1 Sum = -0.740
Derivative = 0.219
-0.893
0.323 DeltaOuput = 0.139
0.277
NEURÔNIO
𝐷𝑒𝑙𝑡𝑎𝐻𝑖𝑑𝑑𝑒𝑛 = ARTIFICIAL
𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒𝑆𝑖𝑔𝑚𝑜𝑖𝑑 ∗ 𝑤𝑒𝑖𝑔ℎ𝑡 ∗ 𝐷𝑒𝑙𝑡𝑎𝑂𝑢𝑡𝑝𝑢𝑡 x1 x2 Class
Sum = -0.066 0 0 0
Derivative = 0.250
0 1 1
0.484 1 0 1
1 1 0
-0.017
1 Sum = -1.317
Derivative = 0.167
-0.893
0.211 DeltaOuput = -0.114
0.193
BACKPROPAGATION
0 0
DeltaOutput = -0.098 DeltaOutput = 0.139
0 1
1
1
DeltaOutput = 0.139
DeltaOutput = -0.114
0
1
NEURÔNIO ARTIFICIAL
𝑤𝑒𝑖𝑔ℎ𝑡 𝑤𝑒𝑖𝑔ℎ𝑡 ∗ 𝑚𝑜𝑚𝑒𝑛𝑡𝑢𝑚
𝑛 +1 =
(𝒊𝒏𝒑𝒖𝒕 ∗ 𝒅𝒆𝒍𝒕𝒂 ∗ 𝑙𝑒𝑎𝑟𝑛𝑖𝑛𝑔 𝑟𝑎𝑡𝑒)
𝑛 +
0 0
0 1
1
1
0.323 DeltaOutput = 0.139
0.211 DeltaOutput = -0.114
0
1
NEURÔNIO ARTIFICIAL
𝑤𝑒𝑖𝑔ℎ𝑡 𝑤𝑒𝑖𝑔ℎ𝑡 ∗ 𝑚𝑜𝑚𝑒𝑛𝑡𝑢𝑚
𝑛 +1 =
(𝒊𝒏𝒑𝒖𝒕 ∗ 𝒅𝒆𝒍𝒕𝒂 ∗ 𝑙𝑒𝑎𝑟𝑛𝑖𝑛𝑔 𝑟𝑎𝑡𝑒)
𝑛 +
0 0
DeltaOuput = -0.098 DeltaOutput = 0.139
0 1
0.5 0.385
0.5 * (-0.098) + 0.385 * 0.139 +
0.277 * 0.139 + 0.193 * (-0.114) = 0.021
1
1
DeltaOutput = 0.139
DeltaOutput = -0.114
0
1
0.277
0.193
NEURÔNIO
Learning rate = 0.3 ARTIFICIAL
Momentum = 1
Input x delta -0.017
0.032
-0.893
0.022
0.021
0.148
0 1
0 0
1 1
Rounded!
NEURÔNIO ARTIFICIAL 𝑤𝑒𝑖𝑔ℎ𝑡𝑛 + 1 = 𝑤𝑒𝑖𝑔ℎ𝑡𝑛 ∗ 𝑚𝑜𝑚𝑒𝑛𝑡𝑢𝑚 +
(𝒊𝒏𝒑𝒖𝒕 ∗ 𝒅𝒆𝒍𝒕𝒂 ∗ 𝑙𝑒𝑎𝑟𝑛𝑖𝑛𝑔 𝑟𝑎𝑡𝑒)
0 1
0 0
0 1
1 1
NEURÔNIO ARTIFICIAL 𝑤𝑒𝑖𝑔ℎ𝑡𝑛 + 1 = 𝑤𝑒𝑖𝑔ℎ𝑡𝑛 ∗ 𝑚𝑜𝑚𝑒𝑛𝑡𝑢𝑚 +
(𝒊𝒏𝒑𝒖𝒕 ∗ 𝒅𝒆𝒍𝒕𝒂 ∗ 𝑙𝑒𝑎𝑟𝑛𝑖𝑛𝑔 𝑟𝑎𝑡𝑒)
0 1
0 0
0 1
1 1
-0.581
-0.468
BIAS
-0.851 1
1
Different values even if all entries are zero -0.424
0.358
Change the output
-0.017
0
-0.541
0.145
-0.740 -0.893
-0.577
0.148
1
-0.961 0.985
-0.469
ERROR (LOOS)
• Simplest algorithm
• error = expected output – prediction
0 0 0 0.406 -0.406
0 1 1 0.432 0.568
1 0 1 0.437 0.563
1 1 0 0.458 -0.458
Sum = 1.011
1
Properties Income Risk
Calculates the error for all rows and updates the weights
1 1 100
2 1 1 2 100
2
2
2
2
1
1
2
3
010
100
Batch gradient descent
2 2 1 3 001
2 2 2 3 001
3 2 1 1 100
3 2 2 3 010
1 2 1 3 001
1 1 2 3 001
Calculates the error for each row and updates the weights
1 1 1 1 100
1 1 1 2 010 Stochastic gradient descent
1 1 1 3 001
3 1 1 2 100
3 1 1 1 100
2 1 1 2 100
2 2 1 2 010
2 2 1 3 100
2 2 1 3 001
2 2 2 3 001
3 2 1 1 100
3 2 2 3 010
1 2 1 3 001
1 1 2 3 001
1 1 1 1 100
1 1 1 2 010
1 1 1 3 001
3 1 1 2 100
GRADIENT DESCENT
• Stochastic
• Helps prevent local minima
• Faster (no need to load all rows into memory)
• Mini batch gradient descent
• Choose a number of rows to calculate the error and update the weights
STEP FUNCTION
0 or 1
SIGMOID FUNCTION
1
𝑦=
1 + 𝑒 !"
# @ ! # A@
Y= # @ $ # A@
Y = max(0, x)
Values >= 0
SOFTMAX FUNCTION
#(")
Y=
∑ #(")
Source: https://deepnotes.io/category/cnn-series
LINEAR FUNCTION
PIXELS
LOREM IPSUM
1.
1. Convolution
Part 1 operation
2. Biological
Pooling fundamentals
Single layer perceptron
3.
2. Flattening
Part 2
4. Multi-layer
Dense neuralperceptronnetwork
3. Part 3
Pybrain
Sklearn
TensorFlow
PyTorch
STEP 1:IPSUM
LOREM CONVOLUTION OPERATION
1. Part 1
0 0 0 0 fundamentals
Biological 0 0 0
0 1 0layer
Single 0 perceptron
0 1 0 0
0 0 0 0 0 0 0 1 0 0
2. 0Part
0 0
2 1 0 1 1 X 1 0 1 =
Multi-layer perceptron
0 1 0 1 1 0 0 0 1 1
3. 0Part
1 03 1 1 0 1 Feature detector
Pybrain
0 1 0 0 0 1 1
Feature map
Sklearn Image
TensorFlow
0*1+0*0+0*0+0*1+1*0+0*1+0*0+0*1+0*1=0
PyTorch
STEP 1:IPSUM
LOREM CONVOLUTION OPERATION
0 0 0 0 0 0 0
0 1 0 0 0 1 0 0 1
0 0 0 0 0 0 0 1 0 0
0 0 0 1 0 1 1 X 1 0 1 =
0 1 0 1 1 0 0 0 1 1
0 1 0 1 1 0 1 Feature detector
0 1 0 0 0 1 1
Feature map
Image
0*1+0*0+0*0+1*1+0*0+0*1+0*0+0*1+0*1=1
STEP 1:IPSUM
LOREM CONVOLUTION OPERATION
0 0 0 0 0 0 0
0 1 0 0 0 1 0 0 1 0
0 0 0 0 0 0 0 1 0 0
0 0 0 1 0 1 1 X 1 0 1 =
0 1 0 1 1 0 0 0 1 1
0 1 0 1 1 0 1 Feature detector
0 1 0 0 0 1 1
Feature map
Image
0*1+0*0+0*0+0*1+0*0+0*1+0*0+0*1+0*1=0
STEP 1:IPSUM
LOREM CONVOLUTION OPERATION
0 0 0 0 0 0 0
0 1 0 0 0 1 0 0 1 0 1
0 0 0 0 0 0 0 1 0 0
0 0 0 1 0 1 1 X 1 0 1 =
0 1 0 1 1 0 0 0 1 1
0 1 0 1 1 0 1 Feature detector
0 1 0 0 0 1 1
Feature map
Image
0*1+0*0+0*0+0*1+0*0+1*1+0*0+0*1+0*1=1
STEP 1:IPSUM
LOREM CONVOLUTION OPERATION
0 0 0 0 0 0 0
0 1 0 0 0 1 0 0 1 0 1 0
0 0 0 0 0 0 0 1 0 0 0 2 1 1 2
0 0 0 1 0 1 1 X 1 0 1 = 1 2 2 3 1
0 1 0 1 1 0 0 0 1 1 1 3 3 3 2
0 1 0 1 1 0 1 Feature detector
1 3 1 3 5
0 1 0 0 0 1 1
Feature map
Image
1*1+0*0+0*0+1*1+0*0+1*1+0*0+1*1+1*1=5
STEP 1:IPSUM
LOREM CONVOLUTION OPERATION – RELU
0 0 0 0 0 0 0
0 1 0 0 0 1 0 0 1 0 1 0
0 0 0 0 0 0 0 1 0 0 0 2 1 1 2
0 0 0 1 0 1 1 X 1 0 1 = 1 2 2 3 1
0 1 0 1 1 0 0 0 1 1 1 3 3 3 2
0 1 0 1 1 0 1 Feature detector
1 3 1 3 5
0 1 0 0 0 1 1
Feature map
Image
STEP 1:IPSUM
LOREM CONVOLUTIONAL LAYER
0 0 0 0 0 0 0 0 1 0 1 0
0 1 00 1
0 1 0 0 0 1 0 0 02 11 01 12 0
0 02 11 01 12 0
0 0 0 0 0 0 0 1 02 0220 1131 0110 121 0 0
0 0 0 1 0 1 1 1 02 220 131 110 21 0
1 13 0230 22032 13121 1101 212 0
0 1 0 1 1 0 0 1 13 230 2032 3121 101 12 0
1 13 1311 23032 23252 3213 111 2
0 1 0 1 1 0 1 1 13 311 3032 3252 213 11 2
1 13 311 332 352 23 1
0 1 0 0 0 1 1 1 13 311 332 352 23 1
1 13 31 33 35 2
Image 1 13 31 33 35 2
1 13 31 33 35 2
1 3 1 3 5
The network will decide which feature detector to use 1 3 1 3 5
Feature maps
The convolutional layer is the set of feature maps
STEP 2:
LOREM POOLING
IPSUM
STEP 2:
LOREM POOLING
IPSUM
0 1 0 1 0
0 2 1 1 2 2
1 2 2 3 1
1 3 3 3 2
1 3 1 3 5
Feature map
STEP 2:
LOREM POOLING
IPSUM
0 1 0 1 0
0 2 1 1 2 2 1
1 2 2 3 1
1 3 3 3 2
1 3 1 3 5
Feature map
STEP 2:
LOREM POOLING
IPSUM
0 1 0 1 0
0 2 1 1 2 2 1 2
1 2 2 3 1
1 3 3 3 2
1 3 1 3 5
Feature map
STEP 2:
LOREM POOLING
IPSUM
0 1 0 1 0
0 2 1 1 2 2 1 2
1 2 2 3 1 3
1 3 3 3 2
1 3 1 3 5
Feature map
STEP 2:
LOREM POOLING
IPSUM
0 1 0 1 0
0 2 1 1 2 2 1 2
1 2 2 3 1 3 3
1 3 3 3 2
1 3 1 3 5
Feature map
STEP 2:
LOREM POOLING
IPSUM
0 1 0 1 0
0 2 1 1 2 2 1 2
1 2 2 3 1 3 3 2
1 3 3 3 2
1 3 1 3 5
Feature map
STEP 2:
LOREM POOLING
IPSUM
0 1 0 1 0
0 2 1 1 2 2 1 2
1 2 2 3 1 3 3 2
1 3 3 3 2 3
1 3 1 3 5
Feature map
STEP 2:
LOREM POOLING
IPSUM
0 1 0 1 0
0 2 1 1 2 2 1 2
1 2 2 3 1 3 3 2
1 3 3 3 2 3 3
1 3 1 3 5
Feature map
STEP 2:
LOREM POOLING
IPSUM
0 1 0 1 0
0 2 1 1 2 2 1 2
1 2 2 3 1 3 3 2
1 3 3 3 2 3 3 5
1 3 1 3 5
Feature map
CONVOLUTIONAL
LOREM IPSUM NEURAL NETWORK –
POOLING
0 0 0 0 0 0 0 0 1 0 1 0
0 1 00 1
0 1 0 0 0 1 0 0 2 1 1 2 0
0 1 0 1 2 1 2
0 02 11 01 12 0 2 2 1
0 0 0 0 0 0 0 1 02 0220 1131 0110 121 0 0 3 23 12 2
1 02 220 131 110 21 0 3 23 12 2
0 0 0 1 0 1 1
1 13 0230 22032 13121 1101 212 0 3 33 2352 12 1 2 2
1 13 230 2032 3121 101 12 0 3 33 352 2 1 2
0 1 0 1 1 0 0 3 33 352 2 1 2
1 13 1311 23032 23252 3213 111 2 3 33 352 2 1 2
0 1 0 1 1 0 1 1 13 311 3032 3252 213 11 2 3 33 35 2
1 13 311 332 352 23 1 3 33 35 2
0 1 0 0 0 1 1 1 13 311 332 352 23 1 3 33 35 2
1 13 31 33 35 2 3 3 5
Image 1 13 31 33 35 2 3 3 5
1 13 31 33 35 2
1 3 1 3 5
1 3 1 3 5 Max pooling
Feature maps
STEP 3:
LOREM FLATTENING
IPSUM
2
1
2
2 1 2
3
3 3 2
3
3 3 5
2
Pooled feature
map
3
3
5
STEP 3:
LOREM DENSE
IPSUM NEURAL NETWORK
0.9
0.8
0.1
0.2
0.1
STEP 3:
LOREM DENSE
IPSUM NEURAL NETWORK
0.1
0.2
0.1
0.7
0.9
STEP 3:
LOREM DENSE
IPSUM NEURAL NETWORK
0.1
0.2
0.9
0.2
0.3
STEP 3:
LOREM DENSE
IPSUM NEURAL NETWORK
0.9
65%
0.6
05%
0.6
0.2 30%
0.3
CONVOLUTIONAL
LOREM IPSUM NEURAL NETWORK
0 0 0 0 0 0 0 0 1 0 1 0 2
0
1 0 1 0 2 1 2
0 1 0 0 0 1 0
0 20 11 10 21 0 2 1 2 1
0 0 0 0 0 0 0 0 2 1 1 2 3 32 21 2
1 20 022 131 0 11 1 2 0 3 32 21 2 2
0 0 0 1 0 1 1
1 2 02 13 0 1 1 0 3 33 53
2 21 2
0 1 0 1 1 0 0 1 31 032 2032 1123 10 1 21 0 3 33 53
1 3 03 203 112 10 21 0 3 33
2 5 21 2 3
0 1 0 1 1 0 1 1 31 113 2033 22503 3112 110 21 0 3 3
32
5
21 2
0 1 0 0 0 1 1 1 31 113 2033 22503 3112 110 21 0
3 32 21 2 3
3 33 53
1 3 1 1 203 225 31 11 2 2 21 2
1 3 3 3 2 3 33 53 2
Image 1 3 1 1 203 225 31 11 2 2
1 3 3 3 2 3 33 53
1 3 11 23 25 3 1 2
1 31 32 32 23 1 3 3 5 3
1 3 1 3 5
1 3 3 3 2 3 3 5
1 3 1 3 5 3
1 3 3 3 2
1 3 1 3 5
1 3 1 3 5 5