A ship number recognition method and system for complex scenes
By combining the C2f_IRMB_DRB module and the learned positional encoding LPE, image features are enhanced, and a multi-head self-attention mechanism and a feedforward neural network are applied to solve the problem of ship number recognition in complex scenarios, achieving high-precision and robust ship number recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2026-03-17
AI Technical Summary
Existing ship number identification technologies struggle to achieve good synergy between detection and identification processes in complex marine environments, and perform poorly under conditions of occlusion and blurring, failing to meet the application needs of real-world marine environments.
Image feature enhancement is performed using the C2f_IRMB_DRB module based on the Inverse Residual Moving Block Network (IRMB) and the DRB network. The Learned Position Encoding (LPE) and multi-head self-attention mechanism are introduced, and combined with the Feedforward Neural Network (FFN), image processing and recognition are performed through TPS transform and SVTR model, and finally the ship number is output.
It improves robustness and recognition accuracy in complex marine environments, making it suitable for actual maritime ship monitoring and management, and demonstrating higher stability and feature extraction capabilities.
Smart Images

Figure CN119672694B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image recognition technology and relates to a method and system for ship number recognition in complex scenarios. Background Technology
[0002] With the rapid growth of global maritime trade and the increasing urgency of maritime surveillance and safety management, rapid and accurate vessel identification has become a crucial aspect of maritime management. Vessel registration numbers, as key identifiers, are of paramount importance in maritime monitoring and law enforcement activities due to the accuracy and efficiency of their identification technology. However, existing vessel registration number identification technologies still face numerous challenges in the face of complex marine environments and urgently require improvement.
[0003] Currently, ship number recognition technology faces several challenges: First, ship numbers are typically located at different positions on the hull, and their size and length vary significantly across different types of vessels. This irregularity increases the difficulty of automated detection and recognition. Second, adverse weather conditions, complex sea environments, and visual blurring and occlusion caused by ship movement all significantly affect the accuracy of ship number recognition. Furthermore, existing ship number datasets are relatively scarce, limiting the data support available for related research and further complicating technological development.
[0004] Early research primarily employed classic deep convolutional neural networks (DCNNs) for ship number recognition. For example, several model architectures based on object detection and character recognition have been proposed. While these methods perform well in single scenarios, they often lack sufficient robustness in complex environments. Furthermore, in recent years, some researchers have proposed improved methods, such as using perspective-based character detection and recognition algorithms to enhance the accuracy of low-resolution ship number recognition. However, most of these methods only optimize a single detection or recognition stage, failing to achieve a good synergistic effect between the detection and recognition processes. Simultaneously, existing solutions still have limitations in addressing issues such as occlusion and blurring in complex scenes. Most technologies are inadequate in handling the variable appearance of ship numbers and blurred scenes, failing to meet the application requirements of ship number recognition in real-world marine environments. Summary of the Invention
[0005] The purpose of this invention is to address the problem that existing technologies only optimize a single step of detection or identification, failing to achieve good synergy between the detection and identification processes. At the same time, most technologies are insufficient in handling the variable appearance of ship numbers and blurred scenes in complex scenarios, and cannot meet the application requirements of ship number identification in actual marine environments. This invention provides a ship number identification method and system for complex scenarios.
[0006] To achieve the above objectives, the present invention employs the following technical solution:
[0007] A method for ship number recognition in complex scenarios includes:
[0008] Based on the collected videos of ships in the port, ship images containing several ship number information are obtained to construct a ship image dataset.
[0009] Based on the Inverse Residual Moving Block Network (IRMB) and DRB network, a C2f_IRMB_DRB module is constructed. The C2f_IRMB_DRB module is a reparameterized window attention module.
[0010] Image features of the ship image dataset are enhanced based on the C2f_IRMB_DRB module;
[0011] Learned Position Encoding (LPE) is introduced into the AIFI_LPE module, and new ship number features containing position information are obtained based on the ship image dataset with enhanced image features.
[0012] Based on the characteristics of the new ship number containing location information, and Multi-head self-attention mechanism Layers and a feedforward neural network (FFN) are used to obtain further enhanced image regions;
[0013] The ship's number is obtained by identifying the enhanced image region.
[0014] A further improvement of the present invention is that:
[0015] Furthermore, based on the collected port videos, ship images containing several ship number information are obtained to construct a ship image dataset. Specifically, the ship dataset is labeled with ship numbers using labelimg software, and the ship number of each image is marked using PaddleLabel software, resulting in a txt file containing all ship number information, with each line recording the image address and the corresponding ship name information.
[0016] Furthermore, the image features of the ship image dataset are enhanced based on the C2f_IRMB_DRB module, specifically as follows:
[0017] The IRMB_DRB module extends the output / input ratio to λ. Expand channel dimensions;
[0018] Image features are further enhanced based on the extended window multi-head attention mechanism EW-MHSA and the DRB_DW-Conv module in the IRMB_DRB module;
[0019] Based on the contraction where the inverse input / output ratio equals λ Shrink the channel size and obtain the final output based on the residual connection.
[0020] Furthermore, the IRMB_DRB module is extended by an output / input ratio of λ. Expanding channel dimensions, specifically:
[0021] (1)
[0022] in, Image of ship number; X= = ; , , These are the value matrix, query matrix, and key matrix, respectively.
[0023] The DRB_DW-Conv module, based on the extended window multi-head attention mechanism EW-MHSA and the IRMB_DRB module, further enhances image features, specifically:
[0024] (2)
[0025] Where skip is a skip connection;
[0026] The contraction based on the inverse input / output ratio being equal to λ The channel size is reduced as follows:
[0027] (3)
[0028] The final output obtained from the residual connection is specifically as follows:
[0029] (4)
[0030] Furthermore, the Learned Position Encoding (LPE) is introduced into the AIFI_LPE module, and based on the enhanced image feature dataset of ships, a new ship number feature containing position information is obtained, specifically:
[0031] The input ship number feature X is combined with the learned position code LPE to generate a new feature containing position information P, as shown in formula (5):
[0032] (5)
[0033] After obtaining new features containing location information P Then, Q, K, and V are obtained through linear transformation, as shown in formula (6):
[0034] , , (6)
[0035] in, It is a query weight matrix, used to weight the input features. Mapped to query matrix Q; It is a key weight matrix, used to weight the input features. Mapped to the key matrix K; It is a value weight matrix, used to weight the input features Mapped to the value matrix V.
[0036] Furthermore, based on new ship number features containing location information, and a self-attention mechanism... Multi-head self-attention mechanism Layers and a feedforward neural network (FFN) are used to obtain further enhanced image regions, specifically:
[0037] New feature representation The self-attention mechanism is applied above to calculate the attention distribution and obtain the self-attention output by weighted summation, as shown in equation (7):
[0038] (7)
[0039] Among them, softmax() is the normalization function. Let K be the dimension of the key matrix. This is the transpose of the key matrix K;
[0040] based on The multi-head self-attention mechanism concatenates the outputs of multiple self-attention heads and performs a linear transformation, enabling the model to focus on different information in parallel in different subspaces; the formula is shown in equation (8):
[0041] (8)
[0042] in, The weight matrix is calculated for each head as follows:
[0043]
[0044] based on Layer normalization and residual connections ensure the capture of detailed information in complex scenes. The formula is shown in equation (9):
[0045] (9)
[0046] The nonlinear expressive power of the model is enhanced by the feedforward neural network FFN, and the final output is obtained again through layer normalization and residual connection, as shown in Equation (10):
[0047] (10).
[0048] Furthermore, the enhanced image region is then identified to obtain the ship's number, specifically:
[0049] The areas where the ship number was detected were divided into clear images and low-quality images;
[0050] For low-quality images, Gaussian blurring is applied, and contrast enhancement is used to improve the difference between different gray levels in the image.
[0051] Image sharpening is performed based on the Laplacian algorithm to enhance the visual quality of the image;
[0052] Based on the TPS transform algorithm, the control points of the enhanced image and the clear image are mapped, and features are extracted according to the PP-LCNet network;
[0053] The SVTR model is used to further process and enhance the image after feature extraction. The features are passed to a fully connected layer, and the output is a character sequence. , and obtain the ship's number.
[0054] Furthermore, for low-quality images, Gaussian blur processing is applied to the original image, specifically as follows:
[0055] (11)
[0056] Where I represents the detected ship number region, Let be a two-dimensional Gaussian kernel with standard deviation σ, and ∗ denote the convolution operation;
[0057] The enhancement of contrast to improve the difference between different gray levels in an image specifically involves:
[0058] (12)
[0059] in, α is the minimum grayscale value of the image, β is the scaling factor used to adjust the image contrast, and β is the offset used to adjust the image brightness.
[0060] The image sharpening process based on the Laplacian algorithm, which enhances the visual quality of the image, specifically involves:
[0061] (13)
[0062] Where k is the sharpening factor. For the Laplace operator.
[0063] Furthermore, based on the TPS transform algorithm, the control points of the enhanced image and the clear image are mapped, specifically as follows:
[0064] The goal of the TPS transform algorithm is to find a transform function. , making control points Mapped to The transformation process is shown in equations (14) and (15):
[0065] (14)
[0066] (15)
[0067] Where, U= These are radial basis functions used to model the influence between control points; , , These are the coefficients of the affine transformation, responsible for the global linear transformation; These are weights associated with each control point, controlling local nonlinear deformation;
[0068] The SVTR-based model further processes and enhances the feature-extracted image, passing the features to a fully connected layer and outputting a character sequence. The ship's number was obtained, specifically:
[0069] Construct loss functions based on the SVTR model: CTC Loss and Attention Loss;
[0070] The CTC Loss calculation process is shown in equation (16):
[0071] (16)
[0072] in, This represents the probability distribution sequence output by the SVTR model; Represents the target label sequence; This represents a path, i.e., the output of the SVTR model at each step; It is the set of all paths, and the path set is equal to l after removing whitespace and duplicate tags;
[0073] The Attention Loss calculation process is shown in Equation (17):
[0074] (17)
[0075] in, It is the true distribution of the target label for character c at time step t. It is the probability that the model predicts character c at time step t.
[0076] The character sequence The calculation process is shown in equation (18):
[0077] (18)
[0078] in, Given an input image, L is a candidate character sequence, and arg max represents the sequence of characters selected from the candidate set that has the conditional probability of being true. The largest character sequence is output, and arg max represents selecting the character sequence L that maximizes the conditional probability P(L|I); T is the number of steps in the probability distribution sequence output by the model, i.e., the length of the sequence after feature extraction, enhancement, and mapping. This represents the conditional probability of the output character of the model at time step t.
[0079] A ship number recognition system for complex scenarios includes:
[0080] The first acquisition module acquires ship images containing several ship number information based on the collected ship videos in the port, and constructs a ship image dataset.
[0081] The construction module is based on the Inverse Residual Moving Block Network (IRMB) and the DRB network, and constructs the C2f_IRMB_DRB module.
[0082] The enhancement module enhances the image features of the ship image dataset based on the C2f_IRMB_DRB module;
[0083] The second acquisition module introduces the Learned Position Encoding (LPE) into the AIFI_LPE module and, based on the enhanced image feature-rich ship image dataset, acquires new ship number features containing location information.
[0084] The third acquisition module is based on the new ship number feature containing location information and a self-attention mechanism. Multi-head self-attention mechanism Layers and a feedforward neural network (FFN) are used to obtain further enhanced image regions;
[0085] The identification module identifies the enhanced image region to obtain the ship's number.
[0086] Compared with the prior art, the present invention has the following beneficial effects:
[0087] This invention enhances the image features of a ship image dataset using the C2f_IRMB_DRB module and introduces Learned Position Encoding (LPE) into the AIFI_LPE module. Based on the enhanced image features of the ship image dataset, it obtains new ship number features containing location information. Then, based on these new ship number features containing location information and a self-attention mechanism... Multi-head self-attention mechanism The invention employs layers and a feedforward neural network (FFN) to acquire further enhanced image regions; then, the enhanced image regions are identified to obtain the ship's number. This invention exhibits higher robustness and stability in complex marine environments, ensuring the accuracy of feature extraction and recognition, and is suitable for practical maritime ship monitoring and management applications. Attached Figure Description
[0088] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0089] Figure 1 This is a flowchart illustrating the ship number recognition method for complex scenarios according to the present invention.
[0090] Figure 2 This is an overall block diagram of the ship number recognition method for complex scenarios according to the present invention;
[0091] Figure 3 This is a structural diagram of the C2f_IRMB_DRB module of the present invention;
[0092] Figure 4 This is a structural diagram of the AIFI_LPE module of the present invention;
[0093] Figure 5 This is a structural diagram of the identification module of the present invention;
[0094] Figure 6 This is a schematic diagram of the ship number recognition system for complex scenarios according to the present invention;
[0095] Figure 7 The AP value trend of this invention and different classic algorithms after 400 rounds of training;
[0096] Figure 8 The trend of R-values in this invention and different classic algorithms after 400 training rounds;
[0097] Figure 9The identification results of different algorithms are as follows: (a) the VITSTR algorithm identifies the ship number Qionghaikouyu 21019 as Wanhaikouhai 21019; (b) the CRNN algorithm identifies the ship number Qionghaikouyu 21019 as Bohaikoulu 21019; (c) the SEED algorithm identifies the ship number Qionghaikouyu 21019 as Bohaikouzao 21019; and (d) the present invention identifies the ship number Qionghaikouyu 21019 as Qionghaikouyu 21019.
[0098] Figure 10 The images show the recognition results of the present invention under different environments, where (a) is a blurred scene, (b) is a scene where the boat license plate is eroded, (c) is a scene where the boat license plate is obscured, (d) is a scene under bad weather, and (e) is a scene in Beijing containing complex text information. Detailed Implementation
[0099] 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 embodiments of the present invention, and not all embodiments. 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.
[0100] Therefore, the following detailed description of the embodiments of the 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 invention without inventive effort are within the scope of protection of the invention.
[0101] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0102] In the description of the embodiments of the present invention, it should be noted that if terms such as "upper," "lower," "horizontal," or "inner" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of the invention is in use, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention. Furthermore, terms such as "first" and "second" are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0103] Furthermore, the use of the term "horizontal" does not imply that the component must be absolutely horizontal, but rather that it can be slightly tilted. For example, "horizontal" simply means that its direction is more horizontal than "vertical," and does not mean that the structure must be completely horizontal, but can be slightly tilted.
[0104] In the description of the embodiments of the present invention, it should also be noted that, unless otherwise explicitly specified and limited, the terms "set," "install," "connect," and "link" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention according to the specific circumstances.
[0105] The present invention will now be described in further detail with reference to the accompanying drawings:
[0106] See Figure 1 This invention discloses a method for ship number recognition in complex scenarios, including:
[0107] S101: Based on the collected video of ships in the port, obtain ship images containing several ship number information and construct a ship image dataset;
[0108] See Figure 2 The present invention provides an overall block diagram of a ship number recognition method for complex scenarios. The ship dataset is labeled with ship numbers using the labelimg software, and the ship number of each image is marked using the PaddleLabel software, resulting in a txt file containing all ship number information. Each line records the address of the image and the corresponding ship name information.
[0109] S102: Based on the Inverse Residual Moving Block Network (IRMB) and DRB network, construct the C2f_IRMB_DRB module, which is a reparameterized window attention module;
[0110] By combining the concept of the Inverse Residual Moving Block (IRMB) network, high-quality features are captured while balancing computational cost, improving both computational efficiency and recognition accuracy. This results in more accurate ship number detection and identification in complex marine environments. The module's structure diagram is shown below. Figure 3 As shown.
[0111] The IRMB_DRB module has two characteristics. The first characteristic is... It integrates depthwise convolution and reparameter recalculation techniques to form a more powerful and flexible convolution module. It adds the ability of dilated convolution to the foundation of depthwise convolution, enabling the model to handle more complex feature patterns while maintaining computational efficiency. The second feature is that it continues the IRMB module's use of expanded window EW-MHSA to more efficiently compute the attention matrix using the unamplified input image X, while only using the amplified value Xe for V (Value). This avoids the need for squaring the number of channels involved in calculating the Q (Query) and K (Key) matrices, as in traditional window-based multi-head self-attention mechanisms (W-MHSA), thus reducing computational complexity and improving efficiency.
[0112] S103: Enhancement of image features in ship image datasets based on C2f_IRMB_DRB module;
[0113] The IRMB_DRB module extends the output / input ratio to λ. Expand channel dimensions;
[0114] (1)
[0115] in, Image of ship number; X= = ; , , These are the value matrix, query matrix, and key matrix, respectively.
[0116] Image features are further enhanced based on the extended window multi-head attention mechanism EW-MHSA and the DRB_DW-Conv module in the IRMB_DRB module;
[0117] (2)
[0118] Where skip is a skip connection;
[0119] Based on the contraction where the inverse input / output ratio equals λ Shrink channel size;
[0120] (3)
[0121] The final output obtained from the residual connection is specifically as follows:
[0122] (4)
[0123] The C2f_IRMB_DRB module is repeatedly used at different scale layers, especially at layers with increased channel counts (128, 256, 512, and 1024 channels), progressively extracting and enhancing image features. The introduction of the C2f_IRMB_DRB module enhances the capabilities of large kernel convolutions, giving the entire module both the ability to capture local details (the role of small kernel convolutions) and a broad field of view (the characteristics of large kernel convolutions), while maintaining computational efficiency. This allows the network to acquire information from different angles, improving feature representation capabilities and thus offering greater advantages in handling ambiguous ship numbers. After progressively extracting and enhancing image features from the original image, the problem of variable ship number sizes and shapes during the detection stage is addressed.
[0124] S104: Introduce Learned Position Encoding (LPE) into the AIFI_LPE module, and obtain new ship number features containing position information based on the ship image dataset after enhancing image features;
[0125] The structure of the AIFI_LPE module is as follows: Figure 4 As shown, the AIFI_LPE module is located at the end of the backbone network, ensuring that the extracted feature maps have high semantic information and can effectively reflect the structure and details of objects in the image.
[0126] The input ship number feature X is combined with the learned position code LPE to generate a new feature containing position information P, as shown in formula (5):
[0127] (5)
[0128] After obtaining new features containing location information P Then, Q, K, and V are obtained through linear transformation, as shown in formula (6):
[0129] , , (6)
[0130] in, It is a query weight matrix, used to weight the input features. Mapped to query matrix Q; It is a key weight matrix, used to weight the input features. Mapped to the key matrix K; It is a value weight matrix, used to weight the input features Mapped to the value matrix V.
[0131] S105: New ship number features based on location information, and a self-attention mechanism Multi-head self-attention mechanism Layers and a feedforward neural network (FFN) are used to obtain further enhanced image regions;
[0132] New feature representation The self-attention mechanism is applied above to calculate the attention distribution and obtain the self-attention output by weighted summation, as shown in equation (7):
[0133] (7)
[0134] Among them, softmax() is the normalization function. Let K be the dimension of the key matrix. This is the transpose of the key matrix K;
[0135] based on The multi-head self-attention mechanism concatenates the outputs of multiple self-attention heads and performs a linear transformation, enabling the model to focus on different information in parallel in different subspaces; the formula is shown in equation (8):
[0136] (8)
[0137] in, The weight matrix is calculated for each head as follows:
[0138]
[0139] based on Layer normalization and residual connections ensure the capture of detailed information in complex scenes. The formula is shown in equation (9):
[0140] (9)
[0141] The nonlinear expressive power of the model is enhanced by the feedforward neural network FFN, and the final output is obtained again through layer normalization and residual connection, as shown in Equation (10):
[0142] (10)
[0143] S106: Identify the enhanced image region to obtain the ship's number.
[0144] The areas where the ship number was detected were divided into clear images and low-quality images;
[0145] For low-quality images, Gaussian blur is applied to the original image, and contrast enhancement is used to improve the difference between different gray levels in the image.
[0146] Image sharpening is performed based on the Laplacian algorithm to enhance the visual quality of the image;
[0147] Based on the TPS transform algorithm, the control points of the enhanced image and the clear image are mapped, and features are extracted according to the PP-LCNet network;
[0148] The SVTR model is used to further process and enhance the image after feature extraction. The features are passed to a fully connected layer, and the output is a character sequence. , and obtain the ship's number.
[0149] To perform Gaussian blur processing on the original image of a low-quality image, the specific steps are as follows:
[0150] (11)
[0151] Where I represents the detected ship number region, Let be a two-dimensional Gaussian kernel with standard deviation σ, and ∗ denote the convolution operation;
[0152] The enhancement of contrast to improve the difference between different gray levels in an image specifically involves:
[0153] (12)
[0154] in, α is the minimum grayscale value of the image, β is the scaling factor used to adjust the image contrast, and β is the offset used to adjust the image brightness.
[0155] The image sharpening process based on the Laplacian algorithm, which enhances the visual quality of the image, specifically involves:
[0156] (13)
[0157] Where k is the sharpening factor. For the Laplace operator.
[0158] Based on the TPS transform algorithm, the control points of the enhanced image and the clear image are mapped, specifically as follows:
[0159] The goal of the TPS transform algorithm is to find a transform function. , making control points Mapped to The transformation process is shown in equations (14) and (15):
[0160] (14)
[0161] (15)
[0162] Where, U= These are radial basis functions used to model the influence between control points; , , These are the coefficients of the affine transformation, responsible for the global linear transformation; These are weights associated with each control point, controlling local nonlinear deformation;
[0163] After TPS transformation, the image is fed into the PP-LCNet network for feature extraction. PP-LCNet is an efficient model based on a lightweight convolutional neural network design. It has a small number of parameters and low computational complexity. This model can quickly and accurately extract key features from images, making it suitable for ship number recognition tasks in real-time scenarios.
[0164] The SVTR-based model further processes and enhances the feature-extracted image, passing the features to a fully connected layer and outputting a character sequence. The ship's number was obtained, specifically:
[0165] Construct loss functions based on the SVTR model: CTC Loss and Attention Loss;
[0166] The CTC Loss calculation process is shown in equation (16):
[0167] (16)
[0168] in, This represents the probability distribution sequence output by the SVTR model; Represents the target label sequence; This represents a path, i.e., the output of the SVTR model at each step; It is the set of all paths, and the path set is equal to l after removing whitespace and duplicate tags;
[0169] The Attention Loss calculation process is shown in Equation (17):
[0170] (17)
[0171] in, It is the true distribution of the target label for character c at time step t. It is the probability that the model predicts character c at time step t.
[0172] The character sequence The calculation process is shown in equation (18):
[0173] (18)
[0174] in, Given an input image, L is a candidate character sequence, and arg max represents the sequence of characters selected from the candidate set that has the conditional probability of being true. The largest character sequence is output, and arg max represents selecting the character sequence L that maximizes the conditional probability P(L|I); T is the number of steps in the probability distribution sequence output by the model, i.e., the length of the sequence after feature extraction, enhancement, and mapping. This represents the conditional probability of the output character at time step t; the total conditional probability is the maximum possible sequence obtained by multiplying the probabilities of each character at all time steps. This sequence represents the specific content of the ship number in the input image. The architecture diagram of the recognition module is shown below. Figure 5 As shown.
[0175] See Figure 6 This invention discloses a ship number recognition system for complex scenarios, comprising:
[0176] The first acquisition module acquires ship images containing several ship number information based on the collected ship videos in the port, and constructs a ship image dataset.
[0177] The construction module is based on the Inverse Residual Moving Block Network (IRMB) and the DRB network, and constructs the C2f_IRMB_DRB module.
[0178] The enhancement module enhances the image features of the ship image dataset based on the C2f_IRMB_DRB module;
[0179] The second acquisition module introduces the Learned Position Encoding (LPE) into the AIFI_LPE module and, based on the enhanced image feature-rich ship image dataset, acquires new ship number features containing location information.
[0180] The third acquisition module is based on the new ship number feature containing location information and a self-attention mechanism. Multi-head self-attention mechanism Layers and a feedforward neural network (FFN) are used to obtain further enhanced image regions;
[0181] The identification module identifies the enhanced image region to obtain the ship's number.
[0182] Example:
[0183] This embodiment constructs a private dataset containing 2437 ship images with ship departure numbers, each with a resolution of 1920×1080. The dataset includes a large number of low-quality images from real-world application scenarios caused by factors such as motion or inclement weather, images with different lighting conditions, various angles and distances, and images with various ship departure numbers in the background.
[0184] To demonstrate the advantages of ALIDP, this study used precision (P), recall (R), F1 score, mean precision (mAP), mAP@0.5, and mAP@0.5:0.95 as evaluation metrics.
[0185] Precison(P) =
[0186] Precision is the proportion of samples that the model predicted as positive but were actually positive. It measures the accuracy of the prediction. TP (True Positives) is the number of samples correctly predicted as positive, and FP is the number of samples incorrectly predicted as positive.
[0187] Rcall(R) =
[0188] This metric represents the proportion of samples that are actually positive but are correctly predicted as positive, measuring the model's coverage capability. FN (False Negatives) is the number of samples that are incorrectly predicted as negative.
[0189] = ( )d
[0190] mAP =
[0191] mAP represents the average AP, used to measure the overall detection accuracy of an object detection algorithm. mAP@0.5 represents the average accuracy calculated when the IoU threshold is 0.5. mAP@0.5:0.95 represents the average accuracy calculated every 0.05 between IoU thresholds from 0.5 to 0.95. In other words, it measures the average performance of the model at different IoU thresholds.
[0192] Performance comparison of different algorithms in ship number detection task
[0193] A comprehensive comparative experiment was conducted on the private dataset constructed in this embodiment, including YOLOv7, YOLOv7-X, YOLOv8-N, YOLOv9, YOLOv10-N, RT-DETR, and the method proposed in this invention. The evaluation was mainly based on key metrics such as detection precision, recall, and computational complexity. The experimental results are shown in Table 1. The experimental results show that this embodiment performs excellently in several key metrics, especially in precision (P) and recall (R). The average precision reached 95.7%, and the recall rate was 94.5%, both higher than all the comparison models. It is worth noting that the YOLOv9 model has a slight advantage in mAP@0.5 and mAP@0.5:0.95, but its huge parameter count (194.6M) and computational cost (238.9G) pose challenges for practical deployment. Such high computational resource requirements are particularly detrimental to real-time applications, especially in edge devices or resource-constrained environments. In contrast, while some lightweight models (such as YOLOv8-N and YOLOv10-N) perform better in terms of parameter count and computational complexity, their accuracy (P) and recall (R) are significantly lower than the method proposed in this invention. For example, YOLOv8-N's P and R are only 87.5% and 90.1%, respectively, indicating that the pursuit of lightweight design has somewhat affected the model's detection capabilities. YOLOv7 and YOLOv7-X also perform relatively poorly on this detection task, further reflecting their limitations in practical applications. The trends of AP and R values for each algorithm after 400 training epochs are shown below. Figure 7 and Figure 8 As shown. In summary, the method proposed in this invention has better balance. The recognition performance of this embodiment compared with other algorithms is as follows. Figure 9 As shown.
[0194] Table 1. Performance comparison of different algorithms in ship number detection task
[0195] FLOPs (G) Parameters (M) P R mAP@0.5 mAP@0.5:0.95 YOLOv7 105.1 141.91 81 90.1 0.908 0.736 YOLOv7-X 188.9 270.16 86 90.3 0.929 0.767 YOLOv8-N 8.1 11.47 87.5 90.1 0.940 0.787 YOLOv 9 238.9 194.56 90.2 93.8 0.951 0.832 YOLOv10-N 8.2 10.281 92.9 93.5 0.942 0.794 RT-DETR 108 125.16 89.3 89.8 0.932 0.782 Ours 11.2 24.68 95.7 94.5 0.948 0.827
[0196] 2. Ablation experiment
[0197] To more intuitively demonstrate the performance gains of each module in the detection section of this invention, a comprehensive study was conducted as shown in Table 2.
[0198] Table 2 Ablation Experiment
[0199] C2f_IRMB_DRB AIFI_LPE Decoder Percision Recall mAP@0.5 mAP@0.5:0.95 FLOPs(G) √ 94.2 94.7 0.940 0.801 11.7 √ √ 94.6 93.5 0.941 0.808 11.7 √ √ 95.0 94.3 0.943 0.812 10.9 √ √ √ 95.7 94.5 0.948 0.827 11.2
[0200] In embodiments of this invention, ablation experiments were conducted to verify the impact of each module on overall performance. First, experimental data shows that even with the Decoder module enabled alone, the model still exhibits significant detection and decoding performance, indicating that the introduction of this module significantly improves the model's ability to handle complex image backgrounds and varying environmental conditions. Furthermore, embodiments of this invention exemplarily demonstrate the performance improvement effect of the AIFI_LPE module. Experimental data shows that the AIFI_LPE module significantly improves mAP@0.5 and mAP@0.5:0.95, indicating that this module effectively enhances the model's ability to detect ship numbers during feature extraction. Simultaneously, this invention also achieves high detection accuracy while reducing FLOPs through the C2f_IRMB_DRB module, fully demonstrating that this module balances computational resource consumption while capturing high-quality features. These experimental results show that the C2f_IRMB_DRB module effectively optimizes the use of computational resources, the AIFI_LPE module enhances feature extraction capabilities, and the Decoder module significantly improves detection and decoding accuracy. When all modules work together, this invention ultimately achieves the highest detection and recognition performance. The recognition results in this embodiment under different scenarios are as follows: Figure 10 As shown.
[0201] 3. Performance comparison of different algorithms in ship number recognition tasks
[0202] After completing the ship number detection experiment, the detected ship number regions and their corresponding ship number categories were obtained. This information served as the data input for subsequent ship number recognition experiments. Based on these detection results, this invention further conducted ship number recognition experiments to evaluate the performance of different recognition algorithms under various complex environments. Specific test results are shown in Table 3.
[0203] Table 3 Performance comparison of different algorithms in ship number recognition task
[0204] Experimental methods AP CRNN
[25] 71.6% ViTSTR
[35] 82.3% SPIN
[36] 87.3% SEED
[37] 77.2% PP-OCRv4
[38] 89.3% Ours 90.3%
[0205] Experimental data show that the AP value of the method of this invention can reach 90.3%, especially showing superior performance compared with CRNN and ViTSTR. Meanwhile, PP-OCRv4 has an AP value of 89.3%, and although it has strong recognition capabilities, this invention further improves performance by introducing a TPS algorithm and an image enhancement module, fully demonstrating the advantages of this invention.
[0206] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A ship number recognition method for a complex scene, characterized in that, The application relates to a ship number recognition method based on a ship image data set. The application comprises the following steps: Based on the collected ship video in the port, ship images containing several pieces of ship number information are acquired, and a ship image data set is constructed; A C2f_IRMB_DRB module is constructed based on an IRMB and a DRB network, and the C2f_IRMB_DRB module is a re-parameterized window attention module; The image features of the ship image data set are enhanced based on the C2f_IRMB_DRB module; A learning position encoding (LPE) is introduced into an AIFI_LPE module, and new ship number features containing position information are acquired based on the ship image data set after the image features are enhanced; the learning position encoding (LPE) is introduced into the AIFI_LPE module, and the new ship number features containing position information are acquired based on the ship image data set after the image features are enhanced, and the specific process is as follows: (5) In obtaining the new feature comprising the position information P Afterwards, Q, K, V are obtained by linear transformation as shown in equation (6): , , (6) wherein, is a query weight matrix for mapping input features to a query matrix Q; is a key weight matrix for mapping input features to a key matrix K; is a value weight matrix for mapping input features to a value matrix V; based on a new ship number feature comprising position information, and a multi-head self-attention mechanism, a layer and a feed-forward neural network, FFN, to obtain a further enhanced image region; The input ship number features X are combined with the learning position encoding (LPE) to generate new features containing position information P, as shown in formula (5):
2. The ship number recognition method for a complex scene according to claim 1, wherein, The ship number of the ship is recognized by recognizing the further enhanced image region.
3. The ship number recognition method for a complex scene according to claim 2, characterized in that, The ship number recognition method based on the ship image data set is specifically as follows: labelimg software is used to mark the ship plates of the ship data set, and PaddleLabel software is used to mark the ship numbers of each image, so that a txt file containing all the ship number information is obtained, and each line records the address of the image and the corresponding ship name information. The IRMB_DRB module is extended by an output / input ratio of λ extended channel dimension; The image features of the ship image data set are enhanced based on the C2f_IRMB_DRB module, and the specific process is as follows: Contraction based on inverse input / output ratio equal to lambda The contraction channel size, resulting in the final output from the residual connection.
4. The ship name recognition method for a complex scene according to claim 3, characterized in that, The IRMB_DRB module expands by an output / input ratio of λ Expanding the channel dimension, in particular: (1) wherein, is a ship number image; X= = ; , , are value matrix, query matrix and key matrix, respectively; The image features are further enhanced based on an extended window multi-head attention mechanism (EW-MHSA) and a DRB_DW-Conv in the IRMB_DRB module. (2) the contraction based on the inverse input / output ratio being equal to λ contracting the channel size, in particular: (3) The image features are further enhanced based on the extended window multi-head attention mechanism (EW-MHSA) and the DRB_DW-Conv in the IRMB_DRB module, and the specific process is as follows: (4)。 5. The ship name recognition method for a complex scene according to claim 4, characterized in that, the new ship number feature based on the position information, and multi-head self-attention mechanism, a layer and a feed-forward neural network (FFN) to obtain a further enhanced image region, in particular: In the new feature representation The application self-attention mechanism is applied, the attention distribution is calculated, and weighted summation is performed to obtain a self-attention output, as shown in formula (7): (7) wherein softmax() is a normalization process, is the dimension of the key matrix K, is the transpose of the key matrix K; Based on The multi-head self-attention mechanism concatenates the outputs of multiple self-attention heads, and after linear transformation, the model can focus on different information in different subspaces in parallel; the formula is shown in equation (8): (8) wherein, is a weight matrix, the calculation for each head is: Based on Layer normalization and residual connection ensure that the detailed information in complex scenes is captured. The formula is shown in equation (9): (9) The final output is obtained according to the residual connection, and the specific process is as follows: (10)。 6. The ship name recognition method for a complex scene according to claim 5, wherein, The non-linear expression ability of the feedforward neural network (FFN) enhancement model is enhanced, and the final output is obtained again through layer normalization and residual connection, as shown in formula (10): The ship number of the ship is recognized by recognizing the further enhanced image region, and the specific process is as follows: The region where the ship number is detected is divided into a clear image and a low-quality image; The low-quality image is subjected to Gaussian blur processing, and the difference between different gray levels in the image is improved through contrast enhancement; The image is subjected to sharpening processing based on a Laplace algorithm, and the visual quality of the image is enhanced; Based on the SVTR model, the pictures after feature extraction are further processed and enhanced, and the features are transmitted to the full connection layer to output the character sequence , and the ship number of the ship is obtained.
7. The ship name recognition method for a complex scene according to claim 6, characterized in that, Based on a TPS transformation algorithm, the control points of the enhanced image and the clear image are mapped, and feature extraction is performed according to a PP-LCNet network; (11) where I is the detected ship number region, is a two-dimensional Gaussian kernel with standard deviation σ, and * denotes the convolution operation. The low-quality image is subjected to Gaussian blur processing, and the specific process is as follows: (12) wherein, is the minimum gray value of the image, a is a scaling factor for adjusting the contrast of the image, and β is an offset for adjusting the brightness of the image. The difference between different gray levels in the image is improved through contrast enhancement, and the specific process is as follows: The image is subjected to sharpening processing based on a Laplace algorithm, and the visual quality of the image is enhanced, and the specific process is as follows: (13) where k is a sharpening coefficient, is the Laplacian operator.
8. The ship name recognition method for a complex scene according to claim 7, characterized in that, The TPS transformation algorithm is used for mapping control points of the enhanced image and the clear image, and specifically for mapping control points of the enhanced image and the clear image. The goal of the TPS transformation algorithm is to find a transformation function such that the control points are mapped to , the transformation process being shown in equations (14) and (15): (14) (15) where U = 1 is a radial basis function used to model the influence between control points; , , are coefficients of an affine transformation responsible for global linear transformation; are weights associated with each control point that control local non-linear deformation; The SVTR model is used for further processing and enhancement of the feature-extracted picture, and the features are transmitted to a full connection layer to output a character sequence The ship number of the ship is obtained, and specifically, A loss function based on the SVTR model is constructed, including CTCLoss and AttentionLoss. The CTCLoss calculation process is shown in formula (16): (16) wherein, denotes a sequence of probability distributions output by the SVTR model; denotes a target label sequence; denotes a path, i.e., the output of the SVTR model at each step; is a set of all paths, equal to l after removing blank symbols and duplicate labels in the path set; The AttentionLoss calculation process is shown in formula (17): (17) wherein, is the true distribution of the target label over characters c at time step t, is the probability of the model predicting character c at time step t; the sequence of characters The calculation process is shown in equation (18): (18) wherein, is the input image, L is the candidate character sequence, argmax denotes selecting the character sequence that maximizes the conditional probability from the candidate set as the output; T is the number of steps of the probability distribution sequence output by the model, i.e., the length of the sequence after feature extraction, enhancement, and mapping; denotes the conditional probability of the output character of the model at time step t.
9. A recognition system based on the complex scene-oriented ship number recognition method according to any one of claims 1-8, characterized in that, It comprises: The first acquisition module acquires ship image data sets containing several pieces of ship number information based on the collected ship video in the port. The construction module constructs a C2f_IRMB_DRB module based on an IRMB and a DRB network, and the C2f_IRMB_DRB module is a reparameterization window attention module. The enhancement module enhances the image features of the ship image data set based on the C2f_IRMB_DRB module. The second acquisition module introduces a learning position encoding (LPE) into an AIFI_LPE module and acquires new ship number features containing position information based on the ship image data set after the image features are enhanced. a third obtaining module, which obtains the new ship number feature based on the position information and multi-head self-attention mechanism, a layer and a feed-forward neural network (FFN) to obtain a further enhanced image region; The recognition module recognizes the image region after further enhancement to obtain the ship number of the ship.
Citation Information
Patent Citations
Ship identification method based on ship number deep learning
CN115331114A
Vehicle detection method suitable for highway tunnel monitoring scene
CN119048994A