FULL
FULL
The Internship Report submitted to the SRM Arts and Science College in partial fulfilment of
the requirements for the award of the Degree of Master of Computer Science
Submitted by
THILAK R
(832000320)
NOVEMBER 2021
1
BONAFIDE CERTIFICATE
THILAK R
(Register number :832000320)
2
TABLE OF CONTENTS
CHAPTER PAGE
PARTICULARS
NO NO
1 Introduction 1
2 Company profile 2
VI. Implementation
28
VII. Testing
37
5 Approval of Supervisor 43
7 References 45
3
4
1. INTRODUCTION
The purpose of this project is to take handwritten English characters as input,
process the character, train the neural network algorithm, to recognize the pattern and
modify the character to a beautified version of the input.
This project is aimed at developing software which will be helpful in
recognizing characters of English language. This project is restricted to English characters
only. It can be further developed to recognize the characters of different languages. It
engulfs the concept of neural network.
One of the primary means by which computers are endowed with humanlike
abilities is through the use of a neural network. Neural networks are particularly useful for
solving problems that cannot be expressed as a series of steps, such as recognizing
patterns, classifying them into groups, series prediction and data mining.
Pattern recognition is perhaps the most common use of neural networks. The
neural network is presented with a target vector and also a vector which contains the pattern
information, this could be an image and hand written data. The neural network then
attempts to determine if the input data matches a pattern that the neural network has
memorized.
A neural network trained for classification is designed to take input samples and
classify them into groups. These groups may be fuzzy, without clearly defined boundaries.
This project concerns detecting free handwritten characters.
1
2.COMPANY PROFILE
The company known today as Teva started as a small business in Jerusalem in 1901. Teva
has since grown significantly worldwide and is currently among the top 15 global
pharmaceutical Companies 01 - a world leader in generic and specialty medicines.
The company known today as Teva started as a small business in Jerusalem in 1901. The
young company, named after its pharmacist founders, was Salomon, Levin and Elstein Ltd.,
and it distributed imported medicines throughout the region using mule trains and camel
caravans.
Over the following decades, the company’s growth was spurred as demand for locally-
produced medicines grew. In 1976, the company became Teva (" "טבע- the Hebrew word for
“nature”) Pharmaceutical Industries Ltd.
Teva grew significantly across the globe through numerous acquisitions which integrated and
enhanced its expertise in innovative and generic medicines, as well as new therapeutic areas
and markets. Today, Teva is among the top 15 global pharmaceutical companies ― a world
leader in generic and specialty medicines.
As the global leader in generic medicine, nearly 200 million people across six continents take
one of our products every day. We also invest hundreds of millions of dollars every year to
help our scientists develop specialty and biopharmaceutical treatments that aim to increase
access and improve patients’ health. Since Teva’s establishment in 1901 in Jerusalem, our
leadership in healthcare has been marked by tenacity, entrepreneurial spirit, and an aspiration
to improve people's lives. This defines how we do business and motivates thousands of Teva
employees all over the world, every single day. It specializes primarily in generic drugs,
but other business interests include active pharmaceutical ingredients and, to a lesser extent,
proprietary pharmaceuticals. Until 2020, Teva Pharmaceuticals was the largest generic drug
manufacturer, when it was surpassed by US-based Pfizer Teva Pharmaceuticals has an
overall rating of 3.6 out of 5, based on over 1,884 reviews left anonymously by employees.
67% of employees would recommend working at Teva Pharmaceuticals to a friend and 48%
have a positive outlook for the business.
2
3. HANDWRITTEN DIGIT RECOGNITION USING NEURAL
NETWORKS WITH TENSORFLOW
3
3.2. LITERATURE SURVEY
A few state of the art approaches that use hand written character recognition for text
identification have been summarized here:
4
C) Neural based handwritten character recognition
(Hanmandlu M, Murali Mohan K.R,Kumar H.)
This paper explores the existing ring based method (W.I.Reber, 1987), the
new sector based method and the combination of these, termed the Fusion method for the
recognition of handwritten English capital letters. The variability associated with the
characters is accounted for by way of considering a fixed number of concentric rings
in the case of the ring based approach and a fixed number of sectors in the case of
the sector approach. Structural features such as end points, junction points and the number
of branches are used for the pre classification of characters, the local features such as
normalized vector lengths and angles derived from either ring or sector approaches are used
in the training using the reference characters and subsequent recognition of the test
characters. The recognition rates obtained are encouraging.
5
proven by subsequent research works. In general, we categorize those methods into to
gradient-based and edge based feature extraction methods, depending on the low level
features they use. In this paper, the definitions for gradient and edge are extended. Because
an image can also be considered as a grid of image patches, it is therefore
reasonable to incorporate the concept of granules to gradient for a review.
6
3.4. SYSTEM REQUIREMENTS
3.4.1 Hardware and Software Requirements
Python 3.5, Tensorflow Windows7
Processor Dual Core, Intel i3
RAM 2GB RAM
7
3.4.2 High Level Specifications
• Python 3.5
• Intel Dual core Intel i3 Windows7 based personal computer
• 2GB RAM recommended
• 8-bit graphics adapter and display (for 256 simultaneous colors). A 32-bit or
64bit OpenGL capable graphics adapter is strongly recommended.
8
3.5. SYSTEM MODELING AND DESIGN
Purpose
The purpose of this design document is to explore the logical view of
architecture design, sequence diagram, data flow diagram, user interface design of the
software for performing the operations such as pre-processing, extracting features and
Displaying the text present in the images.
Scope
The scope of this design document is to achieve the features of the system such
as pre-process the images, feature extraction, segmentation and display the text present in the image.
9
3.5.1.1 Pre-processing
The pre-processing is a series of operations performed on scanned input
image. It essentially enhances the image rendering it suitable for segmentation. The
role of pre- processing is to segment the interesting pattern from the background.
Generally, noise filtering, smoothing and normalization should be done in this step. The
pre-processing also defines a compact representation of the pattern. Binarization process
converts a gray scale image into a binary image. Dilation of edges in the binarized
image is done using sobel technique.
3.5.1.2 Segmentation
In the segmentation stage, an image of sequence of characters is decomposed
into sub-images of individual character. The pre-processed input image is segmented into
isolated characters by assigning a number to each character using a labelling process. This
labelling provides information about number of characters in the image. Each individual
character is uniformly resized into pixels. Normalization: Afterextracting the character
we need to normalize the size of the characters. There are large variations in the sizes of
each Character hence we need a method to normalize the size.
10
Edge Detection Algorithm
The Edge Detection Algorithm has a list called traverse list. It is the list of
pixel already traversed by the algorithm. EdgeDetection(x,y,TraverseList);
1) Add the current pixel to TraverseList. The current position of pixel is (x,y).
2) NewTraverseList= TraverseList + current position(x,y).
If pixel at (x-1,y-1) then
Check if it is not in TraverseList. Edgedetection(x-1,y-1,NewTraverseList);
end if
If pixel at (x-1,y) then
Check if it is not in TraverseList.
Edgedetection(x-1,y+1,NewTraverseList);
end if
If pixel at (x,y+1) then
Check if it is not in TraverseList. Edgedetection(x,y+1,NewTraverseList);
Endif
3)return
11
extracted from the character image include the positions of different line segments in the
character image. So every character image should be independent of its Image size.
12
Intersections
The definition for intersections is somewhat more complicated. The necessary
but insufficient criterion for a pixel to be an intersection is that it should have more than one
neighbour. A new property called true neighbours is defined for each pixel. Based on the
number of true neighbours for a particular pixel, it is classified as an intersection or
not. For this, neighbouring pixels are classified into two categories, Direct pixels and
diagonal pixels. Direct pixels are all those pixels in the neighbourhood of the
pixel under consideration in the horizontal and vertical directions. Diagonal pixels
are the remaining pixels in the neighbourhood which are in a diagonal direction to the pixel
under consideration. Now for finding number of true neighbours for the pixel under
consideration, it has to be classified further based on the number of neighbours it have
in the character skeleton. Pixels under consideration are classified as those with 3
neighbours: If any one of the direct pixels is adjacent to anyone of the diagonal pixels, then
the pixel under consideration cannot be an intersection, else if none of the neighbouring
pixels are adjacent to each other than its an intersection. 4 neighbours: If each and every
direct pixel has an adjacent diagonal pixel or vice-versa, then the pixel under consideration
cannot be considered as an intersection. 5 or neighbours: If the pixel under consideration
has five or more neighbours, then it is always considered as an intersection once all the
intersections are identified in the image, then they are populated in a list.
Minor Starters
Minor starters are found along the course of traversal along the character
skeleton. They are created when pixel under consideration have more than two
neighbours. There are two conditions that can occur Intersections: When the current pixel
is an intersection. The current line segment will end there and all the unvisited neighbours
are populated in the minor starters list. Non-intersections: Situations can occur where the
pixel under consideration has more than two neighbours but still it’s not an
intersection. In such cases, the current direction of traversal is found by using the
13
position of the previous pixel. If any of the unvisited pixels in the neighbourhood is in this
direction, then it is considered as the next pixel and all other pixels are populated in the
minor starters list. If none of the pixels is not in the current direction of traversal,
then the current segment is ended there and the entireneighbourhood are populated in
the minor starters list.When the algorithm proposed is applied to character ’A’, in
most cases, the minor
starters found are given in the image.
14
image was divided into 3 zones by dividing in the horizontal direction. Then features were
extracted for each such zone.
After zonal feature extraction, certain features were extracted for the entire
image based on the regional properties namely Euler Number: It is defined as the difference
of Number of Objects and Number of holes in the image. For instance, a perfectly
drawn ’A’ would have Euler number as zero, since number of objects is 1 and number of
holes is 2, whereas ‘B’ would have Euler number as -1, since it have two holes
Regional Area: It is defined as the ratio of the number of the pixels in the skeleton to the
total number of pixels in the image. Eccentricity: It is defined as the eccentricity of the
smallest ellipse that fits the skeleton of the image.
3.5.1.3.2 Gradient Feature Extraction.
The gradient measures the magnitude and direction of the greatest change in
intensity in a small neighbourhood of each pixel. (In what follows, "gradient" refers to both
the gradient magnitude and direction). Gradients are computed by means of the Sobel
operator. The Sobel templates used to compute the horizontal (X) & vertical (Y)
components of the gradient are shown in Fig.
15
Figure 5.1.3.2.2: directions of chain codes
3.5.1.4 Classification
Artificial Neural Network
Animals recognize various objects and make sense out of large amount of
visual information, apparently requiring very little effort. Simulating the task
performed by animals to recognize to the extent allowed by physical limitations will be
enormously profitable for the system. This necessitates study and simulation of
Artificial Neural Network. In Neural Network, each node perform some simple
computation and each connection conveys a signal from one node to another labelled by a
number called the “connection strength” or weight indicating the extent to which signal is
amplified or diminished by the connection.
16
Different choices for weight results in different functions are being evaluated by the
network. If in a given network whose weight are initial random and given that we
know the task to be accomplished by the network , a learning algorithm must be used to
determine the values of the weight that will achieve the desired task. Learning
Algorithm qualifies the computing system to be called Artificial Neural Network. The node
function was predetermined to apply specific function on inputs imposing a
fundamental limitation on the capabilities of the network. Typical pattern recognition
systems are designed using two pass. The first pass is a feature extractor that finds
features within the data which are specific to the task being solved (e.g. finding bars of
pixels within an image for character recognition). The second pass is the classifier, which is
more general purpose and can be trained using a neural network and sample data sets.
Clearly, the feature extractor typically requires the most design effort, since it usually must
be hand-crafted based on what the application is trying to achieve.
Back propagation was created by generalizing the Widrow-Hoff learning rule
to multiple-layer networks and nonlinear differentiable transfer functions. Input vectors and
the corresponding target vectors are used to train a network until it can approximate
a function, associate input vectors with specific output vectors, or classify input
vectors in an appropriate way as defined by you. Networks with biases, a sigmoid layer, and
a linear output layer are capable of approximating any function with a finite number of
discontinuities.
17
Figure 3.5.1.4.2: Neural Network
Once the network is trained, the match pattern is obtained to generate the associated
character.
Output will be the beautified version of the uploaded image and will be saved in a
.doc or in text file.
18
Image Processing Toolbox supports a diverse set of image types, including high
dynamic range, giga pixel resolution, embedded ICC profile and tomography. Visualization
functions let you explore an image, examine a region of pixels, adjust the contrast, create
contours or histograms, and manipulate regions of interest (ROIs). With toolbox
algorithms you can restore degraded images, detect and measure features, analyze shapes and
textures, and adjust color balance.
Neural Network Toolbox
Neural Network Toolbox™ provides functions and apps for modeling
complex nonlinear systems that are not easily modeled with a closed-form equation. Neural
Network Toolbox supports supervised learning with feed forward, radial basis, and dynamic
networks. It also supports unsupervised learning with self-organizing maps and competitive
layers. With the toolbox you can design, train, visualize, and simulate neural networks. You can
use Neural Network Toolbox for applications such as data fitting, pattern
recognition, clustering, time-series prediction, and dynamic system modeling and control.
Rational Rose
Rational Rose is an object-oriented Unified Modeling Language (UML) software
design tool intended for visual modeling and component construction of enterprise-level
software applications. In much the same way a theatrical director blocks out a play, a
software designer uses Rational Rose to visually create (model) the framework for an
application by blocking out classes with actors (stick figures), use case elements (ovals),
objects (rectangles) and messages/relationships (arrows) in a sequence diagram using drag-
and-drop symbols. Rational Rose documents the diagram as it is being constructed and then
generates code in the designer's choice of C++, Visual Basic, Java, Oracle8, Corba or
Data Definition Language.
19
3.5.3 Flow Chart
21
Post Condition:Image successfully uploaded.
Extension Scenario: If the image is not compatible. Not possible to upload the file
Pre-processing Module:
Segmentation Module
System segmentation
Figure 3.5.4.1.3: Segmentation Module
User Case & Description
Actor: System
Precondition: Pre-processed image should be available.
Main Scenario: The pre-processed input image is segmented into isolated characters by
assigning a number to each character using a labeling process. This labeling provides
information about number of characters in the image. Each individual character is
uniformly resized into pixels.
Extension Scenario: If the image is not compatible.Not possible to upload file.
Post Condition: Image successfully uploaded
22
3.5.4.2 Sequential Diagram
23
3.5.4.3 Activity Diagram
24
3.5.4.4 Architecture of the system
25
3.5.6 Risks Identified
Python is an interpreted language. The main disadvantage of interpreted languages
is execution speed. When a language is compiled, all of the code is analyzed and
processed efficiently, before the programmer distributes the application. With an interpreted
language, the computer running the program has to analyze and interpret the code (through the
interpreter) before it can be executed (each and every time), resulting in slower processing
performance.
The values of 39 and 35 hidden neurons for gradient features and character geometry
respectively are chosen based on experiments conducted on several different images and are
used by classifiers to produce correct classification results. The variations in the hidden neuron
values might tend to produce wrong result. Hence these values should be carefully chosen.
26
3.6. IMPLEMENTATION
3.6.1 Software and Hardware Used
Software Processor RAM Disk Space
Python 3.7, Dual Core, Intel i3 2048 MB 1 GB for Python
Tensorflow only,5 GB for a
custom installation
27
Key Features
• Image enhancement, including filtering, filters design, deblurring and contrast
enhancement.
• Image analysis including features detection, morphology, segmentation, and
measurement.
• Spatial transformations and image registration.
• Support for multidimensional image processing.
• Support for ICC version 4 color management system.
• Modular interactive tools including ROI selection, histograms and distance
measurements.
• Interactive image and video display.
• DICOM import and export.
3.6.2.4 Python Neural Network Toolbox
Neurolab is a simple and powerful Neural Network Library for Python. Contains based
neural networks, train algorithms and flexible framework to create and explore other neural
network types.
Key Features
• Pure Python + Numpy
• API like Neural Network Toolbox(NNT) from MATLAB
• Interface to use train algorithms form scipy.optimize
• Flexible network configurations and learning algorithms.You may change, train, error,
initialization and activation functions.
• Unlimited number of neural layers and number of neurons in layers.
• Variety of supported types of Artificial Neural Network and learning algorithms.
3.6.2.5 Working of the Modules
When you save your GUI layout, Tensorflow automatically generates an Py-file that
you can use to control how the GUI works. This Py-file provides code to initialize the GUI and
contains a framework for the GUI callbacks the routines that execute in response to user-
generated events such as a mouse click. Using the Py-file editor, you can add code to the
callbacks to perform the functions you want.
Home Page
1. The system displays the Home page with some options.
2. The user will browse for the input image.
3. User clicks on LOAD IMAGE Button to upload the image.
28
Processing Module
1. This GUI will receive the query image.
2. Displays the noiseless image of the uploaded image.
3. The characters are extracted from the image and displayed.
4. Output will be displayed in a .txt /.doc file.
3.6.3 Training and Decoding
• Calculate the HOG features for each sample in the database.
• Train a multi-class linear SVM with the HOG features of each sample along with the
corresponding label.
• Save the classifier in a file
python train.py:This will generate a text log file and a Tensorflow summary.
python test.py: This will generate, for each image, the line transcription. The output will be
written to decoded.txt by default.
python compute_probs.py: This will generate, for each image, the posterior probabilities at
each timestep. Files will be stored in Problem by default.
29
3.6.4 Screen Shots of Project
Home Page
Uploaded Image
30
Character Extraction
Output File
31
3.6.4 Snapshot and description of Experimental Set up
Requirements
• An internet connection
• Python Software
1. Go to python.org/downloads and download the version of Python that you want. In
these examples, I'm downloading Python 3.7.
32
2. Install Python with add PATH to Environment.
33
4. Choose the Location for installation
34
6. Finish Installation, then Open IDLE for Python and check python version
35
3.7. TESTING
3.7.1 Verification
The set of Test Cases are used to test the functionality of each module if that
module works properly then that Test Cases marked as Pass or else Fail.
36
3.7.2 Validation
The below table is used to determine whether or not a system satisfies
the acceptance criteria and to determine whether or not to accept the system.
37
again
38
3.7.4 Test Results
Character Geometry
Gradient Features
39
3.7.4 Evaluation
• The Handwritten Character Recognition system was tested on several different
scanned images containing handwritten text written with different styles and
the results were highly encouraging.
• The proposed method performs preprocessing on the image for removing the
noise and further uses feature extraction using gradient technique OR using
character geometry which gives relatively good classification compared to OCR.
• The method is advantageous as it uses nine features to train the neural network using
character geometry and twelve features using gradient technique. The advantage lies
in less computation involved in feature extraction, training and classification phases
of the method.
• The proposed methodology has produced good results for images
containing handwritten text written in different styles, different size and alignment
with varying background. It classifies most of the handwritten characters
correctly if the image contains less noise in the characters and also in the
background. Characters written with legible handwriting are classified more
accurately.
40