Deep image classification method based on channel attention loss

CN118674981BActive Publication Date: 2026-09-22NANJING AUDIT UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410729684.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2026-09-22
Estimated Expiration
2044-06-06

AI Technical Summary

Technical Problem

尤其是损失功能影响着整个训练过程,深刻地影响了网络的学习轨迹,从而影响了其最终性能

Benefits of technology

[0061]1、本发明基于通道注意力损失的深度图像分类方法,将增强网络细节特征注意力的通道注意力损失,和既定的SoftMax损失结合,形成了一个新颖的集成框架,增强了深度卷积神经网络的分类能力,

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118674981B_ABST
    Figure CN118674981B_ABST
Patent Text Reader

Abstract

The application discloses a kind of deep image classification methods based on channel attention loss, to strengthen the attention of network to highlight area in image, and strengthen its ability to learn discriminative features.First, the depth feature distribution map of image is constructed, and the depth feature channel information of all images is obtained through convolution network and feature extraction layer;Then the depth feature distribution map is globally pooled in the main branch, and then a fully connected layer is used to calculate the SoftMax loss;Next, in the additional branch, the channel information is fairly distributed to each class of classification task, more discriminative feature information is extracted, the attention of network to different class details is enhanced, the channel attention loss is calculated, and the probability of specific class is derived;Finally, the SoftMax loss and the channel attention loss are combined to obtain the final loss function of the entire network, joint supervision training and parameter optimization are carried out, and the performance of deep image classification task is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image classification technology, and in particular to a deep image classification method based on channel attention loss. Background Technology

[0002] In recent years, the field of computer vision has undergone rapid evolution within the context of artificial intelligence, particularly in image classification and other visual tasks, where substantial progress has been made. This significant advancement is largely attributed to the emergence of deep neural network models, which have gradually replaced traditional machine learning algorithms due to their superior performance.

[0003] Generally, vision models fall into two categories: traditional networks rooted in convolutional neural network architectures and Transformer architectures based on attention mechanisms, introduced from natural language processing. While the choice of network model is crucial in different tasks, in deep learning tasks, the selection of the network optimizer, strategies to mitigate network overfitting, and the development of an effective loss function to guide supervised training are equally important. In particular, the loss function influences the entire training process, profoundly affecting the network's learning trajectory and thus its final performance.

[0004] In traditional neural network classification training schemes, such as Figure 1 As shown, SoftMax loss is typically used to minimize the difference between the predicted probability distribution from the network and the ground truth probability distribution. This systematically aggregates data of the same category within a specified feature space, forming different cluster families to complete the classification task. This loss function consistently achieves commendable classification performance with relatively low time overhead on large datasets. However, applying SoftMax loss alone is insufficient for more challenging detailed classification tasks, as it lacks attention to certain detailed features that can help the network better perform image classification tasks.

[0005] To address the aforementioned issues, several improved loss functions have been proposed, broadly categorized into two types: The first approach aims to integrate traditional machine learning metric learning techniques with conventional supervised loss, thereby leveraging the capabilities of novel loss supervision networks to acquire deeper features of samples. While the applicability of this loss function may not be as universally applicable as the traditional SoftMax basic loss, it is more practical in specific applications and exhibits superior performance compared to the basic loss function. The second approach, based on metric learning principles, aims to devise innovative loss functions that construct a feature space distribution characterized by inter-class separation and intra-class compactness by discerning the similarity between sample pairs. Summary of the Invention

[0006] The problem to be solved by this invention is to provide a deep image classification method based on channel attention loss, which optimizes the overall network parameters through joint supervised training, enhances the deep neural network's attention to prominent regions in the image, and improves its ability to learn discriminative features.

[0007] This invention adopts the following technical solution: a depth image classification method based on channel attention loss, comprising the following steps:

[0008] S1. Construct the deep feature distribution map of the image. Input the image to be classified into the deep neural network. Through the convolutional network and feature extraction layer, obtain the information of all deep feature channels of the image and pass it into the main branch and extra branches of the deep neural network.

[0009] S2. In the main branch, perform global pooling on the depth feature distribution map, and then calculate the SoftMax loss through a fully connected layer.

[0010] S3. In the additional branch, based on the deep feature distribution map, channel information is fairly allocated to each category in the classification task, channel attention loss is calculated, and the probability of a specific category is derived:

[0011] S4. Combine the SoftMax loss and channel attention loss to obtain the final loss of the entire deep neural network, and perform joint supervised training and parameter optimization to improve the classification effect of deep images.

[0012] Specifically, in step S1, the input image to be classified is X. i , i = 1, 2, ..., N; the convolutional network model is VGG or ResNet, and the extracted deep feature map is represented as:

[0013]

[0014] in, Represents the real number field, with a height of H, a width of W, a number of channels of C, and a minimum batch size of N;

[0015] Using a feature extraction layer, calculate the deep feature map F. i , represents all channel information of the extracted sample;

[0016] F = {F1, F2, ..., F} N}

[0017] All channel information F is fed into the main branch and extra branches of the deep neural network, and the SoftMax loss and channel attention loss are calculated respectively.

[0018] When calculating the channel attention loss in the additional branch, channel information is fairly allocated to each class in the classification task. The number of classification classes is K, and the number of channels allocated to each class is [C / K]. This represents the channel information belonging to class j in the i-th sample:

[0019] F i ={F i 1 F i 2 ,...,F i K}

[0020] in,

[0021] Specifically, in step S2, the SoftMax loss is calculated as follows;

[0022] S2.1. By calculating the cross-entropy loss in the main branch, global pooling is performed on F to obtain the deep feature x. i ;

[0023] S2.2, Transfer depth features x i As input to the fully connected layer, it undergoes a linear transformation and is mapped to obtain the original score vector z. i :

[0024] z i =A T x i +B

[0025] Where A and B represent the class weights and biases of the fully connected layer, respectively, and the superscript T indicates transpose;

[0026] S2.3, Deriving the probability distribution p(l=j|x i This is achieved by using the SoftMax function to cover all classes, where l represents the actual label;

[0027] S2.4. Quantize the predicted label and the actual label using the cross-entropy loss function. i The difference between them yields the SoftMax loss L. S :

[0028]

[0029] Among them, l i ∈{1,2,...,K} is the corresponding label for its K-class classification problem, and the base e represents the natural base.

[0030] Specifically, in step S3, the channel attention loss is calculated as follows;

[0031] S3.1 Based on the deep feature distribution map, perform random channel deactivation processing, randomly capture specific category discrimination information, and fairly allocate the selected channel information to each category in the classification task;

[0032] S3.2 Perform category-specific local pooling, filter through the max pooling layer, generate a mean vector through adaptive mean processing, obtain the average response value of the largest element in the specific category-specific channel, and generate a one-dimensional vector consistent with the number of channels in the specific category.

[0033] S3.3 Calculate the average category coefficient, calculate the channel average value for each specific category, and generate the sensitivity coefficient for different categories;

[0034] S3.4 Calculate the attention coefficient matrix and channel attention loss of the deep feature distribution map to enhance the network's attention to details of different categories.

[0035] Specifically, in step S3.1, the channels are randomly deactivated by implementing a simplified channel attention mechanism, assigning different weight coefficients to each feature map, thereby selectively deactivating specific feature channels and enhancing the network's ability to identify specific features.

[0036] The simplified channel attention mechanism, based on the neuron deactivation method of the dropout layer, assigns different weight coefficients to each feature map and randomly discards depth channel information. Some channel information is stored in each group. They are randomly selected from among them.

[0037] Specifically, in step S3.4, the attention coefficient matrix M of the feature map and the channel attention loss L are calculated. CA The channel attention loss equation for a single sample channel is expressed as:

[0038]

[0039] Where f(·) is defined as follows:

[0040]

[0041] Where SCA, CLP, and ACC represent Simple Channel Attention, Category Local Pooling, and Average Category Coefficient, respectively. CE y is the cross-entropy loss between the truth class label y and the ACC output; is the channel coefficient, consisting of k elements of 0 and 1, where avgpooling and maxpooling represent average pooling and max pooling operations, respectively.

[0042] Specifically, in step S4, the SoftMax loss and channel attention loss are combined to obtain the final loss function of the entire deep neural network, as shown in the following formula:

[0043]

[0044] The weighting coefficient for channel attention loss is denoted as α, which is used to control the contribution of channel attention loss in the overall loss function.

[0045] Furthermore, in step S4, based on the chain rule, gradient backpropagation is used to optimize the parameters of the neural network in each iteration until the final loss function converges or the number of iterations reaches a preset range. Each iteration convergence includes the following sub-steps:

[0046] S4.1 Calculate the gradient of the SoftMax loss for the parameters of the fully connected classification layer.

[0047]

[0048] S4.2 Calculate the gradient of the pooling layer

[0049]

[0050] S4.3 Calculate the gradient of the deep neural network

[0051]

[0052] S4.4 Update the deep neural network parameters θ {C,P,S} :

[0053]

[0054] Where the superscript t represents the number of iterations, the subscript c represents the deep neural network, the subscript p represents the pooling layer, the subscript s represents the fully connected layer, and θ C For network parameters, θ P θ is the pooling layer parameter. S To obtain the parameters of the fully connected layer using SoftMax loss, It is the integer notation for partial derivatives. The partial derivative of the numerator with respect to the denominator after the sign, μ is the network learning rate, and g {C,P,S} This represents the gradient information of the network parameters, pooling layer parameters, and SoftMax loss fully connected layer parameters.

[0055] The present invention also provides: an electronic device, comprising:

[0056] One or more processors;

[0057] A storage device on which one or more programs are stored;

[0058] When the one or more programs are executed by the one or more processors, the one or more processors implement any of the aforementioned deep image classification methods based on channel attention loss.

[0059] The present invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in any of the aforementioned depth image classification methods based on channel attention loss.

[0060] Compared with the prior art, the present invention, employing the above technical solution, has the following technical effects:

[0061] 1. This invention presents a deep image classification method based on channel attention loss. It combines channel attention loss, which enhances the network's attention to detail features, with a predetermined SoftMax loss, forming a novel integrated framework that enhances the classification capabilities of deep convolutional neural networks.

[0062] 2. The deep image classification method based on channel attention loss in this invention uses joint supervision to enhance the network's attention to channel information and improve the discriminative ability of the deep features learned by the network.

[0063] 3. Experimental verification of the image classification method of the present invention on conventional classification tasks and fine-grained image classification demonstrates the effectiveness of the method and shows its practical application potential in the field of computer vision. Attached Figure Description

[0064] Figure 1 This is a flowchart of the parameter training process for a traditional loss-based deep neural network.

[0065] Figure 2 This is a deep feature distribution map obtained by the present invention based on the FashionMNIST dataset;

[0066] Figure 3 This is a flowchart of the channel attention loss calculation method of the present invention;

[0067] Figure 4 Attention heatmap for classifying fine-grained bird images;

[0068] Figure 5 This is a flowchart of the training method for the joint supervised loss method of the present invention;

[0069] Figure 6 This is a sample image of the CUB dataset from an embodiment of the present invention;

[0070] Figure 7 This is a sample instance diagram of the iris flower dataset in an embodiment of the present invention. Detailed Implementation

[0071] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of the application will be further described in detail below with reference to the accompanying drawings. The described embodiments are only a part of the embodiments involved in this invention. All non-innovative embodiments based on these embodiments by other researchers in the art are within the protection scope of this invention. Furthermore, the step numbers in the embodiments of this invention are only set for ease of explanation and do not limit the order of the steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.

[0072] The present invention provides a depth image classification method based on channel attention loss, comprising the following steps:

[0073] S1. Construct the deep feature distribution map of the image. Input the image to be classified into the deep neural network. Through the convolutional network and feature extraction layer, obtain the information of all deep feature channels of the image and pass it into the main branch and extra branches of the deep neural network.

[0074] S2. In the main branch, perform global pooling on the depth feature distribution map, and then calculate the SoftMax loss through a fully connected layer.

[0075] S3. In the additional branch, based on the deep feature distribution map, channel information is fairly allocated to each category in the classification task, channel attention loss is calculated, and the probability of a specific category is derived:

[0076] S4. Combine the SoftMax loss and channel attention loss to obtain the final loss of the entire deep neural network. Perform joint supervised training and parameter optimization of the final loss to improve the classification effect of deep images.

[0077] Specifically, in step S2, the SoftMax loss is calculated as follows:

[0078] Given N samples D N ={(X i , l i The minimum batch training data of X | i = 1, 2, ..., N}, where X i It is the input image, l i ∈{1, 2, ..., K} are the corresponding labels for its K-class classification problem.

[0079] Consider a spatial feature map F, which forms the output of the feature extraction layer in a convolutional model. In this case, a global pooling layer, denoted as P, takes F as its input and effectively extracts the feature map. The depth features.

[0080] The traditional baseline loss is a composite architecture that combines a fully connected layer, a SoftMax activation function, and a cross-entropy loss to formulate an estimate of the probability distribution for all classes, and then measures the prediction error. Specifically, deep features x i As input to the fully connected layer, it undergoes a linear transformation, thus mapping it to the original score vector z according to the following expression. i :

[0081] z i =A T x i +B

[0082] in, and These represent the parameters for class weights and biases of the fully connected layer, respectively.

[0083] Subsequently, the probability distribution p(l=j|x) was derived. i This is achieved by utilizing the SoftMax function to cover all classes.

[0084] Finally, the predicted label and the actual label are quantified using the cross-entropy loss function. i The difference between them ultimately forms the loss function, denoted as L. S , means as follows:

[0085]

[0086] To investigate the distribution of deep features learned by supervised deep neural networks trained with this loss, experiments and analyses were conducted using the LeNet model on the FashionMNIST dataset. Figure 2 As shown, the distribution of deep features obtained by training a LeNet network on the FashionMNIST dataset using SoftMax loss supervision is displayed.

[0087] These feature distributions describe the inherent patterns and feature representations found in the data during network training. Notably, this visualization demonstrates the effectiveness of the SoftMax loss function, which effectively maps samples from each class to a low-dimensional feature space. This process assigns deep features of each class to different clusters, thereby enhancing the network's discriminative ability for subsequent classification tasks. However, through... Figure 2 The study found that while the deep feature distribution learned under the supervision of SoftMax loss can distinguish various sample categories, relatively isolated deep feature data points still exist. These observations suggest that the acquired features lack strong discriminative power, which may hinder their performance in classification tasks.

[0088] Specifically, in step S3, the channel attention loss (CA Loss) is calculated as follows:

[0089] Channel attention loss is a method that extracts key information from the complex channel information obtained by standardizing the network. This method expands the attention to categorical detail features in the deep feature space without relying on manual selection and annotation, aiming to enhance the network's attention to detailed regions in the image and improve its ability to learn discriminative features.

[0090] In this invention, a neuron deactivation method similar to dropout layers is used to randomly discard deep channel information (assigning it to zero coefficients for multiplication) to enhance the network's applicability. A basic attention mechanism is implemented, assigning different weight coefficients to each feature map; some feature channel information remains unchanged, while others are all reduced to zero. The channel information is then fairly allocated to each class in the classification task, and finally, the probability of a specific class is derived through a series of pooling operations and activation functions.

[0091] After receiving the input image, the first step is to pass the image to the base network and extract depth feature maps through designated modules. Commonly used convolutional network models include VGG and ResNet.

[0092] The extracted feature map is represented as follows: The height is H, the width is W, the number of channels is C, the minimum batch size is N, and F is used. i (i = 1, 2, ..., N) represents all channel information of the extracted sample.

[0093] For poems that require special explanation, this invention employs channel attention loss, where each category is allocated as evenly as possible to its own dedicated channel (each category has its own category feature attention depth map).

[0094] If the distribution is uneven, the number of feature channels for some categories may differ by no more than 1 (the feature channels of different convolutional neural networks are not the same).

[0095] Assuming there are K categories, each category can be assigned at least [C / K] channels or at most [C / K] channels. For consistency, we will use [C / K] to represent the number of channels assigned to each category, assuming the rounding is uniform. This represents the channel information belonging to class j in the i-th sample.

[0096] F = {F1, F2, ..., F} N}, F i ={F i 1 F i 2 F iK}

[0097] Following this stage, all channel information F is fed into two branches within the network for further independent computation of two distinct sub-losses. The main branch responsible for calculating the cross-entropy loss involves global pooling of F, including max pooling and average pooling operations, before passing it through a fully connected layer as input for the final loss calculation. Utilizing cross-entropy loss helps incentivize the network to extract salient features from the main global discriminative regions.

[0098] In contrast, the channel attention loss calculation branch primarily guides the supervised network's attention towards the local discriminative regions within each category. During the initial training phase, the main loss is combined with the channel attention loss. Therefore, the overall loss function for the entire network is defined as:

[0099]

[0100] In this invention, the deep features of each class are represented and learned by a certain number of grouped feature channels. The channels assigned to each class are designed to focus more on the discriminative feature information of its own class so that the initial messy feature channels can be combined.

[0101] The equation for processing a single sample channel can be expressed as:

[0102]

[0103] Here, f(·) is defined by the following equation:

[0104]

[0105] Here, SCA, CLP, and ACC are shorthand representations of Simple Channel Attention, Category Local Pooling, and Average Category Coefficient, respectively. LCE is the cross-entropy loss between the ground truth label y and the ACC output.

[0106] Here, It consists of k elements, both 0 and 1, where 20% of the coefficients are 0 and the rest are 1. The order of the elements in each category channel is randomly shuffled, and each element corresponds to a channel coefficient. This is consistent with the attention code for a batch of data, both of which are M.

[0107] The detailed process of channel attention loss calculation for the deep features obtained by the network model is as follows: Figure 3 As shown, it includes the following sub-steps:

[0108] S3.1 Based on the deep feature distribution map, perform random channel deactivation processing, randomly capture specific category discrimination information, and fairly allocate the selected channel information to each category in the classification task;

[0109] S3.2 Perform category-specific local pooling, filter through the max pooling layer, generate a mean vector through adaptive mean processing, obtain the average response value of the largest element in the specific category-specific channel, and generate a one-dimensional vector consistent with the number of channels in the specific category.

[0110] S3.3 Calculate the average category coefficient, calculate the channel average value for each specific category, and generate the sensitivity coefficient for different categories;

[0111] S3.4 Calculate the attention coefficient matrix and channel attention loss of the deep feature distribution map to enhance the network's attention to details of different categories.

[0112] (1) Easy Passage Attention

[0113] In neural networks, supervised training using the classic CE loss method often results in a subset of feature channels containing important class-discriminating information. However, this invention proposes a simplified channel attention mechanism to force the network to randomly capture specific class-discriminating information. Unlike some other attention mechanism designs, this design aims to assign higher priority to discriminative channels, and channel attention coefficients cannot participate in network training.

[0114] The method coefficients of this invention are random binary codes, similar to the dropout method, randomly selecting some channels to be deactivated, and some channel information in each group. The channels are randomly selected, thus encouraging each function channel to include some discriminative information.

[0115] It is important to note that the attention encoding is updated in each iteration and is completely randomized. This effectively controls the channel inactivation coefficient, enhancing the network's generalization ability. SCA is used only during training, not throughout the network's inference. Therefore, the classification layer obtains the same input feature distribution map during both training and inference.

[0116] (2) Category-based local pooling

[0117] CLP category-specific local pooling operations are used to compute class-specific channels. The average response value of the largest element in the vector is used to generate a one-dimensional vector of the same size as the number of channels in a particular class.

[0118] In short, some high-sensitivity coefficients of the channels are filtered through a max pooling layer, and a mean vector is generated through adaptive averaging. It is important to note that this operation differs from the global pooling operation in the main branch of the backbone network, where global pooling directly performs pooling compression and extraction on all channels without considering their specific categories.

[0119] (3) Average category coefficient

[0120] The average class coefficient operation is used to calculate the average channel value for each specific class, thus generating a sensitivity coefficient for that class. Finally, in each iteration, the aforementioned class sensitivity coefficients are used to calculate the error loss corresponding to the true class labels of all samples in the min-batch using SoftMax Loss, which is then used for gradient backpropagation to optimize the network parameters.

[0121] Furthermore, based on the deep classification model obtained through supervised training using channel attention loss, attention heatmaps for fine-grained image classification of birds were generated, such as... Figure 4 As shown.

[0122] The first row of images shows the network attention maps obtained using only SoftMax Loss supervision. It's clear that this loss-supervised network pays more attention to the overall structure of the bird, recognizing its basic outline. The second row shows the attention maps of the model with added channel attention loss. This method enhances the deep network's ability to observe bird details, such as proportions, beak, wings, and claws. This helps the network to identify extremely similar samples, effectively handling fine-grained image classification tasks.

[0123] Finally, loss training and parameter optimization are performed, using channel attention loss Li. CA With main loss L S Let's work together to supervise the training. The calculation of network loss, such as... Figure 5 As shown.

[0124] Figure 5 The training process of the proposed joint supervised loss method is shown, which employs an end-to-end training approach. First, the image passes through convolutional kernels and feature extraction layers to obtain a depth feature distribution map. These feature maps are then used to calculate the channel attention loss via an additional branch. Next, in the main branch, global pooling is performed on the depth feature maps to obtain a depth feature distribution vector. This vector is then passed through a fully connected layer from the main branch, and the SoftMax loss is calculated. The final loss is the sum of these two losses. The channel attention loss aims to enhance the network's attention to detailed features. To ensure consistency and constraint, the CA loss and the SoftMax loss are supervised together as a whole, forming the final loss function, as follows:

[0125] Loss = L S +αL CA

[0126] The weight coefficient of the channel attention loss, denoted as α, controls its contribution to the overall loss function. The process of optimizing the entire network parameters during deep neural network training involves SoftMax loss and channel attention loss, which strictly adhere to the chain rule for parameter optimization. The joint supervised training algorithm is as follows:

[0127]

[0128] Furthermore, in order to evaluate the effectiveness of the above-mentioned joint supervised loss framework, in the embodiments of the present invention, in the field of image classification tasks, using the LFW, CUB and Flower102 benchmark datasets, using top-1 and top-5 accuracy metrics as evaluation criteria, various widely adopted convolutional neural network architectures were employed, which also exhibit different network widths and depths, and empirical studies were conducted.

[0129] For network parameter updates, a stochastic gradient optimizer was used, with weight decay at 0.0005 and momentum at 0.9. Training began with an initial learning rate of 0.1 and lasted for 300 epochs. Learning rate decay occurred at epochs 50 and 150, reducing the learning rate to 0.1 times its initial value. It is important to note that unless explicitly stated otherwise, the optimizer settings for network parameters remain consistent with those described above. Most tasks used a minimum batch size of 128, with a few exceptions using a batch size of 64. Furthermore, it is worth emphasizing that the channel attention loss did not introduce additional training parameters. Typically, the weight coefficients associated with the channel attention loss were assigned either 0.1 or 0.5, depending on the dataset being tested. It is noteworthy that all models were trained from the initial state without using pre-trained models. The loss method proposed in this invention is only used during training to aid in the training and optimization of network parameters; the channel attention loss is not used during testing. Therefore, the network training time is longer than the training time of a single loss, but the testing and inference times remain unchanged.

[0130] Example 1: LFW Dataset Experiment

[0131] To evaluate the effectiveness of the proposed method in the field of face recognition, experiments were conducted using a subset of the LFW dataset. This step was considered necessary because many individuals in the LFW dataset possess only a single facial image; otherwise, the training and test sets could not be partitioned. The LFW dataset is a recognized repository for face recognition tasks, comprising real-world facial images extracted from real-world scenes. The dataset contains a total of 13,233 facial images representing 5,749 distinct individuals. Each image in the dataset is carefully annotated with the individual's name.

[0132] To facilitate the visual classification task, the top 20 individuals with the richest sample representations were selected, and this subset was designated "LFW_20". The dataset was then split into training and test sets in an 8:2 ratio. Notably, each image in the dataset is represented in RGB format with a size of 250×250 pixels.

[0133] Given the high image resolution of the dataset, the evaluation of this invention includes four different model experiments, maintaining a channel attention loss coefficient of 0.1. For data preprocessing, the training data undergoes random cropping and scaling to produce three-channel images of size 224×224 pixels, which helps enhance the network training process. Furthermore, a random horizontal flipping procedure is applied to the images, introducing greater variability into the dataset. This deliberate diversification serves as a mechanism enabling the model to capture features oriented in all directions. In contrast, for the test dataset, random flipping is deliberately omitted, and only a center-cropping technique is used. This approach is chosen to avoid applying data augmentation.

[0134] The subsequent network training scheme spanned a total of 300 epochs, with the learning rate fine-tuned to 0.01 and the batch size set to 64.

[0135] Table 1 shows the top-1 and top-5 accuracy of LFW_20 under various loss conditions and network supervision.

[0136]

[0137] Results Analysis: Table 1 shows the impact of each loss function on four different network architectures, with results including two metrics: top-1 and top-5 accuracy. To mitigate the impact of random numbers on method performance, experimental results are expressed as mean and variance from six repeated experiments. Table 1 shows the following results: First, under the guidance of the lightweight convolutional network model MobileNetV2, the proposed loss method does not show a significant advantage over the baseline loss, but the variance of the SoftMax loss fluctuates significantly. Under certain training conditions, the top-1 accuracy of the proposed method can be about 0.7% higher. The ShuffleNetV2 model trained using the proposed method achieves a top-1 accuracy that is about 0.6% higher than the baseline loss. More importantly, the proposed method has a smaller variance and more stable accuracy. In the DenseNet model, the proposed method also slightly outperforms other methods. Especially under the supervision of the ResNet34 network model, the average top-1 accuracy increases significantly by nearly 2.3%. Furthermore, the variance of the proposed method fluctuates significantly, but under some random parameter settings, it can improve the top-1 accuracy by about 3%.

[0138] Example 2: CUB Data Experiment

[0139] To further verify the effectiveness of the method of the present invention in the field of deep classification, after conducting experiments on facial classification and recognition and basic classification tasks, a more complex classification challenge was selected: fine-grained image classification.

[0140] In this context, the CUB-200-2011 dataset becomes a better choice, as it is a widely adopted benchmark for fine-grained image classification. This dataset contains 11,788 images across 200 categories, each representing a different bird species. Specifically, the dataset is divided into two groups: 5,994 images designated for training and 5,794 images used to evaluate the classification model. In our experimental investigation, the CUB dataset was reduced in size. Specifically, the initial 100 bird species were prioritized. To facilitate the classification task, the dataset was carefully partitioned into two subsets, adhering to an 8:2 ratio, with the larger subset used as the training set and the smaller subset as the test set. Some sample images from the CUB dataset are included in... Figure 6 As shown in the image, it is clear that the categories of each bird are very similar, therefore fine-grained image classification needs to focus on more detailed features.

[0141] Given the variable image size in the CUB dataset, all images were uniformly resized to 224×224 RGB images for subsequent training. Random cropping with 4-pixel padding around the cropped areas was then used as part of the data augmentation strategy. Furthermore, random horizontal image flipping with a certain probability was introduced to enhance network learning. Again, the above operations, including size normalization and augmentation techniques, only applied to the training dataset, while the test dataset only underwent size modification. Subsequently, when setting up the network learning optimizer, the initial learning rate was set to 0.1, which decreased at specific epochs, particularly at 50, 150, and 250, scaling to a factor of 0.1. The coefficient related to CA loss was set to 0.5.

[0142] Table 2 shows the top-1 and top-5 accuracy of CUB_100 under various loss conditions and network supervision.

[0143]

[0144] Results Analysis: Table 2 lists the classification results of five different network models affected by various loss-supervised training methods. It is important to emphasize that the proposed method is quite effective in fine-grained image classification tasks. This phenomenon stems from the fact that channel attention loss emphasizes capturing subtle differences within the same subclass. In experiments using the AlexNet model as the trained network, it is clear that the joint supervision effect of channel attention loss is the optimal strategy, producing excellent performance on both top-1 and top-5 evaluation metrics while exhibiting minimal variance fluctuation. Furthermore, in supervised training using MobileNetV2 and ShuffleNetV2 models, the highest accuracy is improved by approximately 1.1% compared to the baseline, while variance fluctuation is significantly reduced by approximately 0.8%. Notably, training the EfficientNet and ResNet34 models shows even greater improvement in accuracy, with top-1 accuracy significantly improved by 2.6% and 3.3%, respectively, and top-5 accuracy also improved while reducing variance fluctuation. These results effectively validate the effectiveness of the proposed method.

[0145] Example 3: Flower102 Data Experiment

[0146] To further verify the effectiveness of the joint supervision method of this invention in fine-grained image classification tasks, experimental studies were conducted on the Flower102 dataset. This dataset comprises a compilation of 102 different flower categories to represent common British flowers. Within each category, 40 to 258 individual images were observed, exhibiting significant diversity in scale, orientation, and lighting conditions. Furthermore, it is noteworthy that the category information in this data is highly similar, requiring excellent detail classification capabilities. The training phase used a specified training dataset, followed by an evaluation phase on a specified test dataset, all adhering to the official dataset's partitioning settings. Some sample examples from the iris dataset are given below. Figure 7 As shown, the flower dataset exhibits vibrant colors and similar outlines. Furthermore, different photos are affected by factors such as lighting, green leaf backgrounds, and dew. Therefore, performing visual classification tasks on this dataset is quite challenging. Detailed experimental setup and results will be described later.

[0147] The experimental parameters used in this study differed from the global configuration. Initially, data augmentation was performed by resizing the training dataset to 256×256 dimensions, then randomly cropping it to 224×224 dimensions, followed by random horizontal image flipping. Notably, this augmentation protocol applied only to the training dataset; the test dataset was not processed accordingly. Due to the smaller dimensionality of this particular dataset compared to others, the initial learning rate was adjusted to 0.01, while the parameter optimizer settings aligned with the global framework. Within the proposed joint supervised loss, the CA loss coefficient was set to 5, the overall network batch size was set to 64, and the network was trained from its initial state for 300 epochs.

[0148] Table 3 shows the Top-1 and Top-5 accuracy of Flower102 under various loss conditions and network supervision.

[0149]

[0150] Results Analysis: Table 3 shows the performance of the loss function when applied to supervised training of various models. In particular, the channel attention loss method of this invention is the most effective strategy in the AlexNet model. Compared with the baseline method, it produces a significant improvement, with a top-1 accuracy improvement of approximately 4% and a top-5 accuracy improvement of 2.6%, showing a clear advantage over other methods. In the MobileNetV2 model, the proposed method has a negative effect, possibly due to the weak feature learning ability of lightweight networks. In the ShuffleNetV2 network, the proposed method outperforms other methods in both top-1 and top-5 accuracy. For the ResNet34 model, channel attention loss is the most effective supervised strategy, improving top-1 accuracy by 2.5% and top-5 accuracy by 2%, which is significantly better than other methods.

[0151] Experimental results show that the improved classification accuracy of the method of the present invention can be attributed to the application of the joint supervised loss framework.

[0152] In summary, this paper proposes a channel attention loss to enhance the attention to detail features in a network, and introduces a novel ensemble framework combined with a pre-defined SoftMax loss to enhance the classification capabilities of deep convolutional neural networks. This joint supervision strengthens the network's attention to channel information and enhances the discriminative power of the deep features learned by the network. Experiments on conventional classification tasks and fine-grained image classification validate the effectiveness of the proposed method and demonstrate its potential for practical applications in computer vision.

[0153] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A depth image classification method based on channel attention loss, characterized in that, Includes the following steps: S1. Construct the deep feature distribution map of the image. Input the image to be classified into the deep neural network. Through the convolutional network and feature extraction layer, obtain the information of all deep feature channels of the image and input it into the main branch and extra branches of the deep neural network. S2. In the main branch, perform global pooling on the depth feature distribution map, and then calculate the SoftMax loss through a fully connected layer, as follows; S2.

1. By calculating the cross-entropy loss in the main branch, global pooling is performed on F to obtain the deep features. ; S2.2, Depth Features As input to the fully connected layer, it undergoes a linear transformation and is mapped to obtain the original score vector. : ; in, and These represent the parameters of various weights and biases in a fully connected layer, with the superscript T indicating transpose. S2.3, Deriving the probability distribution By utilizing the SoftMax function to cover all classes, Indicates the actual label; S2.

4. Obtain the SoftMax loss using the cross-entropy loss function. : ; in, It is the corresponding label for its K-class classification problem, the base e represents the natural base, and the minimum batch size is N; S3. In the additional branch, based on the deep feature distribution map, channel information is fairly allocated to each category in the classification task, channel attention loss is calculated, and the probability of a specific category is derived. The channel attention loss is calculated as follows: S3.1 Based on the deep feature distribution map, perform random channel deactivation processing, randomly capture specific category discrimination information, and fairly allocate the selected channel information to each category in the classification task; S3.2 Perform category-specific local pooling, filter through the max pooling layer, generate a mean vector through adaptive mean processing, obtain the average response value of the largest element in the specific category-specific channel, and generate a one-dimensional vector consistent with the number of channels in the specific category. S3.3 Calculate the average category coefficient, calculate the channel average value for each specific category, and generate the sensitivity coefficient for different categories; S3.4 Calculate the attention coefficient matrix and channel attention loss of the deep feature distribution map to enhance the network's attention to details of different categories; Calculate the attention coefficient matrix M of the feature map and the channel attention loss. The channel attention loss equation for a single sample channel is expressed as: ; in, The definition is as follows: ; Where SCA, CLP, and ACC represent Simple Channel Attention, Category Local Pooling, and Average Category Coefficient, respectively. It is the cross-entropy loss between the truth class label y and the ACC output; The channel coefficients consist of k elements of 0 and 1. avgpooling and max pooling represent average pooling and max pooling operations, respectively. This represents the channel information belonging to class j in the i-th sample; Represents a depth feature map; S4. Combine the SoftMax loss and channel attention loss to obtain the final loss of the entire deep neural network, and perform joint supervised training and parameter optimization to improve the classification effect of deep images.

2. The depth image classification method based on channel attention loss according to claim 1, characterized in that, In step S1, the input image to be classified is , The convolutional network model is VGG or ResNet, and the extracted deep feature maps are represented as follows: ; in, Represents the real number field, with a height of H, a width of W, a number of channels of C, and a minimum batch size of N; A feature extraction layer is used to compute a deep feature map. , represents all channel information of the extracted sample; ; All channel information The SoftMax loss and channel attention loss are calculated for the main branch and additional branches of the deep neural network, respectively. When calculating the channel attention loss in the additional branch, channel information is fairly allocated to each category in the classification task, with the number of categories being... The number of channels allocated to each category is ,use This represents the channel information belonging to class j in the i-th sample: ; in, .

3. The depth image classification method based on channel attention loss according to claim 2, characterized in that, In step S3.1, the channels are randomly deactivated. By implementing a simplified channel attention mechanism, different weight coefficients are assigned to each feature map to selectively deactivate specific feature channels, thereby enhancing the network's ability to identify specific features. The simplified channel attention mechanism, based on the neuron deactivation method of the dropout layer, assigns different weight coefficients to each feature map and randomly discards depth channel information. Some channel information is stored in each group. They are randomly selected from among them.

4. The depth image classification method based on channel attention loss according to claim 2, characterized in that, In step S4, the SoftMax loss and channel attention loss are combined to obtain the final loss function of the entire deep neural network, as shown in the following formula: ; The weighting coefficients for channel attention loss are expressed as follows: This is used to control the contribution of channel attention loss in the overall loss function.

5. The depth image classification method based on channel attention loss according to claim 4, characterized in that, In step S4, based on the chain rule, gradient backpropagation is used to optimize the parameters of the neural network in each iteration until the final loss function converges or the number of iterations reaches a preset range. Each iteration convergence includes the following sub-steps: S4.1 Calculate the gradient of the SoftMax loss for the parameters of the fully connected classification layer. : ; S4.2 Calculate the gradient of the pooling layer : ; S4.3 Calculate the gradient of the deep neural network : ; S4.4, Update Deep Neural Network Parameters : ; In this diagram, the superscript 't' represents the number of iterations, the subscript 'c' represents a deep neural network, the subscript 'p' represents a pooling layer, and the subscript 's' represents a fully connected layer. For network parameters, These are the pooling layer parameters. To obtain the parameters of the fully connected layer using SoftMax loss, It is the integer notation for partial derivatives. Taking the partial derivative of the numerator with respect to the denominator after the sign, For network learning rate, This represents the gradient information of the network parameters, pooling layer parameters, and SoftMax loss fully connected layer parameters.

6. An electronic device, characterized in that, include: One or more processors; A storage device on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors implement the depth image classification method based on channel attention loss as described in any one of claims 1 to 5.

7. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps in the depth image classification method based on channel attention loss as described in any one of claims 1 to 5.