The biggest challenge for pharmaceutical inventory management is keeping up a high level of service while properly controlling stocks. To tackle issues like product traceability, theft, expiry management, and data accuracy, automation of inventory management using visual AI offers a streamlined solution.
It is estimated that there is a 20% revenue loss in the pharmaceutical industry during inward inventory and this can pose substantial financial challenges. Manual checks are impractical due to the high volume of items. Computer vision, by combining OCR and deep learning, provides a transformative solution by automating the identification and verification of inventory data, streamlining management processes.
How OCR and Image Segmentation Works
OCR methods, matching groups of pixels on a product’s surface with predefined models, are now outpaced by deep learning technology. Deep learning methods utilizing convolutional neural networks (R-CNN) are being introduced for the recognition of binarized expiration dates and batch codes, even with varied printing methods.
Character recognition involves looking at different image parts, combining information using selective search, and processing with a CNN to generate fixed-size feature vectors. These vectors are input for classification, and a bounding box refinement layer enhances coordinate accuracy.
Image segmentation is used to address challenges such as rotated and tilted text by predicting adaptive threshold values for each pixel, accommodating diverse detection scenarios. Incorporating this adaptive binarization into the segmentation network enhances the accuracy of text detection.
The Issue of Curved Packaging and Possible Solutions
Recognition of texts printed on medicine packages can be complicated for OCR due to the curved package surfaces. The sensor’s view can get distorted by changes in surface shape, colour and printing techniques.
Adaptive filtering and haze removal algorithm filters the sub-images to eliminate noise, smooth background texture, and enhance contrast between text and background. The image is inverted, dehazed, and re-inverted for improvement. Then image noise is removed, edges of objects are detected and two sub-images with maximum intensities are merged. The merged edge image’s text characters are binarized. Finally, morphological opening filters unwanted foreground objects in the binary image.
Evidently, the haze removal algorithm enhances the accuracy of binarization and this improvement leads to high-quality segmentation of the text, making OCR more effective.
What if The Boxes are Upside Down?
For a medicine box that is rotated, the SIFT and SURF algorithms are used to recognize box labels effectively. These computer vision algorithms use special filters and integral images to quickly identify key points in images such as corners or unique patterns. It divides the picture into layers, focusing more on center parts and less on outer edges, mirroring how people’s eyes naturally see things. Hence, these features are effective in enabling computers to read patterns on packages presented at different angles.
Orchestrating OCR and Object Recognition Together
YOLOv8, an anchor-free model, enhances the efficiency of object detection and speeds up processes. Post-detection, Tesseract OCR extracts and recognizes characters. YOLOv8 exhibits promising performance in pharmaceutical class detection, with improving metrics like precision and recall. Its ongoing improvements focus on accurately recognizing medications with variations, ensuring reliable identification, particularly for different dosages.
The good old Easy OCR simplifies text extraction from images using pre-trained models. This user-friendly framework supports multiple languages, ensuring accurate image recognition and easy integration into diverse applications. It effortlessly extracts text from images and videos, parsing crucial information from textual data. The code specifies input directory paths, OCR language preferences, iterates through grayscale images, extracts text, formats data, and saves outputs to CSV files. It provides a streamlined approach for extracting and processing text data from video frames.
OCR-based text extraction effectively parses essential data from medicine strips, extracting attributes like batch numbers, MRPs, MFDs, and expiry dates. YOLO can efficiently identify bounding boxes around medicines. EasyOCR demonstrated remarkable adaptability, recognizing and extracting text from pharmaceutical labels in multiple languages, broadening its applicability for handling products from global markets.
Automating pharmaceutical inventory management with visual AI addresses challenges such as stock control, product traceability, theft, expiry management, and data accuracy. Utilizing computer vision and technologies like OCR, YOLO, SIFT, and SURF enhances efficiency in identifying medication, dates, batch codes, etc., even from different angles. This application not only reduces revenue losses during inward inventory but also promotes financial sustainability and operational security.
As the pharma sector is navigating through evolving technology, Random Walk AI helps drive the industry forward with our AI integration services. Dedicated to leading innovations, we assist in monitoring, optimizing, and implementing AI in operations to ensure they operate at their best and can adapt to changing requirements to reshape pharmaceutical inventory management. Explore further possibilities and insights into AI integration for enhanced solutions at here.