Hierarchical Attention Modeling for Handwritten Prescription Recognition: A Swin Transformer-Based Solution
Many doctors’ prescriptions are handwritten and often unreadable by the chemist who sells the medicine. Patients have been put in jeopardy as a result. A deep learning architecture based on the Swin Transformer for handwritten medical prescription identification has been proposed in the research paper. The proposed architecture has both a local and a global aspect. To identify character features, the local part uses handwriting features and contextual patterns through a hierarchical attention mechanism. The recommended framework is very easy to comprehend for both the handwriting style and the distortion. The BD dataset has 4,680 labeled images showing 78 different words associated with medicine. Handwritten prescriptions from doctors are included. The dataset also allows for the creation of a comprehensive preprocessing model that scales, normalizes, and applies sophisticated data augmentations that simulate real-world conditions. The test accuracy obtained was 89.0% with macro and weighted F1 scores of 0.88, performing better than some existing techniques involving CNN and CRNN. In addition, the results of the confusion matrix validate the model's ability to detect similar drug names. To demonstrate the efficiency of the model in segregating illegible handwriting from well-written handwriting, a qualitative study of the model’s performance was undertaken. The researchers showed that using the transformer model, they could effectively digitize handwritten prescriptions, which can successfully curb the errors associated with the selling of medicine. The study on the semantic understanding of the obtained results through the application of optical character recognition and language models via multi-modal fusion is a future direction for research.
@article{polisetty2026,
author = {Swetha V Padmavathi Polisetty and Deepthi Godavarthi},
title = {{Hierarchical Attention Modeling for Handwritten Prescription Recognition: A Swin Transformer-Based Solution}},
journal = {Journal of Innovative Image Processing},
volume = {8},
number = {1},
pages = {332-353},
year = {2026},
publisher = {IRO Journals},
doi = {10.36548/jiip.2026.1.018},
url = {https://doi.org/10.36548/jiip.2026.1.018}
}
Copy Citation
- Kumar, C. Srinivasa, Ranga Swamy Sirisati, Viswanath Gudditti, Kanusu Srinivasa Rao, and Ratna Kumari Challa. "A Smart Recommendation System for Medicine Using Intelligent NLP Techniques." In 2022 International Conference on Automation, Computing and Renewable Systems (ICACRS), IEEE, 2022, 1081-1084.
- World health organization, “Medication Without Harm.” [Online]. Available: https://www.who.int/initiatives/medication-without-harm
- Modi, Tasneem, Ntandoyenkosi Khumalo, Rubina Shaikh, Zelna Booth, Stephanie Leigh-de Rapper, and Gillian Dumsile Mahumane. "Impact of Illegible Prescriptions on Dispensing Practice: A Pilot Study of South African Pharmacy Personnel." Pharmacy 10, no. 5 (2022): 132.
- Edlabadkar, Sania Ravindra, and Pranjali P. Joshi. "Accurate Medicine Recognition and Audio Conversion for Handwritten Prescriptions." In 2024 International Conference on Emerging Smart Computing and Informatics (ESCI), IEEE, 2024, 01-06.
- Pavithiran, G., Sharan Padmanabhan, Nuvvuru Divya, V. Aswathy, and B. Chandar. "Doctor's Handwritten Prescription Recognition System in Multi-Language Using Deep Learning." In 2022 International Conference on Power, Energy, Control and Transmission Systems (ICPECTS), IEEE, 2022, 1-5.
- Abdullahi, Abba Khalid, Ibrahim Senire Fatima, Umar Abdurrahaman, Salihu Isa Sa’adatu, Abubakar Bukhari Hafsat, Haruna Abdullahi Abdulrasheed, Umar Abubakar et al. "Assessment of Legibility of Handwritten Prescriptions and Adherence to WHO Prescription Writing Guidelines in Ahmadu Bello University Teaching Hospital Zaria–Kaduna State, Nigeria." Innovations in Pharmacy 14, no. 1 (2023): 10-24926.
- Zia, Javeria, Usman Habib, and Muhammad Asif Naeem. "Extraction and Classification of Medicines from Handwritten Medical Prescriptions." In 2023 18th International Conference on Emerging Technologies (ICET), IEEE, 2023, 104-109.
- Kulathunga, Dinuka, Chamika Muthukumarana, Umindu Pasan, Chamudika Hemachandra, Muditha Tissera, and Hansi De Silva. "Patientcare: Patient Assistive Tool with Automatic Hand-Written Prescription Reader." In 2020 2nd International Conference on Advancements in Computing (ICAC), vol. 1, IEEE, 2020, 275-280.
- Wijewardena, W. R. A. D. "Medical Prescription Identification Solution." PhD diss., 2021.
- Achkar, Roger, Khodor Ghayad, Rayan Haidar, Sawsan Saleh, and Rana Al Hajj. "Medical Handwritten Prescription Recognition Using CRNN." In 2019 International Conference on Computer, Information and Telecommunication Systems (CITS), IEEE, 2019, 1-5.
- Brits, Hanneke, A. Botha, L. Niksch, K. Venter, R. Terblanché, and G. Joubert. "Illegible Handwriting and Other Prescription Errors on Prescriptions at National District Hospital, Bloemfontein." Professional Nursing Today 21, no. 2 (2017): 53-56.
- Fajardo, Lovely Joy, Niño Joshua Sorillo, Jaycel Garlit, Cia Dennise Tomines, Mideth B. Abisado, Joseph Marvin R. Imperial, Ramon L. Rodriguez, and Bernie S. Fabito. "Doctor’s Cursive Handwriting Recognition System Using Deep Learning." In 2019 IEEE 11th international conference on humanoid, nanotechnology, information technology, communication and control, environment, and management (HNICEM), IEEE, 2019, 1-6.
- Jain, Tavish, Rohan Sharma, and Ruchika Malhotra. "Handwriting Recognition for Medical Prescriptions Using a CNN-Bi-LSTM Model." In 2021 6th International conference for convergence in technology (I2CT), IEEE, 2021, 1-4.
- Dhar, Dibyajyoti, Avishek Garain, Pawan Kumar Singh, and Ram Sarkar. "HP_DocPres: A Method for Classifying Printed and Handwritten Texts in Doctor’s Prescription." Multimedia Tools and Applications 80, no. 7 (2021): 9779-9812.
- Richard Molitor, “Tracking e-Script Errors in a Community Pharmacy,” Pharm. Technol., 2025.
- Hassan, Esraa, Habiba Tarek, Mai Hazem, Shaza Bahnacy, Lobna Shaheen, and Walaa H. Elashmwai. "Medical Prescription Recognition Using Machine Learning." In 2021 IEEE 11th Annual Computing and Communication Workshop and Conference (CCWC), IEEE, 2021, 0973-0979.
- Shaw, Utkarsh, Rishab Mamgai, and Isha Malhotra. "Medical Handwritten Prescription Recognition and Information Retrieval Using Neural Network." In 2021 6th International conference on signal processing, computing and control (ISPCC), IEEE, 2021, 46-50.
- Tabassum, Shaira, Ryo Takahashi, Md Mahmudur Rahman, Yosuke Imamura, Luo Sixian, Md Moshiur Rahman, and Ashir Ahmed. "Recognition of Doctors’ Cursive Handwritten Medical Words by Using Bidirectional LSTM and SRP Data Augmentation." In 2021 IEEE technology & engineering management conference-Europe (TEMSCON-EUR), IEEE, 2021, 1-6.
- Carchiolo, Viincenza, Alessandro Longheu, Giuseppa Reitano, and Luca Zagarella. "Medical Prescription Classification: A NLP-based Approach." In 2019 Federated Conference on Computer Science and Information Systems (FedCSIS), IEEE, 2019, 605-609.
- Shaikh, Danish Ali, Burhanuddin Fatehi, Atif Khan, Amaan Shaikh, and Nafisa Mapari. "Voice Prescription Using Natural Language Understanding." In 2022 Second International Conference on Advances in Electrical, Computing, Communication and Sustainable Technologies (ICAECT), IEEE, 2022, 1-6.
- Mia, Abdur Rahim, Mohammad Abdullah-Al-Sajid Chowdhury, Abdullah Al Mamun, Aurunave Mollik Ruddra, and Nawshin Tabassum Tanny. "A Deep Neural Network Approach with Pioneering Local Dataset to Recognize Doctor's Handwritten Prescription in Bangladesh." In 2024 International Conference on Advances in Computing, Communication, Electrical, and Smart Systems (iCACCESS), IEEE, 2024, 1-6.
- Vashist, Prem Chand, Anmol Pandey, and Ashish Tripathi. "A Comparative Study of Handwriting Recognition Techniques." In 2020 International Conference on Computation, Automation and Knowledge Management (ICCAKM), IEEE, 2020, 456-461.
- Karystianis, George, Therese Sheppard, William G. Dixon, and Goran Nenadic. "Modelling and Extraction of Variability in Free-Text Medication Prescriptions from an Anonymised Primary Care Electronic Medical Record Research Database." BMC medical informatics and decision making 16, no. 1 (2015): 18.
- Ali, Usman, Sahil Ranmbail, Muhammad Nadeem, Hamid Ishfaq, Muhammad Umer Ramzan, and Waqas Ali. "Leveraging Deep Learning with Multi-Head Attention for Accurate Extraction of Medicine from Handwritten Prescriptions." In 2024 International Conference on Robotics and Automation in Industry (ICRAI), IEEE, 2024, 1-6.
- Doctor’s Handwritten Prescription BD dataset, “Doctor’s Handwritten Prescription BD dataset.” [Online]. Available: https://www.kaggle.com/datasets/mamun1113/doctors-handwritten-prescription-bd-dataset