Ship high-precision identity recognition method based on target detection and character recognition

By introducing the CBAM attention mechanism and deformable convolutional network in the YOLOv5s model, the problem of insufficient ship recognition accuracy is solved, and higher water scale object detection accuracy and recall rate are achieved.

CN119648995AInactive Publication Date: 2025-03-18GUANGXI XIJIANG DEV & INVESTMENT GRP CO LTD SHIP LOCK OPERATION MANAGEMENT BRANCH
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411710659.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-03-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, ship recognition accuracy is insufficient, especially when the ship moves, the position change, rotation and distortion of the water ruler in the image leads to low detection accuracy.

Method used

Using an improved ship identity recognition method based on the YOLOv5s model, the detection efficiency and accuracy of smaller targets are improved by introducing CBAM attention mechanism and deformable convolutional network into the C3 structure.

Benefits of technology

The detection accuracy and recall rate of ship water scale targets are improved, the model's detection ability of small-scale targets is enhanced, and the recognition accuracy is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648995A_ABST
    Figure CN119648995A_ABST
Patent Text Reader

Abstract

The invention relates to a ship high-precision identity recognition method based on target detection and character recognition. The method comprises the following steps: S1, obtaining a ship image; s2, the ship image is input into a ship identity recognition model, the ship identity recognition model outputs a ship name image, the ship identity recognition model is improved based on a YOLOv5s model, a deformable convolutional network and an improved C3 module are arranged on a backbone layer of the ship identity recognition model, and the improved C3 module comprises a CBAM attention module; and S3, performing character recognition on the ship name image to obtain a preliminary ship name recognition result, and matching the preliminary ship name recognition result with the database to obtain a final name recognition result. Compared with the prior art, the ship identification method has the advantages that distortion of the water gauge in the ship image and insufficient ship identification precision caused by the fact that the ship water gauge occupies a small space in the whole image are reduced, and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of ship identification, and in particular to a high-precision ship identification method based on target detection and text recognition. Background Art

[0002] With the rapid development of the digital economy and global trade, water transportation is also becoming increasingly prosperous, which has put forward higher requirements for the transportation efficiency of waterways. When ships are waiting for the lock, it is an urgent need for the current intelligent construction of waterways to identify the ship's identity in advance and compare it with the declared data, complete the ship's identity identification with higher accuracy, faster speed and shorter time, and prepare for the ship's rapid entry into the lock.

[0003] At present, most of the locks in the country still confirm the identity of ships by receiving AIS, GPS, RFID and other signals sent by ships to obtain their identity information. The lock control center is relatively passive. If the hull does not actively send out an identity signal, it can only rely on manual identification. This method has low transportation efficiency and invisibly increases transportation costs, which also has a certain impact on cargo throughput. At present, there are few discussions on the methods of intelligent ship identity recognition in the industry. Although there are methods in the prior art that use YOLO technology to identify ships and ship names, the existing YOLO model has the problem that when the ship moves, the position of the ship's water level in the image will change, and the water level in the image will inevitably rotate, distort and deform, and the ship's water level occupies a very small area of ​​the entire image, which is easily affected by irrelevant backgrounds, resulting in low detection accuracy. Summary of the invention

[0004] The purpose of the present invention is to provide a high-precision ship identification method based on target detection and text recognition in order to reduce the distortion of the water gauge in the ship image and the insufficient ship identification accuracy caused by the small proportion of the ship water gauge in the entire image.

[0005] The purpose of the present invention can be achieved by the following technical solutions:

[0006] A high-precision ship identification method based on target detection and text recognition, the method comprising the following steps:

[0007] S1. Acquire ship images;

[0008] S2. Input the ship image into a ship identification model, and the ship identification model outputs a ship name image. The ship identification model is improved based on the YOLOv5s model. The backbone layer of the ship identification model is provided with a deformable convolutional network and an improved C3 module, and the improved C3 module includes a CBAM attention module.

[0009] S3. Perform text recognition on the ship name image to obtain a preliminary ship name recognition result, match the preliminary ship name recognition result with the database, and obtain a final name recognition result.

[0010] Furthermore, the ship identification model includes a backbone network, a neck network and a prediction head, and the backbone network includes a first CBS module, a first deformable convolutional network, a first improved C3 module, a second deformable convolutional network, a second improved C3 module, a third deformable convolutional network, a third improved C3 module, a second CBS module, a fourth improved C3 module and an SPPF module connected in sequence.

[0011] Furthermore, the improved C3 module includes a third CBS module, a first bottleneck module, a connection module, a second bottleneck module and a CBAM attention module connected in sequence, wherein the output of the third CBS module is used as the input of the fourth CBS module, and the output of the fourth CBS module is connected to the connection module.

[0012] Furthermore, the CBAM attention module consists of a channel attention module and a spatial attention module. The output of the CBAM attention module is:

[0013]

[0014] Among them, F″ is the output of the spatial attention module, that is, the output of the CBAM attention module, F′ represents the output of the channel attention module, and M c represents the one-dimensional channel attention map, F represents the feature map of the input CBAM attention module, M s represents a two-dimensional spatial attention map.

[0015] Furthermore, the one-dimensional channel attention map is:

[0016]

[0017] in, They represent the spatial context descriptors obtained by average pooling and maximum pooling respectively; σ(·) represents the Sigmoid function; W1 and W0 represent the MLP weights, where W0 is the weight after activation by the ReLU function, AvgPool represents average pooling, and MaxPool represents maximum pooling.

[0018] Furthermore, the two-dimensional spatial attention map is:

[0019]

[0020] Where σ(·) represents the Sigmoid function; f 7×7 represents a convolution operation with a filter size of 7×7.

[0021] Furthermore, the deformable convolutional network includes a deformable convolution module and a deformable ROI pooling module.

[0022] Furthermore, the output of the deformable convolution module is:

[0023]

[0024] Where p0 represents the center position, R = {(-1,-1), (-1,0), ..., (0,1), (1,1)}, each element in R represents the offset of each position of the convolution kernel relative to the center position; x represents the input feature map; y represents the output feature map; ω(p n ) indicates p n The weight of the position; x(p n ) represents the input feature map p n Pixel value of position; Δm k Represents the weight modulation parameter of the sampling point position, Δm k ∈[0,1];Δp n Indicates p n The offset of the position.

[0025] Furthermore, the output of the deformable ROI pooling module is:

[0026]

[0027] Where y(i,j) represents the value of the (i,j)th block of the output feature map y, γ represents the predefined parameter used to adjust the offset amplitude, w and h are the length and width of the region of interest, bin represents the block divided by the region of interest, and n ij Represents the pixel value in the bin, represents the normalized offset generated by the fully connected layer; γ represents the predefined parameter used to adjust the offset amplitude, Δp ij Indicates the actual offset.

[0028] Furthermore, the specific steps of matching the preliminary ship name recognition result with the database to obtain the final name recognition result are:

[0029] The preliminary ship name recognition result is matched with the database, and the final name recognition result is determined based on the cosine similarity calculation.

[0030] Compared with the prior art, the present invention has the following beneficial effects:

[0031] The improved model of the present invention introduces the CBAM attention mechanism into the C3 structure to form a C3_CBAM module, and the control module is a four-layer network model. The detection efficiency of smaller targets is improved by adaptive feature refinement. The CBAM attention mechanism will perform attention mapping inference along the two dimensions of channel and space in sequence, and then multiply the attention mapping with the original feature map to obtain a new feature map under different weights, thereby realizing adaptive feature refinement. The improved model embedded with the CBAM attention mechanism can automatically focus on the characteristic area of ​​the ship water gauge and improve the detection performance. At the same time, the model of the present invention adopts a deformable convolutional network to perform adaptive detection of ship water gauge targets to improve detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 It is a schematic diagram of an improved model of the present invention;

[0033] Figure 2 It is a deformable convolution structure diagram;

[0034] Figure 3 It is a 3×3 block diagram of the deformable ROI pooling structure;

[0035] Figure 4 This is the CBAM structure diagram;

[0036] Figure 5 This is the structure diagram of the channel attention module;

[0037] Figure 6 This is the structure diagram of the spatial attention module;

[0038] Figure 7 is the change of precision and recall rate during model training process, where Figure 7 (a) is the change in accuracy, Figure 7 (b) is the change in recall rate;

[0039] Figure 8 is the mean change of F1 score and average precision during model training process, where Figure 8 (a) is the F1 score, Figure 8 (b) is the change of average precision mean;

[0040] Fig. 9 The mAP@0.5:0.95 change during the model training process;

[0041] Fig.10 Comparison of performance evaluation indicators of different improved models;

[0042] Fig.11 is the loss function curve of different models, where Fig.11 (a) is the change of the bounding box loss function of the training set, Fig.11 (b) is the change of confidence loss function of the training set;

[0043] Fig.12 Performance comparison of different models on the VOC dataset. DETAILED DESCRIPTION

[0044] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.

[0045] The present invention proposes a high-precision ship identification method based on target detection and text recognition, the method adopts, and the method comprises the following steps:

[0046] S1. Acquire ship images;

[0047] S2. Input the ship image into a ship identification model, and the ship identification model outputs a ship name image. The ship identification model is improved based on the YOLOv5s model. The backbone layer of the ship identification model is provided with a deformable convolutional network and an improved C3 module, and the improved C3 module includes a CBAM attention module.

[0048] S3. Perform text recognition on the ship name image to obtain a preliminary ship name recognition result, match the preliminary ship name recognition result with the database, and obtain a final name recognition result.

[0049] The specific steps of the present invention are:

[0050] Panoramic cameras and flashing lights are deployed at the bow, middle and tail of the piers on the north and south sides of the gate to capture images and videos of the side of the ship when it is moving. The flashing lights can be used for lighting in bad weather conditions or at night. Panoramic cameras and flashing lights are deployed on the front of the navigation tower to capture images and videos of the front of the ship when it is moving. The system background of the camera has built-in analysis and processing modules, image-text conversion modules, calculation and processing modules and data storage modules, and supports large-screen display of real-time camera shooting scenes. The camera is connected to the analysis and processing module and the data storage module and transmits data. The analysis and processing module is used to locate the position of the ship name in the image, and the data storage module is used to store the images and videos captured by the camera. The camera transmits the captured images and videos to the analysis and processing module. The analysis and processing module uses YOLO technology to quickly lock the hull name from the side and front pictures and videos of the hull to form a small picture with only the hull name. At the same time, it supports framing the specific position of the identified hull name on the large screen for display. The analysis and processing module is connected to the image-text conversion module and the data storage module and transmits data. The image-text conversion module is used to parse the text in the picture, and the data storage module is used to store the small picture information. The analysis and processing module transmits the small image to the image-text conversion module, which uses OCR technology to parse the text in the image to form the ship name text. The image-text conversion module is connected to the calculation and processing module and the data storage module in step 3 and transmits data. The calculation and processing module is used to calculate the text similarity, and the data storage module is used to store the ship name text in step 7. The calculation and processing module is connected to the database of the lock chamber control center, wherein the lock chamber control center database is the lock's own database, which is used to receive ship data reported in advance by ships entering the lock, including ship name, captain, draft depth and other information. The image-text conversion module transmits the ship name text information to the calculation and processing module in step 9. The calculation and processing module simultaneously calls the database in step 9 and uses the cosine similarity method to compare the text-type ship name with the data in the database to obtain a comparison result. The cosine similarity method comparison formula used by the calculation and processing module is as follows:

[0051]

[0052] Where Sim is the cosine value, D1 and D2 are two comparison quantities, and W represents the attribute vector.

[0053] The cosine similarity method mainly uses the cosine value of the angle between two non-zero vectors to calculate the similarity of texts. The value range of Sim is mainly achieved through deformable convolution and deformable ROI (Region of Interest) pooling.

[0054] Compared with the traditional convolution through fixed grid sampling, the deformable convolution adds a learnable offset and assigns a corresponding weight coefficient during sampling, thereby changing the shape of the grid, making it more suitable for the ship water level target to be detected, and improving the accurate extraction of effective information. Figure 2 shown.

[0055] For a 3×3 convolution kernel with a dilation rate of 1, the output of the deformable convolution is:

[0056]

[0057] In the formula, R = {(-1,-1), (-1,0), ..., (0,1), (1,1)}, each element in R represents the offset of each position of the convolution kernel relative to the center position; x represents the input feature map; y represents the output feature map; ω(p n ) indicates p n The weight of the position; x(p n ) represents the input feature map p n Pixel value of position; Δm k Represents the weight modulation parameter of the sampling point position, Δm k ∈[0,1];Δp n Indicates p n The pixel value of the input feature map considering the offset can be calculated by the following formula:

[0058]

[0059] Where p = p0 + p n +Δp n , represents any position of the interpolation point, q represents the interpolation area of ​​the input feature map, G(·,·) represents a two-dimensional bilinear interpolation kernel, which can be divided into two one-dimensional linear interpolation kernels g(·,·), g(a,b)=max(0,1-|ab|).

[0060] Deformable ROI Pooling:

[0061] ROI pooling maps the region of interest to the corresponding position of the feature map, and then divides the region into blocks and performs maximum pooling to obtain a feature map of fixed size. Compared with traditional ROI pooling, deformable ROI pooling also introduces a learnable offset and assigns it a suitable weight coefficient, so that it can effectively increase the receptive field without losing much accuracy and expand the recognition range of the ship water gauge. Figure 3 Shown is a schematic diagram of the deformable pooling structure.

[0062] For the input feature map x, the region of interest is w×h. ROI pooling divides this region into k×k chunks (bins) and outputs a feature map y with parameters k×k. The calculation formula for the (i,j) (0≤i,j<k) bin in y for deformable ROI pooling is as follows:

[0063]

[0064] In the formula, n ij represents the pixel value in the bin; the range of the (i,j) bin is: Δm k represents the weight modulation parameter of the sampling point position, and Δm k ∈[0,1]; represents the normalized offset generated by the fully connected layer; γ represents a predefined parameter for adjusting the offset amplitude, usually set to 1; Δp ij represents the true offset, mostly a decimal, and its corresponding pixel value is also obtained using the bilinear interpolation algorithm.

[0065] CBAM attention mechanism:

[0066] During the ship draft target detection process, since the ship draft occupies a very small area of the entire image and is extremely vulnerable to the influence of irrelevant backgrounds and difficult to detect, for this reason, the improved model introduces the CBAM attention mechanism into the C3 structure to form the C3_CBAM module (as Figure 1 shown), and improves the detection efficiency of smaller targets through adaptive feature refinement.

[0067] For the input feature map, the CBAM attention mechanism will sequentially perform attention mapping inference along the channel and spatial dimensions, and then multiply this attention mapping by the original feature map to obtain a new feature map with different weights, thereby achieving adaptive feature refinement, as Figure 5 shown. When a C-dimensional feature map is input, this module will compress the data on each channel through global average pooling and global max pooling to obtain two C×1×1 feature mapping matrices. Then, these two matrices are fed into a multi-layer perceptron (MLP) containing hidden layers, enabling the model to learn the weights of each channel and obtain two C×1×1 channel attention mappings. Furthermore, these two channel attention mappings are added element-wise to merge into the final channel attention mapping M c ∈R C×1×1 , which can be expressed as:

[0068]

[0069] In the formula, They represent the spatial context descriptors obtained by average pooling and maximum pooling respectively; σ(·) represents the Sigmoid function; W1 and W0 represent the MLP weights, where W0 is the weight after activation by the ReLU function.

[0070] Spatial Attention Module:

[0071] The spatial attention module mainly uses the relationship between feature spaces to generate spatial attention maps, thereby obtaining feature maps under different spatial weights, such as Figure 6 As shown in Figure 2. When the feature map after channel attention mapping is refined is input, the module performs maximum pooling and average pooling along the channel direction to obtain two 1×H×W two-dimensional matrices. Then, these two matrices are combined into a 1×H×W feature mapping matrix through channel stitching, and convolution operation is performed and activated with a 7×7 convolution kernel to obtain the final spatial attention map M. s ∈R 1×H×w , which can be expressed as:

[0072]

[0073] Where σ(·) represents the Sigmoid function; f 7×7 represents a convolution operation with a filter size of 7×7.

[0074] The loss function can measure the gap between the predicted results and the real information during the training process, and based on this, it continuously updates the network parameters and optimizes the structure, which largely determines the performance of the model. The closer the predicted results are to the real information, the smaller the loss function value. The loss function used in this model is as follows:

[0075] Loss = L coord1 +L coord2 +L cls +L conf

[0076] In the formula, Loss represents the total loss; L coord1 , L coord2 , L cls , L conf They represent center coordinate loss, width and height loss, category loss, and confidence loss respectively.

[0077] The following is an experimental analysis:

[0078] The model uses pre-trained weights for transfer learning, and the input image size is 640×640. Considering memory requirements and model convergence, the training batch size is set to 48; to avoid gradient explosion, the initial learning rate is set to 0.0005. The optimization algorithm selects Adam gradient optimization, and the number of training rounds is 100. This algorithm can dynamically adjust the learning rate of each parameter according to the parameter gradient, thereby accelerating the training process, especially for data with different scales or sparse gradients. In order to prevent the model from overfitting the training data and encourage the model to learn more generalized features, weight decay is used to reduce the complexity of the model, and the weight decay is set to 0.0005.

[0079] The model was first pre-trained based on the ImageNet dataset. After the pre-training, it was trained and experimented on a self-made ship water gauge dataset. The training data came from the on-site pictures taken at the Taizhou Gaogang Ship Lock Monitoring Point. The water gauge scale was clear and readable, without obstructions such as leaves and mud, and was bright and appropriate. The pictures were adjusted to 640×640 after random flipping, cropping and other pre-processing. There were 5,000 test data in total, which were divided into training set, validation set and test set in a ratio of 8:1:1.

[0080] In order to evaluate the performance of the improved YOLOv5s model, precision, recall, F1 score and mean average precision (mAP) are selected as evaluation indicators.

[0081] (1) Accuracy

[0082] Precision refers to the proportion of the number of correctly predicted positive samples in the number of all predicted positive samples, reflecting the ability of the model to identify relevant targets. The calculation formula is:

[0083]

[0084] In the formula, TP represents the number of correctly predicted positive samples; FP represents the number of incorrectly predicted negative samples; TP+FP represents the number of all predicted positive samples.

[0085] (2) Recall rate

[0086] Recall rate refers to the proportion of the number of correctly predicted positive samples in the number of all true positive samples, reflecting the ability of the model to find the true regression box. The calculation formula is:

[0087]

[0088] In the formula, FN represents the number of incorrectly predicted positive samples; TP+FN represents the number of all true positive samples during the training process.

[0089] (3) F1 score

[0090] Since precision and recall are usually contradictory, when precision is high, recall is often low, and vice versa. The F1 score is the harmonic mean of precision and recall, which can comprehensively measure the quality of the model. Its calculation formula is:

[0091]

[0092] The F1 score takes into account both the accuracy and recall of the model. The higher the value, the better the detection effect.

[0093] (4) Average precision

[0094] Mean Average Precision (mAP) is the average of Average Precision (AP), where AP is the average of precision under different recall rates, and is expressed as the area under the PR curve on a PR curve with precision as the ordinate and recall as the abscissa. The mean average precision takes into account the accuracy and recall of the model. The higher the value, the better the detection effect.

[0095] The model uses pre-trained weights for transfer learning, and the input image size is 640×640. Considering memory requirements and model convergence, the training batch size is set to 48; to avoid gradient explosion, the initial learning rate is set to 0.0005. The optimization algorithm selects Adam gradient optimization, and the number of training rounds is 100. This algorithm can dynamically adjust the learning rate of each parameter according to the parameter gradient, thereby accelerating the training process, especially for data with different scales or sparse gradients. In order to prevent the model from overfitting the training data and encourage the model to learn more generalized features, weight decay is used to reduce the complexity of the model, and the weight decay is set to 0.0005.

[0096] The model was first pre-trained based on the ImageNet dataset. After the pre-training, it was trained and experimented on a self-made ship water gauge dataset. The training data came from the on-site pictures taken at the Taizhou Gaogang Ship Lock Monitoring Point. The water gauge scale was clear and readable, without obstructions such as leaves and mud, and was bright and appropriate. The pictures were adjusted to 640×640 after random flipping, cropping and other pre-processing. There were 5,000 test data in total, which were divided into training set, validation set and test set in a ratio of 8:1:1.

[0097] In order to evaluate the performance of the improved YOLOv5s model, precision, recall, F1 score and mean average precision (mAP) are selected as evaluation indicators.

[0098] (1) Accuracy

[0099] Precision refers to the proportion of the number of correctly predicted positive samples in the number of all predicted positive samples, reflecting the ability of the model to identify relevant targets. The calculation formula is:

[0100]

[0101] In the formula, TP represents the number of correctly predicted positive samples; FP represents the number of incorrectly predicted negative samples; TP+FP represents the number of all predicted positive samples.

[0102] (2) Recall rate

[0103] Recall rate refers to the proportion of the number of correctly predicted positive samples in the number of all true positive samples, reflecting the ability of the model to find the true regression box. The calculation formula is:

[0104]

[0105] In the formula, FN represents the number of incorrectly predicted positive samples; TP+FN represents the number of all true positive samples during the training process.

[0106] (3) F1 score

[0107] Since precision and recall are usually contradictory, when precision is high, recall is often low, and vice versa. The F1 score is the harmonic mean of precision and recall, which can comprehensively measure the quality of the model. Its calculation formula is:

[0108]

[0109] The F1 score takes into account both the accuracy and recall of the model. The higher the value, the better the detection effect.

[0110] (4) Average precision

[0111] Mean Average Precision (mAP) is the average of Average Precision (AP), where AP is the average of precision under different recall rates, and is expressed as the area under the PR curve on a PR curve with precision as the ordinate and recall as the abscissa. The mean average precision takes into account the accuracy and recall of the model. The higher the value, the better the detection effect.

[0112] To verify the effectiveness of the improved YOLOv5s model, this paper evaluates the performance of the model through precision, recall, F1 score and average precision. Finally, the YOLOv5s model with different optimization methods is compared with various benchmark models to verify the superiority of the new model.

[0113] Ablation test

[0114] (1) Precision and recall:

[0115] Figure 7 The following are the curves showing the change of precision and recall during the training process of each model. Figure 7 As shown in the figure, the precision of the YOLOv5s basic model is 95.0% and the recall is 94.4%. After the introduction of the deformable convolutional network and the CBAM attention mechanism, the precision and recall of the model increased by 0.6% and 3.2% respectively. Compared with the precision, the improvement of the recall of the improved model is more obvious, which shows that the improved model performs better in finding the true regression box and can detect more bounding boxes. Secondly, the comparison shows that the CBAM attention mechanism has a higher improvement effect on the model performance than the deformable convolution module in terms of both precision and recall. Even when the deformable convolution module is introduced alone, the precision slightly decreases by 0.5%. This shows that compared with the deformable convolutional network, which can enhance the search ability for irregular objects, when detecting small-scale targets such as ship water gauges, the model relies more on the CBAM attention mechanism to enhance the expression ability of local features, which can focus more computer resources on a small area of ​​the image, improve the detection effect of small targets, and thus enhance the performance of the model.

[0116] (2) F1 score and average precision

[0117] Precision and recall often restrict and contradict each other. As evaluation indicators that comprehensively consider accuracy and recall, F1 score and average precision mean can better reflect the overall performance of the model. Figure 8 The following are the curves showing the changes in F1 score and average precision during the training process of each model. Figure 8 As shown in the figure, the F1 score and mAP@0.5 of the YOLOv5s base model are 94.6% and 94.6%, respectively. After introducing the deformable convolutional network and CBAM attention mechanism, the F1 score and mAP@0.5 of the model are increased by 1.9% and 1.7%, respectively. Comparing the F1 score and mAP@0.5 when the deformable convolution module or CBAM attention mechanism is introduced alone, it shows that the CBAM attention mechanism has a better effect on improving the model performance. This shows that the adaptive feature refinement of the CBAM attention mechanism is more conducive to the detection of small-scale targets such as ship water gauges.

[0118] The IoU threshold of mAP@0.5:0.95 covers a wider range and can provide a more comprehensive evaluation of the model. Fig. 9 The figure shows the change curve of mAP@0.5:0.95 during the training process of different models. As can be seen from the figure, the mAP@0.5:0.95 of the YOLOv5s basic model is 60.6%, and the mAP@0.5:0.9 of the model after the introduction of the deformable convolutional network and the CBAM attention mechanism is increased by 5.5%, which is more obvious than the indicator mAP@0.5. By comparing the mAP@0.5:0.95 change curves of different models, it is found that different improvements to the YOLOv5s basic model have improved the detection performance of the model to a certain extent. Among them, the effect is best when the deformable convolutional network and the CBAM attention mechanism are introduced at the same time, and the mAP@0.5:0.95 change curve converges faster during training, and the loss value after convergence is smaller. This shows that the improved model has better overall performance, better training effect, easier training, and can be better applied to ship water gauge detection.

[0119] Fig.10 The figure shows a comparison of the evaluation indicators of different improved models. As can be seen from the figure, both the deformable convolutional network and the CBAM attention mechanism have improved the detection performance of the YOLOv5s model to varying degrees, especially when both are introduced at the same time, the improvement effect is more obvious. This is mainly attributed to the following factors: (1) The water gauges of different ships have different shapes and sizes, and the water gauges often only occupy a very small part of the entire image, making it difficult to directly and accurately identify them. (2) The introduction of the deformable convolutional network can dynamically adjust the shape of the convolution kernel in space, expand the receptive field and better adapt to irregular target shapes, and improve the model's ability to locate targets. (3) The introduction of the CBAM attention mechanism can effectively capture channel and spatial information, increase the network's attention to important features, help the network better focus on key feature areas, and improve the model's ability to identify and detect small targets.

[0120] The algorithm models improved by using deformable convolutional networks or CBAM attention mechanism have effectively improved the detection accuracy of ship water gauge targets in the actual inland river environment, and the confidence levels (numbers in the red box) have been improved to varying degrees, indicating that the improved models have better small water gauge target detection capabilities.

[0121] Fig.11 The following is a graph showing the bounding box loss (box_loss) and confidence loss (obj_box) function curves of each model in the training set after 100 cycles of training. Fig.11It can be seen that the loss function of the improved YOLOv5s model that introduces both the deformable convolutional network and the CBAM attention mechanism converges fastest, and the loss value after convergence is smaller. This shows that the improved model has a faster convergence speed, is easier to train, and has better prediction results. The reason is that after the introduction of the deformable convolutional network and the CBAM attention mechanism, the model can be adaptively adjusted during image recognition processing, and can detect water gauge features faster, thereby reducing the number of iterations, accelerating convergence speed and improving prediction accuracy.

[0122] To further evaluate the target detection performance of the improved algorithm model, the algorithm was trained and compared with common algorithms such as SSD, YOLOXT, YOLOv5s, and YOLOv6n based on the VOC dataset and the same parameters. The average precision results are shown in the figure. Fig.12 As shown in the figure. As can be seen from the figure, compared with the YOLOv5s basic model, the improved algorithms have improved the model detection performance to varying degrees. Among them, the YOLOv5s model improved by deformable convolutional network and CBAM attention mechanism has the highest accuracy, with mAP@0.5 and mAP@0.5:95 reaching 90.5% and 69.3% respectively, an increase of 5.3% and 7.2%. In addition, compared with the current mainstream target detection algorithm model, the evaluation indicators of the improved model proposed in this paper have been significantly improved, which shows that the improved YOLOv5s model in this paper has more advantages and can be better applied to the draft detection of ships passing through the lock.

[0123] (1) Aiming at the difficulty in detecting the water level gauge of ships passing through the lock, the present invention proposes a ship water level gauge target detection model based on machine vision and improved YOLOv5s algorithm from the perspective of actual production. The model incorporates deformable convolutional network and CBAM attention mechanism, which improves the model detection performance without substantially changing the model volume.

[0124] (2) Model test results show that on the self-made dataset, the proposed YOLOv5s improved model can achieve an accuracy of 95.6% and a recall of 97.26%. Compared with the baseline model, mAP@0.5 increased by 1.7% and mAP@0.5:0.95 increased by 5.5%, which is not only better than the baseline model, but also has advantages over multiple mainstream object detection algorithms.

[0125] (3) This model has the characteristics of high accuracy, strong generalization ability, fast recognition speed, and strong environmental adaptability. It can achieve synchronous and accurate detection and provide technical support for ship water level target detection. In subsequent research, the model will be further lightweight, the training samples will be increased, and the model detection speed, prediction accuracy and generalization ability will be improved.

[0126] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.

Claims

1. A high-precision ship identification method based on target detection and text recognition, characterized in that: The method comprises the following steps: S1. Acquire ship images; S2. Input the ship image into a ship identification model, and the ship identification model outputs a ship name image. The ship identification model is improved based on the YOLOv5s model. The backbone layer of the ship identification model is provided with a deformable convolutional network and an improved C3 module, and the improved C3 module includes a CBAM attention module. S3. Perform text recognition on the ship name image to obtain a preliminary ship name recognition result, match the preliminary ship name recognition result with the database, and obtain a final name recognition result.

2. According to claim 1, a method for high-precision ship identification based on target detection and text recognition is characterized in that: The ship identification model includes a backbone network, a neck network and a prediction head, and the backbone network includes a first CBS module, a first deformable convolutional network, a first improved C3 module, a second deformable convolutional network, a second improved C3 module, a third deformable convolutional network, a third improved C3 module, a second CBS module, a fourth improved C3 module and an SPPF module connected in sequence.

3. According to claim 2, a high-precision ship identification method based on target detection and text recognition is characterized in that: The improved C3 module includes a third CBS module, a first bottleneck module, a connection module, a second bottleneck module and a CBAM attention module connected in sequence, wherein the output of the third CBS module serves as the input of the fourth CBS module, and the output of the fourth CBS module is connected to the connection module.

4. A high-precision ship identification method based on target detection and text recognition according to claim 3, characterized in that: The CBAM attention module consists of a channel attention module and a spatial attention module. The output of the CBAM attention module is: Among them, F″ is the output of the spatial attention module, that is, the output of the CBAM attention module, F′ represents the output of the channel attention module, and M c represents the one-dimensional channel attention map, F represents the feature map of the input CBAM attention module, M s represents a two-dimensional spatial attention map.

5. A high-precision ship identification method based on target detection and text recognition according to claim 4, characterized in that: The one-dimensional channel attention map is: in, They represent the spatial context descriptors obtained by average pooling and maximum pooling respectively; σ(·) represents the Sigmoid function; W1 and W0 represent the MLP weights, where W0 is the weight after activation by the ReLU function, AvgPool represents average pooling, and MaxPool represents maximum pooling.

6. A method for high-precision ship identification based on target detection and text recognition according to claim 5, characterized in that: The two-dimensional spatial attention map is: Where σ(·) represents the Sigmoid function; f 7×7 represents a convolution operation with a filter size of 7×7.

7. The method for high-precision ship identification based on target detection and text recognition according to claim 2 is characterized in that: The deformable convolutional network includes a deformable convolution module and a deformable ROI pooling module.

8. A high-precision ship identification method based on target detection and text recognition according to claim 7, characterized in that: The output of the deformable convolution module is: Where p0 represents the center position, R = {(-1,-1), (-1,0), ..., (0,1), (1,1)}, each element in R represents the offset of each position of the convolution kernel relative to the center position; x represents the input feature map; y represents the output feature map; ω(p n ) indicates p n The weight of the position; x(p n ) represents the input feature map p n Pixel value of the position; Δm k Represents the weight modulation parameter of the sampling point position, Δm k ∈[0,1];Δp n Indicates p n The offset of the position.

9. A method for high-precision ship identification based on target detection and text recognition according to claim 8, characterized in that: The output of the deformable ROI pooling module is: Where y(i,j) represents the value of the (i,h)th block of the output feature map y, γ represents the predefined parameter used to adjust the offset amplitude, w and h are the length and width of the region of interest, bin represents the block divided by the region of interest, and n ij Represents the pixel value in the bin, represents the normalized offset generated by the fully connected layer; γ represents the predefined parameter used to adjust the offset amplitude, Δp ij Indicates the actual offset.

10. The method for high-precision ship identification based on target detection and text recognition according to claim 1, characterized in that: The specific steps of matching the preliminary ship name recognition result with the database to obtain the final name recognition result are: The preliminary ship name recognition result is matched with the database, and the final name recognition result is determined based on the cosine similarity calculation.

Citation Information

Patent Citations

  • OL-YoloV5 ship detection method based on online learning

    CN115909225A

  • Draft detection method based on deep learning

    CN116824570A

  • Light indoor service robot target identification method based on deformable convolution

    CN117115592A

  • LNG unloading arm target identification method based on improved YOLO-V5s model

    CN117649589A

  • Light-weight ship lubricating oil metal impurity image recognition method based on improved YOLOv5s model

    CN118470713A