A small sample image classification method and system based on hierarchical information propagation

By learning the hierarchical relationship between samples and categories in the deep learning model and updating sample and category representations, the problem of insufficient small sample image classification performance in the existing technology is solved, and more efficient classification accuracy and resource optimization are achieved.

CN118447342BActive Publication Date: 2024-10-22HANGZHOU MIND MEDICAL ALLIANCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410906574.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-10-22
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

Existing deep learning models are difficult to effectively utilize the hierarchical relationship between samples and categories in small sample image classification, resulting in insufficient classification performance, especially in professional fields such as medical imaging where data are scarce and labeling costs are high.

Method used

By simultaneously learning the relationship between samples and categories during the learning process, using pre-trained image feature extractors and deep learning models, calculating hierarchical information propagation of samples and categories, and updating sample and category representations, thereby improving classification performance.

Benefits of technology

It improves the classification accuracy of small sample images, reduces computing costs and time, optimizes resource usage efficiency, and enhances the scalability of the model through Transformer or graph neural network structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118447342B_ABST
    Figure CN118447342B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of small sample image classification, and discloses a small sample image classification method and system based on hierarchical information propagation, the method comprising: obtaining a small sample image data set of a target image, and a preset classification category; inputting the small sample image data set into an image feature extractor to obtain a first feature matrix; inputting the first feature matrix into a deep learning model to obtain a second feature matrix; calculating the category center of each preset classification category of the small sample image data set according to the second feature matrix; inputting the category center into the deep learning model to obtain a third feature matrix; inputting the target image to be tested into a pre-trained image feature extractor, and determining the predicted classification category of the target image to be tested according to the category representation corresponding to each preset classification category. The present invention can simultaneously learn the relationship between samples and categories during the learning process, thereby improving the classification performance of small sample images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of small sample image classification, and in particular to a small sample image classification method and system based on hierarchical information propagation. Background Art

[0002] Deep learning is heavily dependent on the amount of training data sets, but data in some professional fields are scarce. When faced with some specific fields, such as medical imaging data of rare diseases, data labeling is difficult or costly. High-quality data labeling requires the knowledge and experience of domain experts, and professional labeling not only requires professional knowledge, but is also time-consuming and labor-intensive, all of which limit the training and generalization capabilities of deep learning models. When deep learning algorithms do not obtain enough sample training, their performance will drop sharply.

[0003] Current small sample image classification schemes are generally divided into two categories:

[0004] (1) Using the relationship between samples to learn better sample representations; some methods focus on learning the relationship between samples, such as using metric learning or contrastive learning to narrow the distance between samples of the same category and push the distance between samples of different categories.

[0005] (2) Exploiting the relationships between known categories to learn better class representations for classification; some methods attempt to exploit the relationships between known categories, such as through category hierarchies or the geometric structure of category embedding space to improve classification performance.

[0006] That is, existing technologies learn the relationship between samples or categories separately, while there is a hierarchical relationship between samples and categories. The hierarchical relationship between samples and categories is crucial because samples of the same category constitute the category, that is, samples of the same category share similar features, which are different from the features of other categories. Learning separately will result in the inability to make good use of this hierarchical relationship, resulting in insufficient classification performance of deep learning.

[0007] Therefore, there is an urgent need for a small sample image classification method and system based on hierarchical information propagation, which can simultaneously learn the relationship between samples and categories during the learning process, thereby improving the classification performance of small sample images. Summary of the invention

[0008] In order to solve the above technical problems, the present invention provides a small sample image classification method and system based on hierarchical information propagation, which can simultaneously learn the relationship between samples and categories during the learning process, thereby improving the classification performance of small sample images.

[0009] The present invention provides a small sample image classification method based on hierarchical information propagation, comprising the following steps:

[0010] S1, obtaining a small sample image dataset of a target image and a preset classification category of the small sample image dataset;

[0011] S2, inputting the small sample image data set into a pre-trained image feature extractor to obtain a first feature matrix of the small sample image data set; wherein the first feature matrix includes an image representation corresponding to each sample in the small sample image data set;

[0012] S3. Input the first feature matrix into a pre-trained deep learning model to obtain a second feature matrix of the small sample image data set; wherein the second feature matrix includes an updated image representation corresponding to each sample in the small sample image data set;

[0013] S4. Calculate the category center of each preset classification category of the small sample image data set according to the second feature matrix;

[0014] S5. Input the category center of each preset classification category into the pre-trained deep learning model to obtain a third feature matrix of each preset classification category of the small sample image data set; wherein the third feature matrix includes the category representation corresponding to the preset classification category;

[0015] S6. Input the target image to be tested into a pre-trained image feature extractor, and determine the predicted classification category of the target image to be tested according to the category representation corresponding to each preset classification category.

[0016] Further, S1, a small sample image dataset of a target image is obtained, and the preset classification categories of the small sample image dataset include:

[0017] S11, obtaining a small sample image data set of a target image and a preset classification category of the small sample image data set;

[0018] S12. Labeling sample images in the small sample image dataset according to preset classification categories.

[0019] Further, S3, the first feature matrix is ​​input into a pre-trained deep learning model to obtain a second feature matrix of the small sample image data set, wherein the pre-trained deep learning model is a Transformer structure.

[0020] Further, S4, calculating the category center of each preset classification category of the small sample image data set according to the second feature matrix includes:

[0021] According to the second feature matrix, the average value of the updated image representations of all samples in each preset classification category is calculated to obtain the category center of each preset classification category.

[0022] Further, S6, inputting the target image to be tested into a pre-trained image feature extractor, and determining the predicted classification category of the target image to be tested according to the category representation corresponding to each preset classification category includes:

[0023] S61, inputting the target image to be tested into a pre-trained image feature extractor to obtain an image representation of the target image to be tested;

[0024] S62, calculating the distance between the image representation of the target image to be tested and each category representation, and taking the preset classification category corresponding to the category representation with the smallest distance as the predicted classification category of the target image to be tested.

[0025] Further, S2, the small sample image data set is input into a pre-trained image feature extractor to obtain a first feature matrix of the small sample image data set, wherein the first feature matrix is ​​as follows:

[0026] ;

[0027] Among them, X 0 represents the first characteristic matrix, x i Represents the image representation corresponding to the i-th sample.

[0028] The present invention also provides a small sample image classification system based on hierarchical information propagation, which is used to execute any of the small sample image classification methods based on hierarchical information propagation described above, and the system includes the following modules:

[0029] A data set acquisition module, used to acquire a small sample image data set of a target image and a preset classification category of the small sample image data set;

[0030] A first feature matrix acquisition module, connected to the data set acquisition module, is used to input the small sample image data set into the pre-trained image feature extractor to obtain a first feature matrix of the small sample image data set; wherein the first feature matrix includes an image representation corresponding to each sample in the small sample image data set;

[0031] A second feature matrix acquisition module, connected to the first feature matrix acquisition module, is used to input the first feature matrix into a pre-trained deep learning model to obtain a second feature matrix of the small sample image data set; wherein the second feature matrix includes an updated image representation corresponding to each sample in the small sample image data set;

[0032] A category center calculation module, connected to the second feature matrix acquisition module, is used to calculate the category center of each preset classification category of the small sample image data set according to the second feature matrix;

[0033] A third feature matrix acquisition module is connected to the category center calculation module, and is used to input the category center of each preset classification category into the pre-trained deep learning model to obtain a third feature matrix of each preset classification category of the small sample image data set; wherein the third feature matrix includes the category representation corresponding to the preset classification category;

[0034] The prediction module is connected to the third feature matrix acquisition module and is used to input the target image to be tested into a pre-trained image feature extractor, and determine the predicted classification category of the target image to be tested according to the category representation corresponding to each preset classification category.

[0035] The embodiments of the present invention have the following technical effects:

[0036] The present invention updates sample representations by learning the relationship between samples, and uses these updated sample representations to obtain more accurate category representations, thereby effectively improving the classification accuracy of small sample images; and the present invention not only updates sample representations, but also further uses the relationship between categories to update category representations, thereby realizing hierarchical information propagation from samples to categories, enhancing the model's understanding of data structure, and further improving classification accuracy;

[0037] When predicting the category of an unknown sample, the present invention only needs to perform distance calculation without the need for a back-propagation algorithm. Therefore, the prediction process is more efficient, reducing computing costs and time. Moreover, since a large amount of computing resources are not required when predicting the category of an unknown sample, more resources can be allocated to the training and feature learning stages of the model, thereby optimizing resource utilization efficiency. The use of structures such as Transformer or graph neural networks provides flexibility for the model, and the network structure can be adjusted according to different task requirements, thereby enhancing the scalability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0039] Figure 1 is a flow chart of a small sample image classification method based on hierarchical information propagation provided by an embodiment of the present invention;

[0040] Figure 2 is a structural schematic diagram of a small sample image classification system based on hierarchical information propagation provided by an embodiment of the present invention;

[0041] Figure 3It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.

[0043] This paper proposes a small sample image classification method based on hierarchical information propagation. Figure 1 is a flowchart of a small sample image classification method based on hierarchical information propagation provided by an embodiment of the present invention, see Figure 1 , specifically including:

[0044] S1. Obtain a small sample image dataset of a target image and preset classification categories of the small sample image dataset.

[0045] S11, obtaining a small sample image dataset of a target image and a preset classification category of the small sample image dataset.

[0046] S12. Labeling sample images in the small sample image dataset according to preset classification categories.

[0047] For example, the small sample image dataset of the target image includes 20 samples, 10 cat samples, and 10 dog samples, and the preset classification categories of the small sample image dataset include: cat and dog. The 20 sample images in the small sample image dataset are labeled according to the preset classification categories.

[0048] S2. Input the small sample image data set into a pre-trained image feature extractor to obtain a first feature matrix of the small sample image data set.

[0049] The first feature matrix includes the image representation corresponding to each sample in the small sample image data set.

[0050] Specifically, the first feature matrix is ​​as follows:

[0051] ;

[0052] Among them, X 0 represents the first characteristic matrix, x i Represents the image representation corresponding to the i-th sample.

[0053] S3. Input the first feature matrix into a pre-trained deep learning model to obtain a second feature matrix of the small sample image data set.

[0054] Specifically, the pre-trained deep learning model is a Transformer structure; the Transformer structure is used to establish the relationship between each sample in the small sample image data set, and the image representation corresponding to each sample is updated to obtain the second feature matrix of the small sample image data set; wherein the second feature matrix includes the updated image representation corresponding to each sample in the small sample image data set.

[0055] The calculation formula of the second characteristic matrix is ​​as follows:

[0056] ;

[0057] Among them, X 1 Represents the second feature matrix, transformer sample (·) indicates that the sample is calculated through the Transformer structure.

[0058] In some embodiments, the Transformer structure can also be replaced with other graph neural network structures.

[0059] S4. Calculate the category center of each preset classification category of the small sample image data set according to the second feature matrix.

[0060] Specifically, according to the second feature matrix, the average value of the updated image representation of all samples in each preset classification category is calculated to obtain the category center of each preset classification category, P sam , j Represents the category center of the jth preset classification category.

[0061] S5. Input the category center of each preset classification category into the pre-trained deep learning model to obtain the third feature matrix of each preset classification category of the small sample image data set.

[0062] Specifically, the pre-trained deep learning model still uses the Transformer structure; the Transformer structure is used to establish the relationship between each preset classification category in the small sample image data set, and the category representation corresponding to each preset classification category is updated to obtain the third feature matrix of the small sample image data set; wherein the third feature matrix includes the category representation corresponding to the preset classification category.

[0063] The calculation formula of the third characteristic matrix is ​​as follows:

[0064] ;

[0065] Among them, P cla , j Represents the third feature matrix of the jth preset classification category, transformer class(·) indicates that the preset classification categories are calculated through the Transformer structure.

[0066] In some embodiments, the Transformer structure can also be replaced with other graph neural network structures.

[0067] S6. Input the target image to be tested into a pre-trained image feature extractor, and determine the predicted classification category of the target image to be tested according to the category representation corresponding to each preset classification category.

[0068] S61, input the target image to be tested into a pre-trained image feature extractor to obtain an image representation x of the target image to be tested q .

[0069] S62, calculating the image representation x of the target image to be measured q With each category characterization P cla , j The preset classification category corresponding to the category representation with the smallest distance is taken as the predicted classification category of the target image to be tested.

[0070] Specifically, when calculating the distance between the image representation of the target image to be tested and each category representation, a measurement method such as Euclidean distance and cosine distance may be used, which is not limited here.

[0071] The present invention updates sample representations by learning the relationship between samples, and uses these updated sample representations to obtain more accurate category representations, thereby effectively improving the classification accuracy of small sample images; and the present invention not only updates sample representations, but also further uses the relationship between categories to update category representations, thereby realizing hierarchical information propagation from samples to categories, enhancing the model's understanding of data structure, and further improving classification accuracy;

[0072] When predicting the category of an unknown sample, the present invention only needs to perform distance calculation without the need for a back-propagation algorithm. Therefore, the prediction process is more efficient, reducing computing costs and time. Moreover, since a large amount of computing resources are not required when predicting the category of an unknown sample, more resources can be allocated to the training and feature learning stages of the model, thereby optimizing resource utilization efficiency. The use of structures such as Transformer or graph neural networks provides flexibility for the model, and the network structure can be adjusted according to different task requirements, thereby enhancing the scalability of the model.

[0073] Figure 2 is a schematic diagram of the structure of a small sample image classification system based on hierarchical information propagation provided by an embodiment of the present invention. The system is used to execute a small sample image classification method based on hierarchical information propagation described in the above embodiment, such as Figure 2 As shown, the system includes the following modules:

[0074] A data set acquisition module, used to acquire a small sample image data set of a target image and a preset classification category of the small sample image data set;

[0075] A first feature matrix acquisition module, connected to the data set acquisition module, is used to input the small sample image data set into the pre-trained image feature extractor to obtain a first feature matrix of the small sample image data set; wherein the first feature matrix includes an image representation corresponding to each sample in the small sample image data set;

[0076] A second feature matrix acquisition module, connected to the first feature matrix acquisition module, is used to input the first feature matrix into a pre-trained deep learning model to obtain a second feature matrix of the small sample image data set; wherein the second feature matrix includes an updated image representation corresponding to each sample in the small sample image data set;

[0077] A category center calculation module, connected to the second feature matrix acquisition module, is used to calculate the category center of each preset classification category of the small sample image data set according to the second feature matrix;

[0078] A third feature matrix acquisition module is connected to the category center calculation module and is used to input the category center into the pre-trained deep learning model to obtain a third feature matrix of the small sample image data set; wherein the third feature matrix includes a category representation corresponding to each preset classification category in the small sample image data set;

[0079] The prediction module is connected to the third feature matrix acquisition module and is used to input the target image to be tested into a pre-trained image feature extractor, and determine the predicted classification category of the target image to be tested according to the category representation corresponding to each preset classification category.

[0080] Figure 3 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 3 As shown, the electronic device 500 includes one or more processors 501 and a memory 502 .

[0081] The processor 501 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 500 to perform desired functions.

[0082] The memory 502 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 501 may run the program instructions to implement a small sample image classification method based on hierarchical information propagation and / or other desired functions of any embodiment of the present application described above. Various contents such as initial external parameters, thresholds, etc. may also be stored in the computer-readable storage medium.

[0083] In one example, the electronic device 500 may further include: an input device 503 and an output device 504, which are interconnected via a bus system and / or other forms of connection mechanisms (not shown). The input device 503 may include, for example, a keyboard, a mouse, etc. The output device 504 may output various information to the outside, including early warning prompt information, braking force, etc. The output device 504 may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.

[0084] Of course, to simplify, Figure 3 Only some of the components related to the present application in the electronic device 500 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 500 may also include any other appropriate components.

[0085] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute a small sample image classification method based on hierarchical information propagation provided by any embodiment of the present application.

[0086] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0087] In addition, an embodiment of the present application may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes a small sample image classification method based on hierarchical information propagation provided by any embodiment of the present application.

[0088] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0089] It should be noted that the terms used in the present invention are only for describing specific embodiments, rather than limiting the scope of the present application. As shown in the present specification, unless the context clearly indicates an exception, the words "one", "a", "a kind of" and / or "the" do not specifically refer to the singular, but may also include the plural. The terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method or device. In the absence of more restrictions, the elements defined by the sentence "include one..." do not exclude the presence of other identical elements in the process, method or device including the elements.

[0090] It should also be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. Unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", etc. should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0091] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention.

Claims

1. A small sample image classification method based on hierarchical information propagation, characterized in that: The steps include: S1. Obtain a small sample image dataset of a target image and a preset classification category of the small sample image dataset; S11, obtaining a small sample image data set of a target image and a preset classification category of the small sample image data set; S12, labeling the sample images in the small sample image dataset according to the preset classification category; S2. Input the small sample image data set into a pre-trained image feature extractor to obtain a first feature matrix of the small sample image data set; wherein the first feature matrix includes an image representation corresponding to each sample in the small sample image data set; The first feature matrix is ​​as follows: ; Among them, X 0 represents the first characteristic matrix, x i Represents the image representation corresponding to the i-th sample; S3. Input the first feature matrix into a pre-trained deep learning model to obtain a second feature matrix of the small sample image data set; wherein the second feature matrix includes an updated image representation corresponding to each sample in the small sample image data set; Wherein, the pre-trained deep learning model is a Transformer structure; S4. Calculating the category center of each preset classification category of the small sample image data set according to the second feature matrix; Specifically include: According to the second feature matrix, calculating the average value of the updated image representations of all samples in each preset classification category to obtain the category center of each preset classification category; S5. Input the category center of each preset classification category into the pre-trained deep learning model respectively to obtain a third feature matrix of each preset classification category of the small sample image data set; wherein the third feature matrix includes the category representation corresponding to the preset classification category; the category representation corresponding to the preset classification category is the category representation updated according to the relationship between each preset classification category; S6, inputting the target image to be tested into the pre-trained image feature extractor, and determining the predicted classification category of the target image to be tested according to the category representation corresponding to each preset classification category; S61, inputting the target image to be measured into the pre-trained image feature extractor to obtain an image representation of the target image to be measured; S62: Calculate the distance between the image representation of the target image to be tested and each category representation, and use the preset classification category corresponding to the category representation with the smallest distance as the predicted classification category of the target image to be tested.

2. A small sample image classification system based on hierarchical information propagation, used to execute the small sample image classification method based on hierarchical information propagation described in claim 1, characterized in that: The system includes the following modules: A data set acquisition module, used to acquire a small sample image data set of a target image and a preset classification category of the small sample image data set; A first feature matrix acquisition module, connected to the data set acquisition module, used to input the small sample image data set into a pre-trained image feature extractor to obtain a first feature matrix of the small sample image data set; wherein the first feature matrix includes an image representation corresponding to each sample in the small sample image data set; a second feature matrix acquisition module, connected to the first feature matrix acquisition module, and configured to input the first feature matrix into a pre-trained deep learning model to obtain a second feature matrix of the small sample image data set; wherein the second feature matrix includes an updated image representation corresponding to each sample in the small sample image data set; A category center calculation module is connected to the second feature matrix acquisition module and is used to calculate the category center of each preset classification category of the small sample image data set according to the second feature matrix; specifically comprising: calculating the average value of the updated image representation of all samples in each preset classification category according to the second feature matrix to obtain the category center of each preset classification category; A third feature matrix acquisition module is connected to the category center calculation module and is used to input the category center of each preset classification category into the pre-trained deep learning model to obtain a third feature matrix of each preset classification category of the small sample image data set; wherein the third feature matrix includes the category representation corresponding to the preset classification category; the category representation corresponding to the preset classification category is the category representation updated according to the relationship between each preset classification category; The prediction module is connected to the third feature matrix acquisition module and is used to input the target image to be tested into the pre-trained image feature extractor, and determine the predicted classification category of the target image to be tested according to the category representation corresponding to each preset classification category.