Vessel detection method and device
By improving the YOLO v3 tiny detection model, using the convolutional layer to replace the pooling layer and introducing the attention layer and multiple anchor frames, the real-time and performance problems of ship detection in the existing technology are solved, and the detection of small-sized and large targets is improved. Ship detection results.
Patent Information
- Application Number
- CN202110009522.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-05
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-01-05
AI Technical Summary
Existing deep neural networks have problems with poor real-time performance and poor detection performance in ship detection, especially in scenarios with high real-time requirements.
The YOLO v3 tiny detection model is improved by using a convolutional layer instead of a pooling layer in the backbone network, and introducing an attention layer and multiple anchor boxes into the detection network to generate feature maps for ships of different sizes and types to improve the detection effect.
It improves the detection effect of small-sized ships and the detection accuracy of large target ships, reduces interference from the external environment, and improves the real-time performance and detection performance of the model.
Smart Images

Figure CN112651376B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a ship detection method and a ship detection device. Background Art
[0002] Ship remote sensing image detection has a wide range of applications in fishery management, ship traffic services, and naval warfare. Especially in recent years, with the continuous reduction of world fishery resources, it has become increasingly important to monitor ships effectively and efficiently and to prohibit illegal fishing activities in a timely manner.
[0003] With the increasing development of deep learning theory, deep neural networks are widely used in ship detection. However, the deep neural networks currently used for ship detection have problems with poor real-time performance and poor detection performance in ship detection scenarios with high real-time requirements. Summary of the invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a ship detection method and a corresponding ship detection device that overcome the above problems or at least partially solve the above problems.
[0005] The embodiment of the present invention discloses a ship detection method, comprising:
[0006] Constructing an improved YOLO v3 tiny detection model; the improved YOLO v3 tiny detection model includes an input layer, a backbone network and a detection network; the backbone network includes multiple convolutional layers; the detection network includes multiple convolutional layers, a first YOLO layer, a second YOLO layer, a first routing layer and a second routing layer; the first YOLO layer uses multiple anchor frames for a first size type of ship to detect a first size type of ship, and the second YOLO layer uses multiple anchor frames for a second size type of ship to detect a second size type of ship; the first routing layer is connected to the convolutional layer in the detection network to generate a first feature map for detecting the first size type of ship; the second routing layer is connected to the convolutional layer in the backbone network to generate a second feature map for detecting the second size type of ship;
[0007] Acquire vessel images;
[0008] Outputting a ship detection result of the ship image according to the improved YOLO v3 tiny detection model.
[0009] Optionally, the constructing an improved YOLO v3 tiny detection model includes:
[0010] The backbone network is provided with thirteen convolutional layers, which are respectively the first convolutional layer to the thirteenth convolutional layer;
[0011] For each of the first convolutional layer to the thirteenth convolutional layer, at least one of the number of filters, the convolution kernel size, the step size, and the output size is set.
[0012] Optionally, the constructing an improved YOLO v3 tiny detection model further includes:
[0013] The detection network is provided with six convolutional layers, namely the fourteenth convolutional layer to the nineteenth convolutional layer;
[0014] For each of the fourteenth to nineteenth convolutional layers, at least one of the number of filters, the size of the convolution kernel, and the output size is set.
[0015] Optionally, the constructing an improved YOLO v3 tiny detection model further includes:
[0016] Connecting the first routing layer to the fourteenth convolutional layer so that the first routing layer generates a first feature map for detecting a vessel of a first size type;
[0017] Setting the number of filters and output size for the first routing layer;
[0018] Connecting the second routing layer to the eighth convolutional layer so that the second routing layer generates a second feature map for detecting a second size type of vessel;
[0019] The number of filters and output size are set for the second routing layer.
[0020] Optionally, the constructing an improved YOLO v3 tiny detection model includes:
[0021] Setting an attention layer for detecting a first size type of vessel for the detection network, the attention layer comprising a channel attention layer and a spatial attention layer;
[0022] The channel attention layer and the spatial attention layer are connected in series and placed before the first YOLO layer.
[0023] Optionally, the detection network further includes a sampling layer, and the constructed improved YOLO v3 tiny detection model further includes:
[0024] According to the output size of the fourteenth convolutional layer, a step size and an output size are set for the sampling layer.
[0025] Optionally, the constructing an improved YOLO v3 tiny detection model includes:
[0026] Get the vessel dataset;
[0027] According to the k-means algorithm and the ship dataset, a plurality of anchor boxes for the first size type of ships and a plurality of anchor boxes for the second size type of ships are generated.
[0028] The embodiment of the present invention further discloses a ship detection device, comprising:
[0029] A model construction module, used to construct an improved YOLO v3 tiny detection model; the improved YOLO v3tiny detection model includes an input layer, a backbone network and a detection network; the backbone network includes multiple convolutional layers; the detection network includes multiple convolutional layers, a first YOLO layer, a second YOLO layer, a first routing layer and a second routing layer; the first YOLO layer uses multiple anchor frames for a first size type of ship to detect a first size type of ship, and the second YOLO layer uses multiple anchor frames for a second size type of ship to detect a second size type of ship; the first routing layer is connected to the convolutional layer in the detection network to generate a first feature map for detecting the first size type of ship; the second routing layer is connected to the convolutional layer in the backbone network to generate a second feature map for detecting the second size type of ship;
[0030] An image acquisition module, used for acquiring images of ships;
[0031] A detection module is used to output a ship detection result of the ship image according to the improved YOLO v3 tiny detection model.
[0032] Optionally, the model construction module includes:
[0033] A first network setting submodule, used for setting thirteen convolutional layers for the backbone network, namely, the first convolutional layer to the thirteenth convolutional layer;
[0034] The first parameter setting submodule is used to set at least one of the number of filters, the convolution kernel size, the step size, and the output size for the first convolution layer to the thirteenth convolution layer respectively.
[0035] Optionally, the model construction module further includes:
[0036] A second network setting submodule, used for setting six convolutional layers for the detection network, namely the fourteenth convolutional layer to the nineteenth convolutional layer;
[0037] The second parameter setting submodule is used to set at least one of the number of filters, the convolution kernel size, and the output size for the fourteenth convolution layer to the nineteenth convolution layer respectively.
[0038] Optionally, the model construction module further includes:
[0039] a first connection submodule, configured to connect the first routing layer to the fourteenth convolutional layer, so that the first routing layer generates a first feature map for detecting a vessel of a first size type;
[0040] A third parameter setting submodule is used to set the number of filters and output size for the first routing layer;
[0041] a second connection submodule, configured to connect the second routing layer to the eighth convolutional layer, so that the second routing layer generates a second feature map for detecting a vessel of a second size type;
[0042] The fourth parameter setting submodule is used to set the number of filters and output size for the second routing layer.
[0043] Optionally, the model construction module includes:
[0044] A third network setting submodule is used to set an attention layer for the detection network for detecting ships of a first size type, wherein the attention layer includes a channel attention layer and a spatial attention layer;
[0045] The third connection submodule is used to connect the channel attention layer and the spatial attention layer in series and place them before the first YOLO layer.
[0046] Optionally, the detection network further includes a sampling layer, and the model construction module further includes:
[0047] The fifth parameter setting submodule is used to set the step size and output size of the sampling layer according to the output size of the fourteenth convolutional layer.
[0048] Optionally, the model construction module includes:
[0049] The vessel data set acquisition submodule is used to acquire the vessel data set;
[0050] The anchor frame generation submodule is used to generate multiple anchor frames for the first size type of ships and multiple anchor frames for the second size type of ships according to the k-means algorithm and the ship data set.
[0051] An embodiment of the present invention further discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the steps of the ship detection method described above when executed by the processor.
[0052] The embodiment of the present invention further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the ship detection method described above are implemented.
[0053] The embodiments of the present invention include the following advantages:
[0054] In an embodiment of the present invention, an improved YOLO v3 tiny detection model can be constructed; the improved YOLO v3 tiny detection model may include an input layer, a backbone network and a detection network; the backbone network includes multiple convolutional layers; the detection network includes multiple convolutional layers, a first YOLO layer, a second YOLO layer, a first routing layer and a second routing layer; the first YOLO layer uses multiple anchor frames for a first size type of ship to detect a first size type of ship, and the second YOLO layer uses multiple anchor frames for a second size type of ship to detect a second size type of ship; the first routing layer connects the convolutional layer in the detection network to generate a first feature map for detecting a first size type of ship; the second routing layer connects the convolutional layer in the backbone network to generate a second feature map for detecting a second size type of ship; obtains a ship image; and outputs a ship detection result of the ship image according to the improved YOLO v3 tiny detection model. Compared with the original YOLO v3 tiny detection model, the improved YOLO v3 tiny detection model can use a convolutional layer instead of a pooling layer, and adjust the number of network channels at the same time, which can improve the detection effect for small-sized ships.
[0055] Furthermore, for the problem of large target ship detection, an attention layer can be introduced into the detection network so that the model can focus more on the detection target itself and reduce interference from the external environment.
[0056] Furthermore, you can also use the ship dataset to train the 6 anchor boxes required by the YOLO v3 tiny detection model, which makes model training easier and achieves better results. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 is a flow chart of steps of a ship detection method according to an embodiment of the present invention;
[0058] Figure 2 This is a schematic diagram of the original YOLO v3 tiny network structure;
[0059] Figure 3 is a schematic diagram of an improved YOLO v3 tiny detection model according to an embodiment of the present invention;
[0060] Figure 4 is a schematic diagram of the anchor frame size in an embodiment of the present invention;
[0061] Figure 5 It is a structural block diagram of a ship detection device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0062] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0063] YOLO v3 is the third version of the YOLO (You Only Look Once) series of target detection algorithms. Compared with previous algorithms, it has significantly improved accuracy, especially for small targets.
[0064] The original version of the YOLO v3 network has poor real-time performance when applied to ship detection scenarios with high real-time requirements.
[0065] Although the YOLO v3 tiny network has ideal real-time performance, it has low recall rate and poor detection performance when detecting small ships, i.e. small targets. At the same time, it is easily affected by the external environment, such as shore buildings and floating objects in the water, when detecting large ships, i.e. large targets.
[0066] In this regard, an embodiment of the present invention provides a ship detection method, which adjusts the network structure of the original YOLO v3 tiny and performs ship detection based on the improved YOLO v3 tiny detection model, thereby solving at least one of the above problems.
[0067] Reference Figure 1 , shows a flow chart of the steps of a ship detection method according to an embodiment of the present invention, and the method may specifically include the following steps:
[0068] Step 101, constructing an improved YOLO v3 tiny detection model; the improved YOLO v3tiny detection model includes an input layer, a backbone network and a detection network; the backbone network includes multiple convolutional layers; the detection network includes multiple convolutional layers, a first YOLO layer, a second YOLO layer, a first routing layer and a second routing layer; the first YOLO layer uses multiple anchor frames for a first size type of ship to detect a first size type of ship, and the second YOLO layer uses multiple anchor frames for a second size type of ship to detect a second size type of ship; the first routing layer is connected to the convolutional layers in the detection network to generate a first feature map for detecting the first size type of ship; the second routing layer is connected to the convolutional layers in the backbone network to generate a second feature map for detecting the second size type of ship.
[0069] Reference Figure 2The figure shows a schematic diagram of the original YOLO v3 tiny network structure. The original YOLO v3tiny network structure includes an input layer, a backbone network, and a detection network. Among them, the backbone network includes a convolutional layer (Convolutional) and a pooling layer (maxpool). Specifically, it includes 7 convolutional layers, namely the first convolutional layer to the seventh convolutional layer and 6 pooling layers, namely the first pooling layer to the sixth pooling layer. Different convolutional layers can set different parameters. For example, the number of filters corresponding to the first convolutional layer is 16, the convolution kernel size (size) is 3*3, and the output size (output) is 416*416*16. Different pooling layers can set different parameters. For example, the convolution kernel size of the first pooling layer is 2*2, the stride (stride) is 2, and the output size is 208*208*16. The detection network includes 6 convolutional layers, namely the eighth convolutional layer to the thirteenth convolutional layer. The detection network may further include a first YOLO layer, a second YOLO layer, a first routing layer, and a second routing layer.
[0070] Reference Figure 3 The figure shows a schematic diagram of an improved YOLO v3 tiny detection model according to an embodiment of the present invention. The improved YOLO v3 tiny detection model includes an input layer, a backbone network and a detection network; wherein the backbone network includes multiple convolutional layers.
[0071] The backbone network of the existing YOLO v3 tiny network structure includes a convolutional layer and a pooling layer (maxpool). In the embodiment of the present invention, in the backbone network, a convolutional layer with a size of 3*3 and a step size of 2 can be used to replace the pooling layer in the original YOLO v3 tiny network structure. Although the parameters are slightly increased, the learning ability of the network is enhanced to store more small target information.
[0072] Specifically, the backbone network may include thirteen convolutional layers, namely, the first convolutional layer to the thirteenth convolutional layer. The step 101 may include: setting thirteen convolutional layers for the backbone network, namely, the first convolutional layer to the thirteenth convolutional layer; and setting at least one of the number of filters, convolution kernel size, step size, and output size for each of the first convolutional layer to the thirteenth convolutional layer.
[0073] Specifically, the number of filters of the first convolutional layer can be set to 32, the convolution kernel size can be set to 3*3, and the output size can be set to 416*416*32; the number of filters of the second convolutional layer can be set to 64, the convolution kernel size can be set to 3*3, the step size can be set to 2, and the output size can be set to 208*208*64; the number of filters of the third convolutional layer can be set to 64, the convolution kernel size can be set to 3*3, and the output size can be set to 208*208*64; the number of filters of the fourth convolutional layer can be set to 64, the convolution kernel size can be set to 3*3, and the output size can be set to 208*208*64; The number of filters is set to 128, the convolution kernel size is set to 3*3, the step size is set to 2, and the output size is set to 104*104*128; the number of filters of the fifth convolution layer is set to 128, the convolution kernel size is set to 3*3, and the output size is set to 104*104*128; the number of filters of the sixth convolution layer is set to 256, the convolution kernel size is set to 3*3, the step size is set to 2, and the output size is set to 52*52*256; the number of filters of the seventh convolution layer is set to 256 , the convolution kernel size is set to 3*3, and the output size is set to 52*52*256; the number of filters of the eighth convolution layer is set to 512, the convolution kernel size is set to 3*3, the step size is set to 2, and the output size is set to 26*26*512; the number of filters of the ninth convolution layer is set to 512, the convolution kernel size is set to 3*3, and the output size is set to 26*26*512; the number of filters of the tenth convolution layer is set to 1024, the convolution kernel size is set to 3*3, and the step size is set to 2 , the output size is set to 13*13*1024; the number of filters of the eleventh convolutional layer is set to 1024, the convolution kernel size is set to 3*3, and the output size is set to 13*13*1024; the number of filters of the twelfth convolutional layer is set to 512, the convolution kernel size is set to 1*1, and the output size is set to 13*13*512; the number of filters of the thirteenth convolutional layer is set to 1024, the convolution kernel size is set to 3*3, and the output size is set to 13*13*1024.
[0074] In an embodiment of the present invention, the step 101 may further include: setting six convolutional layers for the detection network, namely the fourteenth convolutional layer to the nineteenth convolutional layer; setting at least one of the number of filters, the convolution kernel size, and the output size for the fourteenth convolutional layer to the nineteenth convolutional layer, respectively.
[0075] Specifically, the number of filters of the fourteenth convolutional layer can be set to 512, the convolution kernel size can be set to 1*1, and the output size can be set to 13*13*512; the number of filters of the fifteenth convolutional layer can be set to 256, the convolution kernel size can be set to 3*3, and the output size can be set to 13*13*256; the number of filters of the sixteenth convolutional layer can be set to 33, the convolution kernel size can be set to 1*1, and the output size can be set to 13*13*33; the number of filters of the seventeenth convolutional layer can be set to 512, the convolution kernel size can be set to 1*1, and the output size can be set to 13*13*512; the number of filters of the eighteenth convolutional layer can be set to 256, the convolution kernel size can be set to 3*3, and the output size can be set to 26*26*256; the number of filters of the nineteenth convolutional layer can be set to 33, the convolution kernel size can be set to 1*1, and the output size can be set to 26*26*33.
[0076] In an embodiment of the present invention, the improved YOLO v3 tiny detection model includes a total of 19 convolutional layers, which has a deeper network than the 13 convolutional layers of the original YOLO v3 tiny detection model. The backbone network has the same number of layers (13 layers), and the backbone network skips the two-layer network with 16 filters and directly enters the network with 32 filters. By using a convolutional layer with a convolution kernel size of 3*3 and a step size of 2 instead of a pooling layer, the depth of the convolutional layer of the improved YOLO v3 tiny detection model is not reduced, and while reducing the amount of calculation, it does not cause too much prediction quality loss. Like the original YOLO v3 tiny detection model, the improved YOLO v3 tiny detection model outputs a feature map with a size of 13*13*1024.
[0077] In the embodiment of the present invention, step 101 may further include:
[0078] The first routing layer is connected to the fourteenth convolutional layer so that the first routing layer generates a first feature map for detecting a first size type of ship; the number of filters and the output size are set for the first routing layer; the second routing layer is connected to the eighth convolutional layer so that the second routing layer generates a second feature map for detecting a second size type of ship; the number of filters and the output size are set for the second routing layer.
[0079] Specifically, the number of filters of the first routing layer may be set to -6, and the output size may be set to 13*13*512; the number of filters of the second routing layer may be set to -1 and 8, and the output size may be set to 26*26*512.
[0080] In an embodiment of the present invention, the detection network further includes a sampling layer, and step 101 may further include: setting a step size and an output size for the sampling layer according to the output size of the fourteenth convolutional layer. Specifically, the output size of the fourteenth convolutional layer may be 13*13*512, the step size of the sampling layer may be set to 2, and the output size may be set to 26*26*512.
[0081] In an embodiment of the present invention, step 101 may further include: setting an attention layer for detecting a first size type of ship for the detection network, the attention layer including a channel attention layer and a spatial attention layer; connecting the channel attention layer and the spatial attention layer in series and placing them before the first YOLO layer.
[0082] For the detection network, the improved YOLO v3 tiny detection model contains two YOLO layers for the detection of large and small objects respectively.
[0083] For the first YOLO layer used for large target detection, the attention layer CBAM (Convolutional Block Attention Module) is introduced. The attention layer can include a channel attention module (Channel Attention Module) and a spatial attention module (Spatial Attention Module) connected in series, and then placed as a whole before the first YOLO layer for large target detection. This improvement can reduce the impact of complex onshore and hydrological environments on large ship target detection.
[0084] In order to solve the problem of poor detection capability and low recall rate in small target detection, the embodiment of the present invention adopts the idea of deepening the network. The fourteenth convolutional layer can be connected to the first routing layer. Since the attention layer contains two layers, the number of filters in the first routing layer can be set to -6.
[0085] Compared with the feature map of size 13*13*256 output by the original YOLO v3 tiny detection model, the feature map of size 13*13*512 output by the fourteenth convolutional layer has more channels and contains more detailed information. After upsampling, a feature map of size 26*26*512 is obtained.
[0086] In an embodiment of the present invention, step 101 may further include: acquiring a ship dataset; generating a plurality of anchor boxes for ships of a first size type and a plurality of anchor boxes for ships of a second size type according to a k-means algorithm and the ship dataset.
[0087] Specifically, the k-means algorithm can be executed on the ship dataset to obtain the preset anchor boxes suitable for ship detection. Since the YOLO v3 tiny model requires 6 anchor boxes, k = 6. Assume that the length and width of the anchor box in a certain label are: box label =(w l ,h l ), the anchor box of a cluster seed point is box cluster =(w c ,h c ), then the intersection-over-Union (IoU) of the two anchor boxes is:
[0088]
[0089] Because using Euclidean distance will cause larger anchor boxes to produce more errors than smaller anchor boxes, the distance calculation formula can be redefined as: d(box 1 ,box 2 )=1-IoU(box 1 ,box 2 ).
[0090] Finally, the sizes of the six anchor boxes can be [0.1583, 0.0630], [0.0750, 0.0352], [0.3745, 0.1991], [0.2828, 0.1019], [0.7328, 0.2509], [0.5354, 0.1343], and the corresponding aspect ratios are [2.51, 2.13, 1.88, 2.78, 2.92, 3.99]. Figure 4 FIG. 1 is a schematic diagram of the anchor frame size in an embodiment of the present invention. The redefined anchor frame is closer to the shape of the ship in size and shape, and serves as more effective prior knowledge to help the model complete faster and better training.
[0091] Step 102: Acquire a ship image.
[0092] Thanks to the rapid improvement of digital camera performance, more and more video surveillance systems are deployed in coastal and offshore areas to achieve visual ship classification and behavior detection. Video surveillance systems can collect images of ships at sea.
[0093] Step 103: output a ship detection result of the ship image according to the improved YOLO v3 tiny detection model.
[0094] The vessel detection results may include detected vessels of a first size type and vessels of a second size type.
[0095] In an embodiment of the present invention, an improved YOLO v3 tiny detection model can be constructed; the improved YOLO v3 tiny detection model may include an input layer, a backbone network and a detection network; the backbone network includes multiple convolutional layers; the detection network includes multiple convolutional layers, a first YOLO layer, a second YOLO layer, a first routing layer and a second routing layer; the first YOLO layer uses multiple anchor frames for a first size type of ship to detect a first size type of ship, and the second YOLO layer uses multiple anchor frames for a second size type of ship to detect a second size type of ship; the first routing layer connects the convolutional layer in the detection network to generate a first feature map for detecting a first size type of ship; the second routing layer connects the convolutional layer in the backbone network to generate a second feature map for detecting a second size type of ship; obtains a ship image; and outputs a ship detection result of the ship image according to the improved YOLO v3 tiny detection model. Compared with the original YOLO v3 tiny detection model, the improved YOLO v3 tiny detection model can use a convolutional layer instead of a pooling layer, and adjust the number of network channels at the same time, which can improve the detection effect for small-sized ships.
[0096] Furthermore, for the problem of large target ship detection, an attention layer can be introduced into the detection network so that the model can focus more on the detection target itself and reduce interference from the external environment.
[0097] Furthermore, you can also use the ship dataset to train the 6 anchor boxes required by the YOLO v3 tiny detection model, which makes model training easier and achieves better results.
[0098] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0099] Reference Figure 5 , shows a structural block diagram of a ship detection device according to an embodiment of the present invention, which may specifically include the following modules:
[0100] The model construction module 501 is used to construct an improved YOLO v3 tiny detection model; the improved YOLO v3tiny detection model includes an input layer, a backbone network and a detection network; the backbone network includes multiple convolutional layers; the detection network includes multiple convolutional layers, a first YOLO layer, a second YOLO layer, a first routing layer and a second routing layer; the first YOLO layer uses multiple anchor frames for a first size type of ship to detect a first size type of ship, and the second YOLO layer uses multiple anchor frames for a second size type of ship to detect a second size type of ship; the first routing layer is connected to the convolutional layer in the detection network to generate a first feature map for detecting the first size type of ship; the second routing layer is connected to the convolutional layer in the backbone network to generate a second feature map for detecting the second size type of ship;
[0101] An image acquisition module 502, used to acquire a vessel image;
[0102] The detection module 503 is used to output a ship detection result of the ship image according to the improved YOLO v3 tiny detection model.
[0103] In the embodiment of the present invention, the model construction module 501 may include:
[0104] A first network setting submodule, used for setting thirteen convolutional layers for the backbone network, namely, the first convolutional layer to the thirteenth convolutional layer;
[0105] The first parameter setting submodule is used to set at least one of the number of filters, the convolution kernel size, the step size, and the output size for the first convolution layer to the thirteenth convolution layer respectively.
[0106] In the embodiment of the present invention, the model construction module 501 may further include:
[0107] A second network setting submodule, used for setting six convolutional layers for the detection network, namely the fourteenth convolutional layer to the nineteenth convolutional layer;
[0108] The second parameter setting submodule is used to set at least one of the number of filters, the convolution kernel size, and the output size for the fourteenth convolution layer to the nineteenth convolution layer respectively.
[0109] In the embodiment of the present invention, the model construction module 501 may further include:
[0110] a first connection submodule, configured to connect the first routing layer to the fourteenth convolutional layer, so that the first routing layer generates a first feature map for detecting a vessel of a first size type;
[0111] A third parameter setting submodule is used to set the number of filters and output size for the first routing layer;
[0112] a second connection submodule, configured to connect the second routing layer to the eighth convolutional layer, so that the second routing layer generates a second feature map for detecting a vessel of a second size type;
[0113] The fourth parameter setting submodule is used to set the number of filters and output size for the second routing layer.
[0114] In the embodiment of the present invention, the model construction module 501 may include:
[0115] A third network setting submodule is used to set an attention layer for the detection network for detecting ships of a first size type, wherein the attention layer includes a channel attention layer and a spatial attention layer;
[0116] The third connection submodule is used to connect the channel attention layer and the spatial attention layer in series and place them before the first YOLO layer.
[0117] In the embodiment of the present invention, the detection network further includes a sampling layer, and the model construction module 501 may further include:
[0118] The fifth parameter setting submodule is used to set the step size and output size of the sampling layer according to the output size of the fourteenth convolutional layer.
[0119] In the embodiment of the present invention, the model construction module 501 may include:
[0120] The vessel data set acquisition submodule is used to acquire the vessel data set;
[0121] The anchor frame generation submodule is used to generate multiple anchor frames for the first size type of ships and multiple anchor frames for the second size type of ships according to the k-means algorithm and the ship data set.
[0122] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0123] An embodiment of the present invention further provides a vehicle, comprising:
[0124] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned ship detection method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0125] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned ship detection method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0126] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0127] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0128] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0129] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0130] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0131] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0132] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0133] The above is a detailed introduction to a ship detection method and a ship detection device provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A vessel detection method, It is characterized in that include: An improved YOLOv3tiny detection model is constructed; the improved YOLOv3tiny detection model includes an input layer, a backbone network and a detection network; the backbone network includes thirteen convolutional layers; the detection network includes six convolutional layers, a first YOLO layer, a second YOLO layer, a first routing layer and a second routing layer; the first YOLO layer uses a plurality of anchor frames for a first size type of ship to detect a first size type of ship, and the second YOLO layer uses a plurality of anchor frames for a second size type of ship to detect a second size type of ship; the first routing layer connects the convolutional layers in the detection network to generate a first feature map for detecting the first size type of ship; The second routing layer is connected to the convolutional layer in the backbone network to generate a second feature map for detecting a second size type of vessel; Acquire vessel images; Outputting a ship detection result of the ship image according to the improved YOLOv3tiny detection model; The improved YOLO v3 tiny detection model comprises: Replace the six pooling layers in the original YOLO v3 tiny detection model backbone network with six convolutional layers with the same kernel size and stride; Setting an attention layer for detecting a first size type of vessel for the detection network, the attention layer comprising a channel attention layer and a spatial attention layer; The channel attention layer and the spatial attention layer are connected in series and placed before the first YOLO layer, and the number of filters in the first routing layer is reduced by two.
2. The method according to claim 1, It is characterized in that The improved YOLOv3tiny detection model comprises: The backbone network is provided with thirteen convolutional layers, which are respectively the first convolutional layer to the thirteenth convolutional layer; For each of the first convolutional layer to the thirteenth convolutional layer, at least one of the number of filters, the convolution kernel size, the step size, and the output size is set.
3. The method according to claim 2, It is characterized in that The improved YOLOv3tiny detection model further includes: The detection network is provided with six convolutional layers, namely the fourteenth convolutional layer to the nineteenth convolutional layer; For each of the fourteenth to nineteenth convolutional layers, at least one of the number of filters, the size of the convolution kernel, and the output size is set.
4. The method according to claim 3, It is characterized in that The improved YOLOv3tiny detection model further includes: connecting the first routing layer to the fourteenth convolutional layer so that the first routing layer generates a first feature map for detecting a vessel of a first size type; Setting the number of filters and output size for the first routing layer; Connecting the second routing layer to the eighth convolutional layer so that the second routing layer generates a second feature map for detecting a second size type of vessel; The number of filters and output size are set for the second routing layer.
5. The method according to claim 4, It is characterized in that The detection network also includes a sampling layer, and the constructed improved YOLOv3tiny detection model also includes: According to the output size of the fourteenth convolutional layer, a step size and an output size are set for the sampling layer.
6. The method according to claim 1, It is characterized in that The improved YOLOv3tiny detection model comprises: Get the vessel dataset; According to the k-means algorithm and the ship dataset, a plurality of anchor boxes for the first size type of ships and a plurality of anchor boxes for the second size type of ships are generated.
7. A vessel detection device, It is characterized in that include: A model construction module, used to construct an improved YOLOv3tiny detection model; the improved YOLOv3tiny detection model includes an input layer, a backbone network and a detection network; the backbone network includes thirteen convolutional layers; the detection network includes six convolutional layers, a first YOLO layer, a second YOLO layer, a first routing layer and a second routing layer; the first YOLO layer uses a plurality of anchor frames for a first size type of ship to detect a first size type of ship, and the second YOLO layer uses a plurality of anchor frames for a second size type of ship to detect a second size type of ship; the first routing layer is connected to the convolutional layers in the detection network to generate a first feature map for detecting the first size type of ship; the second routing layer is connected to the convolutional layers in the backbone network to generate a second feature map for detecting the second size type of ship; An image acquisition module, used for acquiring images of ships; a detection module, configured to output a ship detection result of the ship image according to the improved YOLOv3tiny detection model; The model construction module is specifically used to replace the six pooling layers in the original YOLO v3 tiny detection model backbone network with six convolutional layers with the same convolution kernel size and step size; The model construction module also includes: A third network setting submodule is used to set an attention layer for the detection network for detecting ships of a first size type, wherein the attention layer includes a channel attention layer and a spatial attention layer; A third connection submodule is used to connect the channel attention layer and the spatial attention layer in series and place them before the first YOLO layer, and the number of filters of the first routing layer is reduced by two.
8. An electronic device, It is characterized in that include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the ship detection method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the ship detection method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Improved target detection method based on YOLO V3-tiny
CN110689118A
Oil and gas pipeline marker identification method based on neural network
CN111339858A
Tree detection method based on Tiny YOLOV3 algorithm
CN111898651A
