Underwater biological detection method based on improved YOLOv7 network

By improving the YOLOv7 network, combined with the improvement of image data enhancement and feature extraction module, the problem of low recognition accuracy of underwater image data is solved, more efficient underwater object detection is achieved, and detection accuracy and efficiency are improved.

CN119068323APending Publication Date: 2024-12-03ANHUI NORMAL UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411028099.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

Existing underwater image data recognition technology faces problems such as color distortion, many small targets, and complex backgrounds, resulting in low recognition accuracy and efficiency, making it difficult to achieve fast and accurate underwater target detection.

Method used

Based on the improved underwater biological detection method of YOLOv7 network, the image data augmentation, design of new Enet structures and C3S modules, add small object detection channels, and use retinex algorithm and DCP defog removal algorithm to improve the structure of YOLOv7 network to improve the accuracy of detection models. Sex and generalization ability.

Benefits of technology

It improves the accuracy and efficiency of underwater target detection, reduces the cost of model deployment, and improves the generalization ability of the model. Compared with the original network model mAP, the detection speed is also faster.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119068323A_ABST
    Figure CN119068323A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer vision target detection, in particular to an underwater biological detection method based on an improved YOLOv7 network. The method comprises the steps that S1, different underwater biological data images are acquired to serve as an underwater data set, the underwater data set is divided into a training set, a verification set and a test set according to the distribution proportion of 7: 1: 2, and image data enhancement is conducted on the underwater data set; s2, improving the underwater data set after image enhancement on the basis of a single-stage detection algorithm YOLOv7 network structure so as to obtain an improved detection model; s3, training the improved detection model by using the training set and the verification set to obtain a trained network model and a weight; and S4, testing the trained network model and the weight by using the test set, and evaluating a test result. According to the method, the accuracy of the model is improved, the deployment cost of the model is further reduced, and the generalization ability of the model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer vision target detection, and in particular to an underwater organism detection method based on an improved YOLOv7 network. Background Art

[0002] As land resources become increasingly scarce, many advanced countries around the world are turning to the ocean, an unknown territory that covers more than 70% of the Earth. In the field of marine exploration and development, underwater target recognition technology is becoming increasingly critical. This technology uses computer vision to conduct detailed analysis of captured underwater photos to identify and determine the type and location of underwater objects.

[0003] Underwater images are a direct and critical medium for conveying ocean information, recording rich data such as seafloor life and topography. Exploring how to combine target recognition technology with the latest developments in artificial intelligence is essential for quickly and accurately mining the information in these images. This will not only significantly promote the development of marine industries such as marine fisheries and aquaculture, but also have an important impact on the exploration of marine resources and the navy's coastal defense strategy.

[0004] However, underwater image data in existing technologies faces challenges brought by the environment and equipment, such as color distortion, many small targets, complex background, etc. These problems usually lead to low recognition accuracy and efficiency. How to provide an effective underwater target recognition algorithm based on deep learning to achieve fast and accurate detection of underwater targets has become an urgent problem to be solved. Summary of the invention

[0005] In view of the above-mentioned shortcomings of the prior art, the object of the present invention is to provide an underwater organism detection method based on an improved YOLOv7 network, which can achieve rapid and accurate detection of underwater targets.

[0006] To achieve the above objectives and other related objectives, the present invention provides an underwater organism detection method based on an improved YOLOv7 network, comprising:

[0007] S1. Acquire underwater different biological data images as an underwater data set, divide the underwater data set into a training set, a validation set, and a test set according to a distribution ratio of 7:1:2, and perform image data enhancement on the underwater data set;

[0008] S2. For the underwater dataset after image enhancement, the single-stage detection algorithm YOLOv7 network structure is used as the basis for improvement to obtain an improved detection model;

[0009] S3, training the improved detection model using the training set and the validation set to obtain a trained network model and weights;

[0010] S4. Use the test set to test the trained network model and weights, and evaluate the test results.

[0011] In one embodiment of the present invention, the image data enhancement described in step S1 is to repair the underwater data set, that is, the underwater image data, by using the retinex algorithm, and then defogging the image data after the image data repair through the DCP defogging algorithm.

[0012] In one embodiment of the present invention, the improvement in step S2 based on the single-stage detection algorithm YOLOv7 network structure to obtain an improved detection model includes:

[0013] S21. Design a new Enet structure to replace the feature extraction module in the YOLOv7 head network;

[0014] S22, improve the C3 module to a C3S module to replace the ELAN module of the original network;

[0015] S23. Add a small target detection channel to the overall network.

[0016] In one embodiment of the present invention, a new Enet structure is designed in step S21 to replace the feature extraction module in the YOLOv7 head network, including:

[0017] Replace the feature extraction ELAN-W module in the YOLOv7 head network with the Enet structure;

[0018] The Enet structure consists of three parts: branch, stem and stage;

[0019] The input of the Enet structure is split through a shunting operation, 1 / 4 of the channel passes through the branch part, and the remaining 3 / 4 of the channel gradually passes through the Stem part and multiple Stage parts. One output end of the Stem part is output to the first Stage part, and the other output end of the Stem part is superimposed with the output end of the first Stage part and input to the next Stage part, until it is input to the nth Stage part;

[0020] The branch part is a branch part, which consists of a 1×1 convolution, a BN normalization layer and a SiLU activation function;

[0021] The Stem part is the starting part. The 3 / 4 channel input undergoes a 3×3 depthwise separable convolution, followed by a 1×1 point-by-point convolution. Its output is passed to Stage 1 on the one hand, and is superimposed with the output of Stage 1 and input into Stage 2 on the other hand.

[0022] The Stage part is the core part. Each Stage part is composed of a 3×3 convolution layer and a BN layer for feature extraction, and then output through the non-parameterized attention mechanism SimAM.

[0023] In one embodiment of the present invention, the C3S module in step S22 is obtained by introducing a parameter-free attention mechanism SimAM into the feature extraction module C3 in the YOLOv5 network.

[0024] In one embodiment of the present invention, adding a small target detection channel to the overall network in step S23 includes:

[0025] The output of the cat layer with an output feature size of 80×80 in the head network of the YOLOv7 network is sequentially passed through the Enet structure and the CBS layer and then output through the upsampling layer. The output of the upsampling layer and the output of the C3S module with an output size of 160×160 in the backbone network of the YOLOv7 network are output through a superposition operation. The output of the superposition operation is output again through the Enet structure. One output end of the Enet structure is input to the small target detection channel, and the other output end of the Enet structure is input to the other three channels through the CBS layer to transmit feature weight information.

[0026] The present invention also provides an underwater organism detection system based on an improved YOLOv7 network, comprising:

[0027] An image data enhancement module is used to obtain underwater different biological data images as an underwater data set, and divide the underwater data set into a training set, a validation set, and a test set according to a distribution ratio of 7:1:2, and perform image data enhancement on the underwater data set;

[0028] The detection model improvement module is used to improve the single-stage detection algorithm YOLOv7 network structure based on the underwater data set after image enhancement to obtain an improved detection model;

[0029] A training module, used to train the improved detection model using the training set and the validation set to obtain a trained network model and weights;

[0030] The testing module is used to test the trained network model and weights using the test set and evaluate the test results.

[0031] As described above, the underwater organism detection method based on the improved YOLOv7 network of the present invention has the following beneficial effects:

[0032] (1) The underwater biological detection method based on the improved YOLOv7 network of the present invention is based on the original YOLOv7 network model, adds a detection channel for smaller targets and derives and transmits information between the three channels, and replaces the feature extraction structure in the head network and backbone network of the YOLOv7 model with the C3S and Enet structures on the original basis, so that the network can obtain more global receptive fields, further reducing the number of model parameters, while improving the accuracy of the model, further reducing the deployment cost of the model, and improving the generalization ability of the model.

[0033] (2) The underwater biological detection method based on the improved YOLOv7 network of the present invention uses the retinex algorithm based on the principle of human vision to make the image look more vivid and clear by changing the contrast, saturation and sharpness of the image data.

[0034] (3) The underwater biological detection method based on the improved YOLOv7 network of the present invention uses the DCP defogging algorithm, which is an image defogging method in the field of image enhancement and improves the clarity of the input image based on the dark channel prior theory. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A flowchart of an underwater organism detection method based on an improved YOLOv7 network provided in an embodiment of the present application.

[0036] Figure 2 A C3S module structure diagram of an underwater biological detection method based on an improved YOLOv7 network that introduces a SimAM attention mechanism is provided in an embodiment of the present application.

[0037] Figure 3 A schematic diagram of the structure of a feature extraction network Enet for an underwater biological detection method based on an improved YOLOv7 network provided in an embodiment of the present application.

[0038] Figure 4 An overall network structure diagram of an underwater organism detection method based on an improved YOLOv7 network provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0040] It should be noted that the illustrations provided in the following embodiments are only used to illustrate the basic concept of the present invention in a schematic manner, and thus the illustrations only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0041] See also Figure 1 , Figure 1 A flowchart of an underwater organism detection method based on an improved YOLOv7 network provided in an embodiment of the present application. The present invention provides an underwater organism detection method based on an improved YOLOv7 network, comprising:

[0042] Step S1, obtaining underwater different biological data images as an underwater data set, and dividing the underwater data set into a training set, a validation set, and a test set according to a distribution ratio of 7:1:2, and performing image data enhancement on the underwater data set.

[0043] Step S2: for the underwater dataset after image enhancement, the single-stage detection algorithm YOLOv7 network structure is improved to obtain an improved detection model.

[0044] Step S3: training the improved detection model using the training set and the validation set to obtain a trained network model and weights.

[0045] Step S4: Use the test set to test the trained network model and weights, and evaluate the test results.

[0046] Specifically, the acquired underwater image data is first enhanced by using the retinex algorithm and the DCP dehazing algorithm to process the acquired data set, so that the acquired underwater images have higher contrast and clarity. Then, the target detection and annotation tools (such as LabelImg) are used to select the underwater target objects in each image, and a different category label is assigned to each type of target object. After the data set is annotated, all the annotated image data are divided into training set, validation set and test set in a ratio of 7:1:2, and attention is paid to ensuring that the number of underwater targets is evenly divided, and the corresponding YOLO format label files with the suffix .txt are generated respectively.

[0047] Specifically, a new detection model is obtained based on the single-stage detection algorithm YOLOv7 network. The main improvement methods include improving the YOLOv7 backbone structure, designing a new module Enet, replacing the ELAN module with a C3S structure, and adding a small target detection channel.

[0048] Please refer to Figure 2 , Figure 2 A C3S module structure diagram of an underwater biological detection method based on an improved YOLOv7 network that introduces a SimAM attention mechanism is provided in an embodiment of the present application.

[0049] Specifically, the improvement in step S2 based on the single-stage detection algorithm YOLOv7 network structure to obtain an improved detection model includes:

[0050] Step S21, design a new Enet structure to replace the feature extraction module in the YOLOv7 head network.

[0051] Step S22: Improve the C3 module to a C3S module to replace the ELAN module of the original network.

[0052] Step S23: adding a small target detection channel to the overall network.

[0053] Specifically, the ELAN module in the YOLOv7 network is replaced by the C3S module. C3S is the feature extraction module C3 in the YOLOv5 network and is obtained by introducing the parameter-free attention mechanism SimAM.

[0054] The C3 module in YOLOv5 usually contains multiple Conv modules (1×1 convolution and 3×3 convolution) and a Bottleneck module (usually two 3×3 convolution modules superimposing feature information on each other). The Conv module extracts more and richer data features through operations such as convolution and normalization, while the Bottleneck module usually increases the receptive field of the backbone network and reduces the computational complexity of the network model. The C3 module promotes multi-scale feature fusion and its ability to reduce the computational complexity of the network model by forming the characteristics of the residual network, effectively improving the performance and accuracy of the target detection algorithm.

[0055] SimAM is a local self-attention mechanism based on three-dimensional images. It does not require the introduction of other additional calculation parameters and other consumption. It calculates the feature attention weights on each channel of the transmitted feature map without interfering with each other, thereby guiding the network model to pay more attention to specific area information in the image data.

[0056] Please refer to Figure 3 , Figure 3 A schematic diagram of the structure of a feature extraction network Enet for an underwater biological detection method based on an improved YOLOv7 network provided in an embodiment of the present application.

[0057] The Enet structure consists of three parts: branch, stem and stage:

[0058] First, the input is split through the split operation, 1 / 4 of the channel passes through the branch part, and the remaining 3 / 4 of the channel gradually passes through the Stem part and multiple Stage parts. Finally, the output of each part is superimposed multiple times and input through a 1×1 convolution layer.

[0059] The branch part is the branch part, which is mainly composed of a 1×1 convolution, a BN normalization layer and a Silu activation function. 1 / 4 of the channel passes through the branch and then outputs, which effectively alleviates the problem of gradient dissipation too fast and plays a certain complementary role in the feature extraction of the overall network.

[0060] The Stem part is the starting part. The 3 / 4 channel input passes through a 3×3 depth-wise separable convolution, followed by a 1×1 point-by-point convolution to extract richer feature information and pass it on. The output is passed to Stage 1 on the one hand, and on the other hand, it is superimposed with the output of Stage 1 and input into Stage 2, fully integrating the feature map features from the shallow and deep layers.

[0061] The Stage part is the core part. Each Stage part is composed of a 3×3 convolution layer and a BN layer for feature extraction, and then passes through the parameter-free attention mechanism SimAM to derive more spatial dimension information for the neural network without introducing additional parameters. This part is composed of multiple Stage parts, and the input and output are superimposed on each other, so that the network model has better perception and feature extraction capabilities.

[0062] Please refer to Figure 4 , Figure 4 The overall network structure diagram of an underwater biological detection method based on an improved YOLOv7 network provided in an embodiment of the present application. In view of the presence of some smaller targets underwater, a small target detection channel is added to the overall network, and the detection input is introduced through the C3S layer with an output size of 160×160 in the backbone network of YOLOv7. On the other hand, the output of the superposition layer with an output feature size of 80×80 in the head is normalized through a 1×1 convolution layer and upsampled to 160×160, and then the two are superimposed. On the one hand, the output of the two leads to a detection channel for a smaller target, and on the other hand, the superimposed output of the two continues to pass through operations such as feature extraction convolution layers and other large, medium and small channels to transmit feature weight information, thereby optimizing the entire network model.

[0063] The training set and validation set divided after data enhancement are used to train the improved overall network model in 1. The initial learning rate is set to 0.01, the input image size is 640×360, the epoch is adjusted to 300, and the batch_size is adjusted to 16.

[0064] The trained network model is evaluated using the test set and compared with the original network and other target detection networks to verify its performance. The evaluation and comparison results are as follows:

[0065]

[0066] The improved network model of the present invention improves mAP by 1.9% compared with the original network, has advantages over YOLOv3, YOLOv5s and YOLOv7_tiny models in overall evaluation indicators, and has a faster detection speed when the image size is the same.

[0067] Similar to the underwater organism detection method based on the improved YOLOv7 network of the present invention, the present invention also provides an underwater organism detection system based on the improved YOLOv7 network, comprising:

[0068] The image data enhancement module is used to obtain underwater different biological data images as an underwater data set, and divide the underwater data set into a training set, a verification set, and a test set according to a distribution ratio of 7:1:2, and perform image data enhancement on the underwater data set.

[0069] The detection model improvement module is used to improve the underwater dataset after image enhancement based on the single-stage detection algorithm YOLOv7 network structure to obtain an improved detection model.

[0070] The training module is used to train the improved detection model using the training set and the validation set to obtain a trained network model and weights.

[0071] The testing module is used to test the trained network model and weights using the test set and evaluate the test results.

[0072] The present invention also proposes an electronic device, the electronic device includes a processor and a memory, the memory stores program instructions, and the processor runs the program instructions to implement the above-mentioned underwater biological detection method based on the improved YOLOv7 network. The processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components; the memory may include a random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The memory can also be an internal memory of the random access memory (RAM) type, and the processor and memory can be integrated into one or more independent circuits or hardware, such as: an application-specific integrated circuit (ASIC). It should be noted that the computer program in the above-mentioned memory can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, an electronic device, or a network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention.

[0073] The present invention also proposes a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the above-mentioned underwater biological detection method based on the improved YOLOv7 network. The computer-readable storage medium can be an electronic medium, a magnetic medium, an optical medium, an electromagnetic medium, an infrared medium or a semiconductor system or a propagation medium. The computer-readable storage medium can also include a semiconductor or solid-state memory, a magnetic tape, a removable computer disk, a random access memory (RAM), a read-only memory (ROM), a hard disk and an optical disk. The optical disk can include a compact disk-read only memory (CD-ROM), a compact disk-read / write (CD-RW) and a DVD.

[0074] In summary, the underwater biological detection method based on the improved YOLOv7 network of the present invention is based on the original YOLOv7 network model, adds a detection channel for smaller targets and derives and transmits information between the large, medium and small channels, and replaces the feature extraction structure in the head network and backbone network of the YOLOv7 model with C3S and Enet structures on the original basis, so that the network can obtain more global receptive fields, further reduce the number of parameters of the model, and at the same time improve the accuracy of the model, further reduce the deployment cost of the model, and improve the generalization ability of the model.

[0075] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A method for underwater organism detection based on an improved YOLOv7 network, characterized in that: include: S1. Acquire underwater different biological data images as an underwater data set, divide the underwater data set into a training set, a validation set, and a test set according to a distribution ratio of 7:1:2, and perform image data enhancement on the underwater data set; S2. For the underwater dataset after image enhancement, the single-stage detection algorithm YOLOv7 network structure is used as the basis for improvement to obtain an improved detection model; S3, training the improved detection model using the training set and the validation set to obtain a trained network model and weights; S4. Use the test set to test the trained network model and weights, and evaluate the test results.

2. According to claim 1, a method for underwater organism detection based on an improved YOLOv7 network is characterized in that: The image data enhancement described in step S1 is to perform image data restoration on the underwater data set, i.e., the underwater image data, by using the retinex algorithm, and then perform defogging processing on the image data after the image data restoration by using the DCP defogging algorithm.

3. The underwater organism detection method based on the improved YOLOv7 network according to claim 1 is characterized in that: The improvement in step S2 based on the single-stage detection algorithm YOLOv7 network structure to obtain an improved detection model includes: S21. Design a new Enet structure to replace the feature extraction module in the YOLOv7 head network; S22, improve the C3 module to a C3S module to replace the ELAN module of the original network; S23. Add a small target detection channel to the overall network.

4. The underwater organism detection method based on the improved YOLOv7 network according to claim 1 is characterized in that: In step S21, a new Enet structure is designed to replace the feature extraction module in the YOLOv7 head network, including: Replace the feature extraction ELAN-W module in the YOLOv7 head network with the Enet structure; The Enet structure consists of three parts: branch, stem and stage; The input of the Enet structure is split through a shunting operation, 1 / 4 of the channel passes through the branch part, and the remaining 3 / 4 of the channel gradually passes through the Stem part and multiple Stage parts. One output end of the Stem part is output to the first Stage part, and the other output end of the Stem part is superimposed with the output end of the first Stage part and input to the next Stage part, until it is input to the nth Stage part; The branch part is a branch part, which consists of a 1×1 convolution, a BN normalization layer and a SiLU activation function; The Stem part is the starting part. The 3 / 4 channel input undergoes a 3×3 depthwise separable convolution, followed by a 1×1 point-by-point convolution. Its output is passed to Stage 1 on the one hand, and is superimposed with the output of Stage 1 and input into Stage 2 on the other hand. The Stage part is the core part. Each Stage part is composed of a 3×3 convolution layer and a BN layer for feature extraction, and then output through the non-parameterized attention mechanism SimAM.

5. The underwater organism detection method based on the improved YOLOv7 network according to claim 1 is characterized in that: The C3S module in step S22 is obtained by introducing the parameter-free attention mechanism SimAM into the feature extraction module C3 in the YOLOv5 network.

6. The underwater organism detection method based on the improved YOLOv7 network according to claim 1 is characterized in that: Adding a small target detection channel to the overall network in step S23 includes: The output of the cat layer with an output feature size of 80×80 in the head network of the YOLOv7 network is sequentially passed through the Enet structure and the CBS layer and then output through the upsampling layer. The output of the upsampling layer and the output of the C3S module with an output size of 160×160 in the backbone network of the YOLOv7 network are output through a superposition operation. The output of the superposition operation is output again through the Enet structure. One output end of the Enet structure is input to the small target detection channel, and the other output end of the Enet structure is input to the other three channels through the CBS layer to transmit feature weight information.

7. An underwater biological detection system based on an improved YOLOv7 network, characterized in that: include: An image data enhancement module is used to obtain underwater different biological data images as an underwater data set, and divide the underwater data set into a training set, a validation set, and a test set according to a distribution ratio of 7:1:2, and perform image data enhancement on the underwater data set; The detection model improvement module is used to improve the single-stage detection algorithm YOLOv7 network structure based on the underwater data set after image enhancement to obtain an improved detection model; A training module, used to train the improved detection model using the training set and the validation set to obtain a trained network model and weights; The testing module is used to test the trained network model and weights using the test set and evaluate the test results.

Citation Information

Cited By

  • Underwater target detection method and device

    CN120047810A