Real-time pill image recognition on edge devices with Adaptive Lightweight Attention
摘要
Medication errors remain a critical challenge in healthcare, particularly for elderly patients and visually impaired individuals. Although existing pill image recognition systems show promise, most operate under controlled laboratory conditions, limiting their real-world applicability. This paper presents an efficient framework for real-time pill image recognition on edge devices using Adaptive Lightweight Attention (ALA). Our approach combines multimodal feature extraction from RGB, contour, texture, and text modalities with an innovative ALA fusion mechanism to achieve high accuracy while maintaining computational efficiency. We conduct dual-dataset evaluation to demonstrate framework adaptability: on the challenging CURE dataset (196 classes, 20–62 samples/class) with cluttered backgrounds and uncontrolled illumination, ALA achieves 96.23% accuracy with real-time performance (3–4 FPS) on resource-constrained edge devices; on the NLM (small) dataset (425 classes, 7 samples/class) under few-shot constraints, the simpler Weighted Sum fusion proves more effective (61.69% vs 60.00% accuracy), revealing that complex attention mechanisms require sufficient training data. Through ONNX optimization on CURE, the model size is reduced by 67% while maintaining 96.23% accuracy, making it highly suitable for edge deployment. These results demonstrate the framework’s potential for practical healthcare applications requiring accurate and efficient pill image recognition across different data regimes.