A small sample image classification method based on triple regularization GAN
Patent Information
- Application Number
- CN202610826074.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-09
- Publication Date
- 2026-10-13
AI Technical Summary
[0013]与现有技术相比,本发明的有益效果在于:通过获取小样本图像数据集,并对其进行预处理划分为支撑集和查询集,构建包含生成器、判别器和分类器的生成对抗网络模型。由此带来的有益效果是,能够在小样本条件下建立统一的数据增强与分类学习框架,为后续的生成与分类联合优化奠定基础,从而减少对大规模标注数据的依赖,提高小样本场景下的数据利用效率。其次,基于三重正则化约束构建总损失函数对模型进行联合训练,其中特征一致性正则化约束生成图像与真实图像在特征空间中的分布一致,有效降低了小样本过拟合风险;样本多样性正则化通过最大化不同隐变量对应生成图像间的距离与隐空间距离之比,防止生成器发生模式崩溃,保证了生成样本的丰富性;分类边界联合正则化通过最小化伪图像分类预测的信息熵,迫使生成样本远离不同类别的决策边界,提高了生成样本的类间可分性及分类器的泛化能力。由此带来的有益效果是,显著提升了生成图像的质量和多样性,同时增强了分类器的判别性能,解决了传统GAN在小样本训练中容易出现的特征失真、模式崩塌和分类边界模糊的问题。再次,利用训练完成的生成器生成与原始数据分布一致的伪图像样本,并将其与小样本图像数据集融合得到扩充数据集,在此基础上对分类器进行微调训练,得到目标图像分类模型。其有益效果表现在,能够在不引入额外人工标注的前提下有效扩充训练样本,改善类别分布不平衡问题,从而显著提高分类模型在有限标注条件下的识别准确率和鲁棒性。最后,通过构建生成器、判别器和分类器的联合训练架构,并采用交替优化的方式进行网络参数更新,使整个小样本图像分类流程具备端到端的自适应学习能力。这一机制的有益效果在于,能够在生成与分类相互促进的框架下,动态调整网络特征表达和决策边界,从而在小样本、大类别或细粒度分类等挑战性场景中,依然保持高精度和高稳定性,满足计算机视觉领域对少样本学习任务的实用化需求。
Smart Images

Figure CN122906415A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image classification technology, and more specifically, to a few-sample image classification method based on triple regularized GAN. Background Technology
[0002] Existing image classification methods typically require feature extraction and model training on limited labeled image data when handling few-shot learning tasks. This data varies significantly in the number of categories, sample distribution, and image morphology, including various types such as natural images, medical images, and remote sensing images. Furthermore, it differs in image resolution, background complexity, and target scale. Because only a very small number of labeled samples are provided for each class under few-shot conditions, existing systems have significant limitations in model generalization ability and overfitting suppression.
[0003] Currently, most mainstream few-shot image classification methods rely on meta-learning frameworks or ordinary generative adversarial networks (GANs) for data augmentation. Meta-learning methods typically require pre-training feature extractors on large-scale base class data and then rapidly adapting them on small-shot support sets; while ordinary GANs expand the training set by generating pseudo-images. However, these approaches are prone to problems in few-shot scenarios, such as low-quality generated images, pattern collapse, and instability in the joint training of discriminators and classifiers. When the number of categories increases or intra-class differences become large, model performance often degrades significantly, impacting tasks such as image recognition, fine-grained classification, and zero-shot detection. Furthermore, existing generative models lack joint regularization constraints for feature consistency, sample diversity, and classification boundaries during training, often requiring repeated manual adjustments to the network structure and hyperparameters to maintain the quality of generated images and classification accuracy.
[0004] In summary, existing technologies are still insufficient to effectively address issues such as distorted generated image features, insufficient diversity of generated samples, and blurred classification decision boundaries in small-sample image classification. In particular, there is a lack of a joint training mechanism that can simultaneously and stably generate high-quality images and improve classification generalization ability under limited labeled data. Therefore, there is an urgent need to propose a new image classification method to improve the efficiency of data augmentation and the robustness of classification models in small-sample scenarios, thereby meeting the practical needs of computer vision for high-precision image recognition with few samples. Summary of the Invention
[0005] In view of this, this invention proposes a few-shot image classification method based on triple regularized GAN, which aims to solve the problems of distortion of generated image features, insufficient diversity of generated samples, pattern collapse and fuzzy classification decision boundaries in current few-shot image classification methods under limited labeled data. At the same time, it overcomes the defects of traditional generative adversarial network training instability and difficulty in jointly optimizing discriminators and classifiers, thereby improving the accuracy and generalization ability of few-shot image classification.
[0006] This invention proposes a few-shot image classification method based on triple regularized GAN, comprising the following steps: Obtain a small sample image dataset and preprocess the small sample image dataset, dividing it into a support set and a query set; Construct a generative adversarial network model, which includes a generator, a discriminator, and a classifier; The generative adversarial network model is jointly trained based on the small sample image dataset. During the training process, a triple regularization constraint is introduced to construct the total loss function. The triple regularization constraint includes feature consistency regularization, sample diversity regularization, and classification boundary joint regularization. The trained generator generates pseudo-image samples that are consistent with the distribution of the small sample image dataset. The pseudo-image samples are then fused with the small sample image dataset to obtain an expanded dataset. The classifier is fine-tuned and trained using the expanded dataset to obtain a target image classification model, and the target image classification model is used to classify the input image.
[0007] Furthermore, the calculation process for the feature consistency regularization is as follows: Extract the true feature representation of the real image from the intermediate layer of the discriminator; Extract the pseudo-feature representation of the pseudo-image generated by the generator in the intermediate layer of the discriminator; The Euclidean distance or cosine similarity between the true feature representation and the pseudo feature representation is calculated as a feature consistency regularization loss to constrain the distribution of the generated image and the real image in the feature space to reduce the risk of small sample overfitting.
[0008] Furthermore, the calculation process for the sample diversity regularization is as follows: Two different sets of latent variables are sampled at the input of the generator; The generator generates two sets of pseudo-images corresponding to the two sets of different latent variables. Calculate the ratio of the image spatial distance between the two sets of pseudo-images to the latent spatial distance between the two sets of different latent variables; The ratio is maximized to construct a sample diversity regularization loss, which penalizes the generator for outputting the same image for different latent variables, thereby preventing the generator from experiencing mode collapse.
[0009] Furthermore, the calculation process for the joint regularization of the classification boundaries is as follows: The pseudo-image is input into the classifier in the current iteration to obtain the corresponding classification prediction probability distribution; Calculate the information entropy of the classification prediction probability distribution and use it as the joint regularization loss of the classification boundary; By minimizing the information entropy, the pseudo-images are forced to move away from the decision boundaries of different categories, thereby improving the inter-class separability of the generated samples and the generalization ability of the classifier.
[0010] Furthermore, the expression for the total loss function is: in, Represents the total loss function. This indicates that the standard generates adversarial loss. This represents the feature consistency regularization loss. This represents the sample diversity regularization loss. This represents the joint regularization loss at the classification boundary. , These represent positive weight hyperparameters.
[0011] Furthermore, the generator employs a deep convolutional neural network structure that incorporates a self-attention mechanism; The classifier uses a residual network model with meta-learning initialization parameters.
[0012] Furthermore, the joint training employs an alternating optimization approach, specifically including: The generator is fixed, and the network parameters of the discriminator and the classifier are updated based on real and pseudo images; Fix the discriminator and the classifier, and update the network parameters of the generator based on the total loss function; Repeat the alternating optimization process until the preset number of iterations is reached or the network as a whole converges.
[0013] Compared with existing technologies, the advantages of this invention are as follows: By acquiring a small sample image dataset and preprocessing it into a support set and a query set, a generative adversarial network model containing a generator, discriminator, and classifier is constructed. This results in the establishment of a unified data augmentation and classification learning framework under small sample conditions, laying the foundation for subsequent joint optimization of generation and classification, thereby reducing dependence on large-scale labeled data and improving data utilization efficiency in small sample scenarios. Secondly, a total loss function based on triple regularization constraints is constructed to jointly train the model. Feature consistency regularization ensures that the generated images and real images are distributed in the feature space, effectively reducing the risk of overfitting in small samples. Sample diversity regularization prevents mode collapse of the generator by maximizing the ratio of the distance between generated images corresponding to different latent variables to the distance in the latent space, ensuring the richness of generated samples. Joint classification boundary regularization minimizes the information entropy of pseudo-image classification predictions, forcing generated samples away from the decision boundaries of different categories, improving the inter-class separability of generated samples and the generalization ability of the classifier. The resulting benefits include significantly improved quality and diversity of generated images, enhanced discriminative performance of the classifier, and resolution of issues such as feature distortion, pattern collapse, and blurred classification boundaries that traditional GANs often encounter during few-shot training. Furthermore, the trained generator generates pseudo-image samples consistent with the original data distribution, which are then fused with the few-shot image dataset to obtain an expanded dataset. Based on this, the classifier is fine-tuned to obtain the target image classification model. The benefits are that it effectively expands the training samples without introducing additional manual annotations, improves the class imbalance problem, and thus significantly improves the recognition accuracy and robustness of the classification model under limited annotation conditions. Finally, by constructing a joint training architecture for the generator, discriminator, and classifier, and employing alternating optimization for network parameter updates, the entire few-shot image classification process possesses end-to-end adaptive learning capabilities. The beneficial effect of this mechanism is that it can dynamically adjust the network feature representation and decision boundary within a framework where generation and classification mutually promote each other. This allows it to maintain high accuracy and stability even in challenging scenarios such as small sample sizes, large categories, or fine-grained classification, thus meeting the practical needs of the computer vision field for few-sample learning tasks.
[0014] On the other hand, this application also provides a few-shot image classification system based on triple regularized GAN, including: The data acquisition and preprocessing module is used to acquire small sample image datasets and preprocess them, dividing them into support sets and query sets; A network construction module is used to build a generative adversarial network model, which includes a generator, a discriminator, and a classifier. The triple regularization training module is used to jointly train the generative adversarial network model based on the small sample image dataset. During the training process, triple regularization constraints are introduced to construct the total loss function. The triple regularization constraints include feature consistency regularization, sample diversity regularization, and classification boundary joint regularization. The data augmentation module is used to generate pseudo-image samples using the trained generator, and then fuse the pseudo-image samples with the small sample image dataset to obtain an augmented dataset. The classification and reasoning module is used to fine-tune and train the classifier using the expanded dataset to obtain a target image classification model, and to classify the input image using the target image classification model. Attached Figure Description
[0015] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 This is a functional block diagram of a few-sample image classification method based on triple regularized GAN provided in an embodiment of the present invention; Figure 2 This is a flowchart illustrating a few-sample image classification method based on triple regularized GAN, provided in an embodiment of the present invention. Detailed Implementation
[0016] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the disclosure to those skilled in the art. It should be noted that, unless otherwise specified, embodiments and features in the embodiments of the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0017] like Figures 1-2 As shown, in some embodiments of this application, this embodiment provides a few-shot image classification method based on triple regularized GAN, including: Step S100: Obtain a small sample image dataset and preprocess the small sample image dataset by dividing it into a support set and a query set.
[0018] Specifically, a small-sample image dataset refers to a target classification task where each class contains only a very small number of labeled image samples. For example, in an N-way K-shot classification task, each class has only K labeled images (usually K≤20). Preprocessing operations include image size normalization, data augmentation (such as random cropping, rotation, and color dithering), and pixel value normalization. The support set is used for meta-training or basic learning of the model, while the query set is used for evaluation and fine-tuning.
[0019] Understandably, explicitly dividing the few-shot image dataset into a support set and a query set lays the foundation for subsequent model training and performance evaluation. In real-world few-shot learning scenarios, directly training a deep classifier using raw few-shot data can easily lead to severe overfitting, preventing the model from generalizing to unseen new categories. Therefore, a training framework simulating a few-shot environment is needed. Specifically, the support set simulates the limited labeled information the model can see during training, guiding feature extraction and the formation of classification boundaries; while the query set acts as the "new sample," simulating unknown images that the model needs to correctly classify during deployment. This division allows the model to learn during training how to correctly classify new samples of the same category when only a small number of samples are seen. Finally, by performing unified preprocessing and data augmentation on the images, not only can differences in size and pixel range between images from different sources be eliminated, but the diversity of the data can also be artificially expanded, providing a richer data foundation for the stable training of the generative adversarial network, thereby effectively reducing the risk of overfitting under few-shot conditions.
[0020] In a specific embodiment of this application, the above steps are implemented as follows: First, a 5-way 1-shot image classification task is selected from a dataset containing images of 100 animal categories. This means that only one labeled image is provided for each category (e.g., cat, dog, bird, fish, rabbit) as the support set, and 10 labeled images are prepared for each category as the query set. All images are RGB color images with varying original sizes. In the preprocessing stage, all images are first uniformly scaled to 128x128 pixels using bicubic interpolation. Then, for each image in the support set, a data augmentation strategy is applied, involving random horizontal flipping, rotation from -10° to 10°, and the addition of a small amount of Gaussian noise, to expand the diversity of the training samples. Simultaneously, the query set is only center-cropped and pixel value normalized (mapping pixel values from [0,255] to [-1,1]) to ensure the fairness of the test. After processing, these 5 augmented support set images and 50 query set images are input into the subsequent model for further processing.
[0021] The above scenarios are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0022] Step S200: Construct a generative adversarial network model, which includes a generator, a discriminator, and a classifier.
[0023] Understandably, constructing a Generative Adversarial Network (GAN) model that includes a generator, discriminator, and classifier aims to establish a joint learning framework. The generator is responsible for producing high-quality pseudo-images, the discriminator for distinguishing between real and pseudo-images, and the classifier for accurately predicting the image's category. Traditional GANs only contain a generator and discriminator; while the generated images may be realistic, they may not be optimal for classification tasks. By introducing a parallel classifier, the goal of the classification task can be directly integrated into the generation process, forcing the generator to produce samples that are not only visually realistic but also highly separable between classes. Specifically, the generator typically employs a deep convolutional neural network or a variant incorporating a self-attention mechanism, capable of progressively generating high-resolution images from low-dimensional random noise. The discriminator is a binary classification network used to determine whether the input image is "real" or "generated," and its adversarial loss is the core driving force propelling the generator to learn the distribution of real data. The classifier is an independent multi-classification network whose input can be either a real or generated image, and whose output is the probability distribution of the image belonging to each category. Through the collaborative game among these three networks, a more stable and efficient small-sample data augmentation and classification learning system can be constructed, providing a core engine for solving the problem of sample scarcity.
[0024] In a specific embodiment of this application, the above steps are implemented as follows: Following the aforementioned 5-way 1-shot animal image classification task, a generative adversarial network (GAN) model is constructed. The generator employs a deep convolutional generative adversarial network (SAGAN) structure with a self-attention mechanism. Its input is a 100-dimensional random noise vector, and its output is a 128x128 RGB pseudo-image. The discriminator uses a standard PatchGAN structure, which divides the input image into multiple small regions for authenticity judgment and outputs a scalar value representing the probability that the image is "real". The classifier uses a residual network (ResNet-12) with meta-learning initialization parameters. This network receives a 128x128 image input and finally outputs a probability distribution for five categories (corresponding to cat, dog, bird, fish, and rabbit) through a fully connected layer. Initially, all parameters of the generator and classifier are randomly initialized. After construction, the model can proceed to the next stage of joint training.
[0025] The above scenarios are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0026] Step S300: Jointly train the generative adversarial network model based on the small sample image dataset. During the training process, a triple regularization constraint is introduced to construct the total loss function. The triple regularization constraint includes feature consistency regularization, sample diversity regularization, and classification boundary joint regularization.
[0027] Specifically, the calculation process of the feature consistency regularization is as follows: extract the real feature representation of the real image in the intermediate layer of the discriminator; extract the pseudo feature representation of the pseudo image generated by the generator in the intermediate layer of the discriminator; calculate the Euclidean distance or cosine similarity between the real feature representation and the pseudo feature representation as the feature consistency regularization loss, so as to constrain the distribution of the generated image and the real image in the feature space to be consistent and reduce the risk of small sample overfitting.
[0028] Specifically, the calculation process of the sample diversity regularization is as follows: two different sets of latent variables are sampled at the input of the generator; two sets of pseudo-images corresponding to the two different sets of latent variables are generated by the generator; the ratio of the image spatial distance between the two sets of pseudo-images to the latent spatial distance between the two different sets of latent variables is calculated; the ratio is maximized to construct the sample diversity regularization loss, so as to punish the generator for outputting the same image for different latent variables, thereby preventing the generator from experiencing mode collapse.
[0029] Specifically, the calculation process of the joint regularization of the classification boundary is as follows: input the pseudo image into the classifier of the current iteration to obtain the corresponding classification prediction probability distribution; calculate the information entropy of the classification prediction probability distribution and use it as the joint regularization loss of the classification boundary; by minimizing the information entropy, the pseudo image is forced to move away from the decision boundaries of different categories, so as to improve the inter-class separability of the generated samples and the generalization ability of the classifier.
[0030] Specifically, the expression for the total loss function is: in, Represents the total loss function. This indicates that the standard generates adversarial loss. This represents the feature consistency regularization loss. This represents the sample diversity regularization loss. This represents the joint regularization loss at the classification boundary. , These represent positive weight hyperparameters.
[0031] Understandably, by jointly training the model on small-sample image datasets and simultaneously introducing triple regularization constraints—feature consistency, sample diversity, and joint classification boundary—it is possible to systematically address the core challenges of unstable training, easy mode collapse, and poor classification performance of generated samples in small-sample generative models. First, feature consistency regularization ensures that generated images retain key semantic features of real images by forcing pseudo-images and real images to have similar distributions in the discriminator's feature space. This prevents the generator from generating "false feature" images that do not conform to the original data distribution in order to deceive the discriminator, thus significantly reducing the risk of overfitting the model to the training data under small-sample conditions. Second, sample diversity regularization directly combats the mode collapse problem by maximizing the trend that "different input latent variables lead to different output images," ensuring that the generator can cover the multimodal distribution of real data, generating rich and diverse samples, and avoiding monotonous generated images. Finally, joint regularization of classification boundaries minimizes the entropy value of the classifier's prediction of pseudo-images, forcing the classifier to be very "confident" in classifying pseudo-images. This causes the generator to tend to generate samples with clear features that are far from any class decision boundary, thus greatly improving the inter-class separability of the generated samples. These three constraints work together from the three dimensions of feature fidelity, sample richness, and classification clarity to comprehensively guide the generation process.
[0032] In a specific embodiment of this application, the above steps are implemented as follows: Based on the SAGAN generator and ResNet-12 classifier constructed in step S200, joint training is performed using the 5-way 1-shot support set prepared in step S100. The training process employs alternating optimization, with a total of 10,000 iterations. The weight hyperparameters in the total loss function are set as follows: , , .
[0033] First, in each iteration, the generator is fixed. Five real images from the support set and five pseudo-images generated by the generator (one for each class) are input into the discriminator and classifier. The adversarial loss of a standard GAN is then calculated. This is used to update the discriminator. Simultaneously, the output features of the real and fake images at the last convolutional layer of the discriminator are extracted, and the Euclidean distance between them is calculated as the feature consistency regularization loss. The pseudo-image is input into the classifier, and the information entropy of its predicted probability distribution is calculated as the joint regularization loss of the classification boundary. The parameters of the discriminator and classifier are updated using a weighted sum of these three losses.
[0034] Secondly, the discriminator and classifier are fixed. Two different latent variables z1 and z2 are randomly sampled from a 100-dimensional standard normal distribution. The generator generates two corresponding pseudo-images G(z1) and G(z2). The ratio of the average distance between the two image groups in pixel space to the distance between the two latent variables in latent space is calculated; the negative value is the sample diversity regularization loss. At the same time, calculate the total loss. And use this loss to update the generator's parameters.
[0035] For example, in the early stages of training, the generator might consistently produce blurry, cat-like images. At this point, The difference will be large because z1 and z2 are different but the output images are almost identical. As training progresses, the generator will learn to generate images of different categories such as cats, dogs, and birds based on different z values. It will gradually decrease. Meanwhile, This will cause the generated bird images to closely resemble the features of real bird images in the feature space, while This forces the classifier to make a high-confidence "bird" prediction for the generated bird images. Through this alternating optimization, the model converges when the images generated by the generator are visually realistic and clearly classified, and the performance of the discriminator and classifier stabilizes.
[0036] The above scenarios are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0037] Step S400: Use the trained generator to generate pseudo-image samples that are consistent with the distribution of the small sample image dataset, and fuse the pseudo-image samples with the small sample image dataset to obtain an expanded dataset.
[0038] Understandably, after joint model training, the generator has learned the true data distribution of the original few-shot dataset. At this point, this trained generator can be used to generate a large number of high-quality pseudo-image samples. These pseudo-image samples are then fused with the original, extremely limited few-shot image dataset to obtain a significantly expanded dataset. The core value of this step lies in significantly increasing the quantity and diversity of training samples without any additional manual annotation costs. For few-shot learning, the data distribution is greatly improved from only one sample per class to hundreds of generated samples per class, providing a solid data foundation for subsequent classifier fine-tuning and effectively alleviating the problems of model underfitting and inaccurate decision boundaries caused by sample scarcity.
[0039] In a specific embodiment of this application, the above steps are implemented as follows: Building upon the trained model, for each category (cat, dog, bird, fish, rabbit) in the 5-way 1-shot task, a trained generator is used to generate an additional 500 pseudo-image samples. Specifically, for the "cat" category, a category vector representing "cat" (e.g., through a conditional GAN, for simplicity, this could actually be a classifier guiding the generated samples) is concatenated with 500 different noise vectors randomly sampled from a standard normal distribution. This concatenation is then input into the generator to obtain 500 pseudo-images of cats with different poses, backgrounds, and colors. The same operation is repeated for the "dog," "bird," "fish," and "rabbit" categories. Finally, a total of 5 × 500 = 2500 pseudo-image samples are generated. These 2500 pseudo-images are then fused with the original 5 support set images to obtain an expanded dataset containing 2505 labeled images. It can be seen that the problem of insufficient original data is fundamentally improved.
[0040] The above scenarios are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0041] Step S500: Fine-tune the classifier using the expanded dataset to obtain a target image classification model, and use the target image classification model to classify the input image.
[0042] Understandably, after obtaining an augmented dataset containing a large number of pseudo-image samples, the classifier (e.g., the ResNet-12 in step S200) is fine-tuned. This fine-tuning phase differs from the previous joint training; here, the generator and discriminator are fixed or no longer used, and only the classifier is optimized. By continuing training on a larger and more diverse augmented dataset, the classifier can learn more robust and discriminative features, and its classification decision boundary becomes clearer and more accurate. Fine-tuning training can use a smaller learning rate to finely adjust based on the original pre-trained knowledge, avoiding forgetting useful information learned in the joint training phase. Finally, the model obtained after fine-tuning training is the target image classification model. This model can be deployed in real-world applications to make fast and accurate class predictions for any input, unseen image. Because the model is fully trained on high-quality pseudo-images with a near-realistic distribution generated by a triple-regularized GAN, its generalization ability and accuracy on real few-shot classification tasks will far exceed those of classifiers trained directly on the original few-shot data.
[0043] In a specific embodiment of this application, the above steps are implemented as follows: Receive the expanded dataset containing 2505 images obtained in step S400. Use this dataset to fine-tune the ResNet-12 classifier that was jointly trained in step S300. The fine-tuning training uses a stochastic gradient descent optimizer, with an initial learning rate set to 0.001, which is one-tenth of the classifier's learning rate during joint training. Training is conducted for 50 epochs, with a batch size of 32. After training, the final target image classification model is obtained. To verify the model's performance, 50 query set images (10 images per class) reserved in step S100 are input into the model. The model outputs the probability that each image belongs to one of the five categories: cat, dog, bird, fish, or rabbit, achieving a final classification accuracy of 92%. In contrast, the same classifier trained directly on the original 5 support set images achieves only 45% accuracy on the same query set. Furthermore, it can also take a hamster image that the model has never seen before as input. After forward computation, the model outputs the category of "mouse" (if such a category is defined in training) or judges it as having similar but different features from categories such as "rabbit" and "bird". This fully demonstrates the effectiveness of the present invention.
[0044] The above scenarios are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0045] In the above embodiments, by acquiring a small sample image dataset and dividing it into a support set and a query set, a generative adversarial network (GAN) model containing a generator, discriminator, and classifier is constructed. This enables the establishment of a unified data augmentation and classification learning framework under small sample conditions, laying the foundation for subsequent joint optimization of generation and classification. This reduces the dependence on large-scale labeled data and improves data utilization efficiency in small sample scenarios. Secondly, a total loss function based on triple regularization constraints is constructed to jointly train the model, significantly improving the quality and diversity of generated images while enhancing the discriminative performance of the classifier. This solves the problems of feature distortion, pattern collapse, and blurred classification boundaries that traditional GANs easily encounter in small sample training. Thirdly, the trained generator generates pseudo-image samples with the same distribution as the original data, and these are fused with the small sample image dataset to obtain an expanded dataset. Based on this, the classifier is fine-tuned to obtain the target image classification model. This effectively expands the training samples without introducing additional manual annotations, improves the class imbalance problem, and significantly improves the recognition accuracy and robustness of the classification model under limited annotation conditions. Finally, by constructing a joint training architecture for the generator, discriminator, and classifier, and using an alternating optimization approach to update network parameters, the entire few-sample image classification process is made capable of end-to-end adaptive learning. Under the framework of mutual promotion between generation and classification, the network feature representation and decision boundary can be dynamically adjusted, thereby maintaining high accuracy and high stability in challenging scenarios such as few samples, large categories, or fine-grained classification.
[0046] In another preferred embodiment based on the above embodiments, this implementation provides a few-sample image classification system based on triple regularized GAN, including: a data acquisition and preprocessing module, a network construction module, a triple regularized training module, a data augmentation module, and a classification and inference module.
[0047] Specifically, the data acquisition and preprocessing module is configured to acquire a small sample image dataset, preprocess it, and divide it into a support set and a query set; the network construction module is used to construct a generative adversarial network (GAN) model, which includes a generator, a discriminator, and a classifier; the triple regularization training module is used to jointly train the GAN model based on the small sample image dataset, introducing triple regularization constraints to construct the total loss function during training, which includes feature consistency regularization, sample diversity regularization, and joint classification boundary regularization; the data augmentation module is used to generate pseudo-image samples using the trained generator, and fuse the pseudo-image samples with the small sample image dataset to obtain an augmented dataset; the classification and inference module is used to fine-tune the classifier using the augmented dataset to obtain a target image classification model, and use the target image classification model to classify the input image.
[0048] It is understood that the few-sample image classification system and method based on triple regularized GAN in the above embodiments have the same beneficial effects, and will not be described in detail here.
[0049] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program goods. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program goods embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0050] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program goods according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0051] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0052] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0053] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A few-sample image classification method based on triple regularized GAN, characterized in that, Includes the following steps: Obtain a small sample image dataset and preprocess the small sample image dataset, dividing it into a support set and a query set; Construct a generative adversarial network model, which includes a generator, a discriminator, and a classifier; The generative adversarial network model is jointly trained based on the small sample image dataset. During the training process, a triple regularization constraint is introduced to construct the total loss function. The triple regularization constraint includes feature consistency regularization, sample diversity regularization, and classification boundary joint regularization. The trained generator generates pseudo-image samples that are consistent with the distribution of the small sample image dataset. The pseudo-image samples are then fused with the small sample image dataset to obtain an expanded dataset. The classifier is fine-tuned and trained using the expanded dataset to obtain a target image classification model, and the target image classification model is used to classify the input image.
2. The few-sample image classification method based on triple-regularized GAN as described in claim 1, characterized in that, The calculation process for the feature consistency regularization is as follows: Extract the true feature representation of the real image from the intermediate layer of the discriminator; Extract the pseudo-feature representation of the pseudo-image generated by the generator in the intermediate layer of the discriminator; The Euclidean distance or cosine similarity between the true feature representation and the pseudo feature representation is calculated as a feature consistency regularization loss to constrain the distribution of the generated image and the real image in the feature space to reduce the risk of small sample overfitting.
3. The few-sample image classification method based on triple-regularized GAN as described in claim 1, characterized in that, The calculation process for sample diversity regularization is as follows: Two different sets of latent variables are sampled at the input of the generator; The generator generates two sets of pseudo-images corresponding to the two sets of different latent variables. Calculate the ratio of the image spatial distance between the two sets of pseudo-images to the latent spatial distance between the two sets of different latent variables; The ratio is maximized to construct a sample diversity regularization loss, which penalizes the generator for outputting the same image for different latent variables, thereby preventing the generator from experiencing mode collapse.
4. The few-sample image classification method based on triple regularized GAN as described in claim 1, characterized in that, The calculation process for the joint regularization of the classification boundaries is as follows: The pseudo-image is input into the classifier in the current iteration to obtain the corresponding classification prediction probability distribution; Calculate the information entropy of the classification prediction probability distribution and use it as the joint regularization loss of the classification boundary; By minimizing the information entropy, the pseudo-images are forced to move away from the decision boundaries of different categories, thereby improving the inter-class separability of the generated samples and the generalization ability of the classifier.
5. The few-sample image classification method based on triple-regularized GAN as described in claim 1, characterized in that, The expression for the total loss function is: in, Represents the total loss function. This indicates that the standard generates adversarial loss. This represents the feature consistency regularization loss. This represents the sample diversity regularization loss. This represents the joint regularization loss at the classification boundary. , These represent positive weight hyperparameters.
6. The few-sample image classification method based on triple-regularized GAN as described in claim 1, characterized in that, The generator employs a deep convolutional neural network structure that incorporates a self-attention mechanism; The classifier uses a residual network model with meta-learning initialization parameters.
7. The few-sample image classification method based on triple regularized GAN as described in claim 1, characterized in that, The joint training employs an alternating optimization approach, specifically including: The generator is fixed, and the network parameters of the discriminator and the classifier are updated based on real and pseudo images; Fix the discriminator and the classifier, and update the network parameters of the generator based on the total loss function; Repeat the alternating optimization process until the preset number of iterations is reached or the network as a whole converges.
8. A few-shot image classification system based on triple-regularized GAN, applicable to the few-shot image classification method based on triple-regularized GAN as described in any one of claims 1-7, characterized in that, include: The data acquisition and preprocessing module is used to acquire small sample image datasets and preprocess them, dividing them into support sets and query sets; A network construction module is used to build a generative adversarial network model, which includes a generator, a discriminator, and a classifier. The triple regularization training module is used to jointly train the generative adversarial network model based on the small sample image dataset. During the training process, triple regularization constraints are introduced to construct the total loss function. The triple regularization constraints include feature consistency regularization, sample diversity regularization, and classification boundary joint regularization. The data augmentation module is used to generate pseudo-image samples using the trained generator, and then fuse the pseudo-image samples with the small sample image dataset to obtain an augmented dataset. The classification and reasoning module is used to fine-tune and train the classifier using the expanded dataset to obtain a target image classification model, and to classify the input image using the target image classification model.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of a few-sample image classification method based on triple regularized GAN as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of a few-sample image classification method based on triple regularized GAN as described in any one of claims 1 to 7.