A hierarchical label driven approach to few-shot image classification

The hierarchical label-driven small-sample image classification method uses the contrastive learning framework and hyperbolic space mapping technology to solve the problems of data scarcity and mixed granularity, and improve the performance and applicability of image classification.

CN118196540BActive Publication Date: 2024-08-30JILIN UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410599748.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-15
Publication Date
2024-08-30
Estimated Expiration
2044-05-15

AI Technical Summary

Technical Problem

In the case of data scarcity, it is difficult for existing technologies to effectively utilize small sample information for image classification. Especially on data sets with large intra-class differences, small inter-class differences, or mixed coarse and fine granularity, the generalization performance and learning ability of the model are insufficient. .

Method used

A hierarchical label-driven small-sample image classification method is adopted, by constructing a convolutional neural network as a contrastive learning framework, combining contrastive loss and similarity loss, using hyperbolic space to map feature vectors, and optimizing network parameters to improve classification performance.

Benefits of technology

It effectively alleviates the problem of difficult classification between fine-grained data in the data set, improves the model's classification performance of coarse- and fine-grained mixed data, and is suitable for fields with problems such as skew, few samples, and fine-grainedness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118196540B
    Figure CN118196540B
Patent Text Reader

Abstract

The present invention is applicable to the field of small sample image classification technology, and provides a small sample image classification method driven by a hierarchical label, comprising the following steps: obtaining a multi-label image with a hierarchical structure, constructing a convolutional neural network as the backbone network of a contrastive learning framework, and constructing a contrastive learning data pair according to the label hierarchy; inputting the data pair into the constructed network model, obtaining a feature vector and calculating the contrast loss based on the feature vector, and mapping the feature vector to a hyperbolic space with negative curvature to calculate the similarity loss; combining the contrast loss and the similarity loss into a total network loss, and optimizing the network parameters by minimizing the loss function. The present invention alleviates the problem of difficulty in distinguishing between fine-grained data in a data set by combining hyperbolic space with hierarchical label prior knowledge. At the same time, the present invention can also be applied to related fields with problems such as skewness, few samples, and fine granularity, and has considerable technical and economic value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of small sample image classification, and in particular relates to a small sample image classification method driven by a hierarchical label. Background Art

[0002] In today's society, data is growing explosively. Massive data obtained from multiple channels can support complex model training and achieve remarkable results. However, data is scarce in many fields, such as emerging diseases in the medical field, telecommunications fraud, modified dangerous goods in the security field, and defective samples in the detection field. This type of data is difficult to obtain and label and is closely related to known field data, resulting in insufficient model training and poor results. Inspired by children's ability to accurately distinguish things after seeing a small number of pictures, we hope that the model has generalization performance for this type of data and learning capabilities for a small number of samples. This type of learning problem with limited information is called small sample learning, and related research fields include small sample learning (Few-shot Learning), transfer learning (Transfer Learning), imbalanced classification (ImbalanceClassification), fine-grained classification (Fine-grained Classification), anomaly detection (AnomalyDetection), etc.

[0003] Small sample learning belongs to the category of supervised learning, so the solution mainly focuses on how to effectively use the information contained in small samples. The main methods are divided into the following three directions:

[0004] The first solution is a resampling strategy (data enhancement) for the data itself. This strategy is mainly reflected in the oversampling of a small number of samples, including manual cropping, flipping, rotation, scaling, etc.; as well as data generation based on algorithm models and learning rules.

[0005] The second solution is based on model strategies. This type of learning strategy mainly constructs a network framework that is suitable for small samples and can be divided into two categories. One type of model reduces the cost of model optimization by obtaining more knowledge from the outside, such as specific information enhancement of external tasks, external model parameter sharing, and external prior knowledge transfer. How to obtain effective external information is the research focus of this learning strategy. The other type is an embedding model based on metric learning, which aims to effectively distinguish whether the data is similar or not. The purpose of the model is not to identify the category to which a certain picture belongs, but to answer the question of whether two pictures belong to the same category through distance measurement. This learning strategy that relies on distance calculation can effectively solve the problem of small sample learning with large category differences (such as cats and dogs), but in the face of large intra-class differences, small inter-class differences, or mixed coarse and fine granularity data sets, more improvements in distance calculation and model framework are needed to improve performance.

[0006] The third solution is a strategy based on algorithm optimization. This type of learning strategy aims to find model parameters faster and better, such as the initial optimization starting point of the model, the update direction of model parameters, and the update step size, or learn an optimizer through a meta-learning strategy, and then change the learning trajectory for different downstream tasks. This strategy is more dependent on the degree of difference between different fields, and parameter migration between fields with large differences will still have a large training cost. Summary of the invention

[0007] The purpose of the present invention is to provide a small sample image classification method driven by a hierarchical label, aiming to solve the problems raised in the above background technology.

[0008] To achieve the above object, the present invention provides the following technical solutions:

[0009] A hierarchical label driven few-shot image classification method, comprising the following steps:

[0010] Step S1, obtaining a multi-label image with a hierarchical structure, constructing a convolutional neural network as the backbone network of a contrastive learning framework, and constructing contrastive learning data pairs according to the label hierarchy;

[0011] Step S2: input the data pair into the established network model, obtain the feature vector and calculate the contrast loss based on the feature vector, and at the same time map the feature vector to a hyperbolic space with negative curvature to calculate the similarity loss;

[0012] Step S3: Combine the contrast loss and similarity loss into the total network loss, and optimize the network parameters by minimizing the loss function.

[0013] Furthermore, the convolutional neural network constructs coarse-grained, coarse-grained and fine-grained data pairs according to the different granularities contained in the data labels.

[0014] Furthermore, in step S2, the contrast loss adopts the maximum edge loss, which is obtained by calculating the Euclidean distance of the data pair containing the anchor point; if the samples in the data pair are of the same type, the distance is minimized, and if they are of different types, the distance between the two is maximized over the interval, and the interval is a hyperparameter; the calculation process of the contrast loss is as follows:

[0015] ,

[0016] in, and is the corresponding eigenvector in the data pair, To compare labels, For the model, are model parameters, is the training interval hyperparameter.

[0017] Furthermore, in step S2, the method for calculating the similarity loss in the hyperbolic space is as follows:

[0018] ,

[0019] ,

[0020] ,

[0021] ,

[0022] in, and is the eigenvector of the original data in the Euclidean space, and is the mapping vector of the data pair in the hyperbolic space, To compare labels, is the hyperbolic space curvature hyperparameter, is the training interval hyperparameter.

[0023] Furthermore, in step S3, the calculation process of the total network loss is as follows:

[0024] ,

[0025] in, is the contrast loss, is the similarity loss, is a weight hyperparameter between 0 and 1.

[0026] Compared with the prior art, the present invention has the following beneficial effects:

[0027] The present invention alleviates the problem of difficulty in distinguishing fine-grained data in a data set by combining hyperbolic space with hierarchical label prior knowledge. At the same time, the present invention can also be applied to related fields with problems such as skewness, few samples, and fine granularity, and has considerable technical and economic value. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a flow chart of the present invention.

[0029] Figure 2 It is a schematic diagram of the structure of the network of the present invention. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0031] The specific implementation of the present invention is described in detail below in conjunction with specific embodiments.

[0032] like Figure 1 As shown, a small sample image classification method driven by a hierarchical label is provided in one embodiment of the present invention, comprising the following steps:

[0033] Step S1, obtaining a multi-label image with a hierarchical structure, constructing a convolutional neural network as the backbone network of a contrastive learning framework, and constructing contrastive learning data pairs according to the label hierarchy;

[0034] Step S2: input the data pair into the established network model, obtain the feature vector (n-dimensional vector), calculate the contrast loss based on the feature vector, and map the feature vector to a hyperbolic space with negative curvature to calculate the similarity loss;

[0035] Step S3: Combine the contrast loss and similarity loss into the total network loss, and optimize the network parameters by minimizing the loss function.

[0036] In the embodiment of the present invention, the network framework is composed of a convolutional neural network, and its input layer is based on a 224*224 size picture. For images that do not meet the standard, they will be automatically adjusted to the corresponding size. The convolutional neural network is composed of convolutional blocks, and the convolutional blocks are composed of convolutional layers and pooling layers; the output layer is a fully connected layer.

[0037] The dataset is Tiered ImageNet, which is a subset of ILSVRC-12 (Imagenet 2012) like mini-ImageNet. The difference is that the former has more categories and the classification also has a hierarchical structure. There are 34 categories in total, each of which contains smaller categories. During training, the dataset is divided into Training set, Query set and Test set. According to the small sample learning settings, there are 5-way (1-shot) and 5-way (5-shot).

[0038] As a preferred embodiment of the present invention, the convolutional neural network is based on ResNet50, and the latter few layers of the network are adjusted to obtain the vector dimension for adaptive loss calculation; coarse-grained, coarse-grained and fine-grained data pairs are constructed according to the different granularities (levels) contained in the data labels.

[0039] As a preferred embodiment of the present invention, in step S2, the contrast loss adopts the maximum edge loss, which is obtained by calculating the Euclidean distance of the data pair containing the anchor point; if the samples in the data pair are of the same type, the distance is minimized, and if they are of different types, the distance between the two is maximized over the interval, and the interval is a hyperparameter; the calculation process of the contrast loss is as follows:

[0040] ,

[0041] in, and is the corresponding eigenvector in the data pair, To compare labels, For the model, are model parameters, is the training interval hyperparameter, which is actually found through grid search.

[0042] As a preferred embodiment of the present invention, in step S2, the method for calculating the similarity loss in the hyperbolic space is as follows:

[0043] ,

[0044] ,

[0045] ,

[0046] ,

[0047] in, and is the eigenvector of the original data in the Euclidean space, and is the mapping vector of the data pair in the hyperbolic space, To compare labels, is the hyperbolic space curvature hyperparameter, is the training interval hyperparameter, which is actually found through grid search.

[0048] As a preferred embodiment of the present invention, in step S3, the calculation process of the total network loss is as follows:

[0049] ,

[0050] in, is the contrast loss, is the similarity loss, is a weight hyperparameter between 0 and 1.

[0051] Example 1: Experiments are conducted on the Tiered ImageNet dataset containing 34 major categories (608 minor categories), and the results are compared with those obtained by other five small sample learning algorithms. The results are shown in Table 1. The experimental environment is Windows 10 (CPU Intel I5, GPU NVIDIA GeForce RTX 3060, RAM 16G), Python 3.8, PyTorch 1.9.0, torchvision 0.10.0.

[0052] Table 1

[0053]

[0054] It can be seen that the method of the present invention can improve the classification performance of the model for mixed data of coarse and fine granularity.

[0055] The above are only preferred embodiments of the present invention. It should be pointed out that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present invention. These should also be regarded as the protection scope of the present invention. These will not affect the effect of the implementation of the present invention and the practicality of the patent.

Claims

1. A hierarchical label-driven small sample image classification method, characterized in that: The following steps are involved: Step S1, obtaining a multi-label image with a hierarchical structure, constructing a convolutional neural network as the backbone network of a contrastive learning framework, and constructing contrastive learning data pairs according to the label hierarchy; Step S2: input the data pair into the established network model, obtain the feature vector and calculate the contrast loss based on the feature vector, and at the same time map the feature vector to a hyperbolic space with negative curvature to calculate the similarity loss; Step S3, combining the contrast loss and the similarity loss into the total network loss, and optimizing the network parameters by minimizing the loss function; In step S2, the contrast loss adopts the maximum edge loss, which is obtained by calculating the Euclidean distance of the data pair containing the anchor point; if the samples in the data pair are of the same type, the distance is minimized, and if they are of different types, the distance between the two is maximized over the interval, and the interval is a hyperparameter; the calculation process of the contrast loss is as follows: ; in, and is the eigenvector of the original data in the Euclidean space, To compare labels, For the model, are model parameters, is the training interval hyperparameter; In step S2, the method for calculating the similarity loss in the hyperbolic space is as follows: ; ; ; ; in, and is the eigenvector of the original data in the Euclidean space, and is the mapping vector of the data pair in the hyperbolic space, To compare labels, is the hyperbolic space curvature hyperparameter, is the training interval hyperparameter; In step S3, the calculation process of the total network loss is as follows: ; in, is the contrast loss, is the similarity loss, is a weight hyperparameter between 0 and 1.

2. The hierarchical label-driven small sample image classification method according to claim 1, characterized in that: The convolutional neural network constructs coarse-grained, coarse-grained and fine-grained data pairs according to the different granularities contained in the data labels.