The document discusses character recognition using machine learning. It explains that historic data will be split into training and test data. An algorithm will be trained on the training data and tested on the test data. The machine is then able to predict characters with an accuracy that is verified on the test data. Digital signal processing techniques were adapted to preprocess sensor data and analyze it, with applications in national security and analyzing nuclear weapons tests.
Character Recognition ThroughML 2
Topic Page
Number
1 . What is Character Recognition ? 3
2 . What is Machine Learning ? 4
3 . Character Recognition using Machine Learning 5
4 . Test Conditions 10
5 . Paying Attention to Signal Processing 11
Friday, November 9, 2018
3.
Character Recognition ThroughML 3Friday, November 9, 2018
Character recognition is a process which allows computers to recognize
written or printed characters such as numbers or letters and to change
them into a form that the computer can use.
It is a a magnetic or optical process used to detect the shape of
individual characters printed or written on paper.
Optical character recognition is the mechanical or electronic conversion
of images of typed, handwritten or printed text into machine-encoded
text, whether from a scanned document, a photo of a document, a
scene-photo or from subtitle text superimposed on an image.
4.
Character Recognition ThroughML 4Friday, November 9, 2018
Machine learning is an application of artificial intelligence (AI)
that provides systems the ability to automatically learn and
improve from experience without being explicitly programmed.
Machine learning focuses on the development of computer
programs that can access data and use it learn for themselves.
Machine learning is a field of artificial intelligence that uses
statistical techniques to give computer systems the ability to
"learn" from data, without being explicitly programmed. The
name machine learning was coined in 1959 by Arthur Samuel
5.
Friday, November 9,2018 Character Recognition Through ML 5
What we will do?
We will be taking a Historic Data out
of which we will be seperating data
in two parts :-
1. Test Data
2. Training Data
Now we will train our algorithm
through the train data and test data
will be used for verification purpose
of our machine.
After the verification of the
Machine's Efficienty , We will use it
for our predicting purpose and
hence our machine is trained for
character recognition.
6.
Friday, November 9,2018 Character Recognition Through ML 6
How we will do?
Basically in sklearn library we have
certain sets of digits in the datasets
module . We will call it as an Historic
data by the function
datasets.load_digits() . We will then
seperate it using Support Vector
Machine Also Called svm module of
sklearn library.
The trained Machine is then used for
prediction and for that we will pass
images through imread module of
scipy library . The images passed is
then matched from the trained set
and Result is Given.
7.
Friday, November 9,2018 Character Recognition Through ML 7
The Code ...
#import datasets, classifiers and performance metrics
from sklearn import datasets, svm
#svm = Support Vector Machine
#Standard scientific Python imports
from matplotlib import pyplot as plt
#The digits dataset
digits = datasets.load_digits()
images_and_labels = list(zip(digits.images, digits.target))
#1797 Datasets are available in the library
for index,[image,label] in enumerate(images_and_labels[:5]):
plt.subplot(2,5,index+1)
#Plotting of the training and Test Data and seeing Machine's Efficiency
plt.axis('on')
plt.imshow(image , cmap=plt.cm.gray_r, interpolation='nearest')
#Plotting Image in Grey Scale Data
plt.title('Training: %i' % label
#Here the Test Data is [8 8 4 9 0] and the same is given by our compuer
8.
Friday, November 9,2018 Character Recognition Through ML 8
The Code (Cont...)
n_samples = len(digits.images)
#flattening the data
imageData = digits.images.reshape((n_samples,-1))
print "After Reshaped: len(imagesData[0]): ", len(imageData[0])
classifier = svm.SVC(gamma=0.001)
classifier.fit( imageData[ :n_samples//2],digits.target[ :n_samples//2])
expected = digits.target[n_samples//2:]
predicted = classifier.predict(imageData[n_samples//2: ])
images_and_predictions = list(zip(digits.images[n_samples//2:],
predicted))
for index,[image, prediction] in
enumerate(images_and_predictions[:5]):
plt.subplot(2, 5, index+6)
plt.axis('off')
plt.imshow(image,cmap=plt.cm.gray_r, interpolation='nearest')
plt.title('Prediction: %i' %prediction)
print "Original Values:", digits.target[n_samples//2: (n_samples//2)+5]
plt.show()
9.
Friday, November 9,2018 Character Recognition Through ML 9
The Code (Cont...)
#Install Pillow Library
from scipy.misc import imread, imresize, bytescale
img = imread("Seven.jpeg")
img = imresize(img, (8,8))
img = img.astype(digits.images.dtype)
img =bytescale(img, high=16.0, low=0)
print "img :", img
x_testData = []
for c in img:
for r in c:
x_testData.append(sum(r)/3.0)
print "x_testData :", x_testData
x_testData = [x_testData]
print "len(x_testData) :", len(x_testData)
print "Machine Output: ", classifier.predict(x_testData)
plt.show()
10.
Friday, November 9,2018 Character Recognition Through ML 10
The Test Conditions
We tsted the machine with many predictable and unpredictable conditions and
machine was efficient enough to handle those very easily. The Following results were
given by machine in different conditions. Just Changing a line of code.
11.
Character Recognition ThroughML 11Friday, November 9, 2018
Digital Signal Processing like many other fields of science traces
itself to a very unruly period in history. Interestingly, most of
the developments can trace their origins to either World Wars
or National Security requirements.
In the 1960s, when the Soviets started building nuclear
weapons, the Americans got interested as well and set up
sensors all around Russia. Unfortunately, like every hardware,
the sensor data was full of noise and could not be analyzed.
The Fourier Transform was then adapted for practical use to
properly pre-process data for analysis.
12.
Prepared By -
VedMishra - 1629115
Aman Kumar - 1629126
Palav Anand - 1629149
Ritwik Saurabh - 1629163
Sachin Bhardwaj - 1629165
Shiwangi Singh - 1629174
Anushmita Panigrahi - 1629192
12Character Recognition Through MLFriday, November 9, 2018