A cross-domain small sample image recognition method and system
By using an image generation network with a variational autoencoder and a style transfer module, the problems of model complexity and domain gap in cross-domain few-shot recognition are solved, and efficient cross-domain few-shot recognition is achieved.
Patent Information
- Application Number
- CN202310258589.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-14
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2043-03-14
AI Technical Summary
Existing cross-domain few-sample recognition techniques based on fine-tuning are complex and computationally expensive, cannot effectively address inter-domain gaps, and have poor generalization performance.
An image generation network employing a variational autoencoder module and a style transfer module is used. A few-shot recognition network is trained through a feature extraction and metric matching module to generate target domain samples and perform matching and classification.
It improves the model's generalization ability in the target domain, achieves more accurate cross-domain small sample recognition, and reduces computational costs.
Smart Images

Figure CN116342906B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision and image processing, and more specifically, relates to a cross-domain few-sample image recognition method and system. Background Technology
[0002] Currently, deep learning-based methods have achieved excellent performance on many computer vision tasks. However, these powerful deep learning models often rely on large-scale datasets and long training processes, requiring significant investment of human resources, time, and computational costs. In this context, few-shot image recognition has become one of the key research directions in the field of deep learning. Compared to traditional large-sample-driven image recognition, few-shot image recognition can accurately predict and classify new categories of samples with limited sample sizes, better reflecting real-world scenarios. However, in more practical applications, collecting samples from the same domain to complete a large number of few-shot classification tasks is difficult. When the distributions of training and testing data are inconsistent—that is, the distributions of source and target domain data differ, resulting in domain shift—the model struggles to generalize. To distinguish this scenario from traditional few-shot learning, the few-shot learning problem in this context is defined as "cross-domain few-shot learning."
[0003] The initial approach was based on model fine-tuning. These methods are based on the idea of meta-learning, which aims to enable the model to learn task-independent knowledge during training, preventing overfitting to the training data and allowing for faster generalization to new tasks. For example, the paper "Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks, Proceedings of the International Conference on Machine Learning (ICML), 2017" proposes the idea of meta-learning to effectively solve the problem of cross-domain few-shot classification.
[0004] Existing cross-domain few-sample recognition based on fine-tuning has obvious limitations. The operation of fine-tuning the model for each new input task is very complex, especially for large-scale models, where parameter fine-tuning consumes a lot of computational cost and time. Therefore, the above-mentioned techniques are not a fundamental solution. Summary of the Invention
[0005] To address the shortcomings of existing technologies, the present invention aims to provide a cross-domain few-shot image recognition method and system, which aims to solve the complexity of existing fine-tuning-based cross-domain few-shot recognition technologies that require parameter fine-tuning for each new input task; and the problem that existing few-shot recognition methods cannot solve the domain gap and have poor generalization performance.
[0006] To achieve the above objectives, in a first aspect, the present invention provides a cross-domain few-sample image recognition method, comprising the following steps:
[0007] A trained few-shot recognition network is determined; the few-shot recognition network is used to match and classify samples of different categories; the training process of the few-shot recognition network requires the use of an image generation network, which includes a variational autoencoder module and a style transfer module. The variational autoencoder module is used to extract and reconstruct the feature distribution of the target domain samples. The variational autoencoder includes intermediate parameters for gradient ascent to reconstruct the target domain samples into samples with more complex styles; the style transfer module is used to stylize the source domain samples to obtain labeled training samples belonging to the target domain data distribution; wherein, different image styles correspond to different sample categories or data domains.
[0008] The target domain samples to be identified are input into a trained few-sample recognition network for prediction and classification to obtain image recognition results.
[0009] In one possible implementation, the few-sample recognition network includes: a feature extraction module and a metric matching module;
[0010] The feature extraction module is used to extract features from the input samples;
[0011] The metric matching module is used to match and classify samples of different categories.
[0012] In one possible implementation, the training process of the few-shot recognition network is as follows:
[0013] When training the few-shot recognition network F, for each input task T, N classes of images are randomly selected cyclically from M classes of images. K samples are determined for each class of images as the support set S, and q samples are determined for each class of images as the query set Q, T = (S, Q). After inputting the image to the image generation network G, the generated samples are obtained. Generate samples The loss L is obtained by performing prediction and recognition calculations on the small sample recognition network. T While updating the parameters of the few-shot recognition network F, the intermediate parameters of the image generation network G are also updated to generate more complex target domain style samples. The training of the few-shot recognition network continues in a loop until the trained few-shot recognition network meets the requirements.
[0014] In one possible implementation, the style transfer module uses the stylization parameters output by the variational autoencoder as style features for stylization, so as to preserve the content features of the original sample and generate a new sample with the data distribution features of the target domain.
[0015] In one possible implementation, the metric matching module is used to match and classify the query set and support set of the current task example, specifically including: calculating the category center for N support set samples, calculating the distance to N category centers for each sample in the query set, and classifying each sample in the query set to the nearest category center to complete the identification and classification of the query set samples.
[0016] In one possible implementation, the overall objective function of the few-sample recognition network is:
[0017]
[0018] Among them, L ω This indicates a stylized query set The classification loss is calculated, where α represents the parameters of the few-shot recognition network, and A represents the value based on the style-based support set. The classifier selected by the corresponding few-shot recognition network parameter α, and ω is the output result of the few-shot recognition network.
[0019] Secondly, the present invention provides a cross-domain few-sample image recognition system, comprising:
[0020] A network identification unit is used to determine the trained few-shot recognition network. The few-shot recognition network is used to match and classify samples of different categories. The training process of the few-shot recognition network requires the use of an image generation network, which includes a variational autoencoder module and a style transfer module. The variational autoencoder module is used to extract and reconstruct the feature distribution of the target domain samples. The variational autoencoder includes intermediate parameters for gradient ascent to reconstruct the target domain samples into samples with more complex styles. The style transfer module is used to stylize the source domain samples to obtain labeled training samples belonging to the target domain data distribution. Different image styles correspond to different sample categories or data domains.
[0021] The sample recognition unit is used to input the target domain samples to be recognized into the trained few-sample recognition network for prediction and classification, so as to obtain the image recognition result.
[0022] In one possible implementation, the few-sample recognition network includes a feature extraction module and a metric matching module. The feature extraction module is used to extract features from the input samples. The metric matching module is used to match and classify samples of different categories. Specifically, it matches and classifies the query set and support set of the current task example. Specifically, it calculates the category centers for N support set samples, calculates the distance to N category centers for each sample in the query set, and classifies each sample in the query set to the nearest category center to complete the recognition and classification of the query set samples.
[0023] In one possible implementation, the system further includes: a recognition network training unit, used to, when training the few-shot recognition network F, cyclically and randomly select N classes of images from M classes of images for each input task T, determine K samples as a support set S for each class of images, and determine q samples as a query set Q for each class of images, T = (S, Q), and obtain generated samples after inputting the image generation network G. Generate samples The loss L is obtained by performing prediction and recognition calculations on the small sample recognition network. T While updating the parameters of the few-shot recognition network F, the intermediate parameters of the image generation network G are also updated to generate more complex target domain style samples. The training of the few-shot recognition network continues in a loop until the trained few-shot recognition network meets the requirements.
[0024] In one possible implementation, the style transfer module in the image generation network uses the stylization parameters output by the variational autoencoder as style features for stylization, so as to preserve the content features of the original sample and generate a new sample with the data distribution features of the target domain.
[0025] Thirdly, this application provides an electronic device, comprising: at least one memory for storing a program; and at least one processor for executing the program stored in the memory, wherein when the program stored in the memory is executed, the processor is configured to execute the method described in the first aspect or any possible implementation thereof.
[0026] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when run on a processor, causes the processor to perform the method described in the first aspect or any possible implementation thereof.
[0027] Fifthly, this application provides a computer program product that, when run on a processor, causes the processor to perform the method described in the first aspect or any possible implementation thereof.
[0028] In summary, the technical solutions conceived by this invention have the following beneficial effects compared with the prior art:
[0029] This invention provides a cross-domain few-shot image recognition method and system. When training the few-shot recognition network model, a test image is input, and a feature extraction network is used to extract features from the input support set and query set samples. Because the feature extraction network fully learns the distribution information of the target domain during the training phase, even if there is a domain gap between the test samples and training samples, the network can effectively extract category-related features from the samples during the feature extraction phase, which helps to distinguish between samples of different categories.
[0030] This invention provides a cross-domain few-sample image recognition method and system. By selecting a matching metric module to train a few-sample recognition model, and by training a flexible metric method to match the similarity of features between samples of different categories, the corresponding relationship between samples can be effectively found, thereby enabling effective matching and recognition.
[0031] This invention provides a cross-domain few-shot image recognition method and system. The provided adversarial generative network model includes a variational autoencoder module and a style transfer module, which can effectively introduce target domain information during the training phase, improve the model's generalization ability to the target domain, and enable the few-shot recognition model to achieve more accurate recognition results in the target domain. Attached Figure Description
[0032] Figure 1 This is a flowchart of the cross-domain few-sample image recognition method provided in the embodiments of the present invention;
[0033] Figure 2 This is a schematic diagram of the architecture for cross-domain small sample recognition provided in an embodiment of the present invention;
[0034] Figure 3 This is a schematic diagram of stylized generation provided in an embodiment of the present invention;
[0035] Figure 4 This is a diagram of the cross-domain small sample image recognition system architecture provided in an embodiment of the present invention. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0037] In this article, the term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The symbol " / " in this article indicates that the related objects are in an "or" relationship; for example, A / B means A or B.
[0038] The terms "first" and "second," etc., used in the specification and claims herein are used to distinguish different objects, not to describe a specific order of objects. For example, "first response message" and "second response message," etc., are used to distinguish different response messages, not to describe a specific order of response messages.
[0039] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0040] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, for example, multiple processing units means two or more processing units, multiple elements means two or more elements, etc.
[0041] First, the technical terms involved in the embodiments of this application will be introduced.
[0042] (1) Stylization
[0043] Image stylization, also known as style transfer, involves transferring the style of an artistic image to an ordinary image, allowing the original image to retain its original content while possessing a unique artistic style, such as cartoon, comic, oil painting, watercolor, or ink painting.
[0044] (2) Domain
[0045] Different domains refer to different distributions of sample data. For example, images of different artistic styles have different data distributions, meaning that images of different artistic styles belong to different domains.
[0046] Next, the technical solutions provided in the embodiments of this application will be described.
[0047] Figure 1 This is a flowchart of the cross-domain few-sample image recognition method provided in an embodiment of the present invention; as shown below. Figure 1 As shown, it includes the following steps:
[0048] S101, Determine the trained few-shot recognition network; the few-shot recognition network is used to match and classify samples of different categories; the training process of the few-shot recognition network requires the use of an image generation network, which includes: a variational autoencoder module and a style transfer module; the variational autoencoder module is used to extract and reconstruct the feature distribution of the target domain samples; the variational autoencoder includes intermediate parameters for gradient ascent to reconstruct the target domain samples into samples with more complex styles; the style transfer module is used to stylize the source domain samples to obtain labeled training samples belonging to the target domain data distribution; wherein, different image styles correspond to different sample categories or data domains.
[0049] S102, the target domain sample to be identified is input into the trained few-sample recognition network for prediction and classification to obtain the image recognition result.
[0050] Specifically, firstly, a pre-trained image generation network G and a few-shot recognition network F are determined. The image generation network G includes a variational autoencoder module and a style transfer module. The variational autoencoder module is used to extract and reconstruct the feature distribution of the target domain samples, where the intermediate parameter ε is used for gradient ascent to generate more difficult style parameters. The style transfer module is used to stylize the source domain samples to obtain labeled training samples belonging to the target domain data distribution. The few-shot recognition network F includes a feature extraction module and a metric matching module. The feature extraction module is used to extract features from the input samples, and the metric matching module is used to match and classify samples of different categories.
[0051] like Figure 2 As shown, the architecture of the cross-domain few-sample identification method and system provided by this invention includes two parts:
[0052] (1) Image generation pre-trained network Includes variational autoencoder module The variational autoencoder module is used to extract and reconstruct the feature distribution of the target domain samples, where the intermediate parameter ε is used for gradient ascent to generate more difficult style parameters. The style transfer module is used to stylize the source domain samples to obtain labeled training samples belonging to the target domain data distribution.
[0053] (2) Small sample recognition network T: includes a feature extraction module and a metric matching module; the feature extraction module is used to extract features of input samples, and the metric matching module is used to match and classify samples of different categories.
[0054] In one specific embodiment, the present invention provides a method for cross-domain few-sample identification, comprising the following steps:
[0055]
[0056] In another example, the present invention provides a cross-domain few-shot identification system, comprising:
[0057] Image generation pre-training module G includes a variational autoencoder unit and a style transfer unit; the variational autoencoder unit is used to extract and reconstruct the feature distribution of the target domain samples, where the intermediate parameter ε is used for gradient ascent to generate more difficult style parameters; the style transfer unit is used to stylize the source domain samples to obtain labeled training samples belonging to the target domain data distribution.
[0058] The small sample recognition module T includes a feature extraction unit and a metric matching unit; the feature extraction unit is used to extract features from the input sample, and the metric matching unit is used to match and classify samples of different categories.
[0059] When training the few-shot recognition module F, for each input task T, N classes of images are randomly selected cyclically from M classes of images. K samples are determined for each class of images as the support set S, and q samples are determined for each class of images as the query set Q, i.e., T = (S, Q), where... The generated samples are obtained after input module G. The generated sample is input into the small sample recognition module for prediction and recognition calculation to obtain the loss L. T While updating the parameters of the recognition module F, the intermediate parameters of the generation module G are also updated to generate more difficult target domain styles, thereby completing the training of the few-sample recognition module F.
[0060] The new category sample of the target domain to be identified is input into the trained small sample recognition module to predict and classify the sample to be identified and output the corresponding recognition result.
[0061] In an optional example, the variational autoencoder unit is used to calculate the data distribution of a set of unlabeled unknown domain samples and reconstruct the corresponding stylization parameters by sampling anchor points ε from the distribution. The parameters specifically include the mean and variance.
[0062] In an optional example, the style transfer unit is used to stylize the example, select the current example as the content feature, and use the stylization parameters output by the variational autoencoder as the style feature for stylization. The output sample retains the original content features, so its label is retained, and it also has the data distribution characteristics of the target domain.
[0063] In an optional example, the feature extraction unit is used for feature extraction, specifically including feature extraction of the sample obtained after stylizing the current example.
[0064] In an optional example, the metric matching unit is used to match and classify the query set and support set of the current task example, specifically including: calculating the category center for N support set samples, and calculating the distance to the N category centers for each sample of the query set, so as to complete the identification and classification of the query set samples.
[0065] In an optional example, the overall objective function of the recognition module is:
[0066]
[0067] Among them, L T This indicates a stylized query set The calculated classification loss is α, where α represents the parameters of the few-sample recognition module described above, and A represents the value based on the style-based support set. The classifier selected by the parameter α of the corresponding small sample recognition module, ω is its corresponding output result.
[0068] Figure 3 This is a schematic diagram of stylization generation provided in an embodiment of the present invention. We first generate a small number of target domain samples X. T Calculate its mean in the feature space. and variance To mitigate the impact of sampling randomness on network training, among which Then calculate the Gaussian distribution statistic N(ψ,ξ), where For each few sample task T = {S T Q T We first sample a vector ε1 from a Gaussian distribution, and input D. vae Decoding yields vectors As style feature input for the subsequent AdaIN network; it will support the set of images S T and query set image Q T Enter E VGG The obtained features are used as another input to AdaIN, and AdaIN outputs some new style images, represented as... These style images approximately conform to the target domain distribution. As introduced in previous sections, "ε1" is the "style anchor point" because the VAE network can reconstruct the distribution of a given M target domain images. The generated stylized images are further input into the task model to solve the few-shot classification problem. In this invention, RelationNet is chosen as the task model, but other models for solving few-shot problems are also applicable. To search for more styles that conform to the target domain distribution, we use an adversarial approach to generate more difficult stylized samples and attempt to iteratively mine more invisible target domain distributions starting from the "style anchor point." Figure 3As shown, we compute the classification loss L on the query set of the task model. T1 We obtain feedback on ε1. And to prepare more difficult samples for the next iteration. Then by minimizing L T The task model parameters are updated in the hope of more accurately classifying target domain images, even though the model has excellent generalization ability.
[0069] Figure 4 This is an architecture diagram of a cross-domain few-sample image recognition system provided in an embodiment of the present invention, such as... Figure 4 As shown, it includes:
[0070] The recognition network training unit 410 is used to train the few-shot recognition network F. For each input task T, N classes of images are randomly selected cyclically from M classes of images. K samples are determined as the support set S for each class of images, and q samples are determined as the query set Q for each class of images, T = (S, Q). After inputting the image to the generation network G, the generated samples are obtained. Generate samples The loss L is obtained by performing prediction and recognition calculations on the small sample recognition network. T While updating the parameters of the few-shot recognition network F, the intermediate parameters of the image generation network G are also updated to generate more complex target domain style samples. The training of the few-shot recognition network continues in a loop until the trained few-shot recognition network meets the requirements.
[0071] The recognition network determination unit 420 is used to determine the trained few-shot recognition network. The few-shot recognition network is used to match and classify samples of different categories. The training process of the few-shot recognition network requires the use of an image generation network, which includes a variational autoencoder module and a style transfer module. The variational autoencoder module is used to extract and reconstruct the feature distribution of the target domain samples. The variational autoencoder includes intermediate parameters for gradient ascent to reconstruct the target domain samples into samples with more complex styles. The style transfer module is used to stylize the source domain samples to obtain labeled training samples belonging to the target domain data distribution. Different image styles correspond to different sample categories or data domains.
[0072] The sample recognition unit 430 is used to input the target domain sample to be recognized into the trained few sample recognition network for prediction and classification, so as to obtain the image recognition result.
[0073] It should be understood that the above-described device is used to execute the methods in the above embodiments. The implementation principle and technical effect of the corresponding program modules in the device are similar to those described in the above methods. The working process of the device can be referred to the corresponding process in the above methods, and will not be repeated here.
[0074] Based on the methods described in the above embodiments, this application provides an electronic device. The device may include at least one memory for storing a program and at least one processor for executing the program stored in the memory. When the program stored in the memory is executed, the processor performs the methods described in the above embodiments.
[0075] Based on the methods in the above embodiments, this application provides a computer-readable storage medium storing a computer program that, when run on a processor, causes the processor to execute the methods in the above embodiments.
[0076] Based on the methods in the above embodiments, this application provides a computer program product that, when run on a processor, causes the processor to execute the methods in the above embodiments.
[0077] It is understood that the processor in the embodiments of this application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. A general-purpose processor may be a microprocessor or any conventional processor.
[0078] The method steps in the embodiments of this application can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, portable hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can reside in an ASIC.
[0079] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0080] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application.
[0081] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A cross-domain few-shot image recognition method, characterized in that, The method comprises the following steps: determine a trained small sample recognition network; The small sample recognition network is used for matching classification of samples of different categories. The training process of the small sample recognition network needs to use an image generation network, and the image generation network comprises a variational autoencoder module and a style conversion module. The variational autoencoder module is used for extracting and reconstructing the feature distribution of a target domain sample. The variational autoencoder comprises intermediate parameters, which are used for gradient ascent to reconstruct the target domain sample into a sample with a more complex style. Small sample recognition network F During training, for each task input T , randomly select M , from N , the class images, determine K , for each class image, determine S , a sample as a support set q , for each class image, determine Q , a sample as a query set , input the image generation network G , then obtain the generated sample , input the generated sample , into the small sample recognition network for prediction and recognition calculation to obtain a loss , update the parameters of the small sample recognition network F , and update the intermediate parameters of the image generation network G , to generate more complex target domain style samples, continue to train the small sample recognition network in a loop until the trained small sample recognition network meets the requirements. The style conversion module is used for stylizing a source domain sample to obtain a labeled training sample belonging to the data distribution of the target domain. wherein, represents a set of stylized queries a computed classification loss, and a denotes parameters of the small sample identification network, A represents a set of stylized support based on and a selected classifier corresponding to the small sample identification network parameters a, is an output result of the small sample identification network.
2. The method of claim 1, wherein, Different image styles correspond to different sample categories or data domains. The target domain sample to be recognized is input into the trained small sample recognition network for prediction classification to obtain an image recognition result. The training process of the small sample recognition network is as follows:
3. The method according to claim 1 or 2, characterized in that, The overall objective function of the small sample recognition network is as follows:
4. The method of claim 2, wherein, The metric matching module is used to match and classify the query set and support set of the current task example, specifically including: ... N The class supports the calculation of class centers for each sample in the query set. N The distance between each category center is used to classify each sample in the query set to the nearest category center, thus completing the identification and classification of the query set samples.
5. A cross-domain few-shot image recognition system, comprising: The small sample recognition network comprises a feature extraction module and a metric matching module. The feature extraction module is used for extracting the features of an input sample. The metric matching module is used for matching classification of samples of different categories. The style conversion module uses the stylization parameters output by the variational autoencoder as style features for stylization to retain the content features of the original sample and generate a new sample with the data distribution characteristics of the target domain. The method comprises the following steps: determine a trained small sample recognition network; For small sample recognition networks F During training, for each input task T ,from M Cyclic random selection in class image N Image class, determine for each image class K 1 sample as support set S Determine for each type of image q One sample as query set Q ,Will Input Image Generation Network G Then the generated samples are obtained , will generate samples The loss is calculated by inputting the sample data into a small sample recognition network for prediction and recognition. Update the few-shot recognition network F While resetting the parameters, update the image generation network mentioned above. G The intermediate parameters are used to generate more complex target domain style samples, and the few-shot recognition network is trained in a loop until the trained few-shot recognition network meets the requirements. The small sample recognition network is used for matching classification of samples of different categories. wherein, represents a set of stylized queries a computed classification loss, and a denotes parameters of the small sample recognition network, A represents a set of stylized support based on and a selected classifier corresponding to the small sample recognition network parameters a, is an output result of the small sample recognition network.
6. The system of claim 5, wherein, The small sample recognition network comprises a feature extraction module and a metric matching module; the feature extraction module is used for extracting features of input samples; the metric matching module is used for matching and classifying different category samples, specifically for matching and classifying a query set and a support set of a current task example, specifically comprising: N calculating a category center for a class support set sample, calculating the distance of each sample of the query set to N a category center, classifying each sample of the query set to the nearest category center to complete the recognition and classification of the query set sample.
7. The system of claim 5 or 6, wherein, The training process of the small sample recognition network needs to use an image generation network, and the image generation network comprises a variational autoencoder module and a style conversion module. The variational autoencoder module is used for extracting and reconstructing the feature distribution of a target domain sample. The variational autoencoder comprises intermediate parameters, which are used for gradient ascent to reconstruct the target domain sample into a sample with a more complex style. The style conversion module is used for stylizing a source domain sample to obtain a labeled training sample belonging to the data distribution of the target domain. Different image styles correspond to different sample categories or data domains. A sample recognition unit is configured to input a target domain sample to be recognized into the trained small sample recognition network for prediction classification to obtain an image recognition result. The training process of the small sample recognition network is as follows: The overall objective function of the small sample recognition network is as follows: The style conversion module uses the stylization parameters output by the variational autoencoder as style features for stylization to retain the content features of the original sample and generate a new sample with the data distribution characteristics of the target domain.
Citation Information
Patent Citations
Machine learning model antagonism sample generation method based on conditional variation auto-encoder
CN112801297A
Small sample image classification method based on depth attention measurement
CN114926702A