A frequency-aware traditional Chinese medicinal material fine-grained few-shot class incremental identification method
By using a frequency-aware method to decompose images of Chinese medicinal materials into high-frequency and low-frequency components, and combining this with a contrastive learning loss function to optimize the feature space, the problems of difficult sample collection and insufficient generalization ability of fine-grained classification in Chinese medicinal material identification are solved, thus achieving efficient and stable identification of Chinese medicinal materials.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHENGDU UNIV OF TRADITIONAL CHINESE MEDICINE
- Filing Date
- 2026-04-20
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies for identifying Chinese medicinal materials suffer from difficulties in sample collection, challenges in constructing large-scale labeled datasets due to diversity, and insufficient generalization ability and catastrophic forgetting phenomena in fine-grained classification, leading to problems in classification accuracy and stability.
By employing a frequency-aware approach, images are decomposed into high-frequency and low-frequency components using two-dimensional discrete cosine transform. Combined with a contrastive learning loss function, the feature space is optimized to enhance intra-class compactness and inter-class discriminability, thus constructing a frequency-aware fine-grained incremental recognition model for Chinese medicinal materials with few samples.
It achieves efficient identification of Chinese medicinal materials with limited labeled samples, improves the accuracy and stability of fine-grained classification, reduces catastrophic forgetting, and enhances the model's generalization ability and class discrimination.
Smart Images

Figure CN122391723A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image recognition, specifically relating to a frequency-aware, fine-grained, small-sample incremental recognition method for traditional Chinese medicinal materials. Background Technology
[0002] Medicinal plants, due to their unique therapeutic effects and historical importance, play a crucial role in traditional medical clinical practice, thus receiving high attention from both traditional physicians and modern medical practitioners. However, current research indicates that the quality problems and commercial value loss caused by species confusion have drawn sustained public concern. Therefore, accurate identification of medicinal plant species is of significant practical importance. Currently, chemical analysis methods for detecting active ingredients such as organic acids and flavonoids remain the gold standard for identifying medicinal plant varieties. Although these laboratory methods are highly accurate, they generally suffer from significant limitations such as long processing times, high costs, and reliance on specialized equipment. While intelligent sensing technologies combining chemometrics are gradually being applied, they are still limited by the rigid requirements of specific instruments and equipment.
[0003] In recent years, with the breakthroughs in deep learning (DL) technology, computer vision has provided a promising, lossless, and rapid solution for plant identification, demonstrating outstanding performance in the field of medical image classification. The effectiveness of deep learning-based automated classification methods has been widely recognized in academia. However, these data-driven models typically rely on large-scale labeled datasets to learn robust feature representations. In the field of medicinal plant research, the diversity of species makes it difficult to construct comprehensive large-scale labeled datasets. Furthermore, due to the inherent difficulties in sample collection, obtaining images covering multiple plant species presents significant challenges. Therefore, how to construct a model capable of efficiently learning feature representations from limited labeled data is a new challenge and task. Developing an intelligent system that can quickly transfer to new species with only a small number of labeled samples would significantly promote the development of the field.
[0004] Few-Shot Learning (FSL) aims to enable image classification models to adapt to new tasks using scarce labeled samples. Its typical framework includes a training phase for model adaptation and a new task adaptation phase. Numerous studies have successfully applied FSL to plant analysis scenarios such as leaf classification, plant detection, and hyperspectral classification. However, standard FSL methods are prone to catastrophic forgetting, meaning that the model's performance on the original task degrades when adapting to a new task. To address this limitation, Few-Shot Incremental Learning (FSCIL) introduces topology modeling techniques such as neural gas networks to achieve dynamic updates to the feature space structure. Despite some progress, current mainstream methods generally employ fixed feature extraction networks pre-trained based on cross-entropy loss. This architecture often suffers from insufficient generalization ability due to its inability to effectively separate inter-class boundaries. Furthermore, data often exhibits fine-grained characteristics: weak differences between different species (low inter-class variance), while significant variations exist within the same species (high intra-class variance). This ambiguity leads to severe confusion between old and new categories in the feature space, resulting in classification errors. Existing fine-grained classification techniques mainly focus on extracting image edge signals or high-frequency features. While these fine-grained features can often effectively capture subtle differences between classes, further enhancing the discriminative power between fine-grained categories remains a key challenge. Therefore, there is an urgent need in this field to design new model structures that enhance the discriminative power of features between fine-grained categories and achieve clear clustering and separation of data from old and new categories. Summary of the Invention
[0005] To address the problems of existing technologies, this invention provides a frequency-aware, fine-grained, small-sample incremental identification method for traditional Chinese medicine materials. The aim is to construct discriminative features by integrating high-frequency and low-frequency components, and utilize the clustering capabilities of contrastive learning to ultimately form a feature distribution with intra-class compactness and inter-class discriminativeness.
[0006] A frequency-aware, fine-grained, small-sample incremental identification method for traditional Chinese medicinal materials includes the following steps: Step S1: Input the original image of the Chinese medicinal materials; Step S2: Extract enhancement features from the original image; The extraction step of the enhanced features is as follows: Step S2.1: Perform a two-dimensional discrete cosine transform on the original image to map it to the frequency domain to obtain the high-frequency components of detail information and the low-frequency components of structural information; Step S2.2: Input the original image, the high-frequency component, and the low-frequency component into the encoder respectively to obtain the original feature map, the high-frequency feature map, and the low-frequency feature map; Step S2.3: Fuse the original feature map, the high-frequency feature map, and the low-frequency feature map to obtain the enhanced feature; Step S3: Based on the enhanced features of the training data, the feature space is trained by contrastive learning loss function to minimize the distance between similar samples in the feature space and maximize the distance between dissimilar samples in the feature space. Step S4: The trained feature space is applied to the incremental learning stage to classify and recognize the fine-grained images of newly added categories of Chinese medicinal materials.
[0007] This invention also provides a frequency-aware, fine-grained, small-sample incremental identification method for traditional Chinese medicinal materials, comprising the following steps: Step 1: Input the original image of the Chinese medicinal materials; Step 2: Extract enhancement features from the original image; Step 3: Input the enhanced features and calculate the cosine similarity between the embedded vector and all prototypes to obtain the Chinese medicinal material identification results; Preferably, the extraction of enhanced features specifically includes the following steps: Step 2.1: The original image is transformed from the spatial domain to the frequency domain using a two-dimensional discrete cosine transform (2D DCT) to obtain the spectrum. ; Step 2.2, Apply a binary mask The spectrum is separated to obtain the low spectrum located in the low-frequency region. and high spectrum located in the high frequency region ; Step 2.3: The masked spectrum is remapped back to the spatial domain using the inverse discrete cosine transform (IDCT) in two dimensions, thereby obtaining the original image. low frequency and high frequency Feature map; Step 2.4, fuse the original images low frequency and high frequency Feature maps are used to obtain enhanced features (discriminative details are extracted from high-frequency features, and structural context is extracted from low-frequency features), specifically including: ; ; in, It is a high-frequency enhancement feature. It is a low-frequency enhancement feature. For the original image, Encode for the encoder.
[0008] Preferably, the overall loss function used to train the feature extraction network is: in, This is the cross-entropy loss function, which calculates the correspondence between class features and their target values. For anchor samples, i Indicates the index of the sample. b Indicates batch size, The model represents the first i Input Samples The predicted probability.
[0009] To compare the loss functions, used to aim at... Zoom in At the same time Push away , where ⊙ represents the dot product operation, The cardinality of the positive sample set. The temperature parameter is set to 16. The denominator is summed over all comparison samples to strictly control the embedding space. It is a positive sample set elements, It is a negative sample set Element.
[0010] Let be the feature enhancement loss function, where For various types of prototypes, R This indicates the number of training image data.
[0011] Preferably, the backbone network of the encoder is selected from ResNet18 or VGG-19.
[0012] Preferably, the present invention also provides a fine-grained, small-sample incremental identification system for Chinese medicinal materials to achieve the above-mentioned frequency perception, comprising: The input module is configured to acquire raw images of the Chinese medicinal herbs. The image acquisition process is as follows: Figure 1 As shown; The calculation module is used to perform frequency decomposition on the original image to obtain the high-frequency components of detailed information. and low-frequency components of structural information The original image and the high-frequency components and the low-frequency components The original feature maps are obtained by inputting them into the feature extraction network. High-frequency feature map and low-frequency feature maps ; Fuse the original feature map The high-frequency feature map and the low-frequency feature map This results in enhanced features; The learning module is configured to train the feature space based on the enhanced feature representation by a contrastive learning loss function to minimize the distance between similar samples and maximize the distance between dissimilar samples in the feature space; and to apply the trained feature space to the incremental learning stage to classify and identify fine-grained images of newly added categories of Chinese medicinal materials.
[0013] The present invention also provides a computer-readable storage medium having a computer program stored thereon for implementing a method for classifying and recognizing fine-grained images of Chinese medicinal materials.
[0014] This invention also proposes a novel frequency-aware guided domain-enhanced contrastive learning model (FGDE) designed to strengthen fine-grained semantic generalization of base categories and topological separation of incremental categories. This model optimizes domain-specific discriminative power by integrating multi-spectral components to achieve detailed feature representation.
[0015] In a preferred embodiment, this invention further enriches the original features and mines class discrimination information in the visual and label domains by introducing high-frequency and low-frequency components. This enhances the multi-semantic aggregation perception capability, enabling accurate differentiation of fine-grained images. By introducing contrast loss, cross-entropy loss, and feature enhancement loss mechanisms, the model maximizes inter-class separation while minimizing intra-class variance, significantly improving its discriminative and generalization abilities.
[0016] Obviously, based on the above description of the present invention, and according to common technical knowledge and conventional methods in the field, various other modifications, substitutions or alterations can be made without departing from the basic technical concept of the present invention.
[0017] The following detailed embodiments further illustrate the above-described content of the present invention. However, this should not be construed as limiting the scope of the present invention to the following examples. All technologies implemented based on the above-described content of the present invention fall within the scope of the present invention. Attached Figure Description
[0018] Figure 1 This is a flowchart of the image acquisition process for high-resolution data acquisition equipment; Figure 2 This is a complete flowchart of the FGDE framework of this invention; Figure 3 This is a partial sample of a Chinese medicinal herb dataset, which contains 20 different types of Chinese medicinal plants, totaling 3,000 images. Figure 4 This is a partial sample of a dataset of medicinal leaves, which contains 100 different types of Chinese herbal plants, totaling 10,000 images. Figure 5These are experimental results for the confusion matrix. (A) The method presented in this paper; (B) Results without using high-frequency and low-frequency enhanced images. Significant contrast areas are marked in red and green. Figure 6 These are visualizations of the different attention modules for each category. The heatmaps for each category were randomly selected. In each group of images, the first row shows the original images, the second row shows the heatmap of Wang et al.'s method, and the last row shows the heatmap of this invention. The results are presented in two groups: (A) basic category, (B) incremental category. Figure 7 These represent the accuracy of different models on different datasets. Among them, (A) is a dataset of Chinese medicinal herbs, and (B) is a dataset of medicinal leaves. Detailed Implementation
[0019] It should be noted that the algorithms for data acquisition, transmission, storage and processing steps not specifically described in the embodiments, as well as the hardware structures and circuit connections not specifically described, can all be implemented using content already disclosed in the prior art.
[0020] Example 1: A frequency-aware, fine-grained, small-sample incremental identification method for traditional Chinese medicinal materials The system provided in this embodiment includes: The input module is configured to acquire raw images of the Chinese medicinal herbs. The image acquisition device uses a self-developed high-resolution data acquisition system (Canon EOS 60D), which consists of a housing, lighting equipment, and an image acquisition system. The image acquisition process is as follows: Figure 1 As shown; The calculation module is used to perform frequency decomposition on the original image to obtain the high-frequency components of detailed information. and low-frequency components of structural information The original image and the high-frequency components and the low-frequency components The original feature maps are obtained by inputting them into the feature extraction network. High-frequency feature map and low-frequency feature maps ; Fuse the original feature map The high-frequency feature map and the low-frequency feature map This results in enhanced features; The learning module is configured to train the feature space based on the enhanced feature representation by a contrastive learning loss function to minimize the distance between similar samples and maximize the distance between dissimilar samples in the feature space; and to apply the trained feature space to the incremental learning stage to classify and identify fine-grained images of newly added categories of Chinese medicinal materials.
[0021] The process framework of this example is as follows: Figure 1 As shown. This embodiment implements a targeted enhancement strategy based on visual perception characteristics (color, shape dimension). Specifically, it uses random rectangle cropping technology to expand the fine-grained feature space: given an input image The cutting dimension is defined as: width And tall Given a random sampling starting point ( , ),in , The final cropping area's bottom right corner coordinates ( , The result is obtained from formula (1): (1) Random cropping techniques of varying sizes are employed to capture local information, aiming to simultaneously enhance the model's understanding of local features and its perception of fine-grained semantics. To further strengthen the representation of category-aware semantics, a transformation set is introduced. Includes color jitter ( ) and random rotation ( Two operations are performed. The processed RGB image is mapped to the frequency domain via a two-dimensional discrete cosine transform (2D DCT), which characterizes pixel data through a linear combination of cosine basis functions. Utilizing the superior energy concentration properties of DCT compared to the complex-valued discrete Fourier transform (DFT), the input image... Each channel is converted into a spectrum. The result is obtained from formula (2): (2) in These represent the horizontal and vertical frequency indices, respectively. a Represents the row index in a two-dimensional spatial domain. a Traverse along the height direction, with values ranging from 0 to... H- 1, b Represents the column index in a two-dimensional spatial domain. b Traverse the width direction, with values ranging from 0 to... W- 1. Normalization coefficient and The definition is derived from formula (3): (3) in, k This represents the frequency index, used to distinguish different frequency components. (In the generated...) In the spectrum, the low-frequency components are concentrated at the origin. Nearby, high-frequency components are distributed in the peripheral region. A binary mask is then applied. The spectrum is separated into low-frequency and high-frequency components. A truncation threshold is defined based on the Manhattan distance in the frequency domain. Mask The definition is as shown in formula (4): Then, the low-frequency spectrum was derived using Hadamard (⊙). With high spectrum : Finally, the masked spectrum is remapped back to the spatial domain using the two-dimensional inverse discrete cosine transform (IDCT) and calculated using formula (5): (5) These components are then fed into the encoder to obtain the original image. low frequency and high frequency Feature maps. This enables the extraction of discriminative details from high-frequency components while extracting structural context from low-frequency components. Feature extraction is defined and calculated as shown in Equation (6): (6) in To select a feature extractor, enhanced discriminative feature maps are used as prior knowledge to improve the model's ability to capture key information and adapt to incremental data. Specifically, high-frequency features are used... Aligning samples with class prototypes and encoding fine-grained details effectively sharpens decision boundaries and improves model performance. This is followed by color dithering (…). ), random rotation ( ) and two-dimensional discrete cosine transform ( The embedded image is calculated using formula (7): (7) in Assigned to the encountered category, it can expand various semantics and fill the unassigned image embedding space, and provide semantic knowledge, thereby facilitating the broad learning of different semantics to achieve better generalization ability.
[0022] For the label domain, predefined transformations can generate multiple enhanced image-label pairs. ),in , To transform the dimensions of the extended space, The generated extended image has the following labels: Therefore, the label space is expanded through fine-grained category-aware embeddings derived from the original space, and the association between the image domain and the label domain can effectively provide richer semantic details to improve accuracy. Similarly, the embedding space... The training within can be expressed as formula (8): (8) in, Let cross-entropy be the loss function. The model represents the first n Input Samples The prediction The overall classification loss is represented by the average cross-entropy loss of all samples. While existing methods perform well in coarse-grained classification, they still have limitations when handling fine-grained data. Therefore, this study proposes an embedded supervised contrastive learning strategy based on the MoCo framework. This method optimizes feature distance by clustering positive sample pairs and separating negative sample pairs. For example... Through data augmentation functions Generate query view and key views Then a shared encoder containing a feature extractor and a classifier is used. Extract the corresponding features. Calculate using formula (9): (9) in For weight values, The feature function. Query encoder. Encoding is performed using gradient descent, while the key encoder... It is then encoded by a progressive encoder, which works by... Driven by momentum updates, the key embedding queue is maintained to store feature vectors.
[0023] In the label domain, a label queue maintains labels corresponding to the feature queue to distinguish between positive and negative sample pairs. This queue always maintains the same length as the feature queue. A contrastive loss is then calculated to drive the model to capture discriminative, fine-grained features. This optimization strategy effectively minimizes intra-class distance while maximizing inter-class differences, thereby promoting deep interaction between the visual and label domains.
[0024] (1) Enhanced Feature Analysis: The model should also focus on global features for multi-transformation imbalanced granularity data. To improve the generalization ability of categories, a global enhancement set is constructed from the generalized features. This set serves as a query view, optimizing the feature space by learning common features of different categories. Similarly, the image-label pairs required for global enhancement... It can be processed in the following way and calculated by formula (10): (10) in, M This represents the index of the image-label pair after global augmentation. Through augmentation feature analysis, the model can more effectively focus on detail enhancement information, thereby distinguishing imbalanced fine-grained images and optimizing the feature space.
[0025] (2) Incremental Class Inference: When using incremental sequences, the backbone network remains unchanged, and the classifier is implemented by calculating the prototype of the new class. By obtaining the information of the new class, the prototypes of the base class and the extended enhancement class can be used to extend the classifier. Calculated by formula (11): (11) This represents the final set of weights used for classification (i.e., the decision boundary parameters of the classifier), obtained by merging the base class and the prototypes of the new classes from all incremental stages. The number of basic classes, To convert the amount of extended space, Number of incremental sequences. Prototype set. This represents the focus of global and local fine-grained semantics in the original class. Calculated by formula (12): (12) in, n Indicates the first n The sample index is then used. The classifier is updated by combining the new class prototype with the original class prototype, which helps push the new samples away from the distribution of the old classes and promotes the generalization of semantic information perceived by the new classes. The fully connected layers of the model are updated by comparing the new query samples with the key embeddings of the slowly evolving base classes in the feature queue. Finally, the inference result of the test image is obtained by calculating the cosine similarity between the embedding vector and all prototypes. Its mathematical expressions are Equations (13) and (14): (13) in Indicates the first t In the first incremental stage, the first b The first batch n The prototype vector of a new category, . indicates the number of samples used to calculate this prototype, i.e., the number of samples used. t In the first incremental stage, the first b The first batch n Number of support set samples for each new category.
[0026] The reasoning result is: (14) Adapting the classifier to the new category while keeping the backbone network unchanged can preserve previously acquired knowledge to the greatest extent.
[0027] To improve model robustness, the loss function in this invention consists of three parts: cross-entropy loss (as shown in Equation 15), contrastive loss (as shown in Equation 16), and feature enhancement loss (as shown in Equation 17). This model optimizes the loss for each sample while maximizing inter-class boundaries, utilizing sufficient data within the basic categories to extract multi-semantic aggregation information from fine-grained images.
[0028] To extend the frequency-aware guided alternation mechanism, anchor point images The cross-entropy loss is used for processing, and the correspondence between class features and their target values is calculated by formula (15): (15) in For the first The true class label of each sample The model represents the first i Input Samples The predicted probability.
[0029] To generate a query view and key view Research and apply specific data augmentation strategies. For specific anchor indexes... Define the set of all indices in the current batch (or memory queue) as These indexes are strictly divided into two subsets: the positive sample set contains the anchor points. Sample indexes sharing the same category labels The negative sample set contains sample indices for all other categories. The InfoNCE loss is used as the comparison target, aiming to maximize the similarity between the anchor sample and its positive sample nodes, while minimizing the similarity with negative samples. Anchor sample The loss function is calculated by formula (16): (16) in This represents the dot product operation. The cardinality of the positive sample set. The temperature parameter is set to 16. The denominator is summed over all comparison samples to strictly control the embedding space. It is a positive sample set elements, It is a negative sample set The elements. This mechanism is designed to... Zoom in At the same time Push away This article supplements the comparative loss, focusing on the sample. Calculate the global feature enhancement loss to improve the generalization and separation ability of the categories. Let the prototypes of each category be... , The model represents the first i Input Samples The predicted probability, then This can be expressed as formula (17): (17) in The number of training images. The overall training objective can be summarized by formula (18): (18) The technical solution of the present invention will be further illustrated by the following experiments. In the following experimental examples, the model structure or method steps not specifically described are the same as those described in Example 1.
[0030] Example 1: Performance of the Model in Identifying Types of Chinese Medicinal Herbs I. Experimental Methods 1. Dataset of Chinese medicinal materials The two datasets for Chinese medicinal materials are the Chinese herbal medicine dataset and the medicinal leaf dataset, and some of their contents are as follows: Figure 3 and Figure 4 As shown. The Traditional Chinese Medicine dataset contains 3,000 images of 20 different types of medicinal plants. The Medicinal Leaf dataset contains 10,000 images of 100 herbaceous plants.
[0031] 2. Identification Models and Systems The model and system described in Example 1 are used.
[0032] 3. Implementation method The experiment used the open-source PyTorch as the basic framework, developed using PyTorch 2.2.1 and Python 3.11. The training environment was a personal computer equipped with an Intel i7 processor and an NVIDIA 4090 graphics card (24GB VRAM). The model was optimized using gradient descent with a momentum coefficient of 0.9. The initial learning rate was set to 0.1, and a step-rate-reduction (StepLR) strategy was used. The batch size was set to 16, and the final model was obtained after 100 epochs of basic training. In the incremental learning phase, the pre-trained model was fine-tuned, and the keyword embeddings generated from the basic training were compared with those from new query samples. The model mitigated overfitting through a classifier update mechanism every 10 epochs.
[0033] 4. Performance Indicators Accuracy, precision, recall, specificity, and F1 score were used as evaluation metrics. Furthermore, the harmonic mean (HM) was used to balance the inherent biases between the base class and the incremental class.
[0034] in TN Represents the number of true negatives. TP This indicates the number of true positives. FN Indicates the number of false negatives. FP The number of false positives. Indicates the accuracy of the base class. This represents the top-1 accuracy of the incremental class.
[0035] II. Experimental Results 1. Identify experimental results The dataset was divided into training and testing sets, with 75% of the data used for training and the remaining 25% for testing. The basic training phase included 16 classes, with 200 samples per class. Additionally, four incremental sequences were included, each containing three classes and five samples per class. Accuracy, precision, recall, specificity, and F1 score were used as evaluation metrics. Furthermore, the harmonic mean (HM) was used to balance the inherent bias between the base and incremental classes. Experimental results are shown in Table 1.
[0036] Table 1. Performance of different categories tested using this model As shown in Table 1, the model demonstrates particularly strong performance in classifying the basic categories, exhibiting high accuracy and robustness when classifying classes A, E, C, F, D, H, and I. In contrast, the F1 scores for incremental categories mainly range from 0.3 to 0.6, indicating limited effectiveness in learning new categories. For example, categories R and Q show high recall but low accuracy, which can be attributed to classification errors caused by significant feature similarity between categories. To further evaluate model performance, a confusion matrix was calculated, and the experimental results are shown below. Figure 5 As shown.
[0037] While the recognition results for the basic categories are comparable across different methods, the improvements in incremental categories are more significant. In the confusion matrix, a sharper diagonal line indicates higher recognition accuracy, and the red and green areas show a significant difference in contrast. Figure 5As shown in (A), in basic category recognition, the labeled regions indicate that the FGDE model has superior performance and fewer misclassifications compared to other methods. For example... Figure 5 (A) and such Figure 5 (B) As can be seen, this model has significant advantages over the baseline model that lacks high-frequency and low-frequency enhancement, especially in the bright areas. Mechanistically, the low-frequency components capture global structural features, while the high-frequency components extract local fine details, thus enriching the image representation. Conversely, methods that do not employ frequency-aware expansion, while maintaining the visible diagonal of the basic category, perform poorly on new categories. Our method demonstrates robust performance, indicating that it can effectively adapt to new categories without violating existing decision boundaries.
[0038] 2. Performance comparison results of different network models One of the most expensive license plates in the world, which is the most suitable FSCIL licensed licensee, is the iCaRL(Rebuffi, SA, Kolesnikov, A., Sperl, G., Lampert, CH 2017.icarl: Incremental classifier and representation learning. In Proceedings ofthe IEEE conference on Computer Vision and Pattern Recognition (pp. 2001-2010))、FSLL(Mazumder, P., Singh, P., Rai, P. 2021. Few-shot lifelong learning. In Proceedings of the AAAI Conference on Artificial Intelligence(pp. 2337-2345))、FACT(Zhou, DW, Wang, FY, Ye, HJ, Ma, L., Pu, S.,Zhan, DC 2022. Forward compatible few-shot class-incremental learning. C-FSCIL(Hersche, M., Karunaratne, G.,Cherubini, G., Benini, L., Sebastian, A., Rahimi, A. 2022. Constrained few-shot class-incremental learning. In Proceedings of the IEEE / CVF conference oncomputer vision and pattern recognition (pp. 9057-9067)、SAVC(Song, Z., Zhao,Y., Shi, Y., Peng, P., Yuan, L., Tian, Y. 2023).Learning with fantasy: Semantic-aware virtual contrastive constraint for few-shot class-incremental learning. In Proceedings of the IEEE / CVF conference on computer vision and pattern recognition (pp. 24183-24192)) and Wang (Wang, QW, Zhou, DW, Zhang, YK, Zhan, DC, Ye, HJ 2024. Few-shot class-incremental learning via training-free prototype calibration. Advances in Neural Information Processing Systems, 36). The experimental results are shown in Table 2. .
[0039] Table 2 Model Recognition Results This method achieves a peak accuracy of 95.000% on the base class, surpassing all existing baseline models. In subsequent incremental training, the method maintains robust performance: the accuracy reaches 91.701% on the first training iteration and remains at a high level of 78.906% on the fourth training iteration. Notably, compared to other methods, this approach significantly mitigates the catastrophic forgetting problem.
[0040] While most methods experienced performance degradation upon introducing new classes, significant differences remained. iCaRL performed the worst, with its base accuracy rapidly declining from 70.542% to achieve the lowest harmonic mean (HM) of 58.774%. Although FSLL, FACT, and C-FSCIL achieved respectable base accuracies (91.421%, 92.040%, and 94.051%, respectively), they all experienced significant declines in later training phases, ultimately resulting in an HM score of 80%. SAVC and Wang et al.'s method demonstrated stronger resistance to degradation, with harmonic means of 84.328% and 83.101%, respectively. However, our method consistently outperformed these leading approaches across all training phases, ultimately achieving the highest harmonic mean of 86.599%.
[0041] This superior performance is attributed to a frequency decomposition strategy, which generates a detail-enhanced discriminative representation by decomposing the image into low-frequency components (capturing overall structural features) and high-frequency components (preserving fine-grained details). This mechanism simultaneously enhances the separability of base classes and the generalization ability to new classes. In summary, this model, while preserving knowledge of base classes, can adapt to new sequences with minimal performance loss, achieving a significant breakthrough over state-of-the-art methods in solving the FSCIL challenge.
[0042] 3. Results of different backbone networks To select a suitable backbone network for feature extraction in this model, various backbone structures were compared to evaluate their impact on model efficiency, including common convolutional networks such as VGG-16, VGG-19, EfficientNet-B0, ResNet20, ResNet50, EfficientNet-B0, DenseNet121, MBConv, and ResNet18. Furthermore, models employing hybrid transformer structures, such as MBConv, were also evaluated. The results are shown in Table 3. Table 3 Model Recognition Results Using runtime as a key feasibility metric, Table 3 compares various basic network architectures. Compared to ResNet18, ResNet20 and ResNet50 have lower accuracy and longer inference times. The simplification of the VGG architecture limits its feature extraction capabilities, leading to a decrease in basic class accuracy; while EfficientNet and DenseNet121 suffer from excessively high computational costs due to their complex structures. Experimental results from MBConv further highlight the limitations of hybrid transformer structures in this scenario. Although VGG19 improves incremental class accuracy by 1.322%, its slower runtime reduces its practicality. Therefore, ResNet18 was ultimately selected as the optimal solution in terms of overall performance.
[0043] Class activation graph visualization comparison results Class activation maps (CAMs) are crucial for interpreting model decisions by highlighting influential image regions. In this experimental example, our self-built method is compared with the heatmaps generated by Wang et al., categorized into base class (A) and incremental class (B). Figure 6 The original images of each instance and their corresponding CAMs are shown. The color intensity represents the activation level, reflecting the importance of each region in the model classification results.
[0044] Depend on Figure 6As can be seen, the systematic comparison of the basic and incremental categories reveals that this method consistently outperforms other schemes. This method significantly leads in target object localization accuracy, and the activation region closely fits the object boundary while effectively suppressing background noise. For example, in samples (1), (4), (8), and (10), the activation distributions generated by other methods are blurry, often overflowing into the background area or focusing on limited edge areas. In contrast, the heatmap generated by this method is accurately aligned with the target center and more effectively covers its key areas. In addition, this model can always generate a more comprehensive activation map covering the entire object, indicating that it has achieved a holistic representation. This advantage is particularly significant in items (2), (5), (7), and (11): when the model tends to focus on local textures or edges, this model can completely capture the semantic structure of the object. This holistic understanding is crucial for achieving robust classification, making the model less susceptible to changes in object orientation or local occlusion. Furthermore, the heatmap generated by this method focuses more concentratedly on the object's feature regions. In contrast, the activation distribution of Wang et al.'s model is scattered and lacks intensity, as shown in (5), (9), and (12). The model generates strong, focused activation responses on core object features, indicating that the method is more effective at identifying key predicted features and less reliant on spurious image associations. These qualitative results strongly support the research hypothesis that the proposed method helps learn more robust and interpretable feature representations. By generating more complete and accurately localized heatmaps, the model demonstrates a deeper semantic understanding of image content and significantly mitigates the problem of catastrophic forgetting.
[0045] Traditional Chinese Medicine Dataset Our method was compared with other state-of-the-art methods on a traditional Chinese medicine dataset. The comparison results are as follows: Figure 7 As shown. By Figure 7 (A) As can be seen, there are 8 basic categories, 4 categories in each incremental classification, and 3 N-gram classifications. This demonstrates that this model exhibits the highest accuracy among other mainstream methods.
[0046] This model prioritizes the extraction of fine-grained features, while the fusion of local details and global context further improves performance and robustness. Figure 7 (B) demonstrates a comparative analysis of this method on a publicly available benchmark dataset and a medicinal leaf dataset containing 100 plant species with subtle differences in visual characteristics. Experimental settings (e.g.) Figure 7 In (B) shown, the model is initialized with 60 basic categories, and then incremental training is performed with 8 categories each time, with 3 samples set for each category.
[0047] like Figure 7As shown, iCaRL exhibits the most drastic performance degradation, indicating that its replay-based policy lacks the stability required for the FSCIL task and struggles to mitigate interference from new classes. While FSLL achieves high accuracy initially, it experiences a sharp decline later, suggesting limited long-term generalization ability despite its early effectiveness. FACT and C-FSCIL show gradual degradation, reflecting stronger knowledge retention capabilities, although performance continues to decline. Conversely, the methods of SAVC and Wang et al. maintain relatively stable performance, especially in the later training phase. To assess the statistical reliability of the results, in Figure 7 An error bar representing the standard deviation has been added, regardless of... Figure 7 (A) or Figure 7 In the incremental sessions of (B), this method maintains compactness throughout. This low variance demonstrates that the FGDE model is highly robust to initialization discrepancies and data sampling fluctuations, maintaining stable performance even as the number of classes increases. In contrast, benchmark methods such as iCaRL and FSLL exhibit significant performance degradation across multiple training phases (e.g., Figure 7 Large error bars appear in stages 0 and 3 of (B), indicating higher instability. Notably, our method performs best among all competing approaches, achieving continuous improvement with minimal performance degradation. Through fine-grained feature comparison and multi-semantic discrimination mechanisms, our method significantly enhances its adaptability to new categories while effectively mitigating catastrophic forgetting.
[0048] As can be seen from the above embodiments and experimental examples, this invention constructs a frequency-aware guided domain-enhanced contrastive learning model, which can strengthen fine-grained semantic generalization of base categories and topological separation of incremental categories. This invention exhibits robust performance superior to existing state-of-the-art methods and has excellent application prospects.
Claims
1. A frequency-aware, fine-grained, small-sample incremental identification method for traditional Chinese medicinal materials, characterized in that, Includes the following steps: Step S1: Input the original image of the Chinese medicinal materials; Step S2: Extract low-frequency feature maps and high-frequency feature maps from the original image; Step S3: Based on the low-frequency feature map and high-frequency feature map of the training data, the feature extraction network is trained by comparing and learning the loss function; Step S4: Extract enhancement features from the original image, low-frequency feature map, and high-frequency feature map; Step S5: The enhanced features are used in the feature extraction network to obtain the identification results of Chinese medicinal materials.
2. The method according to claim 1, characterized in that: Extracting enhanced features specifically includes the following steps: Step 2.1: The original image is transformed from the spatial domain to the frequency domain using a two-dimensional discrete cosine transform to obtain the spectrum. ; Step 2.2, Apply a binary mask The spectrum is separated to obtain the low spectrum located in the low-frequency region. and high spectrum located in the high frequency region ; Step 2.3: The masked spectrum is remapped back to the spatial domain using a two-dimensional inverse discrete cosine transform, thereby obtaining the original image. low frequency and high frequency Feature map; Step 2.4, fuse the original images low frequency and high frequency Feature maps are used to obtain enhanced features. Discriminative details are extracted from high-frequency features, and structural context is extracted from low-frequency features. Specifically, this includes: ; ; in, It is a high-frequency enhancement feature. It is a low-frequency enhancement feature. For the original image, Encode for the encoder.
3. The method according to claim 1, characterized in that, The overall loss function used to train the feature extraction network is: in, Let be the cross-entropy loss function, where For anchor samples, i b represents the sample index, and b represents the batch size. The model represents the first i Input Samples The predicted probability. To compare the loss functions, where ⊙ represents the dot product operation, The cardinality of the positive sample set. For temperature parameters, It is a positive sample set elements, It is a negative sample set Element; Let be the feature enhancement loss function, where For various types of prototypes, R This indicates the number of training image data.
4. The method according to claim 1, characterized in that, The backbone network of the encoder is selected from ResNet18 or VGG-19.
5. A system for implementing the method according to any one of claims 1-4, characterized in that, include: The input module is configured to acquire the original image of the Chinese medicinal materials; The calculation module is used to perform frequency decomposition on the original image to obtain the high-frequency components of detailed information. and low-frequency components of structural information The original image and the high-frequency components and the low-frequency components The masked spectrum is remapped back to the spatial domain using a two-dimensional inverse discrete cosine transform. The results are then input into an encoder to obtain the original feature map. High-frequency feature map and low-frequency feature maps ; Fuse the original feature map The high-frequency feature map and the low-frequency feature map This results in enhanced features; The learning module is configured to, based on the high-frequency feature map and the low-frequency feature map, acquire new high-frequency and low-frequency feature information, combine the new high-frequency and low-frequency feature information with the information in the original feature extraction network to update the feature extraction network, compare the new high-frequency and low-frequency feature information with the slowly evolving key embeddings of the basic class in the feature extraction network to update the fully connected layers of the training model, and adapt the feature extraction network to the new category while keeping the backbone network unchanged, in order to train the feature extraction network.
6. A frequency-aware, fine-grained, small-sample incremental identification system for traditional Chinese medicinal materials, characterized in that, Includes the following steps: The input module is configured to accept original images of Chinese medicinal herbs as input. X ; The computation module is configured to extract enhancement features from the original image; The output module is configured to input the enhanced features into the feature extraction network and calculate the cosine similarity between the embedded vector and all prototypes to obtain the Chinese medicinal material recognition result. The training module, which integrates the system of claim 5, is configured to train the feature extraction network.
7. A computer-readable storage medium, characterized in that: It stores a computer program for implementing the method according to any one of claims 1-5.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1-5.