Image classification method based on CNN neural network

Optimizing the convolution path of the CNN neural network through a multi-objective evolutionary algorithm solves the problem of poor cropping effect of the CNN architecture in the existing technology, improves the accuracy and computing efficiency of image classification, and achieves more efficient model performance.

CN118587494AActive Publication Date: 2024-09-03NAT UNIV OF DEFENSE TECH

Patent Information

Application Number
CN202410733764.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-09-03
Estimated Expiration
2044-06-07

AI Technical Summary

Technical Problem

In the existing technology, the search space selection of CNN neural network and the tailoring of convolutional neural network architecture are not effective, resulting in inefficiency in manually adjusting the network structure and parameters, making it difficult to find the optimal configuration, and affecting model performance.

Method used

The multi-objective evolutionary algorithm NSGA-II is used to optimize the convolution path in the CNN neural network. By calculating the intra-class difference imbalance loss and the inter-class difference imbalance loss, the number, dimension and number of pooling layers are optimized. , combining channel attention and spatial attention, using an optimization algorithm to search for the optimal convolution path.

Benefits of technology

It improves the computational efficiency of the neural network and the accuracy of image classification. By minimizing the intra-class difference imbalance loss and the inter-class difference imbalance loss, it finds the optimal convolution path configuration and improves the model performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587494A
    Figure CN118587494A
Patent Text Reader

Abstract

The invention discloses an image classification method based on a CNN neural network, and the method comprises the following steps: extracting the features of an image through a feature extraction method, and the image features comprise edges and textures; constructing a CNN (Convolutional Neural Network); a plurality of attention heads, dimensions and a plurality of pooling layers in the neural network form a single convolution path, an optimization algorithm is adopted to optimize the convolution path, and intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path are calculated in the search process; optimizing the loss by adopting a multi-objective evolution algorithm; and classifying the image by using the optimized convolutional neural network, and outputting a classification result. According to the method, the number of attention heads, the dimensionality and the optimal number of pooling layers are obtained by using a multi-objective optimization algorithm, the calculation efficiency of a neural network is improved, and the accuracy of image classification is improved by taking minimization of intra-class difference imbalance loss and inter-class difference imbalance loss as an objective.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to an image classification method based on a CNN neural network. Background Art

[0002] Through multi-layer nonlinear transformation, deep neural networks can effectively extract effective features from high-dimensional input space, and have strong generalization and robustness. This ability to automatically extract features enables deep reinforcement learning to achieve impressive results in reinforcement learning tasks such as competition, cooperation, etc. Convolutional neural networks (CNN) and deep residual networks in the field of vision, recurrent neural networks (RNN) and Transformer structures in the field of natural language processing, etc., are all excellent artificial intelligence perception models based on deep learning. Among them, CNN neural networks are widely used in image classification, mainly because they can automatically extract image features, reduce computational complexity, have translation invariance, and have multi-layer convolution and pooling characteristics. These characteristics make CNN have high accuracy and robustness in image classification tasks, so it is widely used in various image classification scenarios.

[0003] The performance of CNN neural network is affected by its network structure and parameter configuration. Different network structures and parameter configurations will have different effects on the performance of the model. Therefore, spatial search is needed to automatically explore different network structures and parameter configurations and find the optimal combination to save time and energy in manually adjusting the network structure and parameters, and to more comprehensively explore the search space to find a better network structure and parameter configuration. In addition, with the continuous development of CNN neural networks, network structure and parameter configuration are becoming more and more complex. Manually adjusting the network structure and parameters is not only inefficient, but may not find the optimal configuration. Therefore, the use of spatial search algorithms can more efficiently and accurately find the optimal network structure and parameter configuration, and improve the performance of CNN neural networks. The selection of search space and the tailoring of convolutional neural network architecture in the prior art have not yet achieved satisfactory results. Summary of the invention

[0004] In view of this, the objective of the present invention is to search for the parameter configuration of the convolutional layer in the CNN network in order to explore an efficient lightweight convolutional neural network and obtain optimized parameters.

[0005] Specifically, to achieve the above purpose, the image classification method based on CNN neural network disclosed in this application includes the following steps:

[0006] Get multiple images as training sets;

[0007] Extracting features of the image by a feature extraction method, wherein the image features include edges and textures;

[0008] Constructing a CNN neural network, wherein the CNN neural network includes channel attention and spatial attention;

[0009] Combining several attention heads, dimensions and several pooling layers in the CNN neural network into a single convolution path, optimizing the convolution path using an optimization algorithm, and calculating the intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path during the search process;

[0010] The multi-objective evolutionary algorithm NSGA-II is used to optimize the intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path;

[0011] Use the optimized convolutional neural network to classify the image and output the classification results.

[0012] Furthermore, the search algorithm evaluates the performance of the convolutional neural network composed of the convolutional paths, and then uses a multi-objective evolutionary algorithm to perform non-dominated sorting on the optimization indicators and select outstanding convolutional paths for mutation and crossover, thereby optimizing the CNN neural network; after searching the convolutional paths using the multi-objective evolutionary algorithm, a set of Pareto optimal solutions, i.e., a set of convolutional paths, is obtained.

[0013] Furthermore, a multi-objective evolutionary algorithm is used to perform non-dominated sorting on the intra-class difference imbalance loss and the inter-class difference imbalance loss of the convolution path; the non-dominated sorting is performed according to the individual crowding distance of the calculated convolution path.

[0014] Furthermore, the intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path are used as the fitness function of each individual evaluated by the multi-objective evolutionary algorithm NSGA-II;

[0015] Individuals are evolved through selection, crossover and mutation operations. First, a convolution path is initialized in the search space and evaluated. Then, convolution paths with excellent performance are retained through selection operations. Mutation and crossover operations are performed on the retained convolution paths to obtain new convolution paths and model evaluation is performed. The new convolution paths and the retained convolution paths enter the next generation as new populations. Next, selection, crossover and mutation operations are performed on the new population to obtain the next generation population. The cycle is repeated until the termination condition is met.

[0016] Furthermore, the intra-class difference imbalance loss is calculated as follows:

[0017]

[0018] Among them, xi is the i-th sample, p is the number of samples in the class, m L is the left boundary within the class, m R is the right boundary within the class, c is the center within the class, and p i is the probability that the sample is correctly classified.

[0019] Furthermore, the inter-class difference imbalance loss is calculated as follows:

[0020]

[0021] Among them, x j is the jth sample, z is the sample x j The number of samples classified into a certain class, m 1L is the left boundary of a class, m 1R is the right boundary of a class, c1 is the center of a class, and p j is the probability that the sample is correctly classified, m 2L is the left boundary of the adjacent class, m 2R is the right boundary of the adjacent class, and c2 is the center within the adjacent class.

[0022] Furthermore, the fitness function is calculated as follows:

[0023]

[0024] Among them, γ is the adjustment factor.

[0025] The beneficial effects of the present invention are as follows:

[0026] This application uses a multi-objective optimization algorithm to obtain the optimal number of attention heads, dimensions, and pooling layers, thereby improving the computational efficiency of the neural network. In terms of optimization objectives, it is proposed to minimize the intra-class difference imbalance loss and the inter-class difference imbalance loss, thereby improving the accuracy of image classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 Algorithm framework diagram of this application. DETAILED DESCRIPTION

[0028] The present invention is further described below in conjunction with the accompanying drawings, but the present invention is not limited in any way. Any changes or substitutions made based on the teachings of the present invention belong to the protection scope of the present invention.

[0029] Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0030] The technical solution provided in the embodiments of the present application relates to machine learning technology of artificial intelligence, which is specifically introduced and explained through the following embodiments.

[0031] refer to Figure 1 The image classification method based on CNN neural network disclosed in this application comprises the following steps:

[0032] Get multiple images as training sets;

[0033] Extracting features of the image by a feature extraction method, wherein the image features include edges and textures;

[0034] Constructing a CNN neural network, wherein the CNN neural network includes channel attention and spatial attention;

[0035] Combining several attention heads, dimensions and several pooling layers in the CNN neural network into a single convolution path, optimizing the convolution path using an optimization algorithm, and calculating the intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path during the search process;

[0036] The multi-objective evolutionary algorithm NSGA-II is used to optimize the intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path;

[0037] Use the optimized convolutional neural network to classify the image and output the classification results.

[0038] In some embodiments, the images of the training set are from an existing public dataset, such as the ImageNet dataset.

[0039] In some embodiments, the features of the image are extracted by a feature extraction method, and the image features include edges and textures; the feature extraction algorithms include SIFT (Scale-Invariant Feature Transform) algorithm, SURF (Speeded Up Robust Features) algorithm, HOG (Histogram of Oriented Gradients) algorithm, LBP (Local Binary Patterns) algorithm, Haar feature, Gabor feature, HOF (Histogram of Flow), etc. In some embodiments, feature extraction also includes converting the signal or image data into a tensor form, and then decomposing it through a tensor ring, and the obtained factor tensor can be regarded as a low-dimensional, compact feature representation of the original data. These features not only contain the main structural information of the data, but also remove irrelevant details through the decomposition process, which is conducive to subsequent analysis and processing. The features obtained by tensor ring decomposition usually have better discrimination and lower dimension, which is conducive to improving the efficiency and accuracy of subsequent classification or recognition tasks.

[0040] In some embodiments, the CNN neural network includes channel attention and spatial attention; channel attention is to determine the weight relationship between different channels, increase the weight of key channels, and suppress channels with little effect; spatial attention is to determine the weight relationship between different pixels in the spatial neighborhood, increase the weight of pixels in key areas, so that the algorithm pays more attention to the required research areas and reduces the weights of non-essential areas.

[0041] In some embodiments, channel attention and spatial attention use CBAM attention mechanism. CBAM attention mechanism is an algorithm model that combines channel and spatial attention mechanisms. The algorithm inputs feature maps and first performs channel attention mechanism and then spatial attention mechanism operation, and finally outputs them, thus achieving the purpose of strengthening the region of interest from both channel and spatial aspects.

[0042] In the prior art, the number of attention heads, dimensions, and the number of pooling layers are usually fixed. However, in image classification tasks, due to the large semantic differences, the number of attention heads, dimensions, and the number of pooling layers are fixed, which will result in unsatisfactory classification results. Therefore, in this application, the number of attention heads, dimensions, and the number of pooling layers are not fixed, and several attention heads, dimensions, and several pooling layers in the CNN neural network are combined into a single convolution path. The convolution path is optimized using an optimization algorithm. During the search process, the intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path are calculated. By minimizing the intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path, the optimal number of attention heads, dimensions, and the number of pooling layers configuration data are obtained. The convolution path contains three types of convolution operations, including basic convolution operations, downsampling convolution operations, and convolution kernel replacement operations.

[0043] Because the number of output channels of the convolution operation is equal to the number of convolution kernels, and only one convolution kernel is used for each channel in depthwise separable convolution, the number of output channels of a single channel after the convolution operation is also 1. So if the number of channels of the input feature map is N, after using a convolution kernel for each of the N channels, we get feature maps with N channels of 1. Then, these N feature maps are concatenated in sequence to get an output feature map with N channels.

[0044] The downsampling convolution operation involves further compressing the feature map obtained by the convolution layer to reduce the number of features and parameters while reducing computational complexity. This process is implemented through maximum pooling or average pooling, which aims to filter out redundant features and retain key information. Downsampling not only reduces feature dimensions, but also increases the receptive field covered by the network graph.

[0045] Convolution kernel replacement decomposes an n×n convolution into two m×m convolution operations to improve the computation speed. In addition, for example, a convolution kernel size of n*n is decomposed into two convolutions of 1×n and n×1. For example, a 3×3 convolution is equivalent to first performing a 1×3 convolution and then a 3×1 convolution. A 5*5 convolution kernel can be replaced by two 3x3 convolution kernels.

[0046] The search algorithm uses the multi-objective evolutionary algorithm NSGA-II to optimize the indicators. Traditional indicators include classification accuracy, parameter quantity, calculation amount and inference time. However, this application designs the optimization indicators as the intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path according to the needs of image classification tasks, which is more in line with the needs of image classification tasks.

[0047] The process of the multi-objective evolutionary algorithm follows the NSGA-II algorithm, which performs mutation and crossover operations on high-performance convolutional neural architectures to explore efficient architectures and obtain Pareto optimal solutions that meet multiple optimization indicators. Among them, the key to the multi-objective evolutionary algorithm is to perform non-dominated sorting on indicators. Next, we will briefly describe the non-dominated sorting used by the evolutionary algorithm in the search algorithm.

[0048] The calculation of its individual crowding distance requires calculating the crowding distance on the optimization objective.

[0049] In addition, during the search process of the search algorithm, some of the existing outstanding convolution paths will be retained when generating the next generation population. After the multi-objective evolutionary algorithm explores the convolutional neural network, a set of Pareto optimal solutions, that is, a set of convolution paths, can be obtained. By training it from scratch, a convolution path that can meet actual needs can be obtained.

[0050] At present, the research and development of CNN is quite mature, and its performance in visual tasks is very outstanding, with broad application prospects. At the same time, the demand for CNN in terminal devices is also growing. In addition, the existing CNN loses translation and other variability due to the use of downsampling operations, and a large number of data enhancement strategies are required during the training process to improve the robustness of the model. Therefore, using neural architecture search methods to learn more stable convolutional neural networks and enhance their performance stability under input perturbations has positive significance for the optimization of convolutional neural networks.

[0051] This application uses a search algorithm to evaluate the performance of the convolutional neural network composed of the convolutional paths, and then uses a multi-objective evolutionary algorithm to perform non-dominated sorting on the optimization indicators and select outstanding convolutional paths for mutation and crossover, thereby optimizing the CNN neural network; after searching the convolutional paths with the multi-objective evolutionary algorithm, a set of Pareto optimal solutions, i.e., a set of convolutional paths, is obtained.

[0052] The multi-objective evolutionary algorithm is used to perform non-dominated sorting on the intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path; the non-dominated sorting is sorted according to the individual crowding distance of the convolution path. The intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path are used as the fitness function of each individual evaluated by the multi-objective evolutionary algorithm NSGA-II.

[0053] A multi-objective optimization algorithm is used to evolve individuals through selection, crossover and mutation operations. First, a convolution path is initialized in the search space and evaluated. Then, the convolution path with excellent performance is retained through selection operation, and mutation and crossover operations are performed on the retained convolution path to obtain a new convolution path and perform model evaluation. The new convolution path and the retained convolution path enter the next generation as a new population. Next, selection, crossover and mutation operations are performed on the new population to obtain the next generation population, and the cycle is repeated until the termination condition is met.

[0054] This application considers the existence of intra-class difference imbalance and inter-class difference imbalance in image classification, and innovatively proposes intra-class difference imbalance loss and inter-class difference imbalance loss to measure the accuracy of image classification.

[0055] In some embodiments, the intra-class difference imbalance loss is calculated as follows:

[0056]

[0057] Among them, x i is the i-th sample, p is the number of samples in the class, m L is the left boundary within the class, m R is the right boundary within the class, c is the center within the class, and p i is the probability that the sample is correctly classified.

[0058] In some embodiments, the inter-class difference imbalance loss is calculated as follows:

[0059]

[0060] Among them, x j is the jth sample, z is the sample x j The number of samples classified into a certain class, m 1L is the left boundary of a class, m 1R is the right boundary of a class, c1 is the center of a class, and p j is the probability that the sample is correctly classified, m 2L is the left boundary of the adjacent class, m 2R is the right boundary of the adjacent class, and c2 is the center within the adjacent class. In some embodiments, the adjacent class is the class to which the sample is divided with the closest distance.

[0061] The fitness function in the multi-objective optimization algorithm is calculated as follows:

[0062]

[0063] Among them, γ is the adjustment factor.

[0064] This section verifies the validity of this application through a series of experiments. First, a large number of experiments are conducted to determine the number of attention heads, dimensions, and number of pooling layers for the convolutional neural network. This application is used to search for convolutional structures on the ImageNet dataset to test its search efficiency and the performance of the resulting structure. The ImageNet image classification experiment can not only evaluate the migration capability of the structure obtained in this application, but also verify the validity of this application.

[0065] The beneficial effects of the present invention are as follows:

[0066] This application uses a multi-objective optimization algorithm to obtain the optimal number of attention heads, dimensions, and pooling layers, thereby improving the computational efficiency of the neural network. In terms of optimization objectives, it is proposed to minimize the intra-class difference imbalance loss and the inter-class difference imbalance loss, thereby improving the accuracy of image classification.

[0067] As used herein, the word "preferred" is intended to be used as an example, instance, or illustration. Any aspect or design described herein as "preferred" is not necessarily to be construed as being more advantageous than other aspects or designs. On the contrary, the use of the word "preferred" is intended to present concepts in a specific way. The term "or" as used in this application is intended to mean an inclusive "or" rather than an exclusive "or". That is, unless otherwise specified or clear from the context, "X uses A or B" means any one of the naturally included permutations. That is, if X uses A; X uses B; or X uses both A and B, then "X uses A or B" is satisfied in any of the foregoing examples.

[0068] Moreover, although the present disclosure has been shown and described with respect to one or implementations, those skilled in the art will think of equivalent variations and modifications based on the reading and understanding of this specification and the accompanying drawings. The present disclosure includes all such modifications and variations, and is limited only by the scope of the appended claims. In particular, with respect to the various functions performed by the above-mentioned components (such as elements, etc.), the terms used to describe such components are intended to correspond to any component (unless otherwise indicated) that performs the specified function of the component (such as it is functionally equivalent), even if the structure is not equivalent to the disclosed structure of the function in the exemplary implementation of the present disclosure shown herein. In addition, although the specific features of the present disclosure have been disclosed with respect to only one of several implementations, such features can be combined with one or other features of other implementations that may be desired and advantageous for a given or specific application. Moreover, insofar as the terms "including", "having", "containing" or their variations are used in specific embodiments or claims, such terms are intended to be included in a manner similar to the term "comprising".

[0069] The functional units in the embodiments of the present invention may be integrated into a processing module, or each unit may exist physically separately, or multiple or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc. The above-mentioned devices or systems may execute the storage method in the corresponding method embodiment.

[0070] To sum up, the above embodiment is an implementation mode of the present invention, but the implementation mode of the present invention is not limited by the embodiment. Any other changes, modifications, substitutions, combinations, and simplifications that deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. An image classification method based on CNN neural network, characterized in that: The following steps are involved: Get multiple images as training sets; Extracting features of the image by a feature extraction method, wherein the image features include edges and textures; Constructing a CNN neural network, wherein the CNN neural network includes channel attention and spatial attention; Combining several attention heads, dimensions and several pooling layers in the CNN neural network into a single convolution path, optimizing the convolution path using an optimization algorithm, and calculating the intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path during the search process; The multi-objective evolutionary algorithm NSGA-II is used to optimize the intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path; Use the optimized convolutional neural network to classify the image and output the classification results.

2. The image classification method based on CNN neural network according to claim 1 is characterized in that: The search algorithm evaluates the performance of the convolutional neural network composed of the convolutional paths, and then uses a multi-objective evolutionary algorithm to perform non-dominated sorting on the optimization indicators and select outstanding convolutional paths for mutation and crossover, thereby optimizing the CNN neural network; after searching the convolutional paths with the multi-objective evolutionary algorithm, a set of Pareto optimal solutions, i.e., a set of convolutional paths, is obtained.

3. The image classification method based on CNN neural network according to claim 2 is characterized in that: A multi-objective evolutionary algorithm is used to perform non-dominated sorting on the intra-class difference imbalance loss and the inter-class difference imbalance loss of the convolution path; the non-dominated sorting is performed according to the individual crowding distance of the calculated convolution path.

4. The image classification method based on CNN neural network according to claim 3 is characterized in that: The intra-class difference imbalance loss and inter-class difference imbalance loss of the convolution path are used as the fitness function of each individual evaluated by the multi-objective evolutionary algorithm NSGA-II; Individuals are evolved through selection, crossover and mutation operations. First, a convolution path is initialized in the search space and evaluated. Then, convolution paths with excellent performance are retained through selection operations. Mutation and crossover operations are performed on the retained convolution paths to obtain new convolution paths and model evaluation is performed. The new convolution paths and the retained convolution paths enter the next generation as new populations. Next, selection, crossover and mutation operations are performed on the new population to obtain the next generation population. The cycle is repeated until the termination condition is met.

5. The image classification method based on CNN neural network according to claim 4 is characterized in that: The intra-class difference imbalance loss is calculated as follows: Among them, x i is the i-th sample, p is the number of samples in the class, m L is the left boundary within the class, m R is the right boundary within the class, c is the center within the class, and p i is the probability that the sample is correctly classified.

6. The image classification method based on CNN neural network according to claim 5 is characterized in that: The inter-class difference imbalance loss is calculated as follows: Among them, x j is the jth sample, z is the sample x j The number of samples classified into a certain class, m 1L is the left boundary of a class, m 1R is the right boundary of a class, c1 is the center of a class, and p j is the probability that the sample is correctly classified, m 2L is the left boundary of the adjacent class, m 2R is the right boundary of the adjacent class, and c2 is the center within the adjacent class.

7. The image classification method based on CNN neural network according to claim 6 is characterized in that: The fitness function is calculated as follows: Among them, γ is the adjustment factor.

Citation Information

Patent Citations

  • Method and apparatus for increasing generalization capability of convolutional neural network

    CN106682734A

  • Text detection method and device, computer equipment and storage medium

    CN111310758A

  • Remote sensing image recognition method based on NSGA-NET

    CN112084877A

  • Multi-model grouping fusion remote sensing image classification method based on metric learning

    CN113807385A

  • Convolution and self-attention fused multi-target neural architecture search method

    CN116258165A

Cited By

  • Complex neural network miniaturized high-voltage transmission line monitoring method and system

    CN119598342A