New energy product digital identification accurate identification method based on cooperative ternary attention mechanism

By integrating deep semantics and high-resolution feature layers through a collaborative ternary attention mechanism, the problem of unstable identification of digital identifiers for new energy products in multi-scale and complex environments is solved, achieving efficient and reliable identification results.

CN122116059APending Publication Date: 2026-05-29BEIJING UNIV OF TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING UNIV OF TECH
Filing Date
2025-11-26
Publication Date
2026-05-29

Smart Images

  • Figure CN122116059A_ABST
    Figure CN122116059A_ABST
Patent Text Reader

Abstract

The application discloses a new energy product digital identification accurate identification method based on a cooperative ternary attention mechanism and relates to the technical field of image recognition. In view of the deficiencies of the existing identification methods in the aspects of subtle feature representation and environmental interference resistance, the method fuses deep semantic features and high-resolution feature layers, and enhances the multi-scale feature extraction capability; before the multi-scale feature fusion, a designed cooperative ternary attention module is used to calculate cross-dimension attention weights, so that the identification model focuses on the target region. The experimental results show that the method can realize the accurate identification of the new energy digital identification under the conditions of multi-scale, low resolution and complex environment, and can be applied to the production management and circulation traceability links of new energy products.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention proposes a method for accurate digital identifier recognition based on a collaborative ternary attention mechanism. This method optimizes the detection architecture by fusing deep semantics with a high-resolution feature layer, and introduces a collaborative ternary attention module before multi-scale feature fusion, enabling the recognition model to quickly and accurately identify digital identifiers of new energy products. This technology solves the problem of model recognition instability caused by multi-scale, low-resolution, and environmental interference in the actual identification of digital identifiers of new energy products, providing efficient and reliable identifier recognition technology support for the production management, circulation traceability, and recycling of new energy products. Background Technology

[0002] To advance the full lifecycle management of new energy products such as energy storage batteries, wind turbines, and solar panels, the Industrial Internet Identifier Resolution System will connect numerous enterprises across the upstream and downstream of the industry chain, with applications spanning multiple new energy sectors. Under this system, the proposed digital identifiers for new energy products can drive upstream and downstream enterprises to connect to secondary nodes, thereby enhancing the integration and development of the industry chain, innovation chain, and supply chain, and achieving interconnectivity of data across the industry chain. Rapid and accurate identification of digital identifiers is crucial in the production, management, and recycling of new energy products. These identifiers carry key product information and are an important basis for achieving full lifecycle management of products.

[0003] Existing digital identification technologies for new energy products have certain limitations. On the one hand, they are weak in representing subtle features in the labels, making it difficult to capture sufficient detailed information and affecting the accuracy of identification. Simultaneously, existing identification network architectures are prone to losing low-level feature information, making it difficult for the identification system to accurately determine the label content. On the other hand, existing identification technologies lack resistance to environmental interference in complex environments, easily affected by complex backgrounds, occlusion, and other factors, leading to false detections, missed detections, or reduced identification efficiency. This can potentially cause chaos in the management of new energy products, increasing production costs and management difficulty. In complex real-world working environments, such as production lines, warehousing and logistics, and recycling stations, the lack of reliable identification technology can significantly impact work efficiency and quality control.

[0004] To address the aforementioned challenges, this invention proposes a method for accurate identification of digital identifiers of new energy products based on a collaborative ternary attention mechanism. This method effectively enhances the ability to extract subtle features and focus on target features by fusing deep semantics with a high-resolution feature layer and introducing a collaborative ternary attention module. This invention aims to achieve reliable identification of multi-scale, low-resolution digital identifiers of new energy products in complex environments, providing technical support for the full lifecycle management of new energy products. Summary of the Invention

[0005] This invention provides a method for accurate identification of digital identifiers of new energy products based on a collaborative ternary attention mechanism. This method enhances multi-scale feature extraction capabilities by fusing deep semantics with high-resolution feature layers. Simultaneously, before fusing multi-scale features, a collaborative ternary attention module is used to calculate attention weights between dimensions, thereby guiding the feature fusion process and enabling the network to accurately focus on the target region. This method solves the problem of unstable identification of digital identifiers of new energy products caused by multi-scale, low-resolution, and environmental interference in practical applications. It achieves efficient and reliable identification while reducing model size, facilitating model deployment in real-world applications.

[0006] The present invention adopts the following technical solution and implementation steps:

[0007] 1. A method for accurate identification of digital identifiers of new energy products based on a collaborative ternary attention mechanism, characterized by the following steps: collecting and dividing a dataset of digital identifiers of new energy products, designing a feature enhancement module based on a collaborative ternary attention mechanism, constructing a digital identifier recognition model based on a collaborative ternary attention mechanism, and training the digital identifier recognition model of new energy products.

[0008] (1) Collect and classify digital identification datasets for new energy products

[0009] This study aims to acquire a dataset of digital identifiers for new energy products, covering multi-scale, low-resolution, and environmentally disturbed scenarios. The dataset includes barcodes and QR codes, two common types of digital identifiers used in energy storage batteries, wind turbines, and solar panels. The digital labels are denoted as 0 and 1, respectively. A barcode is a marker composed of a set of regularly arranged bars, spaces, and their corresponding characters. A QR code is a matrix-style two-dimensional barcode, characterized by high information density and small size. The dataset contains 2115 JPG images. To adapt to the model's input requirements, the pixels of each image in the new energy product digital identifier dataset were normalized to [0,1], and the image size is 640 pixels. 640. The normalized digital identification image dataset of new energy products is divided into a training set and a validation set. The total number of images in the training set is 1472, and the total number of images in the validation set is 643.

[0010] (2) Design a feature enhancement module based on a collaborative ternary attention mechanism

[0011] The feature enhancement module based on the collaborative ternary attention mechanism processes input data by analyzing the relationships between the height, width, and channel dimensions of the input feature map. This attention module comprises three branches: one branch captures the multidimensional relationship between the height and width dimensions, and the other two branches are responsible for capturing the multidimensional relationships between the channel and height dimensions, and between the channel and width dimensions, respectively. The workflow of this feature enhancement module is as follows:

[0012] ① Define the input feature map F∈R c×h×w (c is the number of channels, h and w are the height and width), and pass it to each of the three branches of the proposed collaborative ternary attention module;

[0013] ② The first branch analyzes the multidimensional relationship between spatial dimensions, namely height and width. Specifically, it performs average pooling and max pooling operations on the input feature map F along the channel dimension to calculate the average and maximum eigenvalues ​​at each spatial location, resulting in two feature maps. The two feature maps are concatenated and input into a two-dimensional convolutional layer to generate an attention map, represented as follows:

[0014] (1)

[0015] Among them, Conv2d 3×3 Indicates the kernel size as Two-dimensional convolution, where the learnable parameters of the convolution operation are the kernel weights w. c and bias term b c Max d=C (·) represents global max pooling along the channel dimension. d=C (·) indicates global average pooling along the channel dimension;

[0016] The generated attention map is then passed through a batch normalization layer and a sigmoid activation layer to obtain new attention coefficients. ∈R 1×h×w , represented as:

[0017] (2)

[0018] Where σ represents the Sigmoid activation function, BatchNorm represents batch normalization, and the learnable parameter included in the normalization operation is the scaling parameter. Translation parameters ;

[0019] The newly generated attention coefficient Multiplying it element-wise with the input feature map F, we get ∈R c×h×w , represented as:

[0020] (3)

[0021] Where, · indicates that the attention value will be broadcast accordingly during the element-wise multiplication of the input feature map and the attention coefficient;

[0022] ③ The second branch analyzes the multidimensional relationship between the channel dimension and the width dimension. Specifically, it performs average pooling and max pooling operations on the input feature map F in the height dimension to calculate the average and maximum eigenvalues ​​at each spatial location, resulting in two feature maps. The two feature maps are concatenated and input into a two-dimensional convolutional layer to generate an attention map, represented as follows:

[0023] (4)

[0024] Among them, Max d=H (·) denotes global max pooling in the height dimension, Mean d=H (·) indicates global average pooling in the height dimension;

[0025] The generated attention map is then passed through a batch normalization layer and a sigmoid activation layer to obtain new attention coefficients. ∈R 1×c×w , represented as:

[0026] (5)

[0027] The newly generated attention coefficient Multiplying it element-wise with the input feature map F, we get ∈R c×h×w , represented as:

[0028] (6)

[0029] ④ The third branch analyzes the multidimensional relationship between the channel dimension and the height dimension. Specifically, it performs average pooling and max pooling operations on the input feature map F in the width dimension to calculate the average and maximum eigenvalues ​​at each spatial location, resulting in two feature maps. The two feature maps are concatenated and input into a two-dimensional convolutional layer to generate an attention map, represented as follows:

[0030] (7)

[0031] Among them, Max d=W (·) indicates global max pooling along the width dimension. d=W (·) indicates global average pooling in the width dimension;

[0032] The generated attention map is then passed through a batch normalization layer and a sigmoid activation layer to obtain new attention coefficients. ∈R 1×c×h , represented as:

[0033] (8)

[0034] The newly generated attention coefficient Multiplying it element-wise with the input feature map F, we get ∈R c×h×w , represented as:

[0035] (9)

[0036] ⑤ The processed feature maps obtained from the three branches are aggregated through average pooling to obtain F. ' , represented as:

[0037] (10)

[0038] (3) Construct a digital identifier recognition model based on a collaborative ternary attention mechanism

[0039] The designed digital label recognition model based on the collaborative ternary attention mechanism is an optimization and improvement on the YOLO object detection model, mainly composed of three parts: the backbone network, the neck network, and the head network.

[0040] The backbone network is responsible for processing the input image along five feature layers, P1 to P5. The feature maps output by feature layers P2, P3, P4, and P5 are represented as F, respectively. P2 F P3 F P4 F P5 F P2 F P3 F P4 Further, through the feature enhancement module based on the collaborative ternary attention mechanism in (2), feature maps with stronger target representation capabilities were obtained. , and Subsequently, , , and The inputs are fed into the neck network, and after a series of feature fusion and enhancement operations, three output feature levels P2 are generated. ' P3 ' P4 ' It outputs feature maps at three different scales. , and , respectively represented as:

[0041] (11)

[0042] (12)

[0043] (13)

[0044] Where C3k2(·) represents the feature processing function of the C3k2 module in YOLO, Cat(·) represents the concatenation function, Dws(·) represents the downsampling function, and Ups(·) represents the upsampling function;

[0045] Finally, the feature map output by the neck network , and The data is input into three detection heads. Each detection head processes the data through a classification branch (responsible for identifying the category to which the target belongs) and a regression branch (responsible for predicting the location bounding box of the target), and outputs the detection results of the corresponding feature map.

[0046] (4) Training a digital identification model for new energy products

[0047] After constructing the digital identifier recognition model based on the collaborative ternary attention mechanism, the model for recognizing digital identifiers of new energy products was trained. The total number of training epochs was set to 300. In each epoch, the training set data was divided into multiple batches, each containing 12 sample images. The model performed a parameter update after processing each batch of data; this process is called one iteration. The feature extractor for the digital identification model of new energy products consists of a backbone network and a neck network. t The training data input during the t-th iteration of training. This is the set of model parameters for the feature extractor at the t-th iteration, including all learnable convolutional kernel weights w for each layer of the backbone and neck networks. c Bias term b c and the scaling parameters of the batch normalization layer Translation parameters ;definition The predictor for the identification model consists of a detection head. The input feature map represents Three different sizes of feature maps were obtained when extracting features from each sample. , and The set, Let w be the set of model parameters for the predictor at the t-th iteration, including the learnable convolutional kernel weights w of each layer of the detector head.c Bias term b c and the scaling parameters of the batch normalization layer Translation parameters Input training data to a digital identifier recognition model based on a collaborative ternary attention mechanism. Feature extractor of the recognition model and predictor Complete the training of the recognition model and train the total loss function expression L. total for:

[0048] (14)

[0049] Among them, L box L is the bounding box regression loss, used to optimize the difference between the predicted and true bounding boxes. cls L is the classification loss, used to optimize the model's prediction accuracy for the target category. conf The confidence loss is used to optimize the model's accuracy in determining whether the bounding box contains the target.

[0050] Bounding box regression loss L box Represented as:

[0051] (15)

[0052] Where S is the grid size, which can be 160. 160, 80 80, 40 40 These are three types of multi-scale grids, where B is the number of bounding boxes predicted per grid cell, set to 3, l ij obj Indicates whether the j-th bounding box in the i-th grid cell is responsible for predicting the target, with a value of 0 or 1. ij and y ij These are the coordinates of the center point of the j-th predicted bounding box in the i-th grid cell. and w is the coordinate of the center point of the j-th true bounding box in the i-th grid cell. ij and h ij These are the width and height of the j-th predicted bounding box in the i-th grid cell, respectively. and These are the width and height of the j-th real bounding box in the i-th grid cell, respectively;

[0053] Classification loss L cls Represented as:

[0054] (16)

[0055] Among them, l i obj Indicates whether the target center point is in the i-th grid cell, with a value of 0 or 1. This is the probability predicted by the model that the target in the i-th grid cell belongs to class C, and its value is 0. 1, The true label indicates whether the target in the i-th grid cell belongs to category C, and its value is 0 or 1.

[0056] Confidence loss L conf Represented as:

[0057] (17)

[0058] Among them, l ij noobj This indicates whether the j-th bounding box in the i-th grid cell is not responsible for predicting the target, and its value is either 0 or 1. i It is the confidence level predicted by the i-th grid cell, and its value is 0. 1, It represents the true confidence level of the i-th grid cell, and its value is 0 or 1;

[0059] The stochastic gradient descent algorithm is used to optimize the model parameter sets of the network feature extractor and predictor, respectively. and The parameter update formula is:

[0060] (18)

[0061] (19)

[0062] Among them, the number of iterations , It is the total number of model iterations completed across all training rounds. This indicates the partial derivative. The learning rate is used, employing a cosine annealing scheduling strategy. The learning rate scheduling expression is:

[0063] (20)

[0064] in, The maximum learning rate is set to 0.01. The minimum learning rate is set to 0.001.

[0065] When a complete training dataset is passed through the neural network once, one training round is completed. When the number of training rounds reaches 300, the training of the recognition model is terminated, the weight parameters of the last training are saved, and the training of the recognition model is completed.

[0066] The inventiveness of this invention is mainly reflected in:

[0067] This invention addresses the problems of weak representation of subtle features and susceptibility to interference from complex environments in the existing digital identification process of new energy products. It proposes a precise identification method for new energy product digital identifiers based on a collaborative ternary attention mechanism. This method enhances the feature extraction capability of multi-scale, especially small-scale, targets by fusing deep semantics with a high-resolution feature layer. Simultaneously, before fusing multi-scale features, a feature enhancement module based on the collaborative ternary attention mechanism is used to calculate the attention weights between different dimensions, enabling the identification model to accurately focus on the target region. This invention achieves prediction of digital identifiers for two common new energy products, exhibiting strong stability and good real-time performance. Attached Figure Description

[0068] Figure 1 The distribution characteristics of the new energy product digital identification dataset are presented from four dimensions: the number of category instances, bounding box distribution, target space distribution, and bounding box aspect ratio.

[0069] Figure 2 This invention relates to a digital identifier accurate recognition model architecture based on a collaborative ternary attention mechanism.

[0070] Figure 3 This invention relates to a feature enhancement module structure based on a collaborative ternary attention mechanism.

[0071] Figure 4 This is the recognition model training process of the present invention. Detailed Implementation

[0072] This invention provides a method for accurate identification of digital identifiers of new energy products based on a collaborative ternary attention mechanism. This method enhances the multi-scale feature extraction capability by fusing deep semantics with high-resolution feature layers. At the same time, before fusing multi-scale features, the collaborative ternary attention module is used to calculate the attention weights between dimensions, thereby guiding the feature fusion process and enabling the network to accurately focus on the target region.

[0073] The present invention adopts the following technical solution and implementation steps:

[0074] 1. A method for accurate identification of digital identifiers of new energy products based on a collaborative ternary attention mechanism, characterized by the following steps: collecting and dividing a dataset of digital identifiers of new energy products, designing a feature enhancement module based on a collaborative ternary attention mechanism, constructing a digital identifier recognition model based on a collaborative ternary attention mechanism, and training the digital identifier recognition model of new energy products.

[0075] (1) Collect and classify digital identification datasets for new energy products

[0076] This study aims to acquire a dataset of digital identifiers for new energy products, covering multi-scale, low-resolution, and environmentally disturbed scenarios. The dataset includes barcodes and QR codes, two common types of digital identifiers used in energy storage batteries, wind turbines, and solar panels. The digital labels are denoted as 0 and 1, respectively. A barcode is a marker composed of a set of regularly arranged bars, spaces, and their corresponding characters. A QR code is a matrix-style two-dimensional barcode, characterized by high information density and small size. The dataset contains 2115 JPG images. To adapt to the model's input requirements, the pixels of each image in the new energy product digital identifier dataset were normalized to [0,1], and the image size is 640 pixels. 640. The normalized digital identification image dataset of new energy products is divided into a training set and a validation set. The total number of images in the training set is 1472, and the total number of images in the validation set is 643.

[0077] (2) Design a feature enhancement module based on a collaborative ternary attention mechanism

[0078] The feature enhancement module based on the collaborative ternary attention mechanism processes input data by analyzing the relationships between the height, width, and channel dimensions of the input feature map. This attention module comprises three branches: one branch captures the multidimensional relationship between the height and width dimensions, and the other two branches are responsible for capturing the multidimensional relationships between the channel and height dimensions, and between the channel and width dimensions, respectively. The workflow of this feature enhancement module is as follows:

[0079] ① Define the input feature map F∈R c×h×w (c is the number of channels, h and w are the height and width), and pass it to each of the three branches of the proposed collaborative ternary attention module;

[0080] ② The first branch analyzes the multidimensional relationship between spatial dimensions, namely height and width. Specifically, it performs average pooling and max pooling operations on the input feature map F along the channel dimension to calculate the average and maximum eigenvalues ​​at each spatial location, resulting in two feature maps. The two feature maps are concatenated and input into a two-dimensional convolutional layer to generate an attention map, represented as follows:

[0081] (1)

[0082] Among them, Conv2d 3×3 Indicates the kernel size as Two-dimensional convolution, where the learnable parameters of the convolution operation are the kernel weights w. c and bias term b c Max d=C (·) represents global max pooling along the channel dimension. d=C(·) indicates global average pooling along the channel dimension;

[0083] The generated attention map is then passed through a batch normalization layer and a sigmoid activation layer to obtain new attention coefficients. ∈R 1×h×w , represented as:

[0084] (2)

[0085] Where σ represents the Sigmoid activation function, BatchNorm represents batch normalization, and the learnable parameter included in the normalization operation is the scaling parameter. Translation parameters ;

[0086] The newly generated attention coefficient Multiplying it element-wise with the input feature map F, we get ∈R c×h×w , represented as:

[0087] (3)

[0088] Where, · indicates that the attention value will be broadcast accordingly during the element-wise multiplication of the input feature map and the attention coefficient;

[0089] ③ The second branch analyzes the multidimensional relationship between the channel dimension and the width dimension. Specifically, it performs average pooling and max pooling operations on the input feature map F in the height dimension to calculate the average and maximum eigenvalues ​​at each spatial location, resulting in two feature maps. The two feature maps are concatenated and input into a two-dimensional convolutional layer to generate an attention map, represented as follows:

[0090] (4)

[0091] Among them, Max d=H (·) denotes global max pooling in the height dimension, Mean d=H (·) indicates global average pooling in the height dimension;

[0092] The generated attention map is then passed through a batch normalization layer and a sigmoid activation layer to obtain new attention coefficients. ∈R 1×c×w , represented as:

[0093] (5)

[0094] The newly generated attention coefficient Multiplying it element-wise with the input feature map F, we get ∈R c×h×w , represented as:

[0095] (6)

[0096] ④ The third branch analyzes the multidimensional relationship between the channel dimension and the height dimension. Specifically, it performs average pooling and max pooling operations on the input feature map F in the width dimension to calculate the average and maximum eigenvalues ​​at each spatial location, resulting in two feature maps. The two feature maps are concatenated and input into a two-dimensional convolutional layer to generate an attention map, represented as follows:

[0097] (7)

[0098] Among them, Max d=W (·) indicates global max pooling along the width dimension. d=W (·) indicates global average pooling in the width dimension;

[0099] The generated attention map is then passed through a batch normalization layer and a sigmoid activation layer to obtain new attention coefficients. ∈R 1×c×h , represented as:

[0100] (8)

[0101] The newly generated attention coefficient Multiplying it element-wise with the input feature map F, we get ∈R c×h×w , represented as:

[0102] (9)

[0103] ⑤ The processed feature maps obtained from the three branches are aggregated through average pooling to obtain F. ' , represented as:

[0104] (10)

[0105] (3) Construct a digital identifier recognition model based on a collaborative ternary attention mechanism

[0106] The designed digital identifier recognition model based on the collaborative ternary attention mechanism is an optimization and improvement on the YOLO object detection model, consisting of three parts: a backbone network, a neck network, and a head network.

[0107] The backbone network is responsible for processing the input image along five feature layers, P1 to P5. The feature maps output by feature layers P2, P3, P4, and P5 are represented as F, respectively. P2 F P3F P4 F P5 F P2 F P3 F P4 Further, through the feature enhancement module based on the collaborative ternary attention mechanism in (2), feature maps with stronger target representation capabilities were obtained. , and Subsequently, , , and The inputs are fed into the neck network, and after a series of feature fusion and enhancement operations, three output feature levels P2 are generated. ' P3 ' P4 ' It outputs feature maps at three different scales. , and , respectively represented as:

[0108] (11)

[0109] (12)

[0110] (13)

[0111] Where C3k2(·) represents the feature processing function of the C3k2 module in YOLO, Cat(·) represents the concatenation function, Dws(·) represents the downsampling function, and Ups(·) represents the upsampling function;

[0112] Finally, the feature map output by the neck network , and The data is input into three detection heads. Each detection head processes the data through a classification branch (responsible for identifying the category to which the target belongs) and a regression branch (responsible for predicting the location bounding box of the target), and outputs the detection results of the corresponding feature map.

[0113] (4) Training a digital identification model for new energy products

[0114] After constructing the digital identifier recognition model based on the collaborative ternary attention mechanism, the model for recognizing digital identifiers of new energy products was trained. The total number of training epochs was set to 300. In each epoch, the training set data was divided into multiple batches, each containing 12 sample images. The model performed a parameter update after processing each batch of data; this process is called one iteration. The feature extractor for the digital identification model of new energy products consists of a backbone network and a neck network.t The training data input during the t-th iteration of training. This is the set of model parameters for the feature extractor at the t-th iteration, including all learnable convolutional kernel weights w for each layer of the backbone and neck networks. c Bias term b c and the scaling parameters of the batch normalization layer Translation parameters ;definition The predictor for the identification model consists of a detection head. The input feature map represents Three different sizes of feature maps were obtained when extracting features from each sample. , and The set, Let w be the set of model parameters for the predictor at the t-th iteration, including the learnable convolutional kernel weights w of each layer of the detector head. c Bias term b c and the scaling parameters of the batch normalization layer Translation parameters Input training data to a digital identifier recognition model based on a collaborative ternary attention mechanism. Feature extractor of the recognition model and predictor Complete the training of the recognition model and train the total loss function expression L. total for:

[0115] (14)

[0116] Among them, L box L is the bounding box regression loss, used to optimize the difference between the predicted and true bounding boxes. cls L is the classification loss, used to optimize the model's prediction accuracy for the target category. conf The confidence loss is used to optimize the model's accuracy in determining whether the bounding box contains the target.

[0117] Bounding box regression loss L box Represented as:

[0118] (15)

[0119] Where S is the grid size, which can be 160. 160, 80 80, 40 40 These are three types of multi-scale grids, where B is the number of bounding boxes predicted per grid cell, set to 3, l ij objIndicates whether the j-th bounding box in the i-th grid cell is responsible for predicting the target, with a value of 0 or 1. ij and y ij These are the coordinates of the center point of the j-th predicted bounding box in the i-th grid cell. and w is the coordinate of the center point of the j-th true bounding box in the i-th grid cell. ij and h ij These are the width and height of the j-th predicted bounding box in the i-th grid cell, respectively. and These are the width and height of the j-th real bounding box in the i-th grid cell, respectively;

[0120] Classification loss L cls Represented as:

[0121] (16)

[0122] Among them, l i obj Indicates whether the target center point is in the i-th grid cell, with a value of 0 or 1. This is the probability predicted by the model that the target in the i-th grid cell belongs to class C, and its value is 0. 1, The true label indicates whether the target in the i-th grid cell belongs to category C, and its value is 0 or 1.

[0123] Confidence loss L conf Represented as:

[0124] (17)

[0125] Among them, l ij noobj This indicates whether the j-th bounding box in the i-th grid cell is not responsible for predicting the target, and its value is either 0 or 1. i It is the confidence level predicted by the i-th grid cell, and its value is 0. 1, It represents the true confidence level of the i-th grid cell, and its value is 0 or 1;

[0126] The stochastic gradient descent algorithm is used to optimize the model parameter sets of the network feature extractor and predictor, respectively. and The parameter update formula is:

[0127] (18)

[0128] (19)

[0129] Among them, the number of iterations , It is the total number of model iterations completed across all training rounds. This indicates the partial derivative. The learning rate is used, employing a cosine annealing scheduling strategy. The learning rate scheduling expression is:

[0130] (20)

[0131] in, The maximum learning rate is set to 0.01. The minimum learning rate is set to 0.001.

[0132] When a complete training dataset is passed through the neural network once, one training round is completed. When the number of training rounds reaches 300, the training of the recognition model is terminated, the weight parameters of the last training are saved, and the training of the recognition model is completed.

[0133] The trained digital identifier recognition model identifies two types of digital identifiers for new energy products in the test set, obtains predicted category labels for digital identifiers of new energy products in different scenarios, and completes the task of identifying digital identifiers of new energy products.

Claims

1. A method for accurate identification of digital identifiers of new energy products based on a collaborative ternary attention mechanism, characterized in that, The process of collecting and segmenting a dataset of digital identifiers for new energy products, designing a feature enhancement module based on a collaborative ternary attention mechanism, constructing a digital identifier recognition model based on the collaborative ternary attention mechanism, and training the digital identifier recognition model for new energy products includes the following steps: (1) Collect and classify digital identification datasets for new energy products A dataset of digital identifiers for new energy products covering multi-scale, low-resolution, and environmentally disturbed scenarios was obtained, including barcodes and QR codes, with digital labels denoted as 0 and 1 respectively. The pixels of each image in the dataset were normalized to [0,1], and the image size was 640 pixels.

640. The normalized digital identification image dataset of new energy products is divided into a training set and a validation set. The total number of images in the training set is 1472, and the total number of images in the validation set is 643. (2) Design a feature enhancement module based on a collaborative ternary attention mechanism The feature enhancement module based on the collaborative ternary attention mechanism processes input data by analyzing the relationships between the height, width, and channel dimensions of the input feature map. This attention module comprises three branches: one branch captures the multidimensional relationship between the height and width dimensions, and the other two branches are responsible for capturing the multidimensional relationships between the channel and height dimensions, and between the channel and width dimensions, respectively. The workflow of this feature enhancement module is as follows: ① Define the input feature map F∈R c×h×w , where c is the number of channels, h and w are the height and width, and are passed to each of the three branches of the proposed collaborative ternary attention module; ② The first branch analyzes the multidimensional relationship between spatial dimensions, namely height and width. Specifically, it performs average pooling and max pooling operations on the input feature map F along the channel dimension to calculate the average and maximum eigenvalues ​​at each spatial location, resulting in two feature maps. The two feature maps are concatenated and input into a two-dimensional convolutional layer to generate an attention map, represented as follows: (1) Among them, Conv2d 3×3 Indicates the kernel size as Two-dimensional convolution, where the learnable parameters of the convolution operation are the kernel weights w. c and bias term b c Max d=C (·) represents global max pooling along the channel dimension. d=C (·) indicates global average pooling along the channel dimension; The generated attention map is then passed through a batch normalization layer and a sigmoid activation layer to obtain new attention coefficients. ∈R 1 ×h×w , is represented as: (2) Where σ represents the Sigmoid activation function, BatchNorm represents batch normalization, and the learnable parameter included in the normalization operation is the scaling parameter. Translation parameters ; The newly generated attention coefficient Multiplying it element-wise with the input feature map F, we get ∈R c×h×w , is represented as: (3) Where, · indicates that the attention value will be broadcast accordingly during the element-wise multiplication of the input feature map and the attention coefficient; ③ The second branch analyzes the multidimensional relationship between the channel dimension and the width dimension. Specifically, it performs average pooling and max pooling operations on the input feature map F in the height dimension to calculate the average and maximum eigenvalues ​​at each spatial location, resulting in two feature maps. The two feature maps are concatenated and input into a two-dimensional convolutional layer to generate an attention map, represented as follows: (4) Among them, Max d=H (·) denotes global max pooling in the height dimension, Mean d=H (·) indicates global average pooling in the height dimension; The generated attention map is then passed through a batch normalization layer and a sigmoid activation layer to obtain new attention coefficients. ∈R 1 ×c×w , is represented as: (5) The newly generated attention coefficient Multiplying it element-wise with the input feature map F, we get ∈R c×h×w , is represented as: (6) ④ The third branch analyzes the multidimensional relationship between the channel dimension and the height dimension. Specifically, it performs average pooling and max pooling operations on the input feature map F in the width dimension to calculate the average and maximum eigenvalues ​​at each spatial location, resulting in two feature maps. The two feature maps are concatenated and input into a two-dimensional convolutional layer to generate an attention map, represented as follows: (7) Among them, Max d=W (·) indicates global max pooling along the width dimension. d=W (·) indicates global average pooling in the width dimension; The generated attention map is then passed through a batch normalization layer and a sigmoid activation layer to obtain new attention coefficients. ∈R 1 ×c×h , is represented as: (8) The newly generated attention coefficient Multiplying it element-wise with the input feature map F, we get ∈R c×h×w , is represented as: (9) ⑤ The processed feature maps obtained from the three branches are aggregated through an average pooling operation to obtain F. ' , is represented as: (10) (3) Construct a digital identifier recognition model based on a collaborative ternary attention mechanism The designed digital identifier recognition model based on the collaborative ternary attention mechanism consists of three parts: a backbone network, a neck network, and a head. The backbone network is responsible for processing the input image along five feature layers, P1 to P5. The feature maps output by feature layers P2, P3, P4, and P5 are represented as F, respectively. P2 F P3 F P4 F P5 F P2 F P3 F P4 Further, through the feature enhancement module based on the collaborative ternary attention mechanism in (2), feature maps with stronger target representation capabilities were obtained. , and Subsequently, , , and The inputs are fed into the neck network, and after a series of feature fusion and enhancement operations, three output feature levels P2 are generated. ' P3 ' P4 ' It outputs feature maps at three different scales. , and , respectively represented as: (11) (12) (13) Where C3k2(·) represents the feature processing function of the C3k2 module in YOLO, Cat(·) represents the concatenation function, Dws(·) represents the downsampling function, and Ups(·) represents the upsampling function; Finally, the feature map output by the neck network , and The data is input into three detection heads. Each detection head processes the data through two branches: a classification branch to identify the category of the target and a regression branch to predict the bounding box of the target. The result is then output as the corresponding feature map. (4) Training a digital identification model for new energy products After constructing the digital identifier recognition model based on the collaborative ternary attention mechanism, the model for recognizing digital identifiers of new energy products was trained. The total number of training epochs was set to 300. In each epoch, the training set data was divided into multiple batches, each containing 12 sample images. The model performed a parameter update after processing each batch of data; this process is called one iteration. The feature extractor for the digital identification model of new energy products consists of a backbone network and a neck network. t The training data input during the t-th iteration of training. This is the set of model parameters for the feature extractor at the t-th iteration, including all learnable convolutional kernel weights w for each layer of the backbone and neck networks. c Bias term b c and the scaling parameters of the batch normalization layer Translation parameters ;definition The predictor for the identification model consists of a detection head. The input feature map represents Three different sizes of feature maps were obtained when extracting features from each sample. , and The set, Let w be the set of model parameters for the predictor at the t-th iteration, including the learnable convolutional kernel weights w of each layer of the detector head. c Bias term b c and the scaling parameters of the batch normalization layer Translation parameters Input training data to a digital identifier recognition model based on a collaborative ternary attention mechanism. Feature extractor of the recognition model and predictor Complete the training of the recognition model and train the total loss function expression L. total for: (14) Among them, L box L is the bounding box regression loss, used to optimize the difference between the predicted and true bounding boxes. cls L is the classification loss, used to optimize the model's prediction accuracy for the target category. conf The confidence loss is used to optimize the model's accuracy in determining whether the bounding box contains the target. Bounding box regression loss L box Represented as: (5) Where S is the grid size, using 160. 160, 80 80, 40 40 These are three types of multi-scale grids, where B is the number of bounding boxes predicted per grid cell, set to 3, l ij obj Indicates whether the j-th bounding box in the i-th grid cell is responsible for predicting the target, with a value of 0 or 1. ij and y ij These are the coordinates of the center point of the j-th predicted bounding box in the i-th grid cell. and w is the coordinate of the center point of the j-th true bounding box in the i-th grid cell. ij and h ij These are the width and height of the j-th predicted bounding box in the i-th grid cell, respectively. and These are the width and height of the j-th real bounding box in the i-th grid cell, respectively; Classification loss L cls Represented as: (16) Among them, l i obj Indicates whether the target center point is in the i-th grid cell, with a value of 0 or 1. This is the probability predicted by the model that the target in the i-th grid cell belongs to class C, and its value is 0. 1, The true label indicates whether the target in the i-th grid cell belongs to category C, and its value is 0 or 1. Confidence loss L conf Represented as: (17) Among them, l ij noobj This indicates whether the j-th bounding box in the i-th grid cell is not responsible for predicting the target, and its value is either 0 or 1. i It is the confidence level predicted by the i-th grid cell, and its value is 0. 1, It represents the true confidence level of the i-th grid cell, and its value is 0 or 1; The stochastic gradient descent algorithm is used to optimize the model parameter sets of the network feature extractor and predictor, respectively. and The parameter update formula is: (18) (19) Among them, the number of iterations , It is the total number of model iterations completed across all training rounds. This indicates the partial derivative. The learning rate is used, employing a cosine annealing scheduling strategy. The learning rate scheduling expression is: (20) in, The maximum learning rate is set to 0.

01. The minimum learning rate is set to 0.

001. When a complete training dataset is passed through the neural network once, one training round is completed. When the number of training rounds reaches 300, the training of the recognition model is terminated, the weight parameters of the last training are saved, and the training of the recognition model is completed.