A yolo v13-based offshore micro-ship target detection method and system
By employing adaptive rectangular convolution, Vision Mamba scene semantic preserver, and parameterless edge-aware attention module, combined with a dynamic loss function, the problems of insufficient accuracy and high computational complexity in detecting small vessels at sea are solved, achieving efficient and accurate detection in complex maritime scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI MARITIME UNIVERSITY
- Filing Date
- 2026-04-02
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies lack sufficient accuracy in detecting small vessel targets in complex maritime scenarios, especially in various environments such as cloud cover, sea waves, and nighttime conditions. Furthermore, existing methods are computationally complex, resource-intensive, and cannot effectively handle targets with irregular shapes.
Adaptive rectangular convolution is used for feature extraction. Combined with the Vision Mamba scene semantic preserver and the parameterless edge-aware attention module, attention is guided by ship edge priors. A dynamic loss function is constructed to enhance the detection of small targets. Target completion and separation under occlusion are achieved through a hypergraph model.
It improves the accuracy and robustness of detecting small ships at sea, is applicable to a variety of complex scenarios, reduces computational complexity and resource consumption, and enhances the ability to identify small targets.
Smart Images

Figure CN122176414A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, and in particular to a method and system for detecting small marine vessels based on YOLOv13. Background Technology
[0002] In recent years, with the continued growth of global trade and the booming development of the marine economy, effective monitoring of coastal and near-shore waters has become crucial. Ships, as the primary carriers of maritime activities, are widely used in maritime traffic management, maritime search and rescue, and national defense. However, from a negative perspective, small vessels may be used for "grey area" activities or cause collisions in densely populated areas such as ports and narrow waterways, thus requiring more accurate and real-time detection and identification.
[0003] However, detecting small vessel targets in complex maritime surveillance scenarios remains a challenging problem. With the rise of deep learning, a large number of object detection algorithms based on convolutional neural networks have emerged. Deep learning methods can automatically learn more discriminative feature representations from data. By constructing deep convolutional networks, multi-scale features can be progressively extracted from images, from low-level edge and texture information to high-level semantic information. Typical methods include single-stage detectors, two-stage detectors, and Transformer-based models that have emerged with the rise of large-scale language models, with typical examples being DETR and its variants, deformable attention and real-time deformable attention. Their end-to-end characteristics and powerful global context modeling capabilities make them well-suited for detecting isolated small targets against the backdrop of a vast ocean.
[0004] Despite this, current mainstream methods remain insufficiently effective for small object detection. Anchor-based detectors heavily rely on the relative positions of anchors and ground truth bounding boxes, leading to significant mismatches between positive and negative samples. For small objects, even slight deviations can cause a drop in accuracy, resulting in negative samples and impacting training performance. Anchor-free FCOS models are simpler, avoiding the complexity of anchor design, but they have lower accuracy in small object localization. In two-stage detectors, RPN struggles to generate high-quality candidate boxes for small objects from low-resolution feature maps, rendering the second stage ineffective. Furthermore, CNN-based methods use fixed convolutional kernels, which cannot be resized to fit specific object shapes. Excessively large receptive fields can overwhelm small objects in background noise, while excessively small receptive fields result in insufficient contextual information. Another end-to-end approach, such as DETR, uses object queries to learn the most frequently occurring object features in the data, making it insensitive to small objects. From a computational cost perspective, the original DETR requires a very long training period to converge, far exceeding that of CNN models. This significantly increases research and deployment costs. Its attention mechanism leads to a quadratic increase in computational complexity with image resolution, placing extremely high demands on GPU memory when processing high-resolution SAR images. This is clearly detrimental to deployment and real-time detection in resource-constrained environments. Existing loss functions, such as IoU loss, GIoU loss, DIoU loss, and CIoU loss, while becoming increasingly complex, offer diminishing marginal returns on performance and may introduce instability. These horizontal bounding box-based IoU variants are ineffective at handling irregular shape detection tasks. Summary of the Invention
[0005] To address the shortcomings of existing technologies, the present invention aims to provide a method for detecting small marine vessels based on YOLOv13. This method integrates multiple deep neural network technologies, improving the accuracy of detecting small marine vessels in complex marine scenes. It can also identify objects of multiple scales in various scenarios such as cloud, fog, waves, and nighttime conditions, demonstrating wide applicability and strong robustness.
[0006] This invention provides a method for detecting small marine vessels based on YOLOv13, comprising the following steps: Step 1, using adaptive rectangular convolution to perform preliminary feature extraction on the input image to adapt to ship targets with different aspect ratios, obtaining local feature maps; Step 2, based on the local feature maps, constructing a scene semantic preserver based on Vision Mamba to model the overall scene semantics of the ocean background, obtaining global scene semantic features; Step 3, constructing a parameter-free edge-aware attention module, fusing global scene semantic features with local texture features in the local feature maps, and using ship edge priors to guide attention generation, enhancing focus on small target regions, and outputting enhanced edge feature maps; Step 4, based on the enhanced edge feature maps, using the high-order relationship priors learned by the pre-trained hypergraph model between ship components, inferring the position of occluded components based on visible components during the detection process, achieving target completion and separation under partial occlusion; Step 5, constructing a dynamic loss function, adaptively adjusting the loss weights according to the sea area occupied by the target in the image, strengthening the gradient response to small-sized ship targets.
[0007] Preferably, in step 1, an adaptive rectangular convolution kernel is used to replace the standard square convolution kernel, and the aspect ratio of the convolution kernel is dynamically adjusted by a height-width learner to adapt to ship targets with different length-width ratios.
[0008] Preferably, in step 2, the scene semantic preserver based on Vision Mamba establishes a long-term dependency between each position in the feature map and the implicit global ocean scene semantic state through state space modeling, providing background priors for subsequent local target recognition.
[0009] Preferably, in step 3, the parameterless edge perception attention module includes: a local receptive field modeling unit, which introduces spatial neighborhood information through pooling and interpolation operations to capture statistical patterns in the local area; and a directional edge detection unit, which explicitly models spatial discontinuities through gradient difference to generate edge information as a weight modulation factor to participate in attention allocation.
[0010] Preferably, in step 4, the hypergraph model activates strongly correlated hyperedges based on the edge cues output by the parameterless edge-aware attention module during inference, infers the position and feature information of the occluded component, and feeds it back to the next iteration of the parameterless edge-aware attention module to guide it to search for and verify edge features in the inferred region.
[0011] Preferably, in step 5, the dynamic loss function includes: a scale-adaptive weighting mechanism, which automatically adjusts the loss contribution according to the target size through a combination of area threshold and exponential decay function; a focus loss integration, which modulates the distance penalty intensity through IoU quality, so that the model pays attention to samples with inaccurate predictions during training; and a multi-level numerical protection design, which sets numerical boundaries at multiple nodes of the computation link to ensure the stability and robustness of the training process.
[0012] This invention provides a YOLOv13-based system for detecting small marine vessels, comprising: a backbone network module that uses adaptive rectangular convolution to perform preliminary feature extraction on the input image; a scene semantic preservation module that models the overall scene semantics of the ocean background based on VisionMamba; an edge-aware attention module that fuses global scene semantic features with local feature maps and uses ship edge priors to guide attention generation; a hypergraph inference module that uses pre-trained high-order relationship priors between ship components to achieve target completion and separation under partial occlusion; and a dynamic loss module that adaptively adjusts the loss weights based on the area of the target in the sea in the image.
[0013] The present invention provides an electronic device, including a memory and a processor. The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, they implement the steps of the method described above.
[0014] The present invention provides a computer storage medium storing computer-executable instructions thereon, which, when executed by a processor, implement the steps of the method described above.
[0015] Technical effect
[0016] Compared with existing technologies, the YOLOv13-based method and system for detecting small marine vessels according to this invention effectively improves the accuracy of detecting small marine vessels by employing multiple techniques, including scene semantic preserver, edge-aware global-local attention mechanism, adaptive convolution, depthwise separable convolution, dynamic hyperedge generator, and dynamic balanced loss function. This method, while integrating multiple deep neural network technologies to improve the accuracy of target detection in marine scenes, can also identify objects of different sizes and complex lighting and wave scenes, demonstrating wide applicability and strong robustness. Attached Figure Description
[0017] The above and other objects, features, and advantages of this application will become more apparent from the following detailed description of the embodiments in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the embodiments of this application to explain the application and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.
[0018] Figure 1 This is a schematic diagram of the overall network architecture of the YOLOv13-based method for detecting small marine vessels in an embodiment of the present invention.
[0019] Figure 2 This is a schematic diagram of the scene semantic preserver structure of the YOLOv13-based method for detecting small marine vessels in an embodiment of the present invention.
[0020] Figure 3 This is a schematic diagram of the edge-aware global-local attention mechanism structure of the YOLOv13-based method for detecting small marine vessels in an embodiment of the present invention. Detailed Implementation
[0021] To make the technical means, creative features, objectives and effects of this invention easy to understand, the following embodiments, in conjunction with the accompanying drawings, provide a detailed description of a method and system for detecting small marine vessels based on YOLOv13.
[0022] This embodiment provides a method for detecting small marine vessels based on YOLOv13.
[0023] Figure 1 This is a flowchart of a method for detecting small marine vessels based on YOLOv13 in an embodiment of the present invention.
[0024] like Figure 1 As shown, the YOLOv13-based method for detecting small marine vessels in this embodiment includes the following steps:
[0025] Step S1, Backbone Network: Adaptive rectangular convolution is used to perform preliminary feature extraction on the input image to adapt to ship targets with different aspect ratios, obtaining local feature maps. This method breaks through the limitations of convolution kernels with fixed proportions and effectively captures the features of ship targets with different shapes and proportions.
[0026] In this embodiment, during the initial feature extraction stage of the backbone network, considering the characteristics of large differences in aspect ratio and varied shapes of ship targets in marine scenes, an adaptive rectangular convolution is used to replace the standard square convolution kernel. The aspect ratio of the convolution kernel is dynamically adjusted by the height-width learner to adapt to ship targets with different aspect ratios.
[0027] Step S2 addresses the difficulty in distinguishing between wave textures and local interference from ship edges in an ocean background. Based on local feature maps, a scene semantic preserver based on Vision Mamba is constructed to model the overall scene semantics of the ocean background and obtain global scene semantic features to suppress local clutter interference.
[0028] In this embodiment, the scene semantic preserver based on Vision Mamba has the core mechanism of establishing long-term dependencies between each position in the feature map and the implicit global ocean scene semantic state through state space modeling. This allows for the integration of global context information while maintaining a stable representation of the overall semantics of the ocean scene, providing accurate background priors for subsequent local target identification.
[0029] Figure 2 This is a schematic diagram of the scene semantic preserver structure of the YOLOv13-based method for detecting small marine vessels in an embodiment of the present invention.
[0030] like Figure 2 As shown, given an input feature map, one branch performs an identity mapping to obtain features rich in low-level details. Another branch first performs a 3×3 depthwise convolution operation to capture local context at minimal cost, then performs layer normalization on the convolutional features to stabilize their data distribution, accelerate training convergence, and improve the model's generalization ability. The input feature sequence passes through three independent linear layers, generating three sets of parameters: continuous system matrix parameters a^∈RN, where a^ is the scalar form of the evolution matrix Aˆ; Bˆ, C = xWB, xWC∈RL×N; and Δ=XW∆∈RL∈RL, a parameter controlling the discretization step size, which is crucial for achieving input dependency or selectivity, where WB, WC∈Rd×N, and W∆∈Rd×1 are learnable matrices. The continuous parameter A^ is discretized using Δ through methods such as zero-order preservation, resulting in the discretized system matrices A and B.
[0031] Parameters B, C, and Δ are first processed by depthwise separable convolution, injecting a local inductive bias. Then, they are multiplied with the discretized matrix A to calculate the global hidden state, which is a summary that compresses the entire sequence history information. In this embodiment, the hidden state is first calculated and then fed into the computation module, where gating and projection are directly applied. The mixed hidden state is then multiplied with the initial output matrix through matrix multiplication and projected back into the original sequence space to obtain the output.
[0032] Subsequently, based on the features already infused with global information, a feedforward neural network is used to enhance the model's nonlinear transformation capabilities, further enriching the expressive power of the features. The final output global features of the module are concatenated with the initial input local features along the channel dimension to obtain the output. This ensures that gradients can propagate smoothly in the backpropagation process, avoiding the gradient vanishing problem in deep networks.
[0033] Step S3 addresses the issue of small ship targets and easily obscured edge features by constructing a parameterless edge-aware attention module. This module integrates global scene semantic features with local texture features in the local feature map and uses ship edge priors to guide attention generation. This enhances the focus on small target regions without introducing additional computation and outputs an enhanced edge feature map.
[0034] In this embodiment, an edge-aware global-local attention mechanism is added at the end of the bidirectional feature fusion P4 output layer. Specifically, the parameterless edge-aware attention module in this step includes:
[0035] The local receptive field modeling unit incorporates spatial neighborhood information through pooling and interpolation operations, and this design can capture statistical patterns within local areas.
[0036] The directional edge detection unit explicitly models spatial discontinuities through gradient difference and generates edge information as a weight modulation factor to participate in attention allocation.
[0037] Figure 3 This is a schematic diagram of the edge-aware global-local attention mechanism structure of the YOLOv13-based method for detecting small marine vessels in an embodiment of the present invention.
[0038] like Figure 3 As shown, firstly, a global statistical analysis is performed on the input feature map to establish a basic understanding of the feature distribution. That is, it calculates an independent average value for each channel of each batch of samples, and then calculates the squared deviation of each pixel from the global mean to obtain the global variance component.
[0039] To capture fine-grained patterns, local statistics are first aggregated within the local receptive field. When the height-to-width ratio is less than or equal to 9 (i.e., 3x3 or smaller), the statistical difference between local and global values becomes insignificant, and the local window almost covers the entire feature map, negating the advantages of multi-scale statistics. Therefore, if the feature map size is greater than 4 in both height and width, local pooling is performed, and interpolation upsampling is used to obtain μl; otherwise, the global mean is directly used as a substitute. Similarly, the local variance component is obtained by calculating the squared deviation of each pixel from the local mean.
[0040] Subsequently, the local variance and adaptive variance are linearly combined using a fixed weight coefficient α to generate a hybrid adaptive variance. This weight allocation is based on experimental verification. Finally, the attention weight for each spatial location is obtained based on energy function calculation theory.
[0041] Furthermore, this embodiment sets a detection threshold for edge enhancement processing; edge enhancement is only performed when both the height and width of the feature map are greater than 2 pixels. Otherwise, it indicates insufficient structural information in the current feature map, and edge detection in a feature map that is too small is meaningless, so this module activates a safe fallback path. The absolute difference between each pixel and its rightmost pixel is used as the horizontal gradient. By using edge padding to maintain the same size as the original feature map, the gradients in the horizontal and vertical directions are averaged to obtain a comprehensive edge intensity map. The hyperbolic tangent function controls the edge intensity within the range of −0.3 to 0.3, achieving a smooth edge enhancement effect. The enhancement coefficient α is 0.3 to ensure a moderate gradient amplitude and avoid gradient explosion or vanishing. Finally, the input feature map is multiplied element-wise with the calculated attention weights to generate the enhanced output feature map.
[0042] Step S4 addresses the issue of target features being submerged or stuck due to complex sea conditions. By utilizing the prior high-order relationships between ship components learned from the pre-trained hypergraph model, the location of components obscured by waves or neighboring ships is inferred from the visible components during the detection process, thus achieving target completion and separation under partial obscuration.
[0043] In this embodiment, during inference, the hypergraph model activates strongly correlated hyperedges based on the few fragmented edge cues output by the parameterless edge-aware attention module in step S3, infers the position and feature information of the occluded component, and feeds it back to the next iteration of the parameterless edge-aware attention module to guide it to perform more refined edge feature search and verification in the inferred region.
[0044] Step S5: To address the issue of unbalanced penalties for multi-scale targets in existing loss functions, a dynamic loss function is constructed. This function adaptively adjusts the loss weights based on the sea area occupied by the target in the image, thereby enhancing the gradient response to small-sized ship targets.
[0045] In this embodiment, the dynamic loss function includes:
[0046] The scale-adaptive weighting mechanism automatically adjusts the loss contribution based on the target size by combining an area threshold and an exponential decay function, thus taking into account the training needs of targets at different scales without introducing additional hyperparameters.
[0047] The focus loss ensemble borrows from the idea of hard sample mining, modulating the distance penalty intensity through IoU quality, causing the model to focus on inaccurately predicted samples during training. This has a positive impact on the convergence speed of bounding box regression.
[0048] The multi-level numerical protection design solves the gradient anomaly problem that may occur when the original version faces extreme-scale targets. By setting numerical boundaries at multiple nodes in the computation link, the stability and robustness of the training process are guaranteed.
[0049] Furthermore, for the dynamic loss function, firstly, this embodiment defines the intersection-union ratio (IUGR) of the predicted and ground truth boxes to measure their overlap. Next, the sum of squared Euclidean distances between corresponding corner points of the two boxes is used to define a baseline distance scale for large and medium-sized targets, serving as the normalized denominator for the penalty term calculation to prevent excessive distance penalties. Based on the coordinates, this embodiment calculates the squared Euclidean distances between the top-left corner points of the ground truth and predicted boxes, and between the bottom-right corner points of the two boxes. Smaller distances indicate better alignment of the two box corner points and a smaller penalty; conversely, larger distances indicate greater corner point position deviations and a larger penalty. This embodiment considers both corner point distances and overlap areas, making the loss more sensitive to positional deviations and resulting in faster convergence.
[0050] Based on the baseline scale calculated above, this embodiment normalizes the distance penalty to ensure comparable relative penalty values for targets of different sizes. Subsequently, the areas of the predicted bounding box and the ground truth bounding box are calculated separately. To assign higher weights to smaller targets, this embodiment sets an area threshold of 1024 (corresponding to a 32×32 target) and calculates the weight coefficient based on the minimum area. Taking the smaller area as the safer choice for smaller targets avoids over-enhancement. For objects with areas smaller than the threshold, this embodiment uses an exponential decay function to enhance their weights. After obtaining the enhanced weights for small targets, this embodiment multiplies the weights by the basic distance penalty to obtain the weighted penalty term.
[0051] To enable the model to adaptively focus on the most difficult samples to learn and to prevent it from ignoring low-overlap regions during training, this embodiment designs a sample difficulty balancing factor to enhance the gradient in low IoU regions, significantly improving the model's convergence speed and final accuracy. Combining the aforementioned weighting factors, the final penalty term is obtained. The dynamic loss function is defined as 1 minus the sum of the IoU loss and the final penalty term.
[0052] Furthermore, this embodiment also provides a YOLOv13-based system for detecting small marine vessels, including:
[0053] The backbone network module uses adaptive rectangular convolution to perform preliminary feature extraction on the input image;
[0054] The scene semantic preservation module models the overall scene semantics of the ocean background based on Vision Mamba;
[0055] The edge-aware attention module integrates global scene semantic features with local feature maps and uses ship edge priors to guide attention generation.
[0056] The hypergraph reasoning module utilizes pre-trained prior knowledge of high-order relationships between ship components to achieve target completion and separation under partial occlusion.
[0057] The dynamic loss module adaptively adjusts the loss weights based on the area occupied by the target in the image.
[0058] Although embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and embodiments. They can be applied to various fields suitable for the present invention. For those skilled in the art, other modifications can be easily made. Therefore, without departing from the general concept defined by the claims and their equivalents, the present invention is not limited to the specific details and illustrations shown and described herein.
Claims
1. A method for detecting small marine vessels based on YOLOv13, characterized in that, Includes the following steps: Step 1: Use adaptive rectangular convolution to perform preliminary feature extraction on the input image to adapt to ship targets with different aspect ratios and obtain local feature maps; Step 2: Based on the local feature map, construct a scene semantic preserver based on Vision Mamba to model the overall scene semantics of the ocean background and obtain global scene semantic features; Step 3: Construct a parameterless edge-aware attention module, which integrates the global scene semantic features with the local texture features in the local feature map, and uses the ship edge prior to guide attention generation, enhances the focus on small target areas, and outputs the enhanced edge feature map; Step 4: Based on the enhanced edge feature map, the high-order relationship priors between ship components learned by the pre-trained hypergraph model are used to infer the position of the occluded component based on the visible component during the detection process, so as to achieve target completion and separation under partial occlusion. Step 5: Construct a dynamic loss function that adaptively adjusts the loss weights based on the sea area occupied by the target in the image, thereby enhancing the gradient response to small-sized ship targets.
2. The method for detecting small marine vessels based on YOLOv13 according to claim 1, characterized in that: In step 1, the standard square convolution kernel is replaced with the adaptive rectangular convolution kernel, and the aspect ratio of the convolution kernel is dynamically adjusted by the height-width learner to adapt to ship targets with different length-width ratios.
3. The method for detecting small marine vessels based on YOLOv13 according to claim 1, characterized in that: In step 2, the Vision Mamba-based scene semantic preserver establishes long-term dependencies between each location in the feature map and the implicit global ocean scene semantic state through state space modeling, providing background priors for subsequent local target recognition.
4. The method for detecting small marine vessels based on YOLOv13 according to claim 1, characterized in that: In step 3, the parameterless edge-aware attention module includes: Local receptive field modeling units introduce spatial neighborhood information through pooling and interpolation operations to capture statistical patterns within local areas; The directional edge detection unit explicitly models spatial discontinuities through gradient difference and generates edge information as a weight modulation factor to participate in attention allocation.
5. The method for detecting small marine vessels based on YOLOv13 according to claim 1, characterized in that: In step 4, during inference, the hypergraph model activates strongly correlated hyperedges based on the edge cues output by the parameterless edge-aware attention module, infers the position and feature information of the occluded component, and feeds it back to the next iteration of the parameterless edge-aware attention module to guide it to perform edge feature search and verification in the inferred region.
6. The method for detecting small marine vessels based on YOLOv13 according to claim 1, characterized in that: In step 5, the dynamic loss function includes: The scale-adaptive weighting mechanism automatically adjusts the loss contribution based on the target size by combining an area threshold and an exponential decay function. Focus loss ensemble modulates the distance penalty intensity through IoU quality, enabling the model to focus on inaccurately predicted samples during training; The multi-layered numerical protection design sets numerical boundaries at multiple nodes in the computation link to ensure the stability and robustness of the training process.
7. A marine micro-vessel target detection system based on YOLOv13, characterized in that, include: The backbone network module uses adaptive rectangular convolution to perform preliminary feature extraction on the input image; The scene semantic preservation module models the overall scene semantics of the ocean background based on Vision Mamba; The edge-aware attention module integrates global scene semantic features with local feature maps and uses ship edge priors to guide attention generation. The hypergraph reasoning module utilizes pre-trained prior knowledge of high-order relationships between ship components to achieve target completion and separation under partial occlusion. The dynamic loss module adaptively adjusts the loss weights based on the area occupied by the target in the image.
8. An electronic device comprising a memory and a processor, characterized in that: The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the method as described in any one of claims 1-6.
9. A computer storage medium storing computer-executable instructions thereon, characterized in that: When the computer-executable instructions are executed by a processor, they implement the steps of the method as described in any one of claims 1-6.