## 3 Materials and Methods
### Datasets  
A large-scale pharmaceutical image dataset was used to train and evaluate the proposed system. The dataset, sourced from the Korea Pharmaceutical Information Center, comprises 5088 distinct images of various pharmaceutical tablets, occupying a total storage volume of 168 GB. These images were systematically categorized based on tablet morphology, imprints, and colors to ensure accurate classification. Table 1 presents Summary of the pharmaceutical image dataset. The dataset was partitioned into training (60%), validation (20%), and testing (20%) subsets, ensuring an even distribution of anterior and posterior tablet images across all categories to mitigate potential biases. \begin{table}
\begin{tabular}{p{113.8 pt} p{113.8 pt} p{113.8 pt} p{113.8 pt}} \hline \hline
**Total Images** & \begin{tabular}{p{113.8 pt}} **Original Image Size** \\ **(Pixels)** \\ \end{tabular} & \
\begin{tabular}{p{113.8 pt}} **Processed Input** \\ **Image Size** \\ **(Pixels)** \\ \end{tabular} &
\begin{tabular}{p{113.8 pt}} **Data Split** \\ **(Train: Validation: Test)** \\ \end{tabular} \\ \hline
15,745 & 4032 \(\times\) 3024 & 512 \(\times\) 512 & 60\%: 20\%: 20\% \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Summary of the pharmaceutical image dataset. Figure 7: Flowchart of the proposed methodology. The diagram outlines the key stages of dataset preparation, model selection, training, and evaluation in the deep learning-based pharmaceutical classification system. Figure 8 presents the morphological variations of tablets in the dataset, categorizing them based on their geometric configurations. This classification framework facilitated a structured approach to training the deep learning model, ensuring that it could differentiate between tablets with similar visual features but distinct pharmaceutical compositions. The images in the dataset were captured under diverse environmental conditions, incorporating both background-removed images and contextual images with original backgrounds to improve the model's adaptability to real-world scenarios. The classification criteria for organizing the dataset were based on tablet geometry (e.g., circular, oblong, oval, and quadrilateral shapes) and distinctive manufacturer markings such as embossed or debossed imprints. To maintain consistency across all images, a standardized preprocessing pipeline was implemented. Each image was centered and cropped to retain only the tablet region, effectively removing background noise. The images were then resized to a uniform 512 \(\times\) 512 pixels, ensuring compatibility with deep learning models while preserving morphological integrity. Contrast enhancement techniques, such as histogram equalization, were applied to improve the visibility of tablet imprints and surface details. Additionally, data augmentation methods, including random rotation, flipping, brightness adjustment, and Gaussian noise addition, were employed to improve the model's generalization capabilities against real-world variations in tablet appearance. Recognizing the limitations of our laboratory environment, which made it physically difficult to take direct images in various environments (e.g., variable lighting, clinical settings, and public image repositories), we simulated such diversity through an extensive data augmentation strategy. To evaluate the dataset's reliability and ensure high-quality pharmaceutical image classification, multiple measures were taken. Specifically, image rotation, flip, brightness adjustment, and noise injection were used to simulate different viewing angles, illumination variations, and background elements to reduce visual imbalance between different domains. The dataset was also cross-referenced with official pharmaceutical records to confirm label  
Figure 8: Morphological variations of tablets in the dataset. Representative tablets are categorized based on shape: oblong tablets, oval tablets, circular tablets, and octagonal tablets. accuracy.