# Combination Pattern Method Using Deep Learning for Pill Classification
## 5 Experimental Results  
This section presents and interprets the experimental results of our proposed deep learning-based pill-classification system. First, we describe the results of the proposed base pill-recognition system, and then the experimental results based on MCPL. The proposed system uses a CNN to recognize the colors and shapes of pills. Although CNNs have exhibited high performance in tasks including image classification, object detection, and segmentation, they require large quantities of data for training. Accordingly, we applied the image-augmentation technique to generate new training data from existing images via transformations, allowing the CNN model to learn more diverse patterns. To ensure a sufficiently large and diverse dataset, we rotated the image data by random angles between 0 and 25 degrees, shifted the orientation in horizontal and vertical directions by random values within a range of 0.05, performed scaling by random values between 0.8 and 1.2, and inverted the original images. Figure 10 illustrates the CNN-facilitated processes of image augmentation and color detection. Five color classes were used for classification: class = ['_red_', '_green_', '_blue_', '_orange_', '_white_']. The experimental results show a pill color detection accuracy of 95%.  
Figure 10: Image augmentation and color detection using CNN.  
Figure 9: Shi-Tomasi and Harris algorithm for corner detection.  
Figure 11 illustrates the CNN-based shape-detection procedure. In our experimental setup, we designated Models A and B to compare detection accuracy according to class. In the classification results of the figure, the blue graph indicates correct classifications, while the red graph signifies incorrect classifications. Figure 11 presents the pill shape-detection results obtained by Model A. For shape detection, six classes were initially defined--class = [_'circle_', _'hexagon_', _pentagon_', _rectangle_', _'capsular_', _'triangle_']--yielding an accuracy of 66%. Specifically, the detection accuracies of _circle_, _triangle_, _rectangle_, and _capsular_ shapes were 95%, 65%, 62%, and 75%, respectively, whereas those of _hexagon_ and _pentagon_ shapes were 29% and 32%, respectively.  
Figure 11: CNN-faciliated shape detection.  
Figure 11b presents the pill shape-detection results obtained by Model B, where in four classes were defined: class = [_'circle'_, _'rectangle'_, _'triangle'_, _'etc'_]. The number of classes was reduced to make the pill classification simpler and more intuitive. The _etc_ class was added to allow shapes that were not correctly classified by Model A to be organized within a single category. The resulting detection accuracy was 75%, which is an improvement over Model A. The experimental results once again confirm the importance of identifying features for accurate classification, as complex shapes may negatively impact overall model performance. Accordingly, features identified as _etc_ require further detection based on complex shapes.  
We detect shapes of pill using MCPL for the hexagon and pentagon classes, which are not well classified in the proposed base system, as shown in Figure 11a. We experimented with KAZE, ORB, Shi-Tomasi and Harris for feature extraction. Figure 12 shows the experimental results of MCPL-based pill detection and the colored lines represent similar features.  
The experimental results comparing the combination of feature-extraction algorithms and the proposed system are shown in Table 1. In response to the lower accuracy in detecting complex shapes like hexagons and pentagons, we implemented the MCPL method, incorporating advanced feature-extraction algorithms (KAZE, ORB, Shi-Tomasi, Harris). This corresponds to a relative performance enhancement of approximately 1.2 times the base accuracy, providing a clearer and more concrete demonstration of the MCPL method's effectiveness.