A marine vessel counting method based on residual fusion mechanism

The modified VGG module and residual fusion mechanism for ocean vessel counting solve the problems of accuracy and efficiency in remote sensing images, achieving high-precision vessel counting and adapting to the needs of remote sensing images under different environmental conditions.

CN118799662BActive Publication Date: 2026-05-29SANYA SCI & EDUCATION INNOVATION PARK WUHAN UNIV OF TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SANYA SCI & EDUCATION INNOVATION PARK WUHAN UNIV OF TECH
Filing Date
2024-08-14
Publication Date
2026-05-29

Smart Images

  • Figure CN118799662B_ABST
    Figure CN118799662B_ABST
Patent Text Reader

Abstract

The application relates to a marine ship counting method based on a residual fusion mechanism, which comprises the following steps: performing feature extraction on a remote sensing image through a VGG feature extraction network to obtain a first feature map; using an Acmix module to obtain spatial information of a ship, fusing convolution features and self-attention features of the first feature map to obtain a second feature map; using a Transformer Encoder module to extract deeper spatial features, and using normalization to obtain a feature corresponding weight map; using a residual fusion mechanism to fuse the second feature map and the weight map to obtain a fused feature map; and using a density map regression module to regress and train a prediction density map corresponding to the remote sensing image according to the fused feature map of the remote sensing image. The method efficiently fuses the features of convolution, self-attention and Transformer in a residual fusion mode, realizes a density map regression task, and thus improves the accuracy of the marine ship counting task in a remote sensing scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of machine learning algorithms and image processing technology, specifically to a marine vessel counting method based on residual fusion mechanism. Background Technology

[0002] Remote sensing image recognition technology has become the core of modern remote sensing. This technology involves analyzing and interpreting images taken by aircraft or satellites to achieve the task of counting ships at sea. With the rapid development of aviation technology, the resolution of remote sensing images has significantly improved, which not only enhances the clarity of image details but also greatly expands the application scope of remote sensing images. Among them, ship counting, as a core task in remote sensing detection technology, can effectively count the number of ships in a given remote sensing image and has a wide research background in fields such as maritime safety detection, port management, and environmental monitoring. By counting ships at sea, vessels in shipping lanes can be effectively monitored, which helps to avoid congestion and collisions and improve the safety of maritime traffic.

[0003] Despite significant advancements in target detection and counting techniques based on deep learning, several challenges remain when processing high-resolution, large-area remote sensing images. Remote sensing images are characterized by their wide imaging range, large scale variations, and sparse target distribution within the scene. Furthermore, the size and location distribution of ships within these images vary considerably, all of which can negatively impact the accuracy and efficiency of ship counting.

[0004] The main challenge in the field of marine vessel counting stems from the limitations of traditional target counting methods in processing remote sensing images. Methods that calculate the number of targets through direct regression perform poorly in remote sensing images because they lack constraints on target distribution. During the learning process, the model may lose crucial information about target distribution from the source image, leading to a significant decrease in vessel counting accuracy. While target detection-based methods can provide detailed information about target locations, their accuracy is often unsatisfactory when dealing with scenarios with a large number of targets. Vessels in remote sensing images are often densely distributed and vary in size, making it difficult for detection box statistics methods to accurately distinguish and count all targets. Furthermore, high false alarm rates and missed detections are also encountered when targets are close together or when some targets are difficult to identify due to occlusion. Summary of the Invention

[0005] To address the shortcomings of the existing technologies, this invention proposes a marine vessel counting method based on a residual fusion mechanism. The method employs residual fusion, utilizing the Acmix module to fuse convolutional and self-attention features to capture the spatial information of marine vessels. Furthermore, it efficiently fuses features from convolution, self-attention, and Transformer using residual fusion to achieve density map regression, thereby improving the accuracy of marine vessel counting tasks in remote sensing scenarios.

[0006] To achieve the above objectives, the present invention provides the following technical solution:

[0007] A method for counting marine vessels based on a residual fusion mechanism, the method comprising the following steps:

[0008] S100. Acquire a remote sensing image dataset, resize the remote sensing images in the dataset to a uniform size for easier subsequent processing, and acquire sample images. and location labels of key points of the ship in the image Based on the label information, the remote sensing images are preprocessed to determine the true density map corresponding to each sample image. The remote sensing image dataset is divided proportionally into a training set, a validation set, and a test set for the model training, validation, and testing phases; the training set is defined as follows: , where N represents the total number of images in the training set.

[0009] S200. Construct a marine vessel counting model based on residual fusion mechanism. The marine vessel counting model structure includes five parts: VGG feature extraction network module, Acmix convolution and self-attention fusion module, Transformer Encoder module, residual fusion module and density map regression module.

[0010] S300: Obtain the predicted density map corresponding to the remote sensing image based on the marine vessel counting model constructed in step S200; train the marine vessel counting model using the predicted density map obtained by the marine vessel counting model and the real density map of the original image in the training set; verify the trained marine vessel counting model using the validation set constructed in step S100; and record the most effective counting model based on the evaluation index.

[0011] S400. Repeat step S300 to perform multiple rounds of training. Based on the evaluation index data recorded in step S300, obtain the model with the best performance as the final ocean vessel counting model.

[0012] S500: Based on a trained marine vessel counting model, input the corresponding target remote sensing image and output the number of marine vessels in the target area.

[0013] As a further technical solution of the present invention, step S200, the step of constructing a marine vessel counting model based on a residual fusion mechanism, includes:

[0014] S210. Extract features from the remote sensing image using the VGG feature extraction network to obtain the first feature map I_vgg;

[0015] S220. Use the Acmix module to obtain the spatial information of the ship, and fuse the convolutional features and self-attention features of the first feature map I_vgg to obtain the second feature map I_acmix.

[0016] S230. Using a visual Transformer to extract deeper spatial features from the features, the first feature map I_vgg is input into the Transformer Encoder module to collect features from the original remote sensing image and obtain the feature map I_trans. Subsequently, Batch Normalization is applied to process the feature map I_trans to generate a normalized weight map I_quan.

[0017] S240. Using the residual fusion mechanism, the weight map I_quan obtained in step S230 is fused with the second feature map I_acmix to obtain the fused feature map I_fuse.

[0018] S250. Using the density map regression module, the predicted density map corresponding to the remote sensing image is obtained through regression training based on the fused feature map of the remote sensing image.

[0019] As a further technical solution of the present invention, step S210 includes:

[0020] S211. Modified feature extraction network VGG-10 module: Given that ships in remote sensing images are small in size and occupy few pixels, excessive pooling operations will cause serious loss of the pixels occupied by ships. Therefore, the first ten layers of the original VGG-16 are retained as the feature extraction network.

[0021] S212. Retain the three max pooling layers in the original VGG-16, and reduce the shift in the estimated mean caused by sample error during feature extraction by selecting the maximum value in the region, thereby better protecting the texture features in the image.

[0022] As a further technical solution of the present invention, step S230 includes:

[0023] S231, the Transformer Encoder module, consists of L identical coding layers stacked sequentially to form a deep network structure. Each coding layer contains two main sub-layers: the first is a multi-head self-attention mechanism sub-layer, and the second is a fully connected feedforward network sub-layer. These two sub-layers are used in series, along with the residual connections and layer normalization after each sub-layer, to form the Transformer Encoder module.

[0024] The first sublayer introduced in steps S232 and S231 is the multi-head self-attention mechanism. By processing different parts of the image in parallel, it allows the model to consider information from other regions far away while analyzing the features of a certain region, thereby further capturing the global dependencies between input and output. Furthermore, by computing attention in parallel across different representation subspaces, the model learns the relationships between inputs from multiple dimensions, helping to extract deeper spatial features. Its expression is as follows:

[0025] ;

[0026] ;

[0027] ;

[0028] In the formula, Q is the query vector, K is the key vector, and V is the value vector. Its dimension, h, is the number of heads. It is a weight matrix;

[0029] The second sub-layer introduced in steps S233 and S231 is a two-layer fully connected feedforward network, which consists of fully connected layers and a ReLU activation function. This simple structure helps capture local nonlinear features, providing additional expressive power to the TransformerEncoder. Its expression is as follows:

[0030] ;

[0031] In the formula, and These represent the weight matrix and bias term of the first-layer feedforward network, respectively. and These represent the weight matrix and bias term of the second-layer feedforward network, respectively. This represents the ReLU (Rectified Linear Unit) activation function, which applies a nonlinear transformation to the output of the previous layer.

[0032] Preferably, the residual fusion mechanism described in step S240 improves the accuracy of the density map by learning the features of component combination. It obtains a fused feature map I_fuse by fusing the second feature map I_acmix generated by the Acmix module with the corresponding weight map I_quan, incorporating residual information that may be lost during training, thereby improving training accuracy. The calculation formula used is as follows:

[0033] ;

[0034] In the formula, I_acmix is ​​the weight map obtained by Batch Normalization in step S230, and I_acmix is ​​the second feature map extracted by the Acmix module in step S220.

[0035] As a further technical solution of the present invention, step S300, which involves training the ocean vessel counting model using the predicted density map obtained from the ocean vessel counting model and the true density map of the original images in the training set, includes:

[0036] S300a. For the remote sensing images to be trained in the remote sensing image training set, determine the prediction density map of the current remote sensing image to be trained.

[0037] S300b: Train the marine vessel counting model using the predicted density map and the true density map corresponding to the current remote sensing image to be trained, and determine the loss function of the marine vessel counting model based on the output results of the marine vessel counting model. ;

[0038] S300c, Loss function based on the marine vessel counting model Update the weight parameters of the convolutional kernels in all convolutional layers;

[0039] S300d: Determine whether all remote sensing images to be trained in the remote sensing image training set have been trained. If yes, proceed to step S300f; otherwise, continue to step 300e.

[0040] S300e: Take the next remote sensing image to be trained in the remote sensing image training set as the current remote sensing image to be trained, and go to step S300a.

[0041] S300f: Use the validation set constructed in step S100 to validate the trained marine vessel counting model, and record the most effective counting model based on the evaluation index.

[0042] S300g: Determine whether the current training round of the marine vessel counting model has reached the predetermined training round. If yes, end; otherwise, proceed to step S300a.

[0043] As a further technical solution of the present invention, the loss function used in step S300 during the training of the marine vessel counting model is the l2 loss function. The difference between the predicted density map and the true density map is evaluated by calculating the mean square error between the pixels. Using this loss function can obtain more accurate results when the model training is complete. The expression is as follows:

[0044] ;

[0045] In the formula, It is the loss value between the predicted density map and the true density map. These are the model parameters, N is the number of images in the training set, and Xi represents the original remote sensing image as input. This represents the true density map corresponding to the input remote sensing image. I ( Xi ; q ) represents the predicted density map corresponding to the remote sensing image input to the model.

[0046] As a further technical solution of the present invention, the evaluation index used in step S300 for verifying the marine vessel counting model is the mean absolute error, expressed as follows:

[0047] ;

[0048] Where N is the number of samples, It is the actual number of targets for the i-th sample. It is the number of predicted targets for the i-th sample.

[0049] On the other hand, the present invention proposes a computer device that can be used for counting marine vessels, comprising a memory, a processor, and program instructions stored in the memory that can be executed by the processor, wherein the processor executes the program instructions to implement the steps in the above-described method.

[0050] In another aspect, the present invention provides a computer-readable storage medium storing a computer program, which is executed by a processor to implement the above-described marine vessel counting method based on residual fusion mechanism.

[0051] Compared with the prior art, the beneficial effects of the present invention are:

[0052] 1. This invention provides a marine vessel counting method based on a residual fusion mechanism. First, a first feature map I_vgg is determined using a modified feature extraction network VGG10 module, removing unnecessary features from the remote sensing image for counting. Then, based on the first feature map, a second feature map I_acmix is ​​obtained using the Acmix module. This feature map contains enhanced spatial and dimensional information about the vessels from the first feature map. Furthermore, a Transformer Encoder module is used to capture global features and extract deeper spatial features, resulting in a feature map I_trans. A residual fusion mechanism is used to fuse the comprehensive information from the feature images, resulting in a more robust and accurate feature map. Based on the fused feature map I_fuse, a predicted density map of the corresponding remote sensing image is generated. Finally, a marine vessel counting model is trained based on the predicted and actual density maps. The resulting model can efficiently and accurately complete the marine vessel counting task based on arbitrary remote sensing images.

[0053] 2. This invention presents a marine vessel counting method based on a residual fusion mechanism. During the fusion of the second feature map I_acmix and the third feature map I_trans output by the Transformer Encoder module, a residual fusion mechanism is used. This mechanism improves the accuracy of the density map by learning the combined features of the components. Specifically, by fusing the feature map I_acmix and the weight map I_quan, the residual information lost during the learning process is incorporated, thereby improving counting accuracy. Under the constraint of the loss function, the final output density map is more accurate than the directly output feature map I_acmix. This approach can improve the accuracy of marine vessel counting in remote sensing scenarios.

[0054] 3. Our method, tested on three publicly available datasets, demonstrates high robustness and excellent counting accuracy across various scenarios. Compared to traditional methods, our model achieves higher accuracy on the same datasets. Using three public datasets covers a wider range of scenarios than a single dataset, thus confirming the model's strong adaptability to the needs of counting marine vessels in remotely sensed images under different environmental conditions. This advancement means that our method effectively overcomes common problems such as reduced counting accuracy and insufficient robustness caused by uneven target distribution, varying scales, and high background complexity. Attached Figure Description

[0055] Figure 1 This is a flowchart of a marine vessel counting method based on residual information fusion in an embodiment of the present invention.

[0056] Figure 2 for Figure 1The flowchart shown is a detailed process for determining the prediction density map corresponding to the remote sensing image to be trained in the marine vessel counting method based on residual information fusion.

[0057] Figure 3 for Figure 2 The diagram shows the TransformerEncoder module involved in the marine vessel counting method based on residual information fusion. Detailed Implementation

[0058] To make the technical problems to be solved, the technical solutions, and the beneficial effects of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present invention and are not intended to limit the present invention.

[0059] Please see Figure 1 As an embodiment of the present invention, a method for counting marine vessels based on a residual fusion mechanism is provided, the method comprising the following steps:

[0060] S100. Acquire a remote sensing image dataset, resize the remote sensing images in the dataset to a uniform size, and acquire sample images. and location labels of key points of the ship in the image Based on the label information, the remote sensing images are preprocessed to determine the true density map corresponding to each sample image. The remote sensing image dataset is divided proportionally into a training set, a validation set, and a test set for the model training, validation, and testing phases; the training set is defined as follows: , where N represents the total number of images in the training set.

[0061] In this embodiment, each training remote sensing image is resized to 1024 pixels * 1024 pixels to reduce the impact of different image sizes on network performance and structure. In this embodiment, the `resize()` function in OpenCV can be used to resize all training remote sensing images to a fixed size.

[0062] S200. Construct a marine vessel counting model based on residual fusion mechanism. The marine vessel counting model structure includes five parts: VGG feature extraction network module, Acmix convolution and self-attention fusion module, Transformer Encoder module, residual fusion module and density map regression module.

[0063] S300: Obtain the predicted density map corresponding to the remote sensing image based on the marine vessel counting model constructed in step S200; train the marine vessel counting model using the predicted density map obtained by the marine vessel counting model and the real density map of the original image in the training set; verify the trained marine vessel counting model using the validation set constructed in step S100; and record the most effective counting model based on the evaluation index.

[0064] S400. Repeat step S300 to perform multiple rounds of training. Based on the evaluation index data recorded in step S300, obtain the model with the best performance as the final ocean vessel counting model.

[0065] S500: Based on a trained marine vessel counting model, input the corresponding target remote sensing image and output the number of marine vessels in the target area.

[0066] In this embodiment, after the marine vessel counting model is trained, the target remote sensing image of a certain target area is input into the trained marine vessel counting model. The output of the trained marine vessel counting model is a predicted density map corresponding to the target remote sensing image. At this time, the total number of vessels in the target area can be determined based on the sum of the values ​​of all pixels in the predicted density map of the target remote sensing image.

[0067] Specifically, such as Figure 2 As shown, step S200, the steps for constructing a marine vessel counting model based on a residual fusion mechanism, include:

[0068] S210. Extract features from the remote sensing image using the VGG feature extraction network to obtain the first feature map I_vgg;

[0069] S220. Use the Acmix module to obtain the spatial information of the ship, and fuse the convolutional features and self-attention features of the first feature map I_vgg to obtain the second feature map I_acmix.

[0070] S230. Using a visual Transformer to extract deeper spatial features from the features, the first feature map I_vgg is input into the Transformer Encoder module to collect features from the original remote sensing image and obtain the feature map I_trans. Subsequently, Batch Normalization is applied to process the feature map I_trans to generate a normalized weight map I_quan.

[0071] S240. Using the residual fusion mechanism, the weight map I_quan obtained in step S230 is fused with the second feature map I_acmix to obtain the fused feature map I_fuse.

[0072] S250. Using the density map regression module, the predicted density map corresponding to the remote sensing image is obtained through regression training based on the fused feature map of the remote sensing image.

[0073] As a preferred embodiment of the present invention, step S210 includes:

[0074] S211. Modified feature extraction network VGG-10 module: Given that ships in remote sensing images are small in size and occupy few pixels, excessive pooling operations will cause serious loss of the pixels occupied by ships. Therefore, the first ten layers of the original VGG-16 are retained as the feature extraction network.

[0075] S212. Retain the three max pooling layers in the original VGG-16, and reduce the shift in the estimated mean caused by sample error during feature extraction by selecting the maximum value in the region, thereby better protecting the texture features in the image.

[0076] like Figure 3 As shown, in a preferred embodiment of the present invention, step S230 includes:

[0077] S231, the Transformer Encoder module, consists of L identical coding layers stacked sequentially to form a deep network structure. Each coding layer contains two main sub-layers: the first is a multi-head self-attention mechanism sub-layer, and the second is a fully connected feedforward network sub-layer. These two sub-layers are used in series, along with the residual connections and layer normalization after each sub-layer, to form the Transformer Encoder module.

[0078] The first sublayer introduced in steps S232 and S231 is the multi-head self-attention mechanism. By processing different parts of the image in parallel, it allows the model to consider information from other regions far away while analyzing the features of a certain region, thereby further capturing the global dependencies between input and output. Furthermore, by computing attention in parallel across different representation subspaces, the model learns the relationships between inputs from multiple dimensions, helping to extract deeper spatial features. Its expression is as follows:

[0079] ;

[0080] ;

[0081] ;

[0082] In the formula, Q is the query vector, K is the key vector, and V is the value vector. Its dimension, h, is the number of heads. It is a weight matrix;

[0083] The second sub-layer introduced in steps S233 and S231 is a two-layer fully connected feedforward network, which consists of fully connected layers and a ReLU activation function. This simple structure helps capture local nonlinear features, providing additional expressive power to the TransformerEncoder. Its expression is as follows:

[0084] ;

[0085] In the formula, and These represent the weight matrix and bias term of the first-layer feedforward network, respectively. and These represent the weight matrix and bias term of the second-layer feedforward network, respectively. This represents the ReLU (Rectified Linear Unit) activation function, which applies a nonlinear transformation to the output of the previous layer.

[0086] As a preferred embodiment of the present invention, the residual fusion mechanism in step S240 improves the accuracy of the density map by learning the features of component combination. Specifically, by fusing the second feature map I_acmix generated by the Acmix module with the corresponding weight map I_quan, a fused feature map I_fuse is obtained, which incorporates residual information that may be lost during training, thereby improving training accuracy. The calculation formula used is as follows:

[0087] ;

[0088] In the formula, I_acmix is ​​the weight map obtained by Batch Normalization in step S230, and I_acmix is ​​the second feature map extracted by the Acmix module in step S220.

[0089] As a preferred embodiment of the present invention, step S300, which involves training the ocean vessel counting model using the predicted density map obtained from the ocean vessel counting model and the true density map of the original images in the training set, includes:

[0090] S300a. For the remote sensing images to be trained in the remote sensing image training set, determine the prediction density map of the current remote sensing image to be trained.

[0091] S300b: Train the marine vessel counting model using the predicted density map and the true density map corresponding to the current remote sensing image to be trained, and determine the loss function of the marine vessel counting model based on the output results of the marine vessel counting model. ;

[0092] S300c, Loss function based on the marine vessel counting model Update the weight parameters of the convolutional kernels in all convolutional layers;

[0093] S300d: Determine whether all remote sensing images to be trained in the remote sensing image training set have been trained. If yes, proceed to step S300f; otherwise, continue to step 300e.

[0094] S300e: Take the next remote sensing image to be trained in the remote sensing image training set as the current remote sensing image to be trained, and go to step S300a.

[0095] S300f: Use the validation set constructed in step S100 to validate the trained marine vessel counting model, and record the most effective counting model based on the evaluation index.

[0096] S300g: Determine whether the current training round of the marine vessel counting model has reached the predetermined training round. If yes, end; otherwise, proceed to step S300a.

[0097] In a preferred embodiment of the present invention, the loss function used in step S300 during the training of the marine vessel counting model is the l2 loss function. The difference between the predicted density map and the true density map is evaluated by calculating the mean square error between the pixels. This loss function allows for more accurate results when the model training is complete. The expression is as follows:

[0098] ;

[0099] In the formula, It is the loss value between the predicted density map and the true density map. These are model parameters. Xi represents the number of images in the training set, and Xi represents the original input remote sensing image. This represents the true density map corresponding to the input remote sensing image. I ( Xi ; q ) represents the predicted density map corresponding to the remote sensing image input to the model.

[0100] In a preferred embodiment of the present invention, the evaluation index used in step S300 for verifying the marine vessel counting model is the mean absolute error, expressed as follows:

[0101] ;

[0102] Where N is the number of samples, It is the actual number of targets for the i-th sample. It is the number of predicted targets for the i-th sample.

[0103] On the other hand, the present invention proposes a computer device that can be used for counting marine vessels, comprising a memory, a processor, and program instructions stored in the memory that can be executed by the processor, wherein the processor executes the program instructions to implement the steps in the above-described method.

[0104] In another aspect, the present invention provides a computer-readable storage medium storing a computer program, which is executed by a processor to implement the above-described marine vessel counting method based on residual fusion mechanism.

[0105] The contents not described in detail in this specification are existing technologies known to those skilled in the art.

[0106] It should be understood that those skilled in the art can make improvements or modifications based on the principles of this invention and the above description, or apply the method provided by this invention to similar aerial image recognition tasks, and all such improvements and modifications should fall within the protection scope of the appended claims.

Claims

1. A method for counting marine vessels based on a residual fusion mechanism, characterized in that, The method includes the following steps: S100. Acquire a remote sensing image dataset, resize the remote sensing images in the dataset to a uniform size, and acquire sample images. and location labels of key points of the ship in the image The remote sensing images are preprocessed based on location labels to determine the true density map corresponding to each sample image. The remote sensing image dataset is divided proportionally into a training set, a validation set, and a test set for the model training, validation, and testing phases; the training set is defined as follows: , where N represents the total number of images in the training set; S200. Construct a marine vessel counting model based on residual fusion mechanism. The marine vessel counting model structure includes five parts: VGG feature extraction network module, Acmix convolution and self-attention fusion module, Transformer Encoder module, residual fusion module and density map regression module. S300: Obtain the predicted density map corresponding to the remote sensing image based on the marine vessel counting model constructed in step S200; train the marine vessel counting model using the predicted density map obtained by the marine vessel counting model and the real density map of the original image in the training set; verify the trained marine vessel counting model using the validation set constructed in step S100; and record the most effective counting model based on the evaluation index. S400. Repeat step S300 to perform multiple rounds of training. Based on the evaluation index data recorded in step S300, obtain the model with the best performance as the final ocean vessel counting model. S500: Based on a trained marine vessel counting model, input the corresponding target remote sensing image and output the number of marine vessels in the target area; In step S200, the steps for constructing a marine vessel counting model based on a residual fusion mechanism include: S210. Extract features from the remote sensing image using the VGG feature extraction network to obtain the first feature map I_vgg; S220. Use the convolution and self-attention fusion Acmix module to obtain the spatial information of the ship, fuse the convolution features of the first feature map I_vgg and the self-attention features of the first feature map I_vgg to obtain the second feature map I_acmix. S230. Using a visual Transformer to extract deeper spatial features from the features, the first feature map I_vgg is input into the Transformer Encoder module to collect features from the original remote sensing image and obtain the feature map I_trans. Subsequently, Batch Normalization is applied to process the feature map I_trans to generate a normalized weight map I_quan. S240. Using the residual fusion mechanism, the weight map I_quan obtained in step S230 is fused with the second feature map I_acmix to obtain the fused feature map I_fuse. S250. Using the density map regression module, the predicted density map corresponding to the remote sensing image is obtained through regression training based on the fused feature map of the remote sensing image.

2. The marine vessel counting method based on residual fusion mechanism according to claim 1, characterized in that, Step S210 includes: S211, The modified feature extraction network VGG-10 module retains the first ten layers of the original VGG-16 as the feature extraction network; S212 retains the three max-pooling layers from the original VGG-16.

3. The marine vessel counting method based on residual fusion mechanism according to claim 1, characterized in that, Step S230 includes: S231, the Transformer Encoder module, consists of L identical coding layers stacked sequentially to form a deep network structure. Each coding layer contains two main sub-layers: the first is a multi-head self-attention mechanism sub-layer, and the second is a fully connected feedforward network sub-layer. These two sub-layers are used in series, along with the residual connections and layer normalization after each sub-layer, to form the Transformer Encoder module. The first sub-layer introduced in steps S232 and S231 is the multi-head self-attention mechanism. By processing different parts of the image in parallel, it allows the model to consider information from other regions far away while analyzing the features of a certain region, thereby further capturing the global dependencies between input and output. Furthermore, by computing attention in parallel across different representation subspaces, the model learns the relationships between inputs from multiple dimensions, as expressed below: ; ; ; In the formula, It is a query vector. It is a key vector. It is a value vector. Its dimensions, It refers to the number of heads. It is a weight matrix; The second sub-layer introduced in steps S233 and S231 is a two-layer fully connected feedforward network. The feedforward network consists of a fully connected layer and a ReLU activation function. The expression of the feedforward network is as follows: ; In the formula, and These represent the weight matrix and bias term of the first-layer feedforward network, respectively. and These represent the weight matrix and bias term of the second-layer feedforward network, respectively. This represents the ReLU (Rectified Linear Unit) activation function, which applies a nonlinear transformation to the output of the previous layer.

4. The marine vessel counting method based on residual fusion mechanism according to claim 1, characterized in that, The residual fusion mechanism described in step S240 improves the accuracy of the density map by learning the combined features of the components. It obtains the fused feature map I_fuse by fusing the second feature map I_acmix generated by the convolution and self-attention fusion Acmix module with the corresponding weight map I_quan. The calculation formula is as follows: ; In the formula, The weight map is obtained after Batch Normalization in step S230. This is the second feature map extracted in step S220 using the Acmix module that fuses convolution and self-attention.

5. The marine vessel counting method based on residual fusion mechanism according to claim 1, characterized in that, Step S300, which involves training the ocean vessel counting model using the predicted density map obtained from the ocean vessel counting model and the true density map of the original images in the training set, includes the following steps: S300a. For the remote sensing images to be trained in the remote sensing image training set, determine the prediction density map of the current remote sensing image to be trained. S300b: Train the marine vessel counting model using the predicted density map and the true density map corresponding to the current remote sensing image to be trained, and determine the loss function of the marine vessel counting model based on the output results of the marine vessel counting model. ; S300c, Loss function based on the marine vessel counting model Update the weight parameters of the convolutional kernels in all convolutional layers; S300d: Determine whether all remote sensing images to be trained in the remote sensing image training set have been trained. If yes, proceed to step S300f; otherwise, continue to step 300e. S300e: Take the next remote sensing image to be trained in the remote sensing image training set as the current remote sensing image to be trained, and go to step S300a. S300f: Use the validation set constructed in step S100 to validate the trained marine vessel counting model, and record the most effective counting model based on the evaluation index. S300g: Determine whether the current training round of the marine vessel counting model has reached the predetermined training round. If yes, end; otherwise, proceed to step S300a.

6. The marine vessel counting method based on residual fusion mechanism according to claim 1, characterized in that, In step S300, the loss function used in training the marine vessel counting model is the l2 loss function. The difference between the predicted density map and the true density map is evaluated by calculating the mean square error between the pixels. The expression is as follows: ; In the formula, It is the loss value between the predicted density map and the true density map. These are model parameters. It is the number of images in the training set. This represents the original remote sensing image that was input. This represents the true density map corresponding to the input remote sensing image. This represents the predicted density map corresponding to the remote sensing image input to the model.

7. The marine vessel counting method based on residual fusion mechanism according to claim 1, characterized in that, The evaluation index used in step S300 for validating the marine vessel counting model is the mean absolute error, expressed as follows: in, It is the sample size. It is the first The actual number of targets per sample It is the first Number of predicted targets per sample.

8. A computer device for counting marine vessels, comprising a memory, a processor, and program instructions stored in the memory and executable by the processor, wherein the processor executes the program instructions to perform the steps of the method according to any one of claims 1 to 7.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.