Deep Learning in C# - Coin Recognition in Keras - NET, Part I - CodeProject
Deep Learning in C# - Coin Recognition in Keras - NET, Part I - CodeProject
home articles quick answers discussions features community help Search for articles, questions, tips
In this article, we will examine a convolutional neural network for the problem of coin recognition, and we will implement one in Keras.NET.
Here we will introduce convolutional neural networks (CNNs) and present an architecture of a CNN that we will train to recognize coins.
What is a CNN? As we mentioned in the previous article of the series, a CNN is a class of Neural Network (NN) frequently used for image classification tasks, such as object and face recognition,
and in general for problems where the input can have a grid-like topology. In CNNs, not every node is connected to all nodes of the next layer. This partial connectivity helps prevent overfitting
issues that come up in fully connected NNs, plus speeds up the convergence of the NN.
The core concept surrounding CNNs is that of a mathematical operation known as convolution, which is very common in the field of digital signal processing. Convolution is defined as a product
of two functions, resulting in a third function that represents the amount of overlap between the first two. In the area of CNNs, convolution is achieved by sliding a filter, known as a kernel,
through the image.
In object recognition, the convolution operation allows us to detect different features in the image, such as vertical and horizontal edges, textures, and curves. This is why one of the first layers in
any CNN is a convolutional layer.
Another layer common in CNNs is the pooling layer. Pooling is used to reduce the size of the image representation, which translates to a reduction in the number of parameters and, ultimately,
the computational effort. The most common type of pooling is max pooling, which uses a sliding window similar to the one in the convolution operations to harvest, in every location, the
maximum value from the group of cells being matched. At the end, it builds a new representation of the image from the harvested maximum values.
https://www.codeproject.com/Articles/5284228/Deep-Learning-in-Csharp-Coin-Recognition-in-Keras 1/4
2021/6/26 Deep Learning in C#: Coin Recognition in Keras.NET, Part I - CodeProject
Another concept related to convolution is padding. Padding guarantees that the convolution process will evenly happen across the entire image including the border pixels. This guarantee is
backed by a zero-pixel border that is added around the downscaled image (after pooling) so that the sliding window can go to all pixels of the image the same number of times.
The most common CNN architectures typically start with a convolutional layer, followed by an activation layer, then a pooling layer, and end with a traditional fully connected network such as a
multilayer NN. This type of model, where layers are placed one after the other, is known as a sequential model. Why a fully connected network at the end? To learn a non-linear combination of
features in the transformed image (after convolution and pooling).
The architecture proposed follows a sort of pattern for object recognition CNN architectures; layer parameters had been fine-tuned experimentally.
The result of the fine tuning process of parameters that we went through was partially stored in the Settings class that we present here:
C# Copy Code
https://www.codeproject.com/Articles/5284228/Deep-Learning-in-Csharp-Coin-Recognition-in-Keras 2/4
2021/6/26 Deep Learning in C#: Coin Recognition in Keras.NET, Part I - CodeProject
We now have an architecture for the CNN that we will present in the next article. In the next delivery, we will examine the CNN we implemented for coin recognition using Keras.NET.
License
#1 Free Data Scraping Tool
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL) No Coding Required
Looking for easy yet best Web Scraper
GREPSR.
grepsr.com
OPEN
Computer Scientist and book author living in Belgrade and working for a German IT company. Author of Practical Artificial Intelligence: Machine Learning,
Bots, and Agent Solutions Using C# (Apress, 2018) and PrestaShop Recipes (Apress, 2017). Lover of Jazz and cinema
https://www.codeproject.com/Articles/5284228/Deep-Learning-in-Csharp-Coin-Recognition-in-Keras 3/4
2021/6/26 Deep Learning in C#: Coin Recognition in Keras.NET, Part I - CodeProject
Search Comments
-- There are no messages in this forum --
Permalink
Layout: fixed
|
fluid Article Copyright 2020 by Arnaldo P. Castaño
Advertise
Everything else
Copyright © CodeProject, 1999-2021
Privacy
Cookies
Web03 2.8.20210623.1
Terms of Use
https://www.codeproject.com/Articles/5284228/Deep-Learning-in-Csharp-Coin-Recognition-in-Keras 4/4