MSD-YOLOv4 ship real-time detection network and method oriented to visual image

By simplifying the YOLOv4 network structure using MobileNetv3 and depthwise separable convolution and introducing a channel attention mechanism, the problems of slow speed and insufficient accuracy of the YOLOv4 network in ship detection are solved, and real-time and high-precision ship detection is achieved.

CN117218377BActive Publication Date: 2025-10-10HAINAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311108891.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-30
Publication Date
2025-10-10
Estimated Expiration
2043-08-30

AI Technical Summary

Technical Problem

The existing YOLOv4 network has difficulty in achieving real-time detection in ship detection due to excessive parameters and slow training speed. In addition, computer vision cannot effectively focus on important information when processing images, resulting in insufficient detection speed and accuracy.

Method used

MobileNetv3 is used as the backbone feature extraction module M3Darknet-53 to simplify the network structure, and depth-wise separable convolution is used instead of ordinary convolution. At the same time, the channel attention mechanism is introduced to build an enhanced feature extraction module SPANet to improve detection speed and accuracy.

Benefits of technology

It has achieved a significant improvement in the detection speed of ship visual images while ensuring detection accuracy, can process video stream data in real time, and improve the accuracy of the detection algorithm.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117218377B_ABST
    Figure CN117218377B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of visual image-oriented MSD-YOLOv4 ship real-time detection network and method.The scheme of the present application is especially suitable for the real-time detection of ship in inland port, large wharf and other scenes.The network includes four modules: main feature extraction module M3Darknet-53, multi-scale feature extraction module SPP, enhanced feature extraction module SPANet and detection module YOLO Detect.Main feature extraction module M3Darknet-53 is connected with multi-scale feature extraction module SPP by three ordinary convolution (Conv × 3) ;Multi-scale feature extraction module SPP is connected with enhanced feature extraction module SPANet by splicing and three ordinary convolution (Contact + Conv × 3) ;Enhanced feature extraction module SPANet is directly connected with detection module YOLO Detect.The advantage of the present application is that the network structure is simplified and the detection speed is improved;Using depth separable convolution instead of some ordinary convolution in the network reduces the model parameters, further improves the detection speed;Add channel attention unit to focus on ship target in detection process, improve detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a visual image-oriented MSD-YOLOv4 real-time ship detection network and method. The present invention is particularly suitable for real-time ship detection in scenarios such as inland ports and large docks. Background Art

[0002] Ships are the primary means of transport on water. Using computer vision to accurately and real-timely detect ships in surveillance videos can reduce collisions and help ensure navigation safety. Real-time detection of ships in video sequences places high demands on the detection algorithm's speed. To match the frame rate of the video stream and achieve real-time detection, the detection algorithm's speed must be increased.

[0003] The existing YOLOv4 network is a typical one-stage object detection algorithm. It combines the DarkNet-53 backbone feature extraction module from the YOLOv3 network with the cross-stage network CSPNet to construct a new backbone feature extraction module, CSPDarkNet-53. This feature extraction module has a more complex structure and better feature extraction, but this results in an excessive number of network parameters, slowing training speed and ultimately slowing down ship detection. Furthermore, the YOLOv4 network uses multiple ordinary convolutions. While this better preserves feature information, it also increases the number of network learning parameters, slowing network training and detection speed. As a result, the YOLOv4 network has difficulty achieving real-time detection in video ship detection.

[0004] MobileNetv3, a lightweight convolutional neural network proposed by the Google team in 2019, is suitable for embedded or mobile devices. Compared with traditional convolutional neural networks, MobileNetv3 significantly reduces the number of model parameters at the expense of a small sacrifice in accuracy, thereby improving detection speed. Therefore, this paper proposes an MSD-YOLOv4 real-time ship detection network and method for visual images. This network uses MobileNetv3 as the backbone feature extraction module, a new M3Darknet-53, to simplify the original YOLOv4 network and improve detection speed.

[0005] In addition, considering that the parameters of depthwise separable convolution are fewer than those of ordinary convolution, which is conducive to improving the detection speed, it is proposed to use depthwise separable convolution to replace some ordinary convolutions in the network, which further improves the detection speed.

[0006] On the other hand, to ensure accurate detection of ship targets, an attention mechanism is proposed. Because computers typically treat all image content equally when processing image tasks, they cannot prioritize important information like humans do. The principle of the attention mechanism is to represent the importance of information based on learned weight coefficients, highlighting important information with high weights and suppressing irrelevant information with low weights, thereby achieving attention to the target during the detection process. Therefore, the present invention adds a channel attention unit to the enhanced feature extraction module PANet of YOLOv4, forming a new enhanced feature extraction module SPANet. This allows the detection process to focus on ship targets, thereby improving the accuracy of the detection algorithm. Summary of the Invention

[0007] The purpose of the present invention is to provide an MSD-YOLOv4 real-time ship detection network and method for visual images, which improves the detection speed of ship visual images and realizes real-time detection while ensuring detection accuracy.

[0008] The present invention is described below with reference to the accompanying drawings. On one hand, the present invention provides an MSD-YOLOv4 real-time ship detection network for visual images. The network includes four modules: a backbone feature extraction module M3Darknet-53, a multi-scale feature extraction module SPP, an enhanced feature extraction module SPANet, and a detection module YOLO Detect. The backbone feature extraction module M3Darknet-53 is connected to the multi-scale feature extraction module SPP via three ordinary convolutions (Conv×3); the multi-scale feature extraction module SPP is connected to the enhanced feature extraction module SPANet via splicing plus three ordinary convolutions (Contact+Conv×3); and the enhanced feature extraction module SPANet is directly connected to the detection module YOLO Detect.

[0009] The backbone feature extraction module M3Darknet-53 is composed of six bottleneck residual blocks: bneck1, bneck2, bneck3, bneck4, bneck5, and bneck6. The six bottleneck residual blocks have the same structure and are connected sequentially. The backbone feature extraction module M3Darknet-53 is used to extract shallow information such as texture and contour of the image to obtain the initial effective feature layer.

[0010] The multi-scale feature extraction module SPP includes three parallel maximum pooling layers with the same structure and different sizes, which are used to perform multi-scale extraction on the extracted features, obtain feature layers of different sizes and stack them to extract richer feature information.

[0011] The enhanced feature extraction module, SPANet, is used to further extract and interactively integrate deep information from the initial effective feature layer. It includes six identical channel attention units (SE1, SE2, SE3, SE4, SE5, and SE6); two contact+conv×5 combined depthwise separable convolution and upsampling submodules (A and B); and a downsampling, contact+conv×5 combined depthwise separable convolution and upsampling submodule (C). The channel attention unit SE1 is connected to the contact+conv×5 submodule of submodule A via a depthwise separable convolution. The output of the contact+conv×5 submodule of submodule A is fed into the downsampling submodule (C) and the channel attention unit SE4. The channel attention unit SE2 is connected to the contact plus five depth-wise separable convolutions (Contact+Conv×5) of submodule B through a depth-wise separable convolution (Conv). The output of the contact plus five depth-wise separable convolutions (Contact+Conv×5) of submodule B is fed to the contact plus five depth-wise separable convolutions (Contact+Conv×5) of submodule C, and the output of the contact plus five depth-wise separable convolutions (Contact+Conv×5) of submodule C is fed to the channel attention unit SE5. The channel attention unit SE3 is connected to the depth-wise separable convolution plus sampling (Conv+UpSampling) of submodule B on the one hand, and to the depth-wise separable convolution plus sampling (Conv+UpSampling) of submodule C and the channel attention unit SE6 on the other hand through a contact plus five depth-wise separable convolution (Contact+Conv×5).

[0012] The detection module YOLO Detect is used to classify and regress the final features obtained and give the target detection results. It consists of three submodules: YOLO Head1, YOLO Head2, and YOLO Head3. Each submodule includes a 3×3 depthwise separable convolution and a 1×1 depthwise separable convolution.

[0013] In the backbone feature extraction module M3Darknet-53, the bottleneck residual block bneck4 is connected to the channel attention unit SE1 in the enhanced feature extraction module SPANet; the bottleneck residual block bneck5 is connected to the channel attention unit SE2 in the enhanced feature extraction module SPANet. The concatenated triple convolution (Contact+Conv×3) is connected to the channel attention unit SE3 in the enhanced feature extraction module SPANet. The channel attention units SE4, SE5, and SE6 in the enhanced feature extraction module SPANet are respectively connected to the YOLO Head1, YOLO Head2, and YOLO Head3 submodules in the detection module YOLO Detect.

[0014] A second aspect of the present invention provides a real-time ship detection method using MSD-YOLOv4 for visual images, comprising the following steps:

[0015] Step 1: Establish the backbone feature extraction module M3Darknet-53

[0016] Set up six bottleneck residual blocks bneck1, bneck2, bneck3, bneck4, bneck5 and bneck6 with the same structure but different parameters, and connect them sequentially.

[0017] Step 2: Establish a multi-scale feature extraction module SPP

[0018] Set up three parallel max pooling layers with the same structure but different sizes.

[0019] Step 3: Establish enhanced feature extraction module SPANet

[0020] Six channel attention units (SE1, SE2, SE3, SE4, SE5, and SE6) with identical structures but different parameters are configured. There are also two submodules A and B: contact+conv×5, depthwise separable convolution, and conv+upsampling. There is also a submodule C: downsampling, contact+conv×5, depthwise separable convolution, and conv+upsampling. The channel attention unit SE1 is connected to the contact+conv×5 submodule of submodule A via a depthwise separable convolution. The output of the contact+conv×5 submodule of submodule A is fed into the downsampling submodule C and into the channel attention unit SE4. The channel attention unit SE2 is connected to the contact plus five depth-wise separable convolutions (Contact+Conv×5) of submodule B through a depth-wise separable convolution (Conv). The output of the contact plus five depth-wise separable convolutions (Contact+Conv×5) of submodule B is fed to the contact plus five depth-wise separable convolutions (Contact+Conv×5) of submodule C, and the output of the contact plus five depth-wise separable convolutions (Contact+Conv×5) of submodule C is fed to the channel attention unit SE5. The channel attention unit SE3 is connected to the depth-wise separable convolution plus sampling (Conv+UpSampling) of submodule B on the one hand, and to the depth-wise separable convolution plus sampling (Conv+UpSampling) of submodule C and the channel attention unit SE6 on the other hand through a contact plus five depth-wise separable convolution (Contact+Conv×5).

[0021] Step 4: Create the detection module YOLO Detect

[0022] Set up three submodules: YOLO Head1, YOLO Head2, and YOLO Head3. Each submodule includes a 3×3 depth-wise separable convolution and a 1×1 depth-wise separable convolution.

[0023] Step 5: Establish connections between modules

[0024] The main feature extraction module M3Darknet-53 is connected with the multi-scale feature extraction module SPP through three ordinary convolutions (Conv x 3); the multi-scale feature extraction module SPP is connected with the enhanced feature extraction module SPANet through splicing plus three ordinary convolutions (Contact + Conv x 3). The bottleneck residual block bneck4 in the main feature extraction module M3Darknet-53 is connected with the channel attention unit SE1 in the enhanced feature extraction module SPANet; the bottleneck residual block bneck5 is connected with the channel attention unit SE2 in the enhanced feature extraction module SPANet. The splicing plus three ordinary convolutions (Contact + Conv x 3) are connected with the channel attention unit SE3 in the enhanced feature extraction module SPANet. The channel attention units SE4, SE5 and SE6 in the enhanced feature extraction module SPANet are respectively connected with three sub-modules YOLO Head1, YOLO Head2 and YOLO Head3 in the detection module YOLO Detect.

[0025] Step six: network training and ship detection

[0026] (1) Anchor box generation

[0027] The data set is clustered by K-means++, and anchor boxes are generated for marking the ship position in ship detection. The data set includes a training set and a test set.

[0028] (2) MSD-YOLOv4 network training

[0029] The size of the MSD-YOLOv4 network is set, the initial parameters are given, the data set is input into the network, the network parameters are trained using an optimization algorithm, and a trained network model is obtained.

[0030] (3) Ship detection

[0031] The test set is input into the trained MSD-YOLOv4 network model, and the network outputs the ship detection result marked with anchor boxes.

[0032] Compared with the prior art, the present application has the following advantages:

[0033] (1) MobileNetv3 is used instead of the original CSPDarkNet53 of YOLOv4 as the main feature extraction module M3Darknet-53, which effectively simplifies the network structure and improves the detection speed of the algorithm;

[0034] (2) Deep separable convolution is used instead of some ordinary convolution in the network, which reduces the model parameters and further improves the detection speed of the algorithm;

[0035] (3) By adding channel attention units, a new enhanced feature extraction module SPANet is constructed, so that the detection process focuses on the ship target, thereby improving the accuracy of the detection algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 This is the network structure diagram of MSD-YOLOv4 real-time ship detection for visual images;

[0037] Figure 2 Detection results of the MSD-YOLOv4 real-time ship detection method for visual images. DETAILED DESCRIPTION

[0038] In order to better explain the present invention and facilitate understanding, the MSD-YOLOv4 real-time ship detection method for visual images proposed in the present invention is specifically implemented, combined with Figure 1 The present invention is described in detail.

[0039] Execute step 1: Establish the backbone feature extraction module M3Darknet-53

[0040] Set up six bottleneck residual blocks bneck1, bneck2, bneck3, bneck4, bneck5 and bneck6 with the same structure but different parameters, and connect them sequentially. In this embodiment, the six bottleneck residual blocks are all composed of three convolutional layers, namely, a 1×1 convolutional layer with a stride of 1 and a size of , a 3×3 convolutional layer with a stride of 2 and a 1×1 convolutional layer with a stride of 2 and a size of . The number of convolution kernels of the three convolutional layers in bneck1 are 16, 8, and 16 respectively; the number of convolution kernels of the three convolutional layers in bneck2 are 24, 12, and 24 respectively; the number of convolution kernels of the three convolutional layers in bneck3 are 40, 20, and 40 respectively; the number of convolution kernels of the three convolutional layers in bneck4 are 80, 40, and 80 respectively; the number of convolution kernels of the three convolutional layers in bneck5 are 112, 56, and 112 respectively; and the number of convolution kernels of the three convolutional layers in bneck6 are 160, 80, and 160 respectively.

[0041] Execute step 2: Establish a multi-scale feature extraction module SPP

[0042] Set up three parallel maximum pooling layers with the same structure and sizes of 5×5, 9×9, and 13×13 respectively.

[0043] Execute step 3: Establish the enhanced feature extraction module SPANet

[0044] Six channel attention units (SE1, SE2, SE3, SE4, SE5, and SE6) with identical structures but different parameters are set. The depth of each channel attention unit (SE) is consistent with the depth of its input feature layer. Two submodules A and B are set up: contact+conv×5, depthwise separable convolution, and upsampling (Conv+UpSampling); and a submodule C is set up: downsampling (DownSampling), contact+conv×5, depthwise separable convolution, and upsampling (Conv+UpSampling). Channel attention unit SE1 is connected to the contact+conv×5 submodule of submodule A via a depthwise separable convolution (Conv). The output of the contact+conv×5 submodule of submodule A is fed into the downsampling (DownSampling) submodule C and into channel attention unit SE4. The channel attention unit SE2 is connected to the contact plus five depth-wise separable convolutions (Contact+Conv×5) of submodule B through a depth-wise separable convolution (Conv). The output of the contact plus five depth-wise separable convolutions (Contact+Conv×5) of submodule B is fed to the contact plus five depth-wise separable convolutions (Contact+Conv×5) of submodule C, and the output of the contact plus five depth-wise separable convolutions (Contact+Conv×5) of submodule C is fed to the channel attention unit SE5. The channel attention unit SE3 is connected to the depth-wise separable convolution plus sampling (Conv+UpSampling) of submodule B on the one hand, and to the depth-wise separable convolution plus sampling (Conv+UpSampling) of submodule C and the channel attention unit SE6 on the other hand through a contact plus five depth-wise separable convolution (Contact+Conv×5).

[0045] Execute step 4: Create the detection module YOLO Detect

[0046] Set up three submodules: YOLO Head1, YOLO Head2, and YOLO Head3. Each submodule includes a depthwise separable convolution of size 3×3 and a depthwise separable convolution of size 1×1. Set the number of kernels of the two depthwise separable convolutions in YOLO Head1 to 256 and 33 respectively, the number of kernels of the two depthwise separable convolutions in YOLO Head2 to 512 and 33 respectively, and the number of kernels of the two depthwise separable convolutions in YOLO Head3 to 1024 and 33 respectively. The stride of each ordinary convolution is 1.

[0047] Execute step 5: Establish connections between modules

[0048] The main feature extraction module M3Darknet-53 is connected to the multi-scale feature extraction module SPP through three ordinary convolutions (Conv x 3), and the multi-scale feature extraction module SPP is connected to the enhanced feature extraction module SPANet through splicing plus three ordinary convolutions (Contact + Conv x 3). The bottleneck residual block bneck4 in the main feature extraction module M3Darknet-53 is connected to the channel attention unit SE1 in the enhanced feature extraction module SPANet, and the bottleneck residual block bneck5 is connected to the channel attention unit SE2 in the enhanced feature extraction module SPANet. The splicing plus three ordinary convolutions (Contact + Conv x 3) are connected to the channel attention unit SE3 in the enhanced feature extraction module SPANet. The channel attention units SE4, SE5 and SE6 in the enhanced feature extraction module SPANet are respectively connected to the three sub-modules YOLO Head1, YOLO Head2 and YOLO Head3 in the detection module YOLO Detect.

[0049] Step six: network training and ship detection

[0050] (1) Anchor box generation

[0051] SeaShips7000 is used as the data set, which contains six types of ships including ore ships, bulk carriers, general cargo ships, container ships, fishing boats and passenger ships, a total of 7000 pictures. According to the ratio of 9:1, the data set is divided into training set and test set, respectively 6300 and 700 pictures. K-means++ clustering is performed on the data set to generate anchor boxes for marking the position of ships in ship detection. The data set includes training set and test set. The number of clustering categories is set to 6, and the ship anchor box parameters obtained after clustering are (30x14), (61x25), (86x42), (133x72), (146x46), (210x97), (242x57), (214x217) and (338x105).

[0052] (2) MSD-YOLOv4 network training

[0053] The size of the MSD-YOLOv4 network is set, the initial parameters are given, the data set is input into the network, the network parameters are trained using the optimization algorithm, and the trained network model is obtained. Specifically:

[0054] The input image size is set to 416×416, and Mosaic is used for data enhancement. The learning rate is reduced by cosine annealing, and the learning rate is optimized using stochastic gradient descent (SGD). The initial learning rate is set to 10 -2 , the initial momentum is set to 0.937, and the learning decay rate is set to 5×10 -4 The threshold for non-maximum suppression was set to 0.45. The algorithm was trained for 300 rounds, and the trained model was saved. The batch size for the first 50 rounds was set to 16, and for rounds 51 to 300, the batch size was set to 8. Training was performed on the training set data using these parameters, and each training step was validated.

[0055] The experimental environment used is as follows:

[0056] Operating system: Ubuntu 18.04.6 64bit

[0057] Hardware environment: Intel Xeon(R)E5-2680 v3@2.50GHz×48

[0058] Nvidia GeForce GTX TITAN X GPU

[0059] Software environment:

[0060] (3) Ship inspection

[0061] The test set is input into the trained MSD-YOLOv4 network model, and the network outputs the ship detection results with anchor box labels. Specifically:

[0062] The test set in the dataset is used as the prediction data to detect the ship target and position in the prediction video, and the ship position and target classification are displayed in the original video. The detection effect is shown in the following 9 cases as an example. Figure 2 As shown. Figure 2It can be seen that the anchor frame of the ship has less redundant area and the positioning is more accurate. 1. The probability that the ship in jpg is an ore carrier is 1.00, and it is judged to be an ore carrier. After manual identification, the network judgment result is correct; 2. The probability that the ship in jpg is an ordinary cargo ship is 1.00, and it is judged to be an ordinary cargo ship. After manual identification, the network judgment result is correct; 3. The probability that the ship in jpg is a container ship is 0.99, and it is judged to be a container ship. After manual identification, the network judgment result is correct; 4. The probability that the ship in jpg is a bulk carrier is 1.00, and it is judged to be a bulk carrier. After manual identification, the network judgment result is correct; 5. The probability that the ship in jpg is a fishing vessel is 0.98, and it is judged to be a fishing vessel. After manual identification, the network judgment result is correct; 6. The probability that the ship in g is a passenger ship is 0.89, and it is judged to be a passenger ship. After manual identification, the network judgment result is correct; the probabilities that the two ships in 7.jpg are ordinary cargo ships and passenger ships are 0.98 and 0.78 respectively, and they are judged to be ordinary cargo ships. After manual identification, the network judgment result is correct; there are two valid ship targets in 8.jpg after removing the edges of the ships, and the probabilities that they are fishing ships are 0.88 and 0.96 respectively, and they are judged to be fishing ships. After manual identification, the network judgment result is correct; in 9.jpg, the probability that the ship on the left is a bulk carrier is 0.97, and it is judged to be a bulk carrier. The probability that the ship on the right is an ordinary cargo ship is 0.92, and it is judged to be an ordinary cargo ship. After manual identification, the network judgment result is correct.

[0063] Table 1 shows the statistics of detection accuracy and speed, comparing the detection results of the proposed MSD-YOLOv4 algorithm with those of the publicly available YOLOv4 algorithm. In the statistical evaluation process, the average precision (AP) was used to evaluate the detection accuracy of a single ship target, and the mean average precision (mAP) was used to evaluate the overall ship target detection accuracy. The closer the AP and mAP values ​​are to 100%, the higher the accuracy. Frames per second (FPS) was used to evaluate the detection speed.

[0064] In terms of detection accuracy, MSD-YOLOv4 achieved an average detection accuracy of 97.80% for different types of ships, an improvement of 0.5% compared to YOLOv4. The single-category detection accuracy of each category of ships of MSD-YOLOv4 was higher than 95%. Compared with other algorithms, except for the slightly lower detection accuracy of bulk carriers, the detection accuracy of other ships was significantly improved, indicating that MSD-YOLOv4 not only maintained the high detection accuracy of YOLOv4 but also slightly improved the detection accuracy.

[0065] In terms of detection speed, the FPS value of YOLOv4 is 22, while the FPS value of MSD-YOLOv4 is 45. The detection speed of the proposed algorithm is more than twice that of YOLOv4 and can process video stream data with an FPS of 45 in real time.

[0066] Table 1 Model detection results

[0067]

[0068] It should be appreciated that the embodiments of the present invention may also be implemented or practiced by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer-readable memory. The methods may be implemented in a computer program using standard programming techniques, including a non-transitory computer-readable storage medium configured with a computer program, wherein the storage medium so configured causes the computer to operate in a specific and predefined manner, according to the methods and drawings described in the specific embodiments. Each program may be implemented in a high-level procedural or object-oriented programming language to communicate with the computer system. However, if desired, the program may be implemented in assembly or machine language. In any case, the language may be a compiled or interpreted language. In addition, the program may be run on a programmed application-specific integrated circuit for this purpose.

[0069] Further, the methods can be implemented in any type of computing platform that is operably connected to a suitable computer, including but not limited to a personal computer, a minicomputer, a mainframe, a workstation, a network or distributed computing environment, a separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, etc. Various aspects of the present invention can be implemented as machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, an optical read and / or write storage medium, RAM, ROM, etc., so that it can be read by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the processes described herein. In addition, the machine-readable code, or portions thereof, can be transmitted over a wired or wireless network. When such media includes instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor, the invention described herein includes these and other different types of non-transitory computer-readable storage media. When programmed according to the methods and techniques of the present invention, the present invention also includes the computer itself.

[0070] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.

Claims

1. A real-time ship detection method based on MSD-YOLOv4 for visual images is used to establish a real-time ship detection network based on MSD-YOLOv4 for visual images, characterized in that: include: Step 1: Establish the backbone feature extraction module M3Darknet-53; Step 2: Establish a multi-scale feature extraction module SPP; Step 3: Establish the enhanced feature extraction module SPANet; Step 4: Create the detection module YOLO Detect; Step 5: Establish connections between modules; Step 6: Network training and ship detection; The MSD-YOLOv4 real-time ship detection network for visual images includes: Main feature extraction module M3Darknet-53, multi-scale feature extraction module SPP, enhanced feature extraction module SPANet and detection module YOLO Detect; the main feature extraction module M3Darknet-53 is connected to the multi-scale feature extraction module SPP through three ordinary convolutions (Conv×3); the multi-scale feature extraction module SPP is connected to the enhanced feature extraction module SPANet through splicing plus three ordinary convolutions (Contact+Conv×3); the enhanced feature extraction module SPANet is directly connected to the detection module YOLO Detect; The enhanced feature extraction module SPANet includes: Six identical channel attention units SE1, SE2, SE3, SE4, SE5 and SE6; two splicing plus five depth-separable convolution (Contact+Conv×5) joint depth-separable convolution plus sampling (Conv+UpSampling) sub-modules A and B; a downsampling (DownSampling), splicing plus five depth-separable convolution (Contact+Conv×5) joint depth-separable convolution plus sampling (Conv+UpSampling) sub-module C; the channel attention unit SE1 is connected to the splicing plus five depth-separable convolution (Contact+Conv×5) of sub-module A through a depth-separable convolution (Conv), and the output of the splicing plus five depth-separable convolution (Contact+Conv×5) of sub-module A is sent to the downsampling (DownSampling) of sub-module C on the one hand, and to the channel attention on the other hand Force unit SE4; Channel attention unit SE2 is connected to the splicing plus five depth-separable convolution (Contact+Conv×5) of sub-module B through a depth-separable convolution (Conv), and the output of the splicing plus five depth-separable convolution (Contact+Conv×5) of sub-module B is sent to the splicing plus five depth-separable convolution (Contact+Conv×5) of sub-module C, and the output of the splicing plus five depth-separable convolution (Contact+Conv×5) of sub-module C is sent to the channel attention unit SE5; Channel attention unit SE3 is connected to the depth-separable convolution plus sampling (Conv+UpSampling) of sub-module B on the one hand, and is connected to the depth-separable convolution plus sampling (Conv+UpSampling) of sub-module C and the channel attention unit SE6 on the other hand through a splicing plus five depth-separable convolution (Contact+Conv×5); In the backbone feature extraction module M3Darknet-53, the bottleneck residual block bneck4 is connected to the channel attention unit SE1 in the enhanced feature extraction module SPANet; the bottleneck residual block bneck5 is connected to the channel attention unit SE2 in the enhanced feature extraction module SPANet; the concatenated plus three ordinary convolutions (Contact+Conv×3) is connected to the channel attention unit SE3 in the enhanced feature extraction module SPANet; the channel attention units SE4, SE5 and SE6 in the enhanced feature extraction module SPANet are respectively connected to the three sub-modules YOLO Head1, YOLO Head2 and YOLO Head3 in the detection module YOLO Detect.

2. The MSD-YOLOv4 real-time ship detection method for visual images according to claim 1 is characterized in that: The backbone feature extraction module M3Darknet-53 includes: Six bottleneck residual blocks with the same structure and connected sequentially are bneck1, bneck2, bneck3, bneck4, bneck5 and bneck6.

3. The MSD-YOLOv4 real-time ship detection method for visual images according to claim 2 is characterized in that: The multi-scale feature extraction module SPP includes: Three parallel max pooling layers with the same structure but different sizes.

4. The MSD-YOLOv4 real-time ship detection method for visual images according to claim 1 is characterized in that: The detection module YOLO Detect includes: YOLO Head1, YOLO Head2 and YOLO Head3 are three sub-modules, each of which includes a 3×3 depth-wise separable convolution and a 1×1 depth-wise separable convolution.

5. A computer device, characterized in that: The device comprises: a memory for storing a computer program; A processor, configured to implement the method according to claim 1 when executing the computer program.

6. A readable storage medium, characterized in that: The readable storage medium stores a computer program, which implements the method according to claim 1 when executed by a processor.