# A Multi-Scale Feature Extraction Algorithm for Chinese Herbal Medicine Image Classification
## 3 Dataset Construction  
Chinese herbal datasets play a crucial role in improving model performance. However, the construction of Chinese herbal image datasets in current research still has shortcomings. In a previous study, we constructed the CHMD1 dataset, which includes 16 types of Chinese herbal medicine with 3552 images [9]. This dataset has significant advantages over similar datasets: it is specifically designed for Chinese herbal medicine, effectively addressing issues such as limited categories, insufficient sample sizes, single shooting angles, monotonous backgrounds, and uniform morphology within categories. However, the number of Chinese herb types is still insufficient, leading to excessive differences between different types of Chinese herbal medicine and a lack of inter-class similarity, thereby affecting the model's generalization capabilities. Therefore, we constructed a new Chinese herbal dataset, CHMD2, based on CHMD1.  
The CHMD2 dataset incorporates four new types of Chinese herbal medicine images: Raspberry, Poria Cocos, Rhizoma Phragmitis, and Cinnamon. These images were primarily obtained through web scraping, yielding an initial collection of 2496 raw images. After manual curation, 933 high-quality images were retained, including 249 Raspberry images, 199 Poria Cocos images, 245 Cinnamon images, and 240 Rhizoma Phragmitis images. The total number of images in CHMD2 reaches 4485, with the number of types increasing to 20. As shown in Table 1. The category with the most images has 380 images, while the category with the fewest images has 110 images. The distribution of the number of images for each Chinese herb is shown in Figure 2. CHMD2 not only retains the advantages of CHMD1, such as complex and diverse morphological expressions, stacked or clustered presentation, single-category images, diverse backgrounds, and multi-angle shooting, but it also increases inter-class similarity and further enhances morphological diversity.  
The addition of the four new categories effectively enhances the inter-class similarity of the dataset, thereby improving the model's generalization capabilities. As shown in Figure 3, in the original dataset, matrimony vine is the only red Chinese herb category. However, color is an important feature for model recognition, which may limit the model's ability to recognize red features. Therefore, we introduced raspberry images. Most Raspberries are also red, which will interfere with the model to some extent, thereby improving its generalization capabilities. Similarly, in the original dataset, alumen is the only white block-shaped Chinese herb. Processed poria cocos is also white and block-shaped, and its inclusion helps the model recognize such forms, thereby improving the model's ability to handle similar forms. The introduction of rhizoma phragmitis enhances the model's recognition ability due to its similar texture and morphological features to radix stemonae, while the addition of cinnamon expands the model's recognition range for strip-shaped species.  
To further increase the morphological diversity of the dataset, the four new categories include multiple morphological features. As shown in Figure 4, raspberry presents different forms, colors, and textures, including fresh and processed states, red and black variants, and morphological changes due to different processing techniques. Poria cocos includes processed and unprocessed samples, with processed samples further divided into block and slice forms. Rhizoma phragmitis also has processed and unprocessed distinctions,  
\begin{table}
\begin{tabular}{c c c c} \hline
**Dataset** & **Number of Classes** & **Total Images** & **Average Images per Class** \\ \hline CHMD1 & 16 & 3552 & 222 \\ CHMD2 & 20 & 4485 & 224.25 \\ \hline \end{tabular}
\end{table}
Table 1: Comparison Table of CHMD1 and CHMD2 Datasets.  
Figure 2: Distribution of the number of Chinese herbal images.