Workpiece coded image text detection and recognition method based on improved DBNet and SATRN

By improving the feature fusion and attention mechanisms of DBNet and SATRN models, the problem of decreased accuracy in text recognition of coded images of workpieces in industrial settings was solved, achieving efficient and stable text detection and recognition in complex environments.

CN121640490APending Publication Date: 2026-03-10XI AN JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-25
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing technologies suffer from a sharp decline in the accuracy of text recognition of workpiece coded images in industrial settings due to factors such as metal surface reflection, oil stains, scratches, uneven lighting, and low contrast. Traditional methods are unstable in feature fusion under complex backgrounds, and the attention mechanism is prone to drift.

Method used

The DBNet model is improved by introducing the efficient upsampling convolution module EUCB and the PReLU activation function. The SATRN model is improved by adopting SimAM-DSC, Flow-Attention and SE channel attention mechanisms to enhance feature extraction and attention stability.

Benefits of technology

It achieves more accurate text detection and recognition in complex industrial environments, improves feature fusion quality and gradient fluidity, and enhances the robustness and recognition accuracy of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121640490A_ABST
    Figure CN121640490A_ABST
Patent Text Reader

Abstract

The invention discloses a workpiece coded image text detection and recognition method based on improved DBNet and SATRN, and belongs to the technical field of computer vision. The method comprises the steps that an improved DBNet model is adopted for text area detection and positioning, an efficient up-sampling convolution module EUCB is introduced into a feature fusion module, and an activation function is replaced with a parameterized rectification linear unit PReLU; an improved SATRN model is adopted for character sequence recognition, an improved Shallow CNN based on SimAM-DSC is used for replacing an original module, a Flow-Attention mechanism is adopted in a Transform encoder, and an SE channel attention module is introduced. According to the method, the problem that the text recognition precision is reduced due to factors such as light reflection, oil stain and low contrast in an industrial environment is effectively solved, and the accuracy and robustness of detection and recognition are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of computer vision and deep learning technology, specifically relating to a method for text detection and recognition of workpiece coded images based on an improved DBNet and SATRN. Background Technology

[0002] In the process of intelligent manufacturing, workpiece codes carry critical product information, and their automatic identification is essential for product traceability and quality control. However, workpiece code images acquired in industrial settings often suffer from factors such as metal surface reflection, oil stains, scratches, uneven lighting, and low contrast, leading to a sharp decline in the accuracy of traditional text recognition methods.

[0003] In existing technologies, text recognition typically employs a two-stage "detection-recognition" framework. For text detection, while the DBNet model improves performance through a differentiable binarization module, its Feature Fusion Network (FPN) module is prone to feature loss in complex backgrounds, and the ReLU activation function's gradient is zero in the negative interval, easily leading to neuron inactivation and making it difficult to handle challenges such as glare and low contrast. For text recognition, although the SATRN model utilizes the Transformer architecture to model global dependencies, its shallow feature extraction module is sensitive to noise, and the standard attention mechanism is prone to attention drift under glare interference; furthermore, the efficiency of channel feature utilization needs improvement.

[0004] Therefore, there is an urgent need for a solution that can stably and accurately detect and recognize workpiece coded text in complex industrial environments. Summary of the Invention

[0005] The technical problem to be solved by this invention is to address the shortcomings of the prior art by providing a workpiece coded image text detection and recognition method based on an improved DBNet and SATRN. This method is used to solve the technical problem that the accuracy of traditional text recognition methods is drastically reduced due to factors such as metal surface reflection, oil stains, scratches, uneven lighting, and low contrast in workpiece coded images acquired in industrial settings.

[0006] The present invention adopts the following technical solution: A method for text detection and recognition in coded images of workpieces based on improved DBNet and SATRN includes the following steps: S1. The improved DBNet model is used to detect and locate the text region of the input workpiece coded image. The improved DBNet model introduces the efficient upsampling convolution module EUCB into the feature fusion module and replaces the activation function in the feature fusion module with the parameterized rectified linear unit PReLU. S2. The improved SATRN model is used to perform character sequence recognition on the detected text region image. In the improved SATRN model, an improved Shallow CNN based on SimAM-DSC is used to replace the original Shallow CNN; the Flow-Attention mechanism is used in the Transformer encoder to replace the standard multi-head self-attention; and an SE channel attention module is introduced at the encoder output to achieve adaptive calibration of channel features.

[0007] Preferably, in step S1, the high-efficiency upsampling convolution module EUCB performs feature fusion through depthwise separable convolution and pointwise upsampling operation.

[0008] Preferably, the depth-separable convolution includes depthwise convolution and pointwise convolution.

[0009] Preferably, the parameterized rectified linear unit PReLU avoids neuron deactivation through a learnable negative interval slope parameter, the mathematical expression of which is:

[0010] in, For learnable parameters, when When = 0, PReLU degenerates into standard ReLU; when When the value is greater than 0, the function maintains a non-zero output on the negative half-axis.

[0011] Preferably, in step S2, the improved Shallow CNN based on SimAM-DSC integrates the parameter-free attention mechanism SimAM with depthwise separable convolution, and uses the h-swish activation function in both depthwise convolution and pointwise convolution.

[0012] Preferably, the parameterless attention mechanism SimAM models the importance of each pixel in the feature map through an energy function, which is defined as:

[0013] in, Indicates the first The activation value of a pixel or neuron; and These represent the mean and variance of the feature map, respectively. This is the adjustment coefficient.

[0014] Preferably, the Flow-Attention mechanism uses probability flow and local regularization to ensure that the attention weights are spatially continuous, and its basic form is expressed as:

[0015] in, Indicates the first Attention output for each query location; , and These represent the Query, Key, and Value vectors, respectively. This is the similarity function.

[0016] Preferably, in step S2, the SE channel attention module includes: Compression stage: Global average pooling is performed on the input feature map in the spatial dimension to obtain the channel description vector; Activation phase: The channel description vector is nonlinearly transformed through a two-layer fully connected network to generate channel weights; Scaling phase: Multiply the channel weights with the original feature map channel by channel.

[0017] Preferably, the improved DBNet model uses ResNet34 as the backbone network; the improved SATRN model employs random rotation, brightness adjustment, and Gaussian noise data augmentation methods during training.

[0018] Secondly, embodiments of the present invention provide a workpiece coded image text detection and recognition system based on improved DBNet and SATRN, comprising: The text detection module is used to detect and locate text regions in the input workpiece coded image using an improved DBNet model. The improved DBNet model introduces an efficient upsampling convolution module EUCB into the feature fusion module and replaces the activation function in the feature fusion module with a parameterized rectified linear unit PReLU. The text recognition module is used to perform character sequence recognition on the detected text region image using an improved SATRN model. In the improved SATRN model, an improved Shallow CNN based on SimAM-DSC is used to replace the original Shallow CNN; a Flow-Attention mechanism is used in the Transformer encoder to replace the standard multi-head self-attention; and an SE channel attention module is introduced at the encoder output.

[0019] Thirdly, a computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the above-described method for detecting and recognizing workpiece coded images based on the improved DBNet and SATRN.

[0020] Fourthly, embodiments of the present invention provide a computer-readable storage medium including a computer program, which, when executed by a processor, implements the steps of the above-described method for detecting and recognizing workpiece coded images based on improved DBNet and SATRN.

[0021] Fifthly, a chip includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the above-described workpiece coded image text detection and recognition method based on improved DBNet and SATRN.

[0022] In a sixth aspect, embodiments of the present invention provide an electronic device, including a computer program, which, when executed by the electronic device, implements the steps of the above-described method for detecting and recognizing workpiece coded images based on the improved DBNet and SATRN.

[0023] Compared with the prior art, the present invention has at least the following beneficial effects: A text detection and recognition method for coded workpiece images based on an improved DBNet and SATRN is proposed. The improved DBNet model incorporates an EUCB module and a PReLU activation function, enhancing feature fusion quality and gradient fluidity. The improved SATRN model incorporates SimAM-DSC, Flow-Attention, and SE modules, strengthening feature extraction capabilities and the stability of the attention mechanism. The overall solution achieves more accurate text detection and recognition in complex industrial environments.

[0024] Furthermore, by combining depthwise separable convolution with pointwise upsampling, both efficiency and performance are achieved through feature fusion. Depthwise separable convolution breaks down standard convolution into depthwise convolution and pointwise convolution, significantly reducing computational complexity, while pointwise upsampling ensures accurate alignment of feature maps at different scales. This design not only solves the problems of high computational cost and poor real-time performance in traditional feature fusion, but also preserves key information of high-level semantic features and low-level detailed features through high-fidelity fusion. This enables the improved DBNet model to more accurately capture character edges and texture information when processing coded images of workpieces, providing high-quality text region data support for subsequent recognition stages.

[0025] Furthermore, depthwise separable convolution reduces the number of parameters and improves the computational efficiency of the model by separating depthwise convolution and pointwise convolution, while maintaining the feature extraction capability.

[0026] Furthermore, PReLU effectively avoids neuron inactivation by using learnable negative interval slope parameters, thus enhancing the model's feature representation ability in low-contrast regions.

[0027] Furthermore, the SimAM-DSC module combines a parameter-free attention mechanism with depthwise separable convolution to achieve effective feature selection and noise suppression without increasing the number of parameters.

[0028] Furthermore, SimAM adaptively evaluates feature importance through an energy function, which can highlight key feature regions, suppress redundant information, and improve the quality of feature representation.

[0029] Furthermore, Flow-Attention, through probability flow and local regularization, makes the attention weight distribution more continuous and stable, effectively suppressing attention distraction caused by reflection interference.

[0030] Furthermore, the SE module achieves adaptive calibration of channel features through compression-excitation-scaling operations, thereby enhancing key character-related features.

[0031] Furthermore, the ResNet34 backbone network provides a stable foundation for feature extraction, while data augmentation methods enhance the model's generalization ability and robustness.

[0032] It is understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here.

[0033] In summary, this invention significantly improves the accuracy, stability, and efficiency of workpiece coded text detection and recognition in complex industrial environments through multi-level technical improvements and optimizations in key aspects such as feature extraction, fusion, and attention mechanisms.

[0034] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0035] Figure 1 This is an overall flowchart of the workpiece coded image text recognition framework described in this invention; Figure 2 A schematic diagram of the text detection model structure based on the improved DBNet; Figure 3 A schematic diagram of the structure of the efficient upsampling convolutional module (EUCB); Figure 4 A diagram comparing the ReLU and PReLU activation functions; Figure 5 A schematic diagram of the text recognition model structure based on the improved SATRN; Figure 6 This is a schematic diagram of the structure of an improved Shallow CNN module based on SimAM-DSC; Figure 7 This is a schematic diagram of the SE channel attention module. Figure 8 A schematic diagram of a computer device provided in an embodiment of the present invention; Figure 9 This is a block diagram of a chip provided according to an embodiment of the present invention.

[0036] Among them, 60. Computer equipment; 61. Processor; 62. Memory; 63. Computer program; 600. Electronic device; 610. Processing unit; 620. Storage unit; 6201. Random access memory unit; 6202. Cache memory unit; 6203. Read-only memory unit; 6204. Program / utility; 6205. Program module; 630. Bus; 640. Display unit; 650. Input / output interface; 660. Network adapter; 700. External device. Detailed Implementation

[0037] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0038] In the description of this invention, it should be understood that the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0039] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0040] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Additionally, the character " / " in this invention generally indicates that the preceding and following objects have an "or" relationship.

[0041] It should be understood that although terms such as first, second, third, etc., may be used in the embodiments of the present invention to describe the preset range, these preset ranges should not be limited to these terms. These terms are only used to distinguish the preset ranges from one another. For example, without departing from the scope of the embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.

[0042] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."

[0043] The accompanying drawings illustrate various structural schematic diagrams according to embodiments disclosed in this invention. These drawings are not to scale, and some details have been enlarged for clarity, and some details may have been omitted. The shapes of the various regions and layers shown in the drawings, as well as their relative sizes and positional relationships, are merely exemplary and may deviate from reality due to manufacturing tolerances or technical limitations. Furthermore, those skilled in the art can design regions / layers with different shapes, sizes, and relative positions as needed.

[0044] This invention provides a method for text detection and recognition of coded workpiece images based on an improved DBNet and SATRN framework. Addressing the challenges of recognizing coded workpiece images in industrial settings, such as strong glare and low contrast, an integrated detection-recognition framework is constructed. In the detection stage, the DBNet model is improved by introducing an efficient upsampling convolutional module (EUCB) to enhance the quality of multi-scale feature fusion, and the PReLU activation function is used to enhance the model's expressive power in the negative region. In the recognition stage, the SATRN model is improved by strengthening shallow feature extraction through the SimAM-DSC module, optimizing global dependency modeling using the Flow-Attention mechanism, and introducing an SE module to achieve adaptive calibration of channel features. This invention effectively improves the accuracy and robustness of coded workpiece text recognition in complex industrial environments, providing a reliable solution for product traceability and automated information collection in intelligent manufacturing.

[0045] Please see Figure 1This invention discloses a method for text detection and recognition of workpiece coded images based on an improved DBNet and SATRN. The method involves first inputting a pre-processed workpiece coded image into a detection network to extract text line regions, and then feeding the detected text lines into a recognition network to decode the character sequences, thereby obtaining the final text recognition result. The specific steps are as follows: S1. An improved DBNet model is used to detect and locate text regions in the input workpiece coded image. The improved DBNet model introduces an efficient upsampling convolution module (EUCB) in the feature fusion module and replaces the activation function with a parameterized rectified linear unit (PReLU). S101. Improved Feature Extraction and Fusion: Based on the DBNet framework, an efficient upsampling convolutional module (EUCB) is introduced into its Feature Pyramid Network (FPN). This module achieves high-fidelity fusion of high-level semantic features and low-level detailed features by using depthwise separable convolution and pointwise upsampling operations, while reducing computational complexity. S102. Improved Activation Function: The ReLU activation function in the feature fusion network is replaced with a Parametric Rectified Linear Unit (PReLU). PReLU effectively avoids neuron inactivation by introducing a learnable negative interval slope parameter, thus enhancing the model's feature representation ability in low-contrast and reflective regions.

[0046] DBNet is a classic text detection model based on segmentation algorithms, which introduces a Differentiable Binarization (DB) module. The DB module embeds the binarization step into the network training process, enabling the model to autonomously learn adaptive thresholds and thus complete text region segmentation without relying on complex post-processing. This approach allows the network to form dynamic boundaries between the foreground (characters) and background (surface), improving detection accuracy and stability.

[0047] Traditional segmentation networks typically generate a probability map in the output stage. ,in Represents pixels The probability of belonging to a text region. If a fixed threshold is used. After binarization, the definition of the output binary image is:

[0048] in, Represents pixels in a binary image The output value indicates whether the pixel belongs to the text region; a value of 1 represents the text region, and 0 represents the background. Traditional fixed-threshold binarization functions are non-differentiable and lack adaptability, leading to difficulties in threshold optimization during model training, blurred boundaries, and insufficient robustness to complex scenes. To overcome this problem, DBNet replaces the traditional step function with a smooth, differentiable form, using the sigmoid function to continuously map probability values ​​to the [0,1] interval. A threshold map is introduced. Then, the differentiable binary expression is:

[0049] in, Represents pixels in an approximate binary image The output value is between 0 and 1; Indicates the predicted probability of the text; This represents an adaptive threshold, automatically generated by the model through learning. This represents the slope adjustment coefficient of the Sigmoid function, usually taken as k=50. As k increases, the function curve becomes steeper, approximating the standard step function. Significantly greater than At that time, the exponent term Approaching 0 An approximation of 1 indicates that the pixel belongs to the text region; conversely, an approximation of 0 indicates a difference. When both are close, the output smoothly transitions around 0.5. This differentiable representation allows the network to simultaneously optimize probability prediction and threshold mapping during the training phase through gradient backpropagation.

[0050] While DBNet performs excellently in text detection in natural scenes, it still faces significant challenges in workpiece encoding detection. Workpiece surfaces are often made of metal or alloys, exhibiting strong reflective properties, and may contain defects such as oil, scratches, and rust, resulting in blurred character edges and uneven grayscale distribution. Furthermore, different lighting angles introduce shadows and highlights, leading to insufficient stability of the original model during feature extraction. On the other hand, the original DBNet model employs a traditional FPN (Feature Pyramid Network) structure in the feature fusion stage. While this achieves multi-scale feature fusion, it is prone to feature loss and semantic confusion in complex backgrounds. To address these issues, this invention proposes a structural optimization scheme based on the DBNet framework to improve the model's feature recovery capability and overall detection accuracy. The improved model is as follows: Figure 2As shown, the three-part structure of DBNet is retained: the feature extraction backbone, the feature fusion module (Neck), and the output head. An efficient up-convolution block (EUCB) is introduced in the feature fusion part to improve the fidelity of multi-layer feature fusion; simultaneously, the activation function in the Neck part is changed from ReLU to PReLU (Parametric Rectified Linear Unit), thereby improving gradient propagation efficiency and non-linear expressive power. The core of the overall optimized structure lies in achieving efficient feature reconstruction, robust boundary extraction, and smooth gradient propagation.

[0051] The input image is processed by the Backbone to extract multi-layer feature maps, corresponding to different downsampling ratios of 1 / 2, 1 / 4, 1 / 8, 1 / 16, and 1 / 32. Since the feature spatial resolutions of each layer are different, direct fusion will lead to a mismatch between semantic and spatial information. Therefore, this invention introduces an Efficient Up-Convolution Block (EUCB) in the Neck section to achieve scale alignment and feature enhancement layer by layer. Deep semantic features are upsampled by a factor of two by the EUCB module, aligned with shallow features, and then concatenated (CON-CAT) and element-wise summed to achieve the fusion of global semantics and local details. The Efficient Up-Convolution Block is the core component of the improved model, and its structure is as follows: Figure 3 As shown.

[0052] Here, Up (UpSampling) 2× means upsampling the input feature map by 2 times to keep the feature resolution consistent across different layers; DWC (Depth-wise Convolution) 3×3 means applying a 3×3 depthwise convolution to extract spatial structure information; BN (Batch Normalization) means standardizing the feature distribution of each channel to prevent gradient explosion; ReLU (Rectified Linear Unit) means introducing a non-linear mapping to enhance feature representation; and Conv 1×1 means using 1×1 convolution kernels to linearly combine along the channel dimension to redistribute the number of channels and compress features.

[0053] In the EUCB module, depthwise convolution is used to efficiently extract local spatial features, which can reduce the computational burden while ensuring model accuracy, and improve the local sensitivity and sparsity of features, thereby providing a more compact and discriminative feature representation for subsequent multi-scale feature fusion.

[0054] In traditional 2D convolution, the convolution kernel performs a weighted summation in both the spatial and channel dimensions; that is, each output channel is calculated from the features of all input channels. Depthwise convolution, however, employs a "channel-wise convolution" strategy, decoupling the convolution operation from the channel dimension: each input channel corresponds to an independent convolution kernel, and spatial convolution is performed only within that channel, thus avoiding cross-channel weight mixing. Formally, if the dimension of the input feature map is... ,in and These represent the height and width of the feature map, respectively. This represents the number of input channels; the number of channels in the output feature map is... The kernel size is The computational cost of standard convolution is approximately The computational cost of depthwise convolution is only... This means that its computational complexity is reduced by approximately [percentage missing] compared to standard convolution. This multiplier effect significantly improves the network's computational efficiency while maintaining its feature extraction capabilities.

[0055] However, simple depthwise convolution cannot achieve information exchange between different channels. Therefore, point-wise convolution (1×1 convolution) is usually introduced after depthwise convolution for inter-channel feature fusion. Point-wise convolution is a special type of convolution operation with a 1×1 kernel size. Its main function is to linearly combine the channel dimensions of the input feature map, achieving cross-channel information fusion. Specifically, if the dimension of the input feature map is... Pointwise convolution through Each 1×1 convolutional kernel is used for each spatial location. The channel features are weighted and summed to obtain the output feature map. This process can be viewed as performing fully connected operations at each spatial location, but since convolution operations share weights, the computational efficiency is much higher than that of direct fully connected operations. This combination of "depthmology + pointwise convolution" is called depthwise separable convolution, which significantly reduces the computational cost while maintaining feature representation capabilities.

[0056] In convolutional neural networks, the design of the nonlinear activation function directly determines the network's expressive power and gradient propagation characteristics. Traditional DBNet structures commonly use ReLU (Rectified Linear Unit) as the activation function in the feature fusion and prediction stages. This function directly sets negative inputs to zero, giving the network sparsity and thus computational efficiency. Its mathematical expression is as follows:

[0057] However, the main drawback of ReLU is the "dead ReLU" phenomenon: when some neurons remain in the negative range for an extended period, their gradients remain constant at zero, preventing weight updates and causing the network to lose its learning ability in local areas. This phenomenon is particularly prominent in workpiece coding and detection tasks because the reflectivity and uneven grayscale distribution of metal surfaces cause feature values ​​to tend to concentrate in low-intensity regions, resulting in a high proportion of negative inputs. This leads to premature suppression of some channel features, causing information loss. To improve the stability and gradient fluidity of the network, this invention replaces the traditional ReLU activation function with a Parametric Rectified Linear Unit (PReLU) in the Neck part. A comparison of the two activation functions is provided below. Figure 4 As shown.

[0058] The mathematical expression for the PReLU activation function is as follows:

[0059] in, This is a learnable parameter that controls the linear slope of the negative half-region. When... When = 0, PReLU degenerates into standard ReLU; when When the value is greater than 0, the function maintains a non-zero output on the negative half-axis, allowing the gradient to be continuously updated during backpropagation, thus effectively avoiding neuron inactivation. From a gradient perspective, the gradient expression of PReLU during backpropagation is:

[0060] This means that regardless of whether the input is positive or negative, the network can maintain a certain gradient flow, ensuring the continuity and stability of parameter updates. Learnable parameters During training, the model is adaptively adjusted according to the data distribution, so that it can still have activation response capability in areas with sparse feature distribution or low gray-level contrast.

[0061] S2. The improved SATRN model is used to perform character sequence recognition on the detected text region image.

[0062] S201. Improved Shallow Feature Extraction: An improved Shallow CNN based on SimAM-DSC is designed to replace the original Shallow CNN. This module integrates the parameter-free attention mechanism SimAM with depthwise separable convolution and uses the h-swish activation function, which can enhance the effective feature response and suppress background noise without increasing the number of parameters. SATRN (Spatial Attention Transformer Network) is an end-to-end text recognition model that combines convolutional neural networks and the Transformer architecture. This model efficiently extracts local visual features using convolutional structures and models global dependencies between characters through attention mechanisms, thus maintaining high recognition accuracy even in complex backgrounds. Unlike traditional recurrent neural network (RNN) models, SATRN abandons the time-series recursive structure, enabling the network to process the entire image in parallel, avoiding the gradient vanishing and feature loss problems in long sequence recognition. The entire model structure consists of three main parts: a Shallow CNN module for extracting low-level image structure and texture features and performing spatial compression; a Transformer encoder for global context modeling of two-dimensional features; and a Transformer decoder for mapping visual features into character sequences, achieving end-to-end recognition.

[0063] The SATRN model employs a shallow convolutional network (Shallow CNN) at the input. This module progressively extracts features and reduces spatial resolution through two convolutions, normalization, activation, and pooling operations. This two-stage structure effectively expands the receptive field, enhances feature hierarchy, and preserves character edges and local texture information while downsampling, thus providing a stable feature representation for the subsequent Transformer encoder. Its computation process is as follows:

[0064]

[0065] Final output features = This serves as the input to the Transformer encoder. Wherein, For the input image, , This involves two convolutional layers, used to extract shallow and mid-level features respectively. Batch Normalization is used to stabilize feature distribution and accelerate training convergence. This is the activation function, which can effectively suppress negative responses and enhance the nonlinear expression of the network; For max pooling, the maximum value is selected in a local window, preserving significant responses and reducing spatial dimensionality.

[0066] The SATRN model employs an improved Transformer architecture, consisting of an encoder and a decoder, to map two-dimensional visual features to character sequences. This structure, by introducing spatial awareness mechanisms and local feature modeling strategies, enables the network to maintain its ability to model global dependencies while possessing geometric adaptability to complex character layouts.

[0067] In the Encoder module, the model first receives feature maps extracted by a Shallow CNN and an A2DPE (Adaptive 2D Positional Encoding) module, and performs global context encoding on them. The encoder consists of 12 stacked attention modules, each containing both a multi-head attention unit and a locality-aware feedforward network. The multi-head attention mechanism establishes long-range dependencies across the entire feature map, enabling the network to capture the global arrangement structure between characters, thus handling irregular encoding features such as curved text lines, varying character spacing, or skewed arrangement. Unlike traditional Transformers, SATRN introduces a spatially aware design in the feedforward layer, replacing the original 1×1 convolution with a 3×3 depthwise separable convolution, thereby enabling the feedforward network to model local features. This improvement allows the encoder to retain its responsiveness to detailed textures and local character structures while modeling global attention, achieving an effective fusion of global and local information. After processing by the Encoder, the input features are transformed into a two-dimensional representation that preserves spatial structure and contextual semantics, providing sufficient semantic support for subsequent character decoding.

[0068] The Decoder module's task is to progressively decode the two-dimensional features output by the encoder into character sequences, achieving the transformation from visual features to semantic representation. The decoder consists of six stacked Transformer decoding units, each containing three core substructures: Masked Multi-head Attention, Multi-head Attention, and Point-wise Feedforward. The Masked Multi-head Attention mechanism ensures that the model can only rely on previously generated sequences when generating characters, thus maintaining autoregressive properties and preventing information leakage. The Multi-head Attention layer uses the embedded characters from the previous stage as queries, retrieving the most relevant visual regions in the encoder's output two-dimensional feature map as keys and values, thereby achieving cross-modal alignment between image features and text sequences. Finally, the Point-wise Feedforward layer consists of two 1×1 convolutional layers, used to enhance the non-linear mapping capability of features and integrate contextual information. The entire decoding process is performed in an autoregressive manner, starting from the start token and gradually predicting subsequent characters until the end token is generated, ultimately resulting in a complete character sequence output.

[0069] Through this Transformer encoder-decoder structure, SATRN achieves dual modeling capabilities in both spatial and sequence dimensions. The Encoder is responsible for capturing complementary information from global context and local details, while the Decoder uses an attention mechanism to dynamically map visual features to semantic sequences, enabling the model to exhibit higher robustness and recognition accuracy when dealing with irregular text layouts, complex backgrounds, and character deformations.

[0070] To further improve the adaptability and robustness of the original SATRN model in complex industrial scenarios, this invention optimizes its key structure and proposes a workpiece coding and recognition model based on an improved attention mechanism and a lightweight convolutional structure. This model inherits the convolutional feature extraction and Transformer sequence modeling approach of SATRN in its overall framework. It introduces a SimAM-DSC module in the shallow feature extraction part, a Flow-Attention mechanism in the attention calculation, and achieves adaptive feature weighting through an SE channel attention module. The improved model achieves complementary performance at the feature extraction, global modeling, and channel fusion levels, effectively improving the accuracy and stability in workpiece coding and recognition on metal surfaces. The process is as follows: Figure 5 As shown.

[0071] In SATRN, the Shallow CNN module extracts shallow features through convolution and pooling operations. However, for workpiece surfaces with reflective, scratched, or complex texture backgrounds, its feature responses often suffer from noise interference and spatial redundancy. Therefore, this invention improves the structure of this part, proposing an improved Shallow CNN module based on SimAM-DSC. This module combines the advantages of SimAM's parameter-free attention mechanism and depthwise separable convolution, and introduces the h-swish activation function inside the depthwise and pointwise convolutions to reduce computational complexity and information loss while enhancing feature representation capabilities. The module structure consists of two stacked convolutions, as shown below. Figure 6 As shown.

[0072] The calculation process is expressed as follows:

[0073]

[0074] Final output features = This serves as the input to the Transformer encoder. Wherein, For the input image, , This involves two convolutional layers; This is for batch normalization, used to stabilize the training process; This is the activation function. (Depthwise Separable Convolution, DSC) is a depthwise separable convolution module composed of depthwise convolution (DWC) and pointwise convolution (PWC). The activation function between the depthwise and pointwise convolutions is h-swish (Hard-swish), which improves gradient continuity through smooth nonlinear mapping, enhancing the model's feature representation ability with low complexity. Its calculation formula is as follows:

[0075] SimAM (Simple Attention Module) is a parameter-free attention mechanism. Its core idea is to model the importance of each pixel (or neuron) in the feature map using an energy function, thereby achieving feature selection without introducing additional learnable parameters. SimAM defines an energy function based on the theory of neuron information separation to measure the independence of a single neuron relative to the overall distribution. Its expression is:

[0076] in, Indicates the first The activation value of a pixel or neuron; and These represent the mean and variance of the feature map, respectively. This is an adjustment coefficient used to balance local and global energy distribution. Energy value. It represents the contribution of this location to the overall feature distribution; the lower the energy, the more discriminative the region.

[0077] To achieve feature weighting, SimAM takes the reciprocal of the energy and then uses a sigmoid mapping to generate the weight distribution:

[0078] in, ∈(0,1) represents the pixel position. Attention weights. The final feature map is obtained by element-wise weighting:

[0079] This mechanism can adaptively highlight key information regions and suppress redundant features. When combined with the DepthSepConv structure in the shallow stage, it can achieve efficient feature selection and noise reduction without increasing the number of parameters, thereby enhancing the expressive power and stability of the model.

[0080] S202. Improved Attention Mechanism: In the Transformer encoder, the Flow-Attention mechanism is used instead of the standard multi-head attention. This mechanism, by introducing probability flow and local regularization, ensures that the attention weights are continuously distributed in space, effectively suppressing attention distraction caused by reflections. This invention introduces a Flow-Attention dynamic attention mechanism into the Transformer encoder to replace the traditional multi-head attention mechanism, thereby effectively reducing computational complexity while maintaining global dependency modeling capabilities. Flow-Attention redefines attention computation from the perspective of probability flow, making attention behave as a continuous and conserved flow of information in the feature space. Its basic form can be expressed as:

[0081] in, Indicates the first Attention output for each query location; , and These represent the Query, Key, and Value vectors, respectively. The similarity function is defined as follows:

[0082] in, This is a feature mapping function used to map the input to a high-dimensional linear space, in order to reduce the complexity of exponential calculations in traditional attention.

[0083] Unlike standard attention, Flow-Attention introduces inflow and outflow constraints on the basis of similarity calculation, and performs conservation regularization on the attention calculation process, so that the total amount of information received by each Query node is balanced with the output of the Key node, thereby ensuring the continuity and interpretability of information in the network.

[0084] In its implementation, Flow-Attention uses normalization and element-wise mapping operations to create a smooth, continuous spatial distribution of attention weights, achieving a flowing attention mechanism that integrates source competition, information aggregation, and target allocation. This structure effectively suppresses attention drift caused by changes in illumination or reflective areas while maintaining global dependency modeling capabilities, and improves model robustness while preserving computational efficiency.

[0085] S203, Feature Enhancement Improvement: An SE (Squeeze-and-Excitation) channel attention module is introduced at the encoder output. Through compression-excitation operation, the channel feature response is adaptively calibrated to enhance key features related to characters.

[0086] A Squeeze-and-Excitation (SE) channel attention mechanism is introduced in the Transformer encoder output stage. By modeling the dependencies between channels, it achieves adaptive recalibration (scaling) of features from different channels. This module consists of three stages: Squeeze, Excitation, and Scale, as shown in the following structure. Figure 7 As shown.

[0087] In the Squeeze stage, global average pooling is performed on the input feature map in the spatial dimension, compressing the feature response of each channel into a scalar, thus obtaining a channel description vector containing global information. In the Excitation stage, a two-layer fully connected network performs a non-linear transformation on the channel description vector. The first layer is used for feature compression, and the second layer is used to recover the number of channels. The ReLU activation function is used between the two layers, while the output layer uses the Sigmoid function to normalize the channel weights to the range of 0 to 1. In the Scale stage, the generated channel weight vector is multiplied with the original feature map channel by channel to achieve adaptive recalibration at the channel level. Channels with larger weights are enhanced, while channels with smaller weights are suppressed, thereby strengthening the significant features related to the workpiece's encoded contour and edges, and reducing background and reflection interference. Through this mechanism, selective emphasis on channel information can be achieved, enabling the model to obtain stronger feature representation ability and robustness while maintaining a lightweight structure.

[0088] In another embodiment of the present invention, a workpiece coded image text detection and recognition system based on improved DBNet and SATRN is provided. This system can be used to implement the above-mentioned workpiece coded image text detection and recognition method based on improved DBNet and SATRN. Specifically, the workpiece coded image text detection and recognition system based on improved DBNet and SATRN includes a text detection module and a text recognition module.

[0089] The text detection module is used to detect and locate text regions in the input workpiece coded image using an improved DBNet model. The improved DBNet model introduces an efficient upsampling convolution module EUCB into the feature fusion module and replaces the activation function in the feature fusion module with a parameterized rectified linear unit PReLU. The text recognition module is used to perform character sequence recognition on the detected text region image using an improved SATRN model. In the improved SATRN model, an improved Shallow CNN based on SimAM-DSC is used to replace the original Shallow CNN; a Flow-Attention mechanism is used in the Transformer encoder to replace the standard multi-head self-attention; and an SE channel attention module is introduced at the encoder output.

[0090] This invention provides a terminal device comprising a processor and a memory. The memory stores a computer program, which includes program instructions. The processor executes the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, graphics processing units (GPUs), tensor processing units (TPUs), digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions to achieve a corresponding method flow or corresponding function. The processor described in this embodiment can be used for the operation of a workpiece encoded image text detection and recognition method based on improved DBNet and SATRN, including: An improved DBNet model is used to detect and locate text regions in the input workpiece encoded image. The improved DBNet model introduces an efficient upsampling convolutional module (EUCB) into the feature fusion module and replaces the activation function in the feature fusion module with a parameterized rectified linear unit (PReLU). An improved SATRN model is used to recognize character sequences in the detected text region image. In the improved SATRN model, an improved Shallow CNN based on SimAM-DSC replaces the original Shallow CNN. A Flow-Attention mechanism is used in the Transformer encoder to replace the standard multi-head self-attention. An SE channel attention module is introduced at the encoder output to achieve adaptive calibration of channel features.

[0091] Please see Figure 8The terminal device is a computer device. In this embodiment, the computer device 60 includes a processor 61, a memory 62, and a computer program 63 stored in the memory 62 and executable on the processor 61. When the processor 61 executes the computer program 63, it implements the workpiece coded image text detection and recognition method based on the improved DBNet and SATRN in this embodiment. To avoid repetition, these details are not elaborated here. Alternatively, when the processor 61 executes the computer program 63, it implements the functions of each model / unit in the workpiece coded image text detection and recognition system based on the improved DBNet and SATRN in this embodiment. To avoid repetition, these details are not elaborated here.

[0092] Computer device 60 can be a desktop computer, laptop, handheld computer, cloud server, or other computing device. Computer device 60 may include, but is not limited to, a processor 61 and a memory 62. Those skilled in the art will understand that... Figure 8 This is merely an example of computer device 60 and does not constitute a limitation on computer device 60. It may include more or fewer components than shown, or combine certain components, or different components. For example, computer device may also include input / output devices, network access devices, buses, etc.

[0093] The processor 61 may be a Central Processing Unit (CPU), or other general-purpose processors, graphics processing units (GPUs), tensor processing units (TPUs), digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0094] The memory 62 can be an internal storage unit of the computer device 60, such as a hard disk or RAM of the computer device 60. The memory 62 can also be an external storage device of the computer device 60, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on the computer device 60.

[0095] Furthermore, the memory 62 may include both internal storage units of the computer device 60 and external storage devices. The memory 62 is used to store computer programs and other programs and data required by the computer device. The memory 62 can also be used to temporarily store data that has been output or will be output.

[0096] Please see Figure 9 The terminal device is an electronic device 600, which is manifested in the form of a general-purpose computing device. The components of the electronic device may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including storage unit 620 and processing unit 610), a display unit 640, etc.

[0097] The storage unit stores program code, which can be executed by the processing unit 610 to perform the steps described in the method section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 610 can perform actions such as... Figure 1 The steps are shown in the figure.

[0098] Storage unit 620 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 6201 and / or cache memory 6202, and may further include a read-only memory (ROM) 6203.

[0099] Storage unit 620 may also include a program / utility 6204 having a set (at least one) program module 6205, such program module 6205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0100] Bus 630 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the multiple bus structures.

[0101] Electronic device 600 can also communicate with one or more external devices 700 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 600, and / or with any device that enables electronic device 600 to communicate with one or more other computing devices (e.g., router, modem). This communication can be performed via input / output interface 650. Furthermore, electronic device 600 can also communicate with one or more networks (e.g., local area network, wide area network, and / or public network, such as the Internet) via network adapter 660. Network adapter 660 can communicate with other modules of electronic device 600 via bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.

[0102] Example 4 This invention also provides a storage medium, specifically a computer-readable storage medium, which is a memory device in a terminal device for storing programs and data. It is understood that the computer-readable storage medium here can include both built-in storage media in the terminal device and extended storage media supported by the terminal device; it can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. The computer-readable storage medium provides storage space that stores the terminal's operating system. Furthermore, the storage space also stores one or more instructions suitable for loading and execution by a processor, which can be one or more computer programs (including program code). More specific examples of the computer-readable storage medium include: an electrical connection with one or more wires, a portable disk, a hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical fiber, portable compact disk read-only memory, optical storage device, magnetic storage device, or any suitable combination thereof.

[0103] Computer-readable storage media also include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium can also be any readable medium other than a readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium can be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, radio frequency, etc., or any suitable combination thereof.

[0104] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0105] One or more instructions stored in a computer-readable storage medium can be loaded and executed by the processor to implement the corresponding steps of the workpiece coded image text detection and recognition method based on the improved DBNet and SATRN in the above embodiments; one or more instructions in the computer-readable storage medium are loaded and executed by the processor in the following steps: An improved DBNet model is used to detect and locate text regions in the input workpiece encoded image. The improved DBNet model introduces an efficient upsampling convolutional module (EUCB) into the feature fusion module and replaces the activation function in the feature fusion module with a parameterized rectified linear unit (PReLU). An improved SATRN model is used to recognize character sequences in the detected text region image. In the improved SATRN model, an improved Shallow CNN based on SimAM-DSC replaces the original Shallow CNN. A Flow-Attention mechanism is used in the Transformer encoder to replace the standard multi-head self-attention. An SE channel attention module is introduced at the encoder output to achieve adaptive calibration of channel features.

[0106] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0107] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0108] Example 5 1) System Construction and Data Preparation An image acquisition platform was built to obtain coded images of workpieces containing interference such as metal reflections and oil stains, and a dedicated dataset containing 5,851 detection images and 4,794 recognition images was constructed.

[0109] 2) Text detection model training a) Adjust the input image size to 640×640.

[0110] b) Use ResNet34 as the backbone network for the improved DBNet model.

[0111] c) In the Neck section, the EUCB module is used for feature upsampling and fusion, and all activation functions are replaced with PReLU.

[0112] d) The Adam optimizer was used with a learning rate of 0.001, a batch size of 32, and 20 training cycles.

[0113] e) The loss function is the joint loss of the probability map, the threshold map, and the binary map.

[0114] 3) Text recognition model training a) The size of the detected text line images is uniformly set to 100×32.

[0115] b) Use the improved SATRN model, where Shallow CNN is replaced by an improved ShallowCNN based on SimAM-DSC, multi-head attention in the encoder is replaced by Flow-Attention, and an SE module is added.

[0116] c) The AdamW optimizer was used with a learning rate of 0.0005, a batch size of 128, and 200 training cycles.

[0117] d) Data augmentation methods such as random rotation, brightness adjustment, and Gaussian noise are used during training.

[0118] 4) Model Deployment and Inference The trained detection and recognition models are integrated into the inference system. After preprocessing the image to be recognized, the detection model first locates and crops the text line regions, and then the recognition model decodes the character sequence of the cropped image to finally output the recognition result.

[0119] An image acquisition platform was built to acquire coded images of workpieces containing interference such as metal reflection, oil stains, scratches, uneven lighting, and low contrast. A dedicated dataset was constructed, in which the detection dataset contains 5851 images and the recognition dataset contains 4794 images.

[0120] The experimental environment consisted of an Intel Core i7-12700K processor, an NVIDIA RTX 3090 graphics card, and PyTorch 1.12.0 software.

[0121] Experiments were conducted on a self-built workpiece coding dataset (containing 5851 detection images and 4794 recognition images), and the results show that: Detection performance: The improved DBNet model achieves an F1 score of 95.8% for text detection under interference conditions such as metallic reflection and oil stains, which is about 6.2% higher than the original DBNet model.

[0122] Recognition performance: The improved SATRN model achieves a recognition accuracy of 98.1% in complex backgrounds, which is about 4.5% higher than the original SATRN model.

[0123] Robustness test: Under extreme conditions such as strong reflection and low contrast, the performance degradation of the method of the present invention is significantly less than that of the traditional method, showing stronger environmental adaptability.

[0124] Efficiency analysis: Although the model structure has been increased, the inference speed can still meet the real-time requirements of industry through optimizations such as depthwise separable convolution.

[0125] The experimental data above fully demonstrate the superior performance of the method of the present invention in complex industrial environments, and provide an effective technical solution for the automated identification of workpiece codes.

[0126] In summary, this invention presents a text detection and recognition method for workpiece coded images based on an improved DBNet and SATRN. By introducing the EUCB module and PReLU function, it significantly improves the detection model's ability to locate text regions and the clarity of boundaries under complex working conditions such as reflection and low contrast. By integrating SimAM-DSC, Flow-Attention, and SE modules, a more robust recognition model is constructed, which is more adaptable to noise, blur, and character deformation. It achieves leading performance on a self-built workpiece coded dataset, with a detection F1 score of 95.8% and a recognition accuracy of 98.1%, providing a highly reliable technical means for industrial automation.

[0127] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0128] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0129] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0130] In the embodiments provided by this invention, it should be understood that the disclosed devices / terminals and methods can be implemented in other ways. For example, the device / terminal embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0131] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0132] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0133] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random-access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.

[0134] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus, and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0135] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0136] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0137] The above content is only for illustrating the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solution based on the technical concept proposed in this invention shall fall within the scope of protection of the claims of this invention.

Claims

1. A workpiece coded image text detection and recognition method based on improved DBNet and SATRN, characterized in that, The method comprises the following steps: S1, using an improved DBNet model to detect and locate the text region of an input workpiece coding image, wherein the improved DBNet model introduces an efficient up-sampling convolution module EUCB in a feature fusion module, and replaces the activation function in the feature fusion module with a parameterized rectified linear unit PReLU; S2, using an improved SATRN model to recognize the character sequence of the detected text region image, wherein in the improved SATRN model, an improved Shallow CNN based on SimAM-DSC is used to replace the original Shallow CNN; a Flow-Attention mechanism is used to replace the standard multi-head self-attention in the Transformer encoder; and an SE channel attention module is introduced at the output end of the encoder to realize adaptive calibration of channel features.

2. The workpiece coded image text detection and recognition method based on improved DBNet and SATRN according to claim 1, characterized in that, In step S1, the efficient up-sampling convolution module EUCB fuses features through a depth separable convolution and a point-by-point up-sampling operation.

3. The workpiece coded image text detection and recognition method based on improved DBNet and SATRN according to claim 2, characterized in that, The depth separable convolution comprises a depth convolution and a point-by-point convolution.

4. The workpiece coded image text detection and recognition method based on improved DBNet and SATRN according to claim 1, characterized in that, The parameterized rectified linear unit PReLU avoids neuron inactivation through a learnable negative interval slope parameter, and the mathematical expression is: wherein, are learnable parameters, and PReLU reduces to standard ReLU when > 0, the function keeps non-zero output on the negative half-axis.

5. The workpiece coded image text detection and recognition method based on improved DBNet and SATRN according to claim 1, characterized in that, In step S2, the improved Shallow CNN based on SimAM-DSC fuses a parameter-free attention mechanism SimAM and a depth separable convolution, and uses an h-swish activation function in the depth convolution and the point-by-point convolution.

6. The workpiece coded image text detection and recognition method based on improved DBNet and SATRN according to claim 5, characterized in that, The parameter-free attention mechanism SimAM models the importance of each pixel in the feature map through an energy function, and the energy function is defined as: wherein, represents the activation value of the i-th pixel or neuron; and respectively represent the mean and variance of the feature map, is a tuning coefficient.

7. The workpiece coded image text detection and recognition method based on improved DBNet and SATRN according to claim 6, characterized in that, The Flow-Attention mechanism makes the attention weight continuously distributed in space through probability flow and local regularization, and the basic form is represented as: wherein, denotes the attention output result for the th query position; , and denote Query, Key and Value vectors, respectively; is a similarity function.

8. The workpiece coded image text detection and recognition method based on improved DBNet and SATRN according to claim 1, characterized in that, In step S2, the SE channel attention module comprises: Compression stage: performing global average pooling on the input feature map in the spatial dimension to obtain a channel description vector; Excitation stage: performing nonlinear transformation on the channel description vector through a two-layer fully connected network to generate a channel weight; Scaling stage: multiplying the channel weight with the original feature map channel by channel.

9. The workpiece coded image text detection and recognition method based on improved DBNet and SATRN according to claim 1, characterized in that, The improved DBNet model uses ResNet34 as the backbone network; and the improved SATRN model adopts random rotation, brightness adjustment and Gaussian noise data enhancement methods in the training process.

10. A workpiece coded image text detection and recognition system based on improved DBNet and SATRN, characterized in that, The method comprises the following steps: A text detection module is configured to use an improved DBNet model to detect and locate the text region of an input workpiece coding image, wherein the improved DBNet model introduces an efficient up-sampling convolution module EUCB in a feature fusion module, and replaces the activation function in the feature fusion module with a parameterized rectified linear unit PReLU; The text recognition module is configured to recognize the character sequence of the detected text region image by using an improved SATRN model, wherein in the improved SATRN model, an improved Shallow CNN based on SimAM-DSC is used to replace the original Shallow CNN; a Flow-Attention mechanism is used to replace a standard multi-head self-attention in a Transformer encoder; and an SE channel attention module is introduced at an output end of the encoder.