[go: up one dir, main page]

CN113298184A - Sample extraction and expansion method and storage medium for small sample image recognition - Google Patents

Sample extraction and expansion method and storage medium for small sample image recognition Download PDF

Info

Publication number
CN113298184A
CN113298184A CN202110687034.2A CN202110687034A CN113298184A CN 113298184 A CN113298184 A CN 113298184A CN 202110687034 A CN202110687034 A CN 202110687034A CN 113298184 A CN113298184 A CN 113298184A
Authority
CN
China
Prior art keywords
sample
category
cluster
samples
small
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110687034.2A
Other languages
Chinese (zh)
Other versions
CN113298184B (en
Inventor
王红滨
张政超
张耘
王念滨
周连科
张毅
湛浩旻
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Harbin Engineering University
Original Assignee
Harbin Engineering University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Harbin Engineering University filed Critical Harbin Engineering University
Priority to CN202110687034.2A priority Critical patent/CN113298184B/en
Publication of CN113298184A publication Critical patent/CN113298184A/en
Application granted granted Critical
Publication of CN113298184B publication Critical patent/CN113298184B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computational Linguistics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Evolutionary Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)

Abstract

用于小样本图像识别的样本抽取、扩充方法及存储介质,属于图像处理技术领域。为了解决针对于小样本图像识别过程中采用生成新样本的方式中存在的可能导致的生成错误样本的问题。本发明首先提出了一种基于特征重构的样本抽取方法来解决小样本数据集特征缺失的问题,从数据特征的角度实现了大样本数据集中抽取出一个典型小样本数据集。该方法将大样本数据的质心作为抽取度量的标准,使得抽取出的典型小样本数据集具有更全面的特征,效果更稳定。本发明还提出了基于变形信息的样本扩充方法,利用最优划分中同类异簇的数据间变形信息实现了将抽取出的典型小样本数据集扩充成新的大样本数据集。主要用于小样本图像识别的样本抽取及扩充。

Figure 202110687034

A sample extraction and expansion method and a storage medium for small sample image recognition belong to the technical field of image processing. In order to solve the problem of generating wrong samples that may be caused in the way of generating new samples in the process of image recognition with small samples. The invention first proposes a sample extraction method based on feature reconstruction to solve the problem of missing features of small sample data sets, and realizes the extraction of a typical small sample data set from large sample data sets from the perspective of data features. In this method, the centroid of the large sample data is used as the standard of extraction measurement, so that the typical small sample data set extracted has more comprehensive features and the effect is more stable. The invention also proposes a sample expansion method based on deformation information, which utilizes the deformation information between the same and different clusters in the optimal division to realize the expansion of the extracted typical small sample data set into a new large sample data set. It is mainly used for sample extraction and expansion of small sample image recognition.

Figure 202110687034

Description

用于小样本图像识别的样本抽取、扩充方法及存储介质Sample extraction, expansion method and storage medium for small sample image recognition

技术领域technical field

本发明涉及图像样本抽取和扩充方法以及存储介质。属于图像处理技术领域。The present invention relates to an image sample extraction and expansion method and a storage medium. It belongs to the technical field of image processing.

背景技术Background technique

神经网络往往需要大量的数据来完成有效的训练。在低数据区,网络的训练效果和泛化能力会表现不佳。Neural networks often require large amounts of data to complete effective training. In the low data area, the training effect and generalization ability of the network will be poor.

为了保证网络的识别效果,目前基本都是采用基于数据扩充的小样本学习方法,在数据扩充的大多是利用生成对抗的思想生成数据或直接使用相似数据集间的差异信息实现数据增强。但是这种方式没有考虑扩充前小样本数据集特征是否完整的问题,会导致扩充后的数据依然缺失重要的特征。也没有考察差异信息使用是否合理的问题,如果将无关的差异信息使用在小样本数据上,进而生成新的样本,会导致生成错误的样本。再利用新生成的错误的样本进行训练会影响网络的训练效果,不仅不能提高识别效果,甚至可能导致识别效果变差。In order to ensure the recognition effect of the network, the small-sample learning method based on data expansion is basically used at present. Most of the data expansion is to use the idea of generative confrontation to generate data or directly use the difference information between similar data sets to achieve data enhancement. However, this method does not consider the completeness of the features of the small sample data set before expansion, which will lead to the lack of important features in the expanded data. There is also no question of whether the use of difference information is reasonable. If irrelevant difference information is used on small sample data to generate new samples, wrong samples will be generated. Reusing the newly generated wrong samples for training will affect the training effect of the network, not only can not improve the recognition effect, but may even cause the recognition effect to deteriorate.

发明内容SUMMARY OF THE INVENTION

本发明是为了解决针对于小样本图像识别过程中采用生成新样本的方式中存在的可能导致的生成错误样本的问题,进而影响训练效果。The present invention aims to solve the problem of generating wrong samples that may be caused in the way of generating new samples in the process of small sample image recognition, thereby affecting the training effect.

一种用于小样本图像识别的样本抽取方法,包括以下步骤:A sample extraction method for small sample image recognition, comprising the following steps:

S1、计算出图像大样本数据集的各类别中心支持点CkS1. Calculate the center support point C k of each category of the image large sample data set;

S2、从样本特征的角度对同类样本数据划分为动态数量的簇,并根据每种划分情况先计算出各簇的质心;S2. Divide the same sample data into a dynamic number of clusters from the perspective of sample characteristics, and first calculate the centroid of each cluster according to each division situation;

根据各簇的质心计算出在该种划分情况下该类别新的中心点;并通过计算同簇误差和质心误差之和作为该类别在该种划分情况的总误差;选出最小误差的情况作为该类别的最优划分方式;According to the centroid of each cluster, the new center point of the category under this kind of division is calculated; and the sum of the error of the same cluster and the centroid error is calculated as the total error of the category in this kind of division; the case with the smallest error is selected as the The optimal way of dividing the category;

S3、从最优划分的各簇中按照其样本分布均匀定量的抽取出样本,作为特征重构的小样本数据集。S3 , extracting samples uniformly and quantitatively from each optimally divided cluster according to its sample distribution, as a small sample data set for feature reconstruction.

进一步地,计算出图像大样本数据集的各类别中心支持点Ck的过程包括以下步骤:Further, the process of calculating the center support point C k of each category of the image large sample data set includes the following steps:

针对于图像大样本数据集,计算出大样本数据集中每个类别的中所有特征向量的平均向量,将其作为该类别的中心支持点CkFor the image large sample data set, calculate the average vector of all feature vectors in each category in the large sample data set, and use it as the central support point C k of the category:

Figure BDA0003124960410000011
Figure BDA0003124960410000011

Sk表示第K个类别的样本集,|Sk|表示第K个类别的样本集中样本的数量;xi表示属于Sk样本集的样本数据,yi是样本xi对应的标签;

Figure BDA0003124960410000023
为嵌入函数。S k represents the sample set of the K-th category, |S k | represents the number of samples in the K-th category of the sample set; xi represents the sample data belonging to the S k sample set, and yi is the label corresponding to the sample xi ;
Figure BDA0003124960410000023
is an embedded function.

进一步地,步骤S2包括以下步骤:Further, step S2 includes the following steps:

2.1、将大样本数据集中每个类别中样本的特征向量聚类成一个动态数量的簇,设有m个簇;2.1. Cluster the eigenvectors of the samples in each category in the large sample data set into a dynamic number of clusters, with m clusters;

2.2、计算出各个新簇的质心C′k_m_n,将该簇下的所有样本表示为X∈Sk_m_;C′k_m_n表示将类别k的数据划分为m个簇后,第n簇的质心;Sk_m_n表示将类别k中的样本划分为m个簇后,第n个簇中的所有样本的集合;2.2. Calculate the centroid C′ k_m_n of each new cluster, and denote all samples under the cluster as X∈S k_m_ ; C′ k_m_n indicates the centroid of the nth cluster after dividing the data of category k into m clusters; S k_m_n represents the set of all samples in the nth cluster after dividing the samples in category k into m clusters;

2.3、通过各个新簇的质心C′k_m_n计算出该类别在该种划分情况下的新质心C′k_m2.3. Calculate the new centroid C′ k_m of the category in this case of division through the centroid C′ k_m_n of each new cluster;

Figure BDA0003124960410000021
Figure BDA0003124960410000021

其中,C′k_m表示将第K个类别的样本划分为m个簇后,由每个簇的质心构成的该类别新的中心支持点;Among them, C′ k_m represents the new center support point of the category formed by the centroid of each cluster after the samples of the Kth category are divided into m clusters;

2.4、通过计算同簇误差Lsce和质心误差Lce的和作为该类别在该种划分情况下的总误差Ls;从中选出总误差最小的情况作为该类别数据的最优化分。2.4. Calculate the sum of the same-cluster error L sce and the centroid error L ce as the total error L s of the category in this division; select the case with the smallest total error as the optimal score for the category of data.

进一步地,所述的总误差Ls=Lsve+Lce;其中Further, the total error L s =L sve +L ce ; wherein

同簇误差为每个簇中所有样本与该簇质心间的距离之和:The co-cluster error is the sum of the distances between all samples in each cluster and the centroid of the cluster:

Figure BDA0003124960410000022
Figure BDA0003124960410000022

质心误差为通过各簇质心构造出的该类别的新质心与大样本中该类别质心间的距离:The centroid error is the distance between the new centroid of the category constructed by the centroids of each cluster and the centroid of the category in the large sample:

Lce=C′k_m-CkL ce =C' k_m -C k .

一种存储介质,所述存储介质中存储有至少一条指令,所述至少一条指令由处理器加载并执行以实现一种用于小样本图像识别的样本抽取方法。A storage medium stores at least one instruction, the at least one instruction is loaded and executed by a processor to implement a sample extraction method for small sample image recognition.

用于小样本图像识别的样本扩充方法,利用一种用于小样本图像识别的样本抽取方法确定小样本数据集,并基于小样本数据集进行扩充,样本的扩充包括训练阶段和生成阶段;训练阶段:The sample expansion method for small-sample image recognition uses a sample extraction method for small-sample image recognition to determine a small-sample data set, and expands based on the small-sample data set. The sample expansion includes a training phase and a generation phase; training stage:

根据用于小样本图像识别的样本抽取方法中每一类别的最优划分的方式将典型的小样本数据集划分成样本对的形式(x′m,x′n),其中x′m和x′n属于同类别中不同簇的样本数据;即x′m∈Qk_i_s,x′n∈Qk_i_t,s≠t,其中Qk_i_s和Qk_i_t分别表示将类别k的数据最优划分为i簇后,第s簇和第t簇的样本数据;A typical small-sample data set is divided into the form of sample pairs ( x'm , x'n ) according to the optimal division of each class in the sample extraction method for small-sample image recognition, where x'm and x ′ n belong to the sample data of different clusters in the same category; that is, x′ m ∈ Q k_i_s , x′ n ∈ Q k_i_t , s≠t, where Q k_i_s and Q k_i_t respectively represent the optimal division of the data of category k into i clusters After, the sample data of the s-th cluster and the t-th cluster;

样本扩充的过程使用样本扩充模型来完成,所述的样本扩充模型是一个包括推断模型、生成模型、判别模型及分类器的网络结构;The process of sample expansion is completed by using a sample expansion model, and the sample expansion model is a network structure including an inference model, a generative model, a discriminant model and a classifier;

推断模型对同类不同簇的样本对(x′m,x′n)编码,并学习同类不同簇的样本x′m和x′n之间的变形信息Z=E(x′m,x′n);The inference model encodes the sample pairs (x′ m , x′ n ) of the same different clusters, and learns the deformation information Z=E(x′ m , x′ n between the samples x′ m and x′ n of the same different clusters );

生成模型利用潜在空间内的变形信息Z和输入的样本x′n来生成

Figure BDA0003124960410000031
表示为
Figure BDA0003124960410000032
Figure BDA0003124960410000033
The generative model uses the deformation information Z in the latent space and the input samples x′ n to generate
Figure BDA0003124960410000031
Expressed as
Figure BDA0003124960410000032
Figure BDA0003124960410000033

判别模型被训练用于区分是真实样本对(xc,x′m)还是重构样本对

Figure BDA0003124960410000034
通过对抗性训练使得网络能够更加准确的重构出该样本;The discriminative model is trained to distinguish between real sample pairs (x c , x′ m ) and reconstructed sample pairs
Figure BDA0003124960410000034
Through adversarial training, the network can reconstruct the sample more accurately;

分类器用于对重构样本

Figure BDA0003124960410000035
进行分类;The classifier is used to reconstruct the sample
Figure BDA0003124960410000035
sort;

生成阶段:Build stage:

将同类不同簇的样本对(x′m,x′n)作为模型的输入,然后将变形信息Z和样本x′u∈Qk_i_t作为生成模型的输入,最终为该类别生成一个新的样本;通过不断地改变推断模型输入的样本对(x′m,x′n)或改变生成模型的输入的样本x′u来为该类别生成更多的新样本。Take the sample pair (x′ m , x′ n ) of the same type and different clusters as the input of the model, and then take the deformation information Z and the sample x′ u ∈ Q k_i_t as the input of the generative model, and finally generate a new sample for this category; More new samples for the class are generated by constantly changing the sample pair ( x'm , x'n ) input to the inference model or changing the sample x'u input to the generative model.

进一步地,所述改变推断模型输入的样本对(x′m,x′n)的过程中需要保证样本对(x′m,x′n)是训练过程中训练过的样本对。Further, in the process of changing the sample pair (x' m , x' n ) input by the inference model, it is necessary to ensure that the sample pair (x' m , x' n ) is the sample pair trained in the training process.

进一步地,所述改变生成模型的输入的样本x′u的过程冲要保证x′u与生成模型输入的样本x′n同类同簇。Further, the process of changing the input samples x' u of the generative model must ensure that x' u and the samples x' n input by the generative model are of the same type and the same cluster.

进一步地,样本扩充模型在训练阶段的总损失如下:Further, the total loss of the sample augmentation model in the training phase is as follows:

L=Lmse+LD+Lcls L=L mse +L D +L cls

其中,Lmse为生成损失,LD为判别损失,Lcls为分类损失。Among them, L mse is the generation loss, L D is the discriminative loss, and L cls is the classification loss.

一种存储介质,所述存储介质中存储有至少一条指令,所述至少一条指令由处理器加载并执行以实现用于小样本图像识别的样本扩充方法。A storage medium storing at least one instruction, the at least one instruction is loaded and executed by a processor to implement a sample expansion method for small sample image recognition.

有益效果:Beneficial effects:

本发明首先提出了一种基于特征重构的样本抽取方法来解决小样本数据集特征缺失的问题,从数据特征的角度实现了大样本数据集中抽取出一个典型小样本数据集。该方法将大样本数据的质心作为抽取度量的标准,使得抽取出的典型小样本数据集具有更全面的特征,效果更稳定;同时,也为数据扩充提供了一个特征较为完整的典型小样本数据集。本发明还进一步提出了基于变形信息的样本扩充方法,利用最优划分中同类异簇的数据间变形信息实现了将抽取出的典型小样本数据集扩充成新的大样本数据集。该方法更合理地提取和使用变形信息,使得生成的数据更加的准确。由于本发明保证了生成的图像数据更加准确,因此在在进一步训练图像识别网络时能够有效提高网络的识别效果。The invention first proposes a sample extraction method based on feature reconstruction to solve the problem of missing features of small sample data sets, and realizes the extraction of a typical small sample data set from large sample data sets from the perspective of data features. In this method, the centroid of the large sample data is used as the standard of extraction measurement, so that the extracted typical small sample data set has more comprehensive characteristics and the effect is more stable; at the same time, it also provides a typical small sample data with relatively complete characteristics for data expansion. set. The invention further proposes a sample expansion method based on deformation information, which realizes the expansion of the extracted typical small sample data set into a new large sample data set by using the deformation information between the data of the same kind and different clusters in the optimal division. This method extracts and uses deformation information more reasonably, making the generated data more accurate. Since the invention ensures that the generated image data is more accurate, the recognition effect of the network can be effectively improved when the image recognition network is further trained.

附图说明Description of drawings

图1为样本抽取和扩充方法的概述图;Figure 1 is an overview of sample extraction and expansion methods;

图2为基于特征重构和变形信息的对抗性数据增强模型;Figure 2 is an adversarial data augmentation model based on feature reconstruction and deformation information;

图3为数据量与模型准确率的关系图;Figure 3 is a graph showing the relationship between the amount of data and the accuracy of the model;

图4为以MNIST数据集标签为5的样本为例,可视化其最优划分簇中各簇的质心;Figure 4 shows the centroid of each cluster in the optimal partition of the sample with the label of 5 in the MNIST dataset as an example;

图5为运用SECIDI方法中的网络结构在MNIST数字数据集(标签为3)和EMNIST字符数据集(标签为46)上生成的新样本。Figure 5 shows new samples generated on the MNIST numeric dataset (label 3) and the EMNIST character dataset (label 46) using the network structure in the SECIDI method.

具体实施方式Detailed ways

具体实施方式一:Specific implementation one:

本实施方式为一种用于小样本图像识别的样本抽取方法,本质是一种基于特征重构的抽样方法,其主要思想为通过无监督模糊聚类的方法对大样本数据进行最优划分,然后再重构典型的小样本数据集。具体来说,包括以下步骤:This embodiment is a sample extraction method for small sample image recognition, which is essentially a sampling method based on feature reconstruction. The main idea is to optimally divide large sample data through an unsupervised fuzzy clustering method. Then reconstruct the typical small sample dataset. Specifically, the following steps are included:

首先,计算出图像大样本数据集的各类别中心支持点CkFirst, the center support point C k of each category of the image large sample data set is calculated.

其次,从样本特征的角度对同类样本数据划分为动态数量的簇,并根据每种划分情况先计算出各簇的质心。Secondly, from the perspective of sample characteristics, the same sample data is divided into a dynamic number of clusters, and the centroids of each cluster are first calculated according to each division.

然后,根据各簇的质心计算出在该种划分情况下该类别新的中心点。并通过计算同簇误差和质心误差之和作为该类别在该种划分情况的总误差。选出最小误差的情况作为该类别的最优划分方式。Then, according to the centroid of each cluster, the new center point of the category under this kind of division is calculated. And by calculating the sum of the same cluster error and centroid error as the total error of the category in this kind of division. The case with the smallest error is selected as the optimal division method for this category.

最后,从每个类别的最优划分簇中,重构典型的小样本数据。Finally, the typical small sample data is reconstructed from the optimally divided clusters for each class.

具体的重构过程包括以下步骤:The specific reconstruction process includes the following steps:

1、类别均值(质心)计算:1. Calculation of category mean (centroid):

针对于图像大样本数据集,计算出大样本数据集中每个类别的中所有特征向量的平均向量,将其作为该类别的中心支持点Ck。所述的类别是按照图像的标签进行划分的,即类别是指按照标签分类,比如手写数字识别的数据集,所有标签为0的是一类,标签是1的是一类,以此类推。For the image large sample data set, calculate the average vector of all feature vectors in each category in the large sample data set, and use it as the central support point C k of the category. The category is divided according to the label of the image, that is, the category refers to the classification according to the label, such as the data set of handwritten digit recognition, all the labels are 0 is a class, the label is 1 is a class, and so on.

Figure BDA0003124960410000041
Figure BDA0003124960410000041

Sk表示第K个类别的样本集,|Sk|表示第K个类别的样本集中样本的数量;xi表示属于Sk样本集的样本数据,yi是样本xi对应的标签;

Figure BDA0003124960410000051
为嵌入函数,在一些实施例中嵌入函数指卷积神经网络的卷积层。S k represents the sample set of the K-th category, |S k | represents the number of samples in the K-th category of the sample set; xi represents the sample data belonging to the S k sample set, and yi is the label corresponding to the sample xi ;
Figure BDA0003124960410000051
is an embedding function, which in some embodiments refers to a convolutional layer of a convolutional neural network.

2、同类数据的最优划分:2. Optimal division of similar data:

2.1、将大样本数据集中每个类别中样本的特征向量聚类成一个动态数量的簇(假设为m个簇)。2.1. Cluster the feature vectors of the samples in each category in the large sample dataset into a dynamic number of clusters (assuming m clusters).

2.2、计算出各个新簇的质心C′k_m_n(表示将类别k的数据划分为m个簇后,第n簇的质心),将该簇下的所有样本表示为X∈Sk_m_n(Sk_m_n表示将类别k中的样本划分为m个簇后,第n个簇中的所有样本的集合)。2.2. Calculate the centroid C′ k_m_n of each new cluster (representing the centroid of the nth cluster after dividing the data of category k into m clusters), and denote all samples under the cluster as X∈S k_m_n (S k_m_n represents After dividing the samples in class k into m clusters, the set of all samples in the nth cluster).

2.3、通过各个新簇的质心C′k_m_n计算出该类别在该种划分情况下的新质心C′k_m2.3. Calculate the new centroid C′ k_m of the category in this case of division through the centroid C′ k_m_n of each new cluster.

Figure BDA0003124960410000052
Figure BDA0003124960410000052

其中,C′k_m表示将第K个类别的样本划分为m个簇后,由每个簇的质心构成的该类别新的中心支持点。Among them, C′ k_m represents the new center support point of the category formed by the centroid of each cluster after the samples of the Kth category are divided into m clusters.

2.4、通过计算同簇误差Lsce和质心误差Lce的和作为该类别在该种划分情况下的总误差Ls。从中选出总误差最小的情况作为该类别数据的最优化分。2.4. Calculate the sum of the same-cluster error L sce and the centroid error L ce as the total error L s of the category under this kind of division. The case with the smallest total error is selected as the optimal score for this category of data.

同簇误差是指每个簇中所有样本与该簇质心间的距离之和:The co-cluster error is the sum of the distances between all samples in each cluster and the centroid of the cluster:

Figure BDA0003124960410000053
Figure BDA0003124960410000053

质心误差是指通过各簇质心构造出的该类别的新质心与大样本中该类别质心间的距离:The centroid error refers to the distance between the new centroid of the category constructed by the centroids of each cluster and the centroid of the category in the large sample:

Lce=C′k_m-Ck(4)L ce =C' k_m -C k (4)

总误差为The total error is

Ls=Lsce+Lce(5)L s =L sce +L ce (5)

3、重构小样本数据集:3. Reconstruct the small sample data set:

从最优划分的各簇中按照其样本分布均匀定量的抽取出样本,作为特征重构的小样本数据集。Samples are uniformly and quantitatively extracted from the optimally divided clusters according to their sample distribution, as a small sample data set for feature reconstruction.

具体实施方式二:Specific implementation two:

本实施方式为一种存储介质,所述存储介质中存储有至少一条指令,所述至少一条指令由处理器加载并执行以实现一种用于小样本图像识别的样本抽取方法。This embodiment is a storage medium, and the storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement a sample extraction method for small sample image recognition.

具体实施方式三:Specific implementation three:

本实施方式为一种用于小样本图像识别的样本扩充方法,本质是一种基于类内变形信息的样本扩充方法。其主要思想为通过学习同类别数据间的变形信息,再将变形信息用于同类的其他样本上来生成和扩充成该类别新的数据集。为了更好地学习同类数据间变形信息,通过特征重构的样本抽取方法,具体实施方式一为数据的扩充提供一个特征较为完整的典型小样本数据集,并且典型的小样本数据集中每个类别都被划分为了具有特征差异的多簇,然后基于具体实施方式一确定的小样本数据集进行扩充。图1为基于特征重构和变形信息的样本抽取和扩充方法的概述图,其中(a)表示大样本数据集,(b)表示通过同簇误差和质心误差对大样本数据集的划分,其中虚线空白点表示各簇质心,实线空白点代表该类别的质心,(c)表示大样本数据集的最优划分,(d)表示特征重构方法抽取的典型小样本数据集,(e)表示箭头表示小样本数据集各簇间的变形信息,(f)表示基于变形信息扩充后新的大样本数据集,其中双色点表示新生成的样本。This embodiment is a sample expansion method for small sample image recognition, which is essentially a sample expansion method based on intra-class deformation information. The main idea is to learn the deformation information between the same type of data, and then use the deformation information on other samples of the same type to generate and expand into a new data set of this type. In order to better learn the deformation information between similar data, the sample extraction method of feature reconstruction is used, and the specific embodiment 1 provides a typical small-sample data set with relatively complete features for data expansion, and each category in the typical small-sample data set is are divided into multi-clusters with characteristic differences, and then expanded based on the small sample data set determined in the specific embodiment 1. Figure 1 is an overview of the sample extraction and expansion method based on feature reconstruction and deformation information, in which (a) represents the large sample data set, (b) represents the division of the large sample data set by the same-cluster error and centroid error, where The dotted blank point represents the centroid of each cluster, the solid blank point represents the centroid of the category, (c) represents the optimal division of the large sample data set, (d) represents the typical small sample data set extracted by the feature reconstruction method, (e) represents the arrow represents the deformation information between each cluster of the small sample data set, (f) represents the new large sample data set expanded based on the deformation information, and the two-color dots represent the newly generated samples.

具体来说,样本的扩充包括两个阶段:训练阶段和生成阶段。Specifically, the augmentation of samples consists of two stages: the training stage and the generation stage.

训练阶段:Training phase:

根据用于小样本图像识别的样本抽取方法中每一类别的最优划分的方式将典型的小样本数据集划分成样本对的形式(x′m,x′n),其中x′m和x′n属于同类别中不同簇的样本数据。即x′m∈Qk_i_s,x′n∈Qk_i_t,s≠t,其中Qk_i_s和Qk_i_t分别表示将类别k的数据最优划分为i簇后,第s簇和第t簇的样本数据。这样保证了在合理划分的情况之下,学习第s簇与第t簇样本间的变形信息。这样的优点是学到的变形信息一定与该类别相关,并且能够运用于该类别中。样本扩充方法和核心是训练一个由推断模型、生成模型、判别模型及分类器构成的网络结构,如图5所示,推断模型:对同类不同簇的样本对(x′m,x′n)编码,在隐空间中形成变形信息Z,生成模型通过变形信息Z和样本x′n来重构样本

Figure BDA0003124960410000061
生成模型:利用潜在空间内的变形信息Z和输入的样本x′n来重构
Figure BDA0003124960410000062
表示为
Figure BDA0003124960410000063
判别模型:对真实样本对(xc,x′m)和重构样本对
Figure BDA0003124960410000064
进行判别。分类器:对重构样本
Figure BDA0003124960410000065
进行分类。A typical small-sample data set is divided into the form of sample pairs (x' m , x' n ) according to the optimal division of each class in the sample extraction method for small-sample image recognition, where x' m and x ' n belong to the sample data of different clusters in the same category. That is, x′ m ∈ Q k_i_s , x′ n ∈ Q k_i_t , s≠t, where Q k_i_s and Q k_i_t respectively represent the sample data of the sth cluster and the tth cluster after the data of category k is optimally divided into clusters i . This ensures that the deformation information between the samples of the s-th cluster and the t-th cluster can be learned under the condition of reasonable division. The advantage of this is that the learned deformation information must be relevant to the class and can be applied to the class. The sample expansion method and core is to train a network structure composed of an inference model, a generative model, a discriminant model and a classifier, as shown in Figure 5, the inference model: sample pairs (x′ m , x′ n ) for different clusters of the same type Encoding, the deformation information Z is formed in the latent space, and the generative model reconstructs the sample through the deformation information Z and the sample x′ n
Figure BDA0003124960410000061
Generative model: use the deformation information Z in the latent space and the input samples x′ n to reconstruct
Figure BDA0003124960410000062
Expressed as
Figure BDA0003124960410000063
Discriminant model: for the real sample pair (x c , x′ m ) and the reconstructed sample pair
Figure BDA0003124960410000064
make a judgment. Classifier: For reconstructed samples
Figure BDA0003124960410000065
sort.

推断模型学习同类不同簇的样本x′m和x′n之间的变形信息。变形信息是通过自编码器学到的:利用自编码器将x′m和x′n进行降维处理,尽最大可能保留其关键信息,再利用保留的关键信息和其中一个样本x′n来训练网络生成另一个样本x′m,也是这个训练生成的过程使得降维后保留的信息是变形信息。换句话说,变形信息是指从x′n转换到x′m所需的附加信息(附加信息就是经过编码器压缩后的低维向量),其存在于潜在空间中,表示为Z=E(x′m,x′n)。The inference model learns the deformation information between samples x'm and x'n of the same different clusters. The deformation information is learned by the auto-encoder: use the auto-encoder to reduce the dimension of x' m and x' n , retain its key information as much as possible, and then use the retained key information and one of the samples x' n to The training network generates another sample x′ m , which is also the process of training generation so that the information retained after dimensionality reduction is deformation information. In other words, the deformation information refers to the additional information required to convert from x' n to x' m (the additional information is the low-dimensional vector compressed by the encoder), which exists in the latent space and is expressed as Z = E ( x′ m , x′ n ).

生成模型利用潜在空间内的变形信息Z和输入的样本x′n来生成

Figure BDA0003124960410000066
表示为
Figure BDA0003124960410000067
Figure BDA0003124960410000068
生成模型即对抗网络中的生成网络。The generative model uses the deformation information Z in the latent space and the input samples x′ n to generate
Figure BDA0003124960410000066
Expressed as
Figure BDA0003124960410000067
Figure BDA0003124960410000068
Generative models are generative networks in adversarial networks.

Figure BDA0003124960410000069
Figure BDA0003124960410000069

其中,

Figure BDA00031249604100000610
为生成损失,
Figure BDA00031249604100000612
表示新生成样本
Figure BDA00031249604100000611
与真实样本x′m间的均方误差;in,
Figure BDA00031249604100000610
To generate a loss,
Figure BDA00031249604100000612
Represents a newly generated sample
Figure BDA00031249604100000611
mean squared error with the real sample x'm;

判别模型被训练用于区分是真实样本对(xc,x′m)还是重构样本对

Figure BDA0003124960410000071
通过对抗性训练使得网络能够更加准确的重构出该样本。The discriminative model is trained to distinguish between real sample pairs (x c , x′ m ) and reconstructed sample pairs
Figure BDA0003124960410000071
Through adversarial training, the network can reconstruct the sample more accurately.

Figure BDA0003124960410000072
Figure BDA0003124960410000072

其中,LD为判别损失,D(·,·)为判别器,G(·,·)为生成器。Among them, L D is the discriminant loss, D(·,·) is the discriminator, and G(·,·) is the generator.

分类器用于对重构样本

Figure BDA0003124960410000073
进行分类。The classifier is used to reconstruct the sample
Figure BDA0003124960410000073
sort.

Figure BDA0003124960410000074
Figure BDA0003124960410000074

其中,Lcls为分类损失;Among them, L cls is the classification loss;

总损失:Total loss:

L=Lmse+LD+Lcls(9)L=L mse +L D +L cls (9)

生成阶段:Build stage:

本发明依然将同类不同簇的样本对(x′m,x′n)作为模型的输入,然后将变形信息Z和样本x′u∈Qk_i_t(与x′n同类同簇)作为生成模型的输入,最终为该类别生成一个新的样本。通过不断地改变推断模型输入的样本对(x′m,x′n)(但应该保证是训练过程中训练过的样本对)或改变生成模型的输入的样本x′u来为该类别生成更多的新样本(但要保证生成模型输入的样本x′n同类同簇),这样可以保证最大的利用学习到的变形信息。在训练过程中采用对抗训练的目的是使得网络可以从已有的样本中生成新的样本,这个样本只要看起来与输入的样本有不同之处,它就足够可以成为该类别新的样本。In the present invention, the sample pair (x' m , x' n ) of the same type and different clusters is still used as the input of the model, and then the deformation information Z and the sample x' u ∈ Q k_i_t (the same cluster as x' n ) are used as the input of the generation model. input, and finally generate a new sample for that class. By constantly changing the sample pair (x' m , x' n ) input to the inference model (but it should be guaranteed to be the sample pair trained during training) or changing the sample x' u input to the generative model to generate more information for the class There are many new samples (but ensure that the samples x′ n input by the generation model are of the same type and the same cluster), which can ensure the maximum use of the learned deformation information. The purpose of adversarial training in the training process is to enable the network to generate new samples from existing samples. As long as this sample looks different from the input sample, it is enough to become a new sample of the category.

图2为基于特征重构和变形信息的对抗性数据增强模型。Figure 2 shows an adversarial data augmentation model based on feature reconstruction and deformation information.

伪代码如下:The pseudo code is as follows:

Figure BDA0003124960410000075
Figure BDA0003124960410000075

Figure BDA0003124960410000081
Figure BDA0003124960410000081

具体实施方式四:Specific implementation four:

本实施方式为一种存储介质,所述存储介质中存储有至少一条指令,所述至少一条指令由处理器加载并执行以实现用于小样本图像识别的样本扩充方法。This embodiment is a storage medium, where at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement a sample expansion method for small sample image recognition.

实施例Example

本发明在两个标准基准数据集(MNIST和EMNIST)上进行了三个实验,分别是大样本数据与小样本数据的量化实验、典型小样本数据集的抽取实验以及典型小样本数据集的扩充实验。用以评估SEFI方法和SECIDI方法。The present invention conducts three experiments on two standard benchmark data sets (MNIST and EMNIST), which are the quantification experiment of large sample data and small sample data, the extraction experiment of typical small sample data set, and the expansion of typical small sample data set. experiment. To evaluate the SEFI method and the SECIDI method.

对于MNIST数据集,有10个类别,训练集有60000条数据,测试集有10000条数据,本发明选择训练集中的前2000条数据作为大样本数据集。从中抽取出的30%(共600条数据)作为小样本数据。在小样本数据集中,每个类别的样本量在60条左右。For the MNIST data set, there are 10 categories, the training set has 60,000 pieces of data, and the test set has 10,000 pieces of data. The present invention selects the first 2,000 pieces of data in the training set as a large sample data set. 30% (600 pieces of data in total) extracted from it are used as small sample data. In the small sample data set, the sample size of each category is about 60.

对于EMNIST数据集内的平衡数据集,共有47个类别(其中有10个数字类别,37个字符类别),训练集有112800条数据,测试集有18800条数据。为了与其他实验对比,本发明只选择类别42-47(共6个类别)作为字符识别任务。同样,本发明每个类别选择200条数据(共1200条)作为大样本数据集。For the balanced dataset within the EMNIST dataset, there are a total of 47 categories (of which there are 10 numeric categories and 37 character categories), with 112,800 pieces of data in the training set and 18,800 pieces of data in the test set. In order to compare with other experiments, the present invention only selects categories 42-47 (6 categories in total) as the character recognition task. Similarly, the present invention selects 200 pieces of data for each category (1200 pieces in total) as a large sample data set.

在实验过程中,本发明将抽取出来的数据作为小样本数据集,剩余的未抽取的数据作为Rest数据集,也用于测试。During the experiment, the present invention uses the extracted data as a small sample data set, and the remaining unextracted data is used as a Rest data set, which is also used for testing.

运用Bootstrapping抽样方法分别从大样本数据集中抽取出10%(200个样本)-90%(1800个样本)的样本数据。运用相同的CNNs模型结构训练抽取出的数据。并运用相同的测试集进行测试,得出数据量与模型准确率间的关系,并展示了相同数据量的情况下,模型准确率最优、平均和最差的情况,如图3所示。Using Bootstrapping sampling method, 10% (200 samples)-90% (1800 samples) of sample data were extracted from the large sample data set. The extracted data is trained using the same CNNs model structure. And use the same test set to test, get the relationship between the amount of data and the accuracy of the model, and show the best, average and worst cases of the model accuracy under the same amount of data, as shown in Figure 3.

实验结果分析:Analysis of results:

1.通过图3,可以明显的看出,随着数据量的减少,模型的准确率下降。并且当抽取的样本低于大样本的30%时,模型的准确率下降更为严重。1. From Figure 3, it can be clearly seen that as the amount of data decreases, the accuracy of the model decreases. And when the sample drawn is less than 30% of the large sample, the accuracy of the model drops more seriously.

2.对于从大样本数据集中,抽取出相同数量的小样本数据时,不同的样本选择训练出的模型在测试时存在较为明显的差异。并且随着抽取量的减少,差异明显增大。也说明了本发明为模型提供一个典型小样本数据集的重要性。2. When the same amount of small sample data is extracted from the large sample data set, the models trained by different samples have obvious differences during testing. And as the amount of extraction decreases, the difference increases significantly. It also illustrates the importance of the present invention to provide a typical small sample data set for the model.

3.通过大样本数据和小样本数据的量化实验,本发明确定将大样本数据量的30%作为小样本数据集的数量(即每个类别有五六十个样本)。因为在本发明利用Bootstrapping方法采样时,当抽取大样本数据量30%时,存在接近于大样本数据训练的效果。如果数量再减少,其最优情况也很难达到大样本数据的训练效果。3. Through quantitative experiments on large sample data and small sample data, the present invention determines 30% of the large sample data as the number of small sample data sets (ie, each category has fifty or sixty samples). Because when the present invention uses the Bootstrapping method for sampling, when 30% of the large sample data is extracted, there is an effect close to that of large sample data training. If the number is further reduced, the optimal situation will be difficult to achieve the training effect of large sample data.

本发明对大样本数据集的每个类别的数据进行最优划分,在划分过程中从划分为两簇开始逐次递增,当Ln+1>αLn时(其中Ln表示将划分为n簇时的总损失,α为超参数,在实验过程中本发明设定α=0.95),本发明将该类别的最优簇数确定为n。确定最优划分数目后将每一类别数据进行划分。MNIST数据集的划分结果如下表1所示。The present invention divides the data of each category of the large sample data set optimally, and in the process of dividing, it starts to be divided into two clusters and increases successively. When L n+1 >αL n (wherein L n indicates that it will be divided into n clusters The total loss when α is a hyperparameter, the present invention sets α=0.95) in the experiment process, and the present invention determines the optimal number of clusters for this category as n. After determining the optimal number of divisions, each category of data is divided. The division results of the MNIST dataset are shown in Table 1 below.

表1:MNIST数据集最优划分情况:Table 1: The optimal division of the MNIST dataset:

Figure BDA0003124960410000091
Figure BDA0003124960410000091

Figure BDA0003124960410000101
Figure BDA0003124960410000101

其次,在每个类别的最优划分中,均匀定量的抽取出样本来组成典型小样本数据集。剩余的未被抽取的数据作为Rest数据集。利用抽取出的典型小样本数据集训练模型,然后分别采用测试集和Rest数据集对模型测试。Secondly, in the optimal division of each category, samples are uniformly and quantitatively extracted to form a typical small sample data set. The remaining unextracted data is used as the Rest dataset. The model is trained using the extracted typical small sample data set, and then the model is tested with the test set and the Rest data set respectively.

最后,本发明分别对比了大样本数据集,Bootstrapping抽样方法,均匀抽样方法,SEFR抽样方法(SEFR即本发明的抽样方法,分别用测试集和对应的Rest数据集测试)等4种方法。分别进行了50次实验,并从中将最优、平均和最差的情况汇总如下表2所示:Finally, the present invention compares four methods, including large sample data set, Bootstrapping sampling method, uniform sampling method, and SEFR sampling method (SEFR is the sampling method of the present invention, which is tested with the test set and the corresponding Rest data set respectively). 50 experiments were carried out respectively, and the best, average and worst cases were summarized in Table 2 below:

表2:数字数据集上的实验结果Table 2: Experimental Results on Numerical Datasets

Figure BDA0003124960410000102
Figure BDA0003124960410000102

实验结果分析:Analysis of results:

1.对于图像而言,SEFR方法的效果明显优于Bootstrapping抽样方法和均匀抽样方法。首先,SEFR方法的平均分类精度高于Bootstrapping抽样方法和均匀抽样方法。其次,SEFR方法的浮动范围明显小于Bootstrapping抽样方法,效果更稳定。并且其最差情况明显优于Bootstrapping抽样方法。SEFR方法可以避免抽取出的样本集较为极端的情况,其最差的情况也可以高于Bootstrapping抽样方法的平均水平。1. For images, the SEFR method is significantly better than the Bootstrapping sampling method and the uniform sampling method. First, the average classification accuracy of SEFR method is higher than Bootstrapping sampling method and uniform sampling method. Secondly, the floating range of the SEFR method is significantly smaller than that of the Bootstrapping sampling method, and the effect is more stable. And its worst case is significantly better than Bootstrapping sampling method. The SEFR method can avoid the extreme cases of the sample set extracted, and its worst case can also be higher than the average level of the Bootstrapping sampling method.

2.使用SEFR方法使得在数据量减少70%的条件下,其平均精度比大样本数据训练的平均精度下降了4.5%。因为本发明运用CNNs来学习样本的特征,所以从特征的角度来说,SEFR方法抽取出的小样本数据集可以涵盖大样本数据集的绝大多数特征。2. Using the SEFR method makes the average accuracy drop by 4.5% compared to the average accuracy of large sample data training under the condition that the data volume is reduced by 70%. Because the present invention uses CNNs to learn the features of the samples, from the perspective of features, the small sample data set extracted by the SEFR method can cover most of the features of the large sample data set.

3.利用SEFR抽取方法并用Rest数据集测试时,其典型小样本数据集的最优情况可代替了原有大样本94.5%的数据。3. When using the SEFR extraction method and testing with the Rest data set, the optimal situation of the typical small sample data set can replace 94.5% of the original large sample data.

4.在SEFR方法的实验中,存在多次实验的精度可达到90%以上,甚至可以接近于大样本数据集训练出模型的平均精度。4. In the experiments of the SEFR method, the accuracy of multiple experiments can reach more than 90%, and it can even be close to the average accuracy of the model trained on a large sample data set.

将同一类别数据分为几簇,通过可视化的方法,本发明以MNIST中标签5的样本为例,其被分为了四簇。将其每簇的质心展示出来,如图4所示。图4以MNIST数据集标签为5的样本为例,可视化其最优划分簇中各簇的质心,图4(a)至图4(d)分别表示不同簇的质心可视化的图片,每一簇的质心形态不同,本发明所要寻找的变形信息即为任意两簇(图4(a)和图4(b)或图4(c)和图4(d)等组合)之间的转换信息。并将这种差异信息(图4(a)与图4(b)间的)用于其中一簇(图4(b))的其他样本上,也可以将这种差异信息(图4(c)与图4(d)间的)用于其中一簇(图4(d))的其他样本上。The data of the same category is divided into several clusters. Through the visualization method, the present invention takes the sample of label 5 in MNIST as an example, which is divided into four clusters. The centroid of each cluster is displayed, as shown in Figure 4. Figure 4 takes the sample with the label of 5 in the MNIST dataset as an example to visualize the centroid of each cluster in its optimally divided cluster. The shape of the centroid is different, and the deformation information that the present invention seeks is the conversion information between any two clusters (the combination of Fig. 4(a) and Fig. 4(b) or Fig. 4(c) and Fig. 4(d), etc.). and apply this difference information (between Fig. 4(a) and Fig. 4(b)) to other samples in one of the clusters (Fig. 4(b)), and we can also apply this difference information (Fig. 4(c) ) and Fig. 4(d) are used on other samples of one of the clusters (Fig. 4(d)).

本发明从MNIST数字数据集和EMNIST字符数据集中抽取出的典型小样本数据集,本发明基于SECIDI方法(本发明的扩充方法)进行了多次数据扩充实验,每次都是在原有数据量的基础之上扩充一倍的数据,并将扩充后新的大样本数据集与扩充前典型小样本数据就以及用DAGAN等扩充方法进行了对比,如下表3和表4所示。The present invention is a typical small sample data set extracted from the MNIST digital data set and the EMNIST character data set. The present invention has carried out multiple data expansion experiments based on the SECIDI method (the expansion method of the present invention), and each time is at the original data volume. On the basis, the data is doubled, and the new large-sample data set after the expansion is compared with the typical small-sample data before the expansion, and the expansion methods such as DAGAN are used, as shown in Tables 3 and 4 below.

表3:MNIST SECIDI ClassificationTable 3: MNIST SECIDI Classification

Figure BDA0003124960410000111
Figure BDA0003124960410000111

表4:EMNIST SECIDI ClassificationTable 4: EMNIST SECIDI Classification

Figure BDA0003124960410000112
Figure BDA0003124960410000112

Figure BDA0003124960410000121
Figure BDA0003124960410000121

实验结果分析:Analysis of results:

SECIDI在MNIST数字数据集和EMNIST字符数据集上的分类精度如表3和表4所示,展示了所有实验的平均精度。表3显示运用SECIDI方法对MNIST中的典型小样本数据集扩充后,其平均精度对比扩充前均提高了2.5%以上。当典型的小样本数据集的每个类别有100个样本时,扩充后的平均精度接近于原有大样本数据集的平均精度。实验结果表明了,利用扩充后的大样本数据训练模型的泛化性更佳,说明可以正确的使用变形信息来生成新的数据,新生成的数据与原有数据不同,进而提升了网络的训练效果。The classification accuracies of SECIDI on the MNIST numeric dataset and the EMNIST character dataset are shown in Tables 3 and 4, showing the average accuracies across all experiments. Table 3 shows that after the SECIDI method is used to expand the typical small-sample data set in MNIST, the average accuracy is improved by more than 2.5% compared with that before the expansion. When a typical small-sample dataset has 100 samples per class, the average precision after augmentation is close to that of the original large-sample dataset. The experimental results show that the generalization of the model trained by the expanded large sample data is better, indicating that the deformation information can be used correctly to generate new data, and the newly generated data is different from the original data, thus improving the training of the network. Effect.

表4显示了使用SECIDI方法对EMNIST中的典型小样本数据集扩充后的结果,其结果明显优于扩充前典型小样本数据集和DAGAN方法的结果。两组实验中,SECIDI方法对比DAGAN方法均提升了1.8%左右。本发明对典型小样本数据集进行了最优簇的划分,使得网络更容易且正确的学习类内变形信息。并且在判别新生成的样本时,本发明向其提供对应簇的质心,目的是使得新生成的样本更加符合该簇的特征及其分布情况。Table 4 shows the results after augmentation with the SECIDI method on a typical few-shot dataset in EMNIST, which is significantly better than the results on the typical few-shot dataset before augmentation and the DAGAN method. In the two sets of experiments, the SECIDI method improved by about 1.8% compared with the DAGAN method. The invention divides the optimal cluster for the typical small sample data set, so that the network can learn the intra-class deformation information more easily and correctly. And when discriminating a newly generated sample, the present invention provides it with the centroid of the corresponding cluster, in order to make the newly generated sample more conform to the characteristics and distribution of the cluster.

图5运用SECIDI方法中的网络结构在MNIST数字数据集(标签为3)和EMNIST字符数据集(标签为46)上生成的新样本,图5(a)和图5(b)分别对应在MNIST数字数据集和EMNIST字符数据集。Figure 5. New samples generated on the MNIST numeric dataset (labeled 3) and EMNIST character dataset (labeled 46) using the network structure in the SECIDI method. Figures 5(a) and 5(b) correspond to MNIST Numeric dataset and EMNIST character dataset.

可视化实验:图5(a)和图5(b)中左下的图片均为新生成的样本。以图5(b)为例,利用左上与右上两个样本间的变形信息和右下的样本来生成该类别新的样本。本发明的目标首先是保证生成的新样本一定属于该类别,并且生成的新样本要与提供的几个样本不同,这样也就保证了新生成样本的可用性。使得扩充后大样本数据集提高了网络的泛化性。Visualization experiment: The lower left pictures in Figure 5(a) and Figure 5(b) are newly generated samples. Taking Figure 5(b) as an example, the deformation information between the upper left and upper right samples and the lower right sample are used to generate new samples of this category. The objective of the present invention is first to ensure that the new samples generated must belong to this category, and the new samples generated must be different from the provided samples, thus ensuring the availability of the newly generated samples. The expanded large sample data set improves the generalization of the network.

本发明还可有其它多种实施例,在不背离本发明精神及其实质的情况下,本领域技术人员当可根据本发明作出各种相应的改变和变形,但这些相应的改变和变形都应属于本发明所附的权利要求的保护范围。The present invention can also have other various embodiments. Without departing from the spirit and essence of the present invention, those skilled in the art can make various corresponding changes and deformations according to the present invention, but these corresponding changes and deformations are all It should belong to the protection scope of the appended claims of the present invention.

Claims (10)

1.一种用于小样本图像识别的样本抽取方法,其特征在于,包括以下步骤:1. a sample extraction method for small sample image recognition, is characterized in that, comprises the following steps: Sl、计算出图像大样本数据集的各类别中心支持点CkS1. Calculate the center support point C k of each category of the image large sample data set; S2、从样本特征的角度对同类样本数据划分为动态数量的簇,并根据每种划分情况先计算出各簇的质心;S2. Divide the same sample data into a dynamic number of clusters from the perspective of sample characteristics, and first calculate the centroid of each cluster according to each division situation; 根据各簇的质心计算出在该种划分情况下该类别新的中心点;并通过计算同簇误差和质心误差之和作为该类别在该种划分情况的总误差;选出最小误差的情况作为该类别的最优划分方式;According to the centroid of each cluster, the new center point of the category under this kind of division is calculated; and the sum of the error of the same cluster and the centroid error is calculated as the total error of the category in this kind of division; the case with the smallest error is selected as the The optimal way of dividing the category; S3、从最优划分的各簇中按照其样本分布均匀定量的抽取出样本,作为特征重构的小样本数据集。S3 , extracting samples uniformly and quantitatively from each optimally divided cluster according to its sample distribution, as a small sample data set for feature reconstruction. 2.根据权利要求1所述的一种用于小样本图像识别的样本抽取方法,其特征在于,计算出图像大样本数据集的各类别中心支持点Ck的过程包括以下步骤:2. a kind of sample extraction method for small sample image recognition according to claim 1, is characterized in that, the process that calculates each category center support point C k of image large sample data set comprises the following steps: 针对于图像大样本数据集,计算出大样本数据集中每个类别的中所有特征向量的平均向量,将其作为该类别的中心支持点CkFor the image large sample data set, calculate the average vector of all feature vectors in each category in the large sample data set, and use it as the central support point C k of the category:
Figure FDA0003124960400000011
Figure FDA0003124960400000011
Sk表示第K个类别的样本集,|Sk|表示第K个类别的样本集中样本的数量;xi表示属于Sk样本集的样本数据,yi是样本xi对应的标签;
Figure FDA0003124960400000012
为嵌入函数。
S k represents the sample set of the K-th category, |S k | represents the number of samples in the K-th category of the sample set; xi represents the sample data belonging to the S k sample set, and yi is the label corresponding to the sample xi ;
Figure FDA0003124960400000012
is an embedded function.
3.根据权利要求1或2所述的一种用于小样本图像识别的样本抽取方法,其特征在于,步骤S2包括以下步骤:3. a kind of sample extraction method for small sample image recognition according to claim 1 and 2, is characterized in that, step S2 comprises the following steps: 2.1、将大样本数据集中每个类别中样本的特征向量聚类成一个动态数量的簇,设有m个簇;2.1. Cluster the eigenvectors of the samples in each category in the large sample data set into a dynamic number of clusters, with m clusters; 2.2、计算出各个新簇的质心C′k_m_n,将该簇下的所有样本表示为X∈Sk_m_n;C′k_m_n表示将类别k的数据划分为m个簇后,第n簇的质心;Sk_m_n表示将类别k中的样本划分为m个簇后,第n个簇中的所有样本的集合;2.2. Calculate the centroid C′ k_m_n of each new cluster, and denote all samples under the cluster as X∈S k_m_n ; C′ k_m_n indicates the centroid of the nth cluster after dividing the data of category k into m clusters; S k_m_n represents the set of all samples in the nth cluster after dividing the samples in category k into m clusters; 2.3、通过各个新簇的质心C′k_m_n计算出该类别在该种划分情况下的新质心C′k_m2.3. Calculate the new centroid C′ k_m of the category in this case of division through the centroid C′ k_m_n of each new cluster;
Figure FDA0003124960400000013
Figure FDA0003124960400000013
其中,C′k_m表示将第K个类别的样本划分为m个簇后,由每个簇的质心构成的该类别新的中心支持点;Among them, C′ k_m represents the new center support point of the category formed by the centroid of each cluster after the samples of the Kth category are divided into m clusters; 2.4、通过计算同簇误差Lsce和质心误差Lce的和作为该类别在该种划分情况下的总误差Ls;从中选出总误差最小的情况作为该类别数据的最优化分。2.4. Calculate the sum of the same-cluster error L sce and the centroid error L ce as the total error L s of the category in this division; select the case with the smallest total error as the optimal score for the category of data.
4.根据权利要求3所述的一种用于小样本图像识别的样本抽取方法,其特征在于,所述的总误差Ls=Lsce+Lce;其中4. A sample extraction method for small sample image recognition according to claim 3, wherein the total error L s =L sce +L ce ; wherein 同簇误差为每个簇中所有样本与该簇质心间的距离之和:The co-cluster error is the sum of the distances between all samples in each cluster and the centroid of the cluster:
Figure FDA0003124960400000021
Figure FDA0003124960400000021
质心误差为通过各簇质心构造出的该类别的新质心与大样本中该类别质心间的距离:The centroid error is the distance between the new centroid of the category constructed by the centroids of each cluster and the centroid of the category in the large sample: Lce=C′k_m-CkL ce =C' k_m -C k .
5.用于小样本图像识别的样本扩充方法,其特征在于,利用权利要求1至4之一所述的一种用于小样本图像识别的样本抽取方法确定小样本数据集,并基于小样本数据集进行扩充,样本的扩充包括训练阶段和生成阶段;5. A sample expansion method for small sample image recognition, characterized in that a small sample data set is determined by a sample extraction method for small sample image recognition according to one of claims 1 to 4, and based on the small sample The data set is expanded, and the expansion of the sample includes the training stage and the generation stage; 训练阶段:Training phase: 根据用于小样本图像识别的样本抽取方法中每一类别的最优划分的方式将典型的小样本数据集划分成样本对的形式(x′m,x′n),其中x′m和x′n属于同类别中不同簇的样本数据;即x′m∈Qk_i_s,x′n∈Qk_i_t,s≠t,其中Qk_i_s和Qk_i_t分别表示将类别k的数据最优划分为i簇后,第s簇和第t簇的样本数据;A typical small-sample data set is divided into the form of sample pairs ( x'm , x'n ) according to the optimal division of each class in the sample extraction method for small-sample image recognition, where x'm and x ′ n belong to the sample data of different clusters in the same category; that is, x′ m ∈ Q k_i_s , x′ n ∈ Q k_i_t , s≠t, where Q k_i_s and Q k_i_t respectively represent the optimal division of the data of category k into i clusters After, the sample data of the s-th cluster and the t-th cluster; 样本扩充的过程使用样本扩充模型来完成,所述的样本扩充模型是一个包括推断模型、生成模型、判别模型及分类器的网络结构;The process of sample expansion is completed by using a sample expansion model, and the sample expansion model is a network structure including an inference model, a generative model, a discriminant model and a classifier; 推断模型对同类不同簇的样本对(x′m,x′n)编码,并学习同类不同簇的样本x′m和x′n之间的变形信息Z=E(x′m,x′n);The inference model encodes the sample pairs (x′ m , x′ n ) of the same different clusters, and learns the deformation information Z=E(x′ m , x′ n between the samples x′ m and x′ n of the same different clusters ); 生成模型利用潜在空间内的变形信息Z和输入的样本x′n来生成
Figure FDA0003124960400000022
表示为
Figure FDA0003124960400000023
Figure FDA0003124960400000024
The generative model uses the deformation information Z in the latent space and the input samples x′ n to generate
Figure FDA0003124960400000022
Expressed as
Figure FDA0003124960400000023
Figure FDA0003124960400000024
判别模型被训练用于区分是真实样本对(xc,x′m)还是重构样本对
Figure FDA0003124960400000025
通过对抗性训练使得网络能够更加准确的重构出该样本;
The discriminative model is trained to distinguish between real sample pairs (x c , x′ m ) and reconstructed sample pairs
Figure FDA0003124960400000025
Through adversarial training, the network can reconstruct the sample more accurately;
分类器用于对重构样本
Figure FDA0003124960400000026
进行分类;
The classifier is used to reconstruct the sample
Figure FDA0003124960400000026
sort;
生成阶段:Build stage: 将同类不同簇的样本对(x′m,x′n)作为模型的输入,然后将变形信息Z和样本x′u∈Qk_i_t作为生成模型的输入,最终为该类别生成一个新的样本;通过不断地改变推断模型输入的样本对(x′m,x′n)或改变生成模型的输入的样本x′u来为该类别生成更多的新样本。Take the sample pair (x′ m , x′ n ) of the same type and different clusters as the input of the model, and then take the deformation information Z and the sample x′ u ∈ Q k_i_t as the input of the generative model, and finally generate a new sample for this category; More new samples for the class are generated by constantly changing the sample pair ( x'm , x'n ) input to the inference model or changing the sample x'u input to the generative model.
6.根据权利要求5所述的用于小样本图像识别的样本扩充方法,其特征在于,所述改变推断模型输入的样本对(x′m,x′n)的过程中需要保证样本对(x′m,x′n)是训练过程中训练过的样本对。6. The sample expansion method for small sample image recognition according to claim 5, wherein, in the process of changing the sample pair (x' m , x' n ) input by the inference model, it is necessary to ensure that the sample pair ( x′ m , x′ n ) are pairs of samples trained during training. 7.根据权利要求6所述的用于小样本图像识别的样本扩充方法,其特征在于,所述改变生成模型的输入的样本x′u的过程冲要保证x′u与生成模型输入的样本x′n同类同簇。7. The sample expansion method for small sample image recognition according to claim 6, wherein the process of changing the input sample x' u of the generative model is to ensure that x' u and the sample input of the generative model are x' n are of the same type and the same cluster. 8.根据权利要求7所述的用于小样本图像识别的样本扩充方法,其特征在于,样本扩充模型在训练阶段的总损失如下:8. The sample expansion method for small sample image recognition according to claim 7, wherein the total loss of the sample expansion model in the training phase is as follows: L=Lmse+LD+Lcls L=L mse +L D +L cls 其中,Lmse为生成损失,LD为判别损失,Lcls为分类损失。Among them, L mse is the generation loss, L D is the discriminative loss, and L cls is the classification loss. 9.一种存储介质,其特征在于,所述存储介质中存储有至少一条指令,所述至少一条指令由处理器加载并执行以实现如权利要求1至4之一所述的一种用于小样本图像识别的样本抽取方法。9. A storage medium, characterized in that, the storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement a method for A sample extraction method for small sample image recognition. 10.一种存储介质,其特征在于,所述存储介质中存储有至少一条指令,所述至少一条指令由处理器加载并执行以实现如权利要求5至8之一所述的用于小样本图像识别的样本扩充方法。10. A storage medium, wherein at least one instruction is stored in the storage medium, and the at least one instruction is loaded and executed by a processor to implement the method for small samples according to one of claims 5 to 8 A sample augmentation method for image recognition.
CN202110687034.2A 2021-06-21 2021-06-21 Sample extraction and expansion method and storage medium for small sample image recognition Active CN113298184B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110687034.2A CN113298184B (en) 2021-06-21 2021-06-21 Sample extraction and expansion method and storage medium for small sample image recognition

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110687034.2A CN113298184B (en) 2021-06-21 2021-06-21 Sample extraction and expansion method and storage medium for small sample image recognition

Publications (2)

Publication Number Publication Date
CN113298184A true CN113298184A (en) 2021-08-24
CN113298184B CN113298184B (en) 2022-09-02

Family

ID=77329008

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110687034.2A Active CN113298184B (en) 2021-06-21 2021-06-21 Sample extraction and expansion method and storage medium for small sample image recognition

Country Status (1)

Country Link
CN (1) CN113298184B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114595775A (en) * 2022-03-14 2022-06-07 腾讯科技(深圳)有限公司 Training method and device of data generation model
CN114998956A (en) * 2022-05-07 2022-09-02 北京科技大学 Small sample image data expansion method and device based on intra-class difference
CN117932457A (en) * 2024-03-22 2024-04-26 南京信息工程大学 A model fingerprint recognition method and system based on error classification

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108446738A (en) * 2018-03-23 2018-08-24 联想(北京)有限公司 A kind of clustering method, device and electronic equipment
CN108959305A (en) * 2017-05-22 2018-12-07 北京国信宏数科技有限公司 A kind of event extraction method and system based on internet big data
CN109325532A (en) * 2018-09-18 2019-02-12 成都网阔信息技术股份有限公司 The image processing method of EDS extended data set under a kind of small sample
CN109948728A (en) * 2019-03-28 2019-06-28 第四范式(北京)技术有限公司 The method and apparatus of the training of abnormal transaction detection model and abnormal transaction detection
CN111461179A (en) * 2020-03-11 2020-07-28 清华大学 Base class selection method and device for small sample learning
US20200285890A1 (en) * 2019-03-05 2020-09-10 Memorial Sloan Kettering Cancer Center Systems and methods for image classification using visual dictionaries
CN112200211A (en) * 2020-07-17 2021-01-08 南京农业大学 Small sample fish identification method and system based on residual error network and transfer learning
CN112231583A (en) * 2020-11-11 2021-01-15 重庆邮电大学 E-commerce recommendation method based on dynamic interest group identification and generative adversarial network
CN112784929A (en) * 2021-03-14 2021-05-11 西北工业大学 Small sample image classification method and device based on double-element group expansion
CN112966740A (en) * 2021-03-05 2021-06-15 西安邮电大学 Small sample hyperspectral image classification method based on core sample adaptive expansion

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108959305A (en) * 2017-05-22 2018-12-07 北京国信宏数科技有限公司 A kind of event extraction method and system based on internet big data
CN108446738A (en) * 2018-03-23 2018-08-24 联想(北京)有限公司 A kind of clustering method, device and electronic equipment
CN109325532A (en) * 2018-09-18 2019-02-12 成都网阔信息技术股份有限公司 The image processing method of EDS extended data set under a kind of small sample
US20200285890A1 (en) * 2019-03-05 2020-09-10 Memorial Sloan Kettering Cancer Center Systems and methods for image classification using visual dictionaries
CN109948728A (en) * 2019-03-28 2019-06-28 第四范式(北京)技术有限公司 The method and apparatus of the training of abnormal transaction detection model and abnormal transaction detection
CN111461179A (en) * 2020-03-11 2020-07-28 清华大学 Base class selection method and device for small sample learning
CN112200211A (en) * 2020-07-17 2021-01-08 南京农业大学 Small sample fish identification method and system based on residual error network and transfer learning
CN112231583A (en) * 2020-11-11 2021-01-15 重庆邮电大学 E-commerce recommendation method based on dynamic interest group identification and generative adversarial network
CN112966740A (en) * 2021-03-05 2021-06-15 西安邮电大学 Small sample hyperspectral image classification method based on core sample adaptive expansion
CN112784929A (en) * 2021-03-14 2021-05-11 西北工业大学 Small sample image classification method and device based on double-element group expansion

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
PEG HOWLAND ET AL.: "Solving the small sample size problem in face recognition using generalized discriminant analysis", 《PATTERN RECOGNITION》 *
Y-LAN BOUREAU ET AL.: "Ask the locals: multi-way local pooling for image recognition", 《2011 INTERNATIONAL CONFERENCE ON COMPUTER VISION》 *
孙永光: "SAR图像目标特征提取与识别方法研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
赵凯琳 等: "小样本学习研究综述", 《软件学报》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114595775A (en) * 2022-03-14 2022-06-07 腾讯科技(深圳)有限公司 Training method and device of data generation model
CN114998956A (en) * 2022-05-07 2022-09-02 北京科技大学 Small sample image data expansion method and device based on intra-class difference
CN114998956B (en) * 2022-05-07 2023-03-28 北京科技大学 Small sample image data expansion method and device based on intra-class difference
CN117932457A (en) * 2024-03-22 2024-04-26 南京信息工程大学 A model fingerprint recognition method and system based on error classification
CN117932457B (en) * 2024-03-22 2024-05-28 南京信息工程大学 Model fingerprint identification method and system based on error classification

Also Published As

Publication number Publication date
CN113298184B (en) 2022-09-02

Similar Documents

Publication Publication Date Title
CN113298184B (en) Sample extraction and expansion method and storage medium for small sample image recognition
CN107122809B (en) A neural network feature learning method based on image self-encoding
CN110633725B (en) Method and device for training classification model and classification method and device
CN110852288B (en) A Cell Image Classification Method Based on Two-Stage Convolutional Neural Networks
CN103714148B (en) SAR image search method based on sparse coding classification
CN107622182A (en) Method and system for predicting local structural features of proteins
CN103258210B (en) A kind of high-definition image classification method based on dictionary learning
CN113887580A (en) Contrast type open set identification method and device considering multi-granularity correlation
CN115510965A (en) Bearing imbalance fault diagnosis method based on generated data fusion
CN102915448B (en) A kind of three-dimensional model automatic classification method based on AdaBoost
CN106203521A (en) Based on disparity map from the SAR image change detection of step study
CN114783604A (en) A method, system and storage medium for predicting sentinel lymph node metastasis of breast cancer
Liu et al. HEp-2 cell classification based on a deep autoencoding-classification convolutional neural network
Li et al. HEp-2 specimen classification via deep CNNs and pattern histogram
Sharma et al. phylaGAN: data augmentation through conditional GANs and autoencoders for improving disease prediction accuracy using microbiome data
CN114093445B (en) Patient screening marking method based on partial multi-marking learning
CN111523404A (en) Partial face recognition method based on convolutional neural network and sparse representation
CN110717602A (en) Machine learning model robustness assessment method based on noise data
Dong et al. A supervised dictionary learning and discriminative weighting model for action recognition
Fang et al. Improving Speaker Verification with Noise-Aware Label Ensembling and Sample Selection: Learning and Correcting Noisy Speaker Labels
CN111639659B (en) Fusion classification method for underwater undersea small targets
Du et al. Deep neural networks with parallel autoencoders for learning pairwise relations: Handwritten digits subtraction
CN113837293B (en) MRNA subcellular localization model training method, positioning method and readable storage medium
CN117727043A (en) Training and image retrieval methods, devices and equipment of information reconstruction model
CN116630694A (en) A target classification method, system and electronic equipment for more marked images

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant