Graphology is a method of identifying, evaluating, and understanding human personality traits through the strokes and patterns revealed by handwriting. Although human intervention in handwriting analysis has been effective, it is costly and prone to error. The project is a small attempt on developing a program that can predict the personality traits with the aid of machine learning without human intervention.
The details of the project is contained in the dissertation report Psychological Analysis based on Handwriting Pattern with ML.pdf provided in this repository.
Support Vector Machines (SVM) are used to classify the following handwriting features into a few selected personality traits.
- Top margin
- Pen pressure
- Baseline angle
- Letter size
- Line spacing
- Word spacing
- Slant angle
- The
extract_routine.pyreads the handwriting images from a folder namedimagesin the same directory and extracts all the features by callingextract.py. The extracted raw feature values are stored in a fileraw_feature_list. - The
raw_feature_listis read byfeature_routine.pyand mapped into discrete values. The discrete values are put into a filefeature_list. - The
label_routine.pygenerates the personality traits of the handwriting features into a filelabel_listby reading thefeature_list. This is where principles of graphology comes into picture. Thelabel_listis used for training the classifiers. - Combinations of the selected handwriting features are used to train eight SVM classifiers to predict eight personality traits of a handwriting image input.
train_predict.pytrains the SVM classifiers by reading thelabel_listand predicts input handwriting image.
For my own educational purpose, I am using the handwriting samples provided by https://fki.tic.heia-fr.ch/databases/iam-handwriting-database for non-profit usage.
The images obtained from the above non-profit source need to be cropped and resized to have similar resolutions of 850 pixels width and ~850 pixels length so that they can be used in the program. Images modification is not in the scope of this project. You can use photoshop or any method of your choice to modify the images en masse.
As there is limit to the size of a commit in Github, I cannot put the data in this repository. The prepared data can be downloaded here https://drive.proton.me/urls/CCFB5R73RG#XUfhPiyr8ZBM