Two-section container number identification method
Through the two-stage container box number identification method, including image preprocessing and multi-level feature fusion, the problem of low recognition accuracy in the prior art is solved, and higher recognition accuracy and stability are achieved.
Patent Information
- Application Number
- CN202411868047.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-12-18
AI Technical Summary
The prior art has the problem of low recognition accuracy in container number recognition, especially under different lighting, angles and background conditions, the generalization ability of the clustering method is limited and the image enhancement method is simple, which limits the model's processing ability of complex images.
A two-stage container box number identification method is proposed, including image preprocessing, box number area detection and recognition. Image preprocessing uses histogram equalization, affine transformation and brightness adjustment for data enhancement; box number area detection uses backbone network, neck network and detection head for object detection and segmentation; box number identification uses backbone network, channel attention module, neck network and deep supervision module for feature extraction and identification.
Through image preprocessing and multi-level feature fusion, the accuracy and stability of container number recognition are significantly improved, and it can better adapt to container images in different environments.
Smart Images

Figure CN119810840A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of container number recognition, and in particular relates to a two-stage container number recognition method. Background Art
[0002] In the field of port logistics, container number recognition is a crucial technology, which is of great significance for improving logistics efficiency and reducing human errors. The Chinese invention patent with publication number CN117809310A discloses a port container number recognition method and system based on machine learning, which mainly obtains container number information by directly recognizing container images. However, in practical applications, this method faces a series of challenges, resulting in the need to improve its recognition accuracy.
[0003] First, the patent uses a clustering method to locate the container number area. Although the clustering method can achieve preliminary positioning of the container number area to a certain extent, its generalization ability is relatively limited and it is difficult to adapt to container images under different lighting, angles, backgrounds and other conditions.
[0004] In addition, in terms of image enhancement, the method in this patent is relatively simple, and only adjusts the size of the image through upsampling and downsampling, without further optimizing the image's contrast, position, shape, brightness and other attributes. This simple image enhancement method limits the model's ability to process complex images, further affecting recognition accuracy.
[0005] In view of the above problems, the present invention proposes a two-stage container number recognition method. Summary of the invention
[0006] In order to overcome the problems in the prior art, the present invention proposes a two-stage container number recognition method.
[0007] The technical solution of the present invention to solve the above technical problems is as follows:
[0008] The present invention provides a two-stage container number recognition method, comprising the following steps: step 100: acquiring a container image and performing image preprocessing on the container image; step 200: detecting and segmenting a container number area based on the preprocessed image; step 300: identifying the container number based on the identified and segmented container number area.
[0009] In step 100, the container image is preprocessed, including data enhancement of the collected container image, including histogram equalization, affine transformation, and brightness adjustment.
[0010] Furthermore, in the step 200, a box number region detection algorithm is used to detect and locate the box number region, wherein the box number region recognition algorithm includes a backbone network, a neck network and a detection head connected in sequence;
[0011] The preprocessed container image is input into the backbone network to extract key features; the extracted key features are input into the neck network for feature fusion and optimization; the fused features are input into the detection head to predict and locate the container number area; and the container number area is segmented and extracted according to the prediction results.
[0012] Furthermore, in step 300, a box number recognition algorithm is used to recognize the segmented box number area, and the box number recognition algorithm includes a backbone network, a channel attention module, a neck network, a deep supervision module and a detection head;
[0013] The backbone network, the channel attention module, the neck network and the detection head are connected in sequence, and the channel attention module is connected after the neck network;
[0014] The segmented box number area is input into the backbone network, the backbone network outputs the features of the box number area, the attention module performs weighted processing on the features, the neck network fuses and optimizes the weighted features; the deep supervision module upsamples and additionally supervises the output of the neck network; the detection head outputs the recognition result.
[0015] Furthermore, the channel attention module includes a pooling layer and a fully connected layer; a full pooling operation is performed on the original feature map output by the backbone network to comprehensively capture the feature information of each channel; a fully connected layer is used to deeply calculate the specific weight of each channel for the detection task; then, the calculated attention weight is multiplied element by element with the original feature map output by the backbone network to generate a weighted feature representation.
[0016] Furthermore, the deep supervision module includes upsampling and a deep supervision detection head; in the deep supervision module, upsampling processing is performed on the features after neck network fusion optimization, and preliminary detection is performed through the deep supervision detection head, and the label supervises and guides the prediction results of the deep supervision detection head.
[0017] Furthermore, MPDIoU is used as the loss function in the training stage.
[0018] Further, the backbone network includes a CBS module, a VCB module, an RCB module, and an RBF module;
[0019] The CBS module and VCB module are used to extract and save image features; the RCB module helps learn deeper feature representations by introducing residual connections; the RBF module is used to further enhance the model’s feature extraction capabilities and the comprehensiveness of spatial information capture.
[0020] Furthermore, the VCB module includes a variable convolution layer, a BN layer and a SiLu activation function connected in sequence.
[0021] Furthermore, the CBS module includes a convolutional layer, a BN layer and a SiLu activation function.
[0022] Compared with the prior art, the present invention has the following technical effects:
[0023] The present invention first performs image preprocessing on the container image, and then uses the container number region detection algorithm to detect and segment the container number region of the image, wherein the backbone network is responsible for extracting the key features of the image, the neck network performs efficient fusion processing on these features, and the detection head predicts the specific location of the container number region based on the fused features. Finally, the container number recognition algorithm is used to accurately identify the segmented container number region, wherein the channel attention enhancement model is used to enhance the accuracy of container number recognition after the backbone network extracts features, and the deep supervision module is used to enhance the feature extraction ability of the network after the neck network fuses features. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 is a flow chart of the present invention;
[0026] Figure 2 It is a flow chart of the box number area detection algorithm of the present invention;
[0027] Figure 3 It is a flow chart of the box number recognition algorithm of the present invention;
[0028] Figure 4 A model diagram of the backbone network of the present invention;
[0029] Figure 5 A model diagram of the neck network of the present invention;
[0030] Figure 6 It is a model diagram of each module of the present invention. DETAILED DESCRIPTION
[0031] In order to further explain the technical means and effects taken by the present invention to achieve the predetermined invention purpose, the specific implementation methods, structures, features and effects of the technical solutions proposed by the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments. The specific features, structures or characteristics in one or more embodiments may be combined in any suitable form. Unless otherwise defined, all technical and scientific terms used in the present invention have the same meaning as those commonly understood by technicians in the technical field of the present invention.
[0032] The present invention discloses a two-stage container number recognition method, which firstly performs image enhancement such as histogram equalization, radiation transformation, brightness adjustment, etc. on the container image; then uses a container number area detection algorithm to perform target detection on the enhanced image, identifies and segments the container number area; finally uses a container number recognition algorithm to recognize the container number in the container number area.
[0033] In one embodiment of the present invention, referring to Figure 1-Figure 6 , provides a two-stage container number recognition method, comprising the following steps: Step 100: Acquire a container image and perform image preprocessing on the container image; Step 200: Detect and segment the container number area based on the preprocessed image; Step 300: Based on the identified and segmented container number area, recognize the container number.
[0034] The following is a detailed explanation of each of the above steps:
[0035] Step 100: Acquire a container image and perform image preprocessing on the container image.
[0036] Due to the influence of various factors such as shooting environment, lighting conditions, shooting angle, etc., the acquired container images often have problems such as insufficient contrast, position offset, inconsistent size, distorted shape and uneven brightness. These problems not only increase the difficulty of image recognition, but may also lead to a decrease in the performance of subsequent recognition models in practical applications.
[0037] In order to improve the model's ability to recognize container images in multiple environments, this embodiment uses image data enhancement technologies such as histogram equalization, affine transformation, and brightness adjustment to adjust the contrast, position, size, shape, brightness and other attributes of the container image, thereby achieving effective image enhancement.
[0038] Histogram equalization is a commonly used image contrast enhancement technology. It adjusts the grayscale histogram of the image to make the grayscale value distribution of the image more uniform, thereby enhancing the image contrast. In container image recognition, histogram equalization can effectively improve the problem of insufficient image contrast caused by uneven lighting or differences in shooting equipment, making the container number area clearer and facilitating subsequent feature extraction and recognition.
[0039] Affine transformation is a two-dimensional coordinate transformation, including operations such as translation, rotation, scaling, and shearing. In container image recognition, affine transformation can be used to adjust the position, size, and shape of the image. By simulating container images at different shooting angles and distances, affine transformation can increase the diversity of training data, enabling the model to better adapt to complex scenarios in practical applications. At the same time, affine transformation can also be used to correct image distortion caused by shooting angles and improve recognition accuracy.
[0040] Brightness adjustment is a simple image enhancement technology that changes the brightness of an image by adjusting the brightness value of the image. In container image recognition, brightness adjustment can be used to deal with image recognition problems under different lighting conditions. By increasing or decreasing the brightness value of the image, the container number area can maintain a clear visual effect under different lighting conditions, thereby improving the stability and accuracy of recognition.
[0041] Step 200: Detect and segment the box number area based on the pre-processed image.
[0042] The box number area detection algorithm is used to detect and locate the box number area. The box number area recognition algorithm includes a backbone network, a neck network and a detection head. The backbone network is used to extract the key features of the preprocessed image, the neck network performs efficient fusion processing on the key features, and the detection head is used to predict the specific location of the box number area based on the fused features.
[0043] Reference Figure 2 , the preprocessed container image is input into the backbone network to extract key features; the extracted key features are input into the neck network for feature fusion and optimization; the fused features are input into the detection head to predict and locate the container number area; according to the prediction results, the container number area is segmented and extracted for subsequent character recognition and other processing.
[0044] Reference Figure 4 The backbone network includes CBS module, VCB module, RCB module and RBF module. First, multiple CBS modules and VCB modules are used to extract and save image features; then, the RCB module with residual structure is used to ensure that the model can learn stably during training to avoid gradient explosion; finally, the RBF module is used to further improve the model's feature extraction ability and the comprehensiveness of spatial information capture.
[0045] Reference Figure 6The CBS module includes a convolutional layer Conv, a BN layer, and a SiLu activation function, which is designed to efficiently extract features from the pre-processed container image input. Among them, the SiLU activation function has a smooth nonlinear characteristic and can provide different output responses in different input ranges, thereby improving the expressiveness of the model and making the network easier to converge during training.
[0046] The VCB module includes a variable convolution layer, a BN layer, and a SiLu activation function. Among them, the deformable convolution introduces a two-dimensional offset to flexibly adjust the sampling position of the standard convolution. This local, dense, and adaptive deformation mechanism completely relies on the input features and can better adapt to the spatial changes of the input data at the shallow stage of the network, thereby greatly improving the accuracy and robustness of feature extraction. Therefore, the VCB module can realize adaptive feature extraction, normalization processing, and nonlinear transformation of the input data.
[0047] The RCB module adopts a residual structure, which effectively avoids the gradient explosion problem that may occur during model training. The RBF module, through a multi-branch structure composed of convolutional layers with different sizes of convolutional kernels and dilated convolutional layers with different dilation rates, realizes the weighted fusion of global and local features, enhancing the model's feature extraction capability and the comprehensiveness of spatial information capture.
[0048] Specifically, the backbone network includes a first CBS module, a first VCB module, a second CBS module, a first RCB module, a second VCB module, a second RCB module, a third CBS module, an RBF module, a fourth RCB module, and a fourth CBS module connected in sequence. The first CBS module is used to extract initial features from the input container image, the first VCB module performs adaptive feature extraction and transformation on the initial features, the second CBS module is used to further extract features, the first RCB module adopts a residual structure to avoid gradient explosion, the second VCB module performs adaptive feature extraction again, the second RCB module continues to use a residual structure for stable learning, the third CBS module extracts deeper features, the RBF module realizes weighted fusion of global and local features, the fourth RCB module further stabilizes learning, and the fourth CBS module outputs the final extracted features for use by the neck network and the detection head. Among them, the first RCB module outputs the first feature map Map1, the second RCB module outputs the second feature map Map2, and the fourth CBS module outputs the third feature map Map3.
[0049] Reference Figure 5 The neck network fuses the different levels of features generated by the backbone network through the RCB module and the CBS module to enhance the diversity and robustness of the features. At the same time, the features are also reduced and increased in dimension to meet the detection requirements of the subsequent detection head.
[0050] The neck network uses methods such as cascading and upsampling to make up for the low-level feature information that may be lost in the convolution operation in the backbone network. Specifically, the neck network adjusts the deep feature information to the same size as the low-level feature information through upsampling technology and performs feature fusion. This process not only fuses the multi-level features extracted from the backbone network, but also enhances the feature representation, significantly improving the accuracy and robustness of the network for target detection.
[0051] Specifically, the resolution of the third feature map Map3 is first adjusted by upsampling technology to match the resolution of the second feature map Map2; the fused feature map Fusion_Map2_3 is used as the input of the subsequent module; Fusion_Map2_3 passes through the fifth RCB module and the fifth CBS module in turn, and these two modules are used to enhance feature representation and further extract features, respectively. The processed feature map is called Processed_Map_After_5RCB_5CBS; the Processed_Map_After_5RCB_5CBS adjusts its resolution by upsampling technology to match the resolution of the first feature map Map1, and the fused feature map Fusion_Map1_Processed is used as the input of the sixth RCB module; after being processed by the sixth RCB module, Fusion_Map1_Processed outputs the feature map F1.
[0052] The feature map output by the sixth RCB module is processed by the sixth CBS module, and then feature fused with Fusion_Map1_Processed. The fused feature map is used as the input of the seventh RCB module. The fused feature map is processed by the seventh RCB module to output feature map F2.
[0053] The feature map output by the seventh RCB module is processed by the seventh CBS module, and then feature fused with the original third feature map Map3. The fused feature map is used as the input of the eighth RCB module. After the fused feature map is processed by the eighth RCB module, the feature map F3 is finally output.
[0054] Reference Figure 6 The detection head consists of multiple detection layers, each of which consists of a series of convolutional layers, normalization layers, and activation function layers. These layers further process and transform the input feature map to extract key information for target detection. Finally, the detection head maps the feature map to the output space of target detection, outputting information such as the location coordinates of the box number, the category prediction probability, and the confidence.
[0055] In the training phase, MPDIoU is used as the loss function L MPDIoU , the formula is as follows:
[0056]
[0057] Among them, IoU represents the traditional intersection-over-union ratio, d1 represents the distance between the upper left corner of the predicted bounding box and the actual labeled bounding box, d2 represents the distance between the lower right corner of the predicted bounding box and the actual labeled bounding box, w represents the width of the bounding box, and h represents the height of the bounding box. By introducing these additional distance metrics, MPDIoU can more accurately measure the similarity between bounding boxes and improve the accuracy of the model.
[0058] Step 300: Based on identifying and segmenting the box number area, identify the box number.
[0059] The box number recognition algorithm is used to accurately identify the segmented box number area. The box number recognition algorithm includes a backbone network, a channel attention module, a neck network, a deep supervision module and a detection head. A channel attention module is added between the backbone network and the neck network to improve the accuracy of box number recognition; after the neck network fuses features, a deep supervision module is used to enhance the network's feature extraction capability.
[0060] The backbone network is used to extract key features, and a channel attention module is added between the backbone network and the neck network. The channel attention module first performs a global average pooling operation to fully capture the feature information of each channel; then, a fully connected layer is used to deeply calculate the specific weight of each channel for the detection task; then, these calculated attention weights are element-by-element multiplied with the original feature map output by the backbone network to generate a weighted feature representation; this process realizes the dynamic adjustment of the weights of each channel, enabling the detection network to focus more accurately on the box number area, thereby significantly improving the accuracy of box number detection.
[0061] The neck network is used to further process and fuse the features processed by the channel attention module. The neck network fuses the different levels of features generated by the backbone network through the RCB module and the CBS module to enhance the diversity and robustness of the features. At the same time, it also reduces and increases the dimensions of the features to meet the needs of the subsequent deep supervision module.
[0062] Reference Figure 6 The deep supervision module includes deconvolution, BN layer, activation function layer and deep supervision detection head. In the deep supervision module, upsampling and other processing are performed on the features after neck network fusion optimization, and preliminary detection is performed through the deep supervision detection head. The label directly supervises and guides the prediction results of the deep supervision detection head, realizing the direct supervision of the label on the deep features. The label is a model-guided label, and the box number position is obtained by professionals using labelme software. This enhances the backbone network's ability in feature extraction, thereby improving the accuracy and efficiency of the entire box number recognition algorithm.
[0063] The detection head is the output part of the bin number recognition algorithm. The detection head consists of multiple detection layers, each of which consists of a 3x3 convolution layer, a normalization layer, and an activation function layer. These layers further fuse the input feature map to extract key information for target detection. Finally, the feature map is mapped to the output space of target detection through a 1x1 convolution, and the location coordinates of the bin number, the category prediction probability, and the confidence level are output. MPDIoU is used as the loss function in the training stage.
[0064] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.
Claims
1. A two-stage container number recognition method, characterized in that: The following steps are involved: Step 100: Acquire a container image and perform image preprocessing on the container image; Step 200: Detect and segment the box number area based on the pre-processed image; Step 300: Based on identifying and segmenting the box number area, identify the box number.
2. A two-stage container number recognition method according to claim 1, characterized in that: In step 100, the container image is preprocessed, including data enhancement of the collected container image, including histogram equalization, affine transformation, and brightness adjustment.
3. A two-stage container number recognition method according to claim 1, characterized in that: In step 200, a box number region detection algorithm is used to detect and locate the box number region, wherein the box number region recognition algorithm includes a backbone network, a neck network and a detection head connected in sequence; The preprocessed container image is input into the backbone network to extract key features; the extracted key features are input into the neck network for feature fusion and optimization; the fused features are input into the detection head to predict and locate the container number area; and the container number area is segmented and extracted according to the prediction results.
4. A two-stage container number recognition method according to claim 1, characterized in that: In step 300, a box number recognition algorithm is used to recognize the segmented box number area, and the box number recognition algorithm includes a backbone network, a channel attention module, a neck network, a deep supervision module and a detection head; the backbone network, the channel attention module, the neck network and the detection head are connected in sequence, and the channel attention module is connected after the neck network; The segmented box number area is input into the backbone network, and the backbone network outputs the features of the box number area. The features are weighted through the attention module, and the neck network fuses and optimizes the weighted features; the deep supervision module upsamples and additionally supervises the output of the neck network; and the detection head outputs the recognition result.
5. A two-stage container number recognition method according to claim 4, characterized in that: The channel attention module includes a pooling layer and a fully connected layer; a full pooling operation is performed on the original feature map output by the backbone network to fully capture the feature information of each channel; and a fully connected layer is used to deeply calculate the specific weight of each channel for the detection task; Subsequently, the calculated attention weights are multiplied element-wise with the original feature map output by the backbone network to generate a weighted feature representation.
6. A two-stage container number recognition method according to claim 5, characterized in that: The deep supervision module includes upsampling and a deep supervision detection head; in the deep supervision module, upsampling processing is performed on the features after neck network fusion optimization, and preliminary detection is performed through the deep supervision detection head, and the label supervises and guides the prediction results of the deep supervision detection head.
7. A two-stage container number recognition method according to claim 3 or 4, characterized in that: MPDIoU is used as the loss function in the training stage.
8. A two-stage container number recognition method according to claim 3 or 4, characterized in that: The backbone network includes a CBS module, a VCB module, an RCB module, and an RBF module; The CBS module and VCB module are used to extract and save image features; the RCB module helps learn deeper feature representations by introducing residual connections; the RBF module is used to further enhance the model’s feature extraction capabilities and the comprehensiveness of spatial information capture.
9. A two-stage container number recognition method according to claim 8, characterized in that: The VCB module includes a variable convolution layer, a BN layer and a SiLu activation function connected in sequence.
10. A two-stage container number recognition method according to claim 8, characterized in that: The CBS module includes a convolutional layer, a BN layer and a SiLu activation function.
Citation Information
Patent Citations
Port container number identification method and system based on machine learning
CN117809310A
Container weak and small serial number target detection and identification method based on deep learning
CN117253154A
Feature correlation-based osteosarcoma CT image lesion area detection method and system
CN118587217A
Container identification method
CN118644868A
Fire detection method, apparatus and device based on deep learning, and medium
WO2024109873A1