## 3 Materials and Methods
### Implementation and System Deployment  
To ensure the efficient deployment of the pharmaceutical classification system, we implemented a robust deep learning framework utilizing Python (version 3.9.20) as the primary programming language. The system was designed to leverage Python's extensive ecosystem of scientific computing libraries and deep learning frameworks, enabling optimized model training, evaluation, and real-time inference. For the web server implementation, we employed Flask (version 3.1.0), a lightweight WSGI web application framework, which facilitated the seamless integration of the pharmaceutical classification model into a networked environment. This ensured real-time processing capabilities, making the system suitable for mobile-based deployment. The classification model development was based on the Fastai library (version 2.7.18), a high-level deep learning API built on PyTorch (version 2.6.0). Fastai provided sophisticated tools for model construction and fine-tuning, advanced data augmentation techniques, discriminative learning rates for optimized training, and progressive resizing to enhance generalization performance. These features were critical in optimizing the classification model's accuracy while ensuring efficient computation, making it suitable for real-world healthcare applications. To systematically validate the system, we implemented rigorous evaluation protocols to assess the classification precision across various pharmaceutical compounds. Through quantitative performance analysis, we established reliable classification benchmarks that could translate effectively into clinical and pharmaceutical applications. Figure 9: Architecture of the ResNet101 model. The residual learning framework facilitates stable gradient propagation, enhancing classification accuracy while maintaining computational efficiency. Figure 10 presents an overview of the implementation workflow, illustrating the sequential process from data acquisition to model training, validation, and deployment. The pharmaceutical classification system follows a structured seven-step process, ensuring an accurate, efficient, and user-friendly experience:  
1. User access (STEP 1): The user launches the mobile application on their smartphone. 2. Image upload (STEP 2): The user selects or captures an image of a pharmaceutical tablet, uploading it to the flask-based backend server. 3. Region of interest (ROI) detection (STEP 3): The server applies advanced computer vision algorithms to detect the tablet region and eliminate unnecessary background elements. 4. Deep learning classification (STEP 4): The isolated pill image is classified using ResNet101, which processes the segmented image through multiple convolutional layers, extracting hierarchical feature representations. 5. Prediction generation (STEP 5): The system generates a classification label along with confidence metrics, which are transmitted back to the server. 6. Result transmission (STEP 6): The classified medication information is sent to the mobile device via an API request. 7. User interface display (STEP 7): The app displays the identified pill name, dosage, and confidence score, enabling users to recognize and verify their medication. This structured pipeline ensures that the system delivers accurate and fast medication classification, addressing critical challenges in pharmaceutical safety. To enhance accessibility, the mobile application interface was designed with a user-centric approach, prioritizing ease of use, clarity, and functionality. The primary target demographic includes elderly users, who may require simplified navigation and clear feedback. Key design considerations included the following:  
* A minimalist interface to reduce cognitive load. * Streamlined navigation for effortless interaction. * Large fonts and high-contrast UI elements for improved readability. * Intuitive workflow to guide users through the medication classification process.