Fish body injury detection method and system based on improved YOLOv7

By introducing the coordinate attention mechanism and SIOU loss into the YOLOv7 network, the problem of fish damage recognition in multiple fish images in fish damage detection is solved, efficient detection of damaged areas on the fish body surface is achieved, and detection accuracy and efficiency are improved. .

CN118823451APending Publication Date: 2024-10-22SHANDONG UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410838620.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

Existing fish damage detection methods have low accuracy in identifying and locating abnormal fish surface damaged areas when there are multiple fish in the image, and have problems with low applicability.

Method used

The coordinate attention mechanism and SIOU loss are introduced in the YOLOv7 network to capture cross-channel direction perception and position-sensitive information, enhance the discriminative characteristics of fish damage and suppress background interference, integrate position information through the coordinate attention mechanism, and integrate the position information through SIOU The loss constrains the network training process and improves detection efficiency.

Benefits of technology

It achieves accurate and automatic identification of fish body damage from complex fish school images, improves detection accuracy and efficiency, and solves the problem of precise positioning and identification of fish body damage detection in the existing technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118823451A_ABST
    Figure CN118823451A_ABST
Patent Text Reader

Abstract

The invention provides a fish body injury detection method and system based on improved YOLOv7, and relates to the technical field of fish body injury detection, and the specific scheme comprises the steps: obtaining a to-be-detected fish school image; inputting the fish school image into the trained improved YOLOv7 network, and identifying a fish body surface damaged area to obtain a fish body damage detection result; wherein the improved YOLOv7 network is characterized in that a coordinate attention mechanism and SIOU loss are introduced into YOLOv7, the coordinate attention mechanism is embedded into a backbone network of the YOLOv7, and the improved YOLOv7 network is used for capturing cross-channel direction perception and position sensitive information, enhancing distinguishing characteristics of fish body injury and inhibiting background interference; according to the SIOU loss, direction information between a real frame and a prediction frame is considered and serves as a loss function to constrain the training process of the network; according to the method, a coordinate attention mechanism and SIOU loss are introduced into the YOLOv7 network, and the method is used for accurately and automatically identifying fish body injury from a complex fish school image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of fish body damage detection, and in particular relates to a fish body damage detection method and system based on improved YOLOv7. Background Art

[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.

[0003] With the increasing density and intensiveness of aquaculture, fish health has become a major concern for consumers and farmers. During aquaculture, fish are often exposed to various physical, chemical, and biological stressors that may cause damage to the fish surface. Damage to the fish surface means that there is something wrong with the aquaculture system. In addition, damage to the fish surface can affect the fish immune system, making it more susceptible to disease. Worse still, the outbreak and rapid spread of the disease may lead to mass fish deaths and water pollution. Therefore, fish surface damage detection is an integral part of aquaculture, and the development of an automatic fish surface damage detection method is crucial for aquaculture.

[0004] Traditional methods for detecting fish surface damage rely on visual observation by aquaculture professionals and experts, which is time-consuming, labor-intensive and costly. Computer vision technology has the advantages of being non-destructive and fast, and provides a feasible method for automatic detection of fish surface damage. In the past few decades, digital image processing technology has been used to extract features such as shape, texture and color in images to show changes in the surface and internal tissues of fish. In addition, machine learning techniques such as decision trees, logistic regression, artificial neural networks and support vector machines have also been used to identify fish damage in images. However, these methods rely on manually extracted features and have poor generalization capabilities.

[0005] With the rapid development of deep learning technology, deep neural networks have been widely used in various fields of aquaculture, such as fish abnormal behavior analysis and water quality prediction. Some researchers have also applied deep learning technology to the identification and classification of fish injuries and diseases. A typical method is to use deep neural networks to identify whether the fish in the image is injured or has a certain type of disease. However, these methods can usually only distinguish images containing a single fish, and it is difficult to identify and locate abnormal fish when there are multiple fish in the image. Recently, some researchers have used deep learning-based target detection technology to identify and locate abnormal fish in images. However, few studies have focused on the precise positioning and identification of damaged areas on the fish surface. Therefore, existing fish damage detection schemes have the problems of low applicability and insufficient accuracy. Summary of the invention

[0006] In order to overcome the shortcomings of the above-mentioned prior art, the present invention provides a fish body damage detection method and system based on improved YOLOv7, and introduces a coordinate attention mechanism and SIOU loss into the YOLOv7 network to accurately and automatically identify fish body damage from complex fish school images.

[0007] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions:

[0008] A first aspect of the present invention provides a fish body damage detection method based on improved YOLOv7.

[0009] A fish body damage detection method based on improved YOLOv7, comprising:

[0010] Acquire an image of a school of fish to be detected;

[0011] The fish school image is input into the trained improved YOLOv7 network to identify the damaged area on the fish body surface and obtain the fish body damage detection result;

[0012] Among them, the improved YOLOv7 network introduces the coordinate attention mechanism and SIOU loss in YOLOv7. The coordinate attention mechanism embedded in the backbone network of YOLOv7 is used to capture cross-channel direction perception and position-sensitive information, enhance the discriminative features of fish body damage and suppress background interference; the SIOU loss considers the direction information between the real box and the predicted box as a loss function to constrain the training process of the network.

[0013] Furthermore, the improved YOLOv7 network includes an input module, a backbone module, a neck module and a prediction module;

[0014] The input module is used to pre-process the input image;

[0015] The backbone module is used to extract multi-level features from the preprocessed image;

[0016] The neck module is used to fuse multi-level features;

[0017] The prediction module is used to predict the final damaged area on the fish body surface.

[0018] Furthermore, the preprocessing includes adaptive image scaling and mosaic data enhancement.

[0019] Furthermore, the backbone module consists of CBS, ELAN, coordinate attention module and MPconv;

[0020] The CBS is used for feature extraction and channel conversion;

[0021] The ELAN controls the different lengths of the gradient paths so that the deep network can converge effectively during the training process;

[0022] The coordinate attention module uses the coordinate attention mechanism to decompose the channel attention into two parallel encoding operations, fusing information along two spatial directions, thereby integrating the position information into the channel attention;

[0023] The MPconv module is used to fuse feature maps obtained by different downsampling methods to retain more feature information.

[0024] Furthermore, the coordinate attention mechanism includes two steps:

[0025] Coordinate information embedding: Use the average pooling method to encode each channel of a given input along the horizontal and vertical axes respectively, and obtain a pair of direction-aware feature maps;

[0026] Coordinate attention generation: Based on a pair of direction-aware feature maps, the attention weights in the vertical and horizontal directions are calculated, and then weighted fusion is performed along the two spatial directions to obtain features that enhance direction perception and position-sensitive information.

[0027] Further, the neck module is composed of SPPCSPC, ELANW, UPSample and Cat;

[0028] The ELANW module adds two splicing operations to the ELAN module.

[0029] Furthermore, the SIOU loss includes four parts: angle loss, distance loss, shape loss and IOU loss.

[0030] A second aspect of the present invention provides a fish damage detection system based on improved YOLOv7.

[0031] A fish damage detection system based on improved YOLOv7, comprising:

[0032] The image module is configured to: obtain an image of a school of fish to be detected;

[0033] The detection module is configured to: input the fish school image into the trained improved YOLOv7 network, identify the damaged area on the surface of the fish body, and obtain the fish body damage detection result;

[0034] Among them, the improved YOLOv7 network introduces the coordinate attention mechanism and SIOU loss in YOLOv7. The coordinate attention mechanism embedded in the backbone network of YOLOv7 is used to capture cross-channel direction perception and position-sensitive information, enhance the discriminative features of fish body damage and suppress background interference; the SIOU loss considers the direction information between the real box and the predicted box as a loss function to constrain the training process of the network.

[0035] The third aspect of the present invention provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps in a fish damage detection method based on improved YOLOv7 as described in the first aspect of the present invention.

[0036] The fourth aspect of the present invention provides an electronic device, including a memory, a processor, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps in a method for detecting fish damage based on improved YOLOv7 as described in the first aspect of the present invention are implemented.

[0037] One or more of the above technical solutions have the following beneficial effects:

[0038] The present invention introduces the coordinate attention mechanism and SIOU loss into the YOLOv7 network to accurately and automatically identify fish body damage from complex fish school images. Firstly, the coordinate attention mechanism is embedded into the backbone network of YOLOv7 to enhance the discriminative features of fish body damage and suppress background interference; secondly, the SIOU loss is introduced to accelerate the convergence speed of the model and improve the detection efficiency by considering the orientation information between the real box and the predicted box; finally, the problem of accurately and efficiently identifying the damaged area on the surface of the fish body from the fish school images is solved.

[0039] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0041] Figure 1 This is a flow chart of the method of the first embodiment.

[0042] Figure 2 The structural diagram of YOLOv7 is improved for the first embodiment.

[0043] Figure 3 This is the structure diagram of the coordinate attention mechanism of the first embodiment.

[0044] Figure 4 This is an example diagram of data enhancement in the first embodiment.

[0045] Figure 5 This is an example diagram of fish body damage marking in the first embodiment.

[0046] Figure 6 This is a comparison chart of the visual fish body damage detection results of different methods in the first embodiment. DETAILED DESCRIPTION

[0047] It should be noted that the following detailed descriptions are illustrative and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used in the present invention have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.

[0048] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0049] Embodiment 1

[0050] In one embodiment of the present disclosure, a fish body damage detection method based on improved YOLOv7 is provided. Figure 1 As shown, the following steps are included:

[0051] Step S1: obtaining an image of a school of fish to be detected;

[0052] Step S2: input the fish school image into the trained improved YOLOv7 network to identify the damaged area on the fish body surface and obtain the fish body damage detection result;

[0053] Among them, the improved YOLOv7 network introduces the coordinate attention mechanism and SIOU loss in YOLOv7. The coordinate attention mechanism embedded in the backbone network of YOLOv7 is used to capture cross-channel direction perception and position-sensitive information, enhance the discriminative features of fish body damage and suppress background interference; the SIOU loss considers the direction information between the real box and the predicted box as a loss function to constrain the training process of the network.

[0054] The improved YOLOv7 network is described in detail below. This embodiment proposes an improved YOLOv7 network based on a coordinate attention mechanism and SIOU loss for automatically identifying fish body damage.

[0055] Firstly, the coordinate attention mechanism is embedded into the backbone network of YOLOv7 to capture the direction-aware and position-sensitive information across channels, so that the network can enhance the discriminative features of fish damage and suppress background interference.

[0056] In addition, SIOU loss is used to replace CIoU loss in YOLOv7. SIOU takes into account the vector angle (i.e., direction information) between the predicted box and the true box, thereby improving the training speed and inference accuracy of the model.

[0057] Specifically, the proposed improved YOLOv7 network structure consists of four parts: input module, backbone module, neck module and prediction module. Figure 2 As shown:

[0058] 1) Input module: Adaptive image scaling and mosaic data enhancement techniques are used to pre-process the input fish school images and uniformly scale the original images to 640×640 to meet the backbone network’s input image size requirements.

[0059] 2) Backbone network module, which is used to extract multi-level feature information of the input image for subsequent feature fusion and target detection.

[0060] The backbone network consists of four parts: CBS, ELAN, CA (coordinate attention module) and MPconv.

[0061] The CBS module is used for feature extraction and channel conversion.

[0062] The ELAN structure controls the different lengths of gradient paths, allowing the deep network to converge effectively during training.

[0063] The MPconv module is used to fuse feature maps obtained by different downsampling methods in order to retain more feature information during downsampling.

[0064] like Figure 2 As shown in the figure, a coordinate attention module is introduced after ELAN in the YOLOv7 backbone architecture. The coordinate attention mechanism is used to decompose the channel attention into two parallel encoding operations, and the information is fused along two spatial directions, so that the position information is integrated into the channel attention to enhance the discriminative feature extraction of fish damage in the image and suppress background interference.

[0065] Finally, the features output by the second, third, and fourth ELANs are the features of different levels finally extracted by the backbone network.

[0066] 3) The neck module fuses the features of different levels extracted by the backbone network to further enhance the feature expression ability of the network.

[0067] The neck network mainly consists of four parts: SPPCSPC, ELANW, UPSample and Cat.

[0068] The SPPC module uses maximum pooling with different receptive fields to capture multi-scale contextual information to better detect objects of different scales.

[0069] The ELANW module adds two splicing operations compared to the ELAN module.

[0070] The UPSample module implements feature size adjustment.

[0071] The Cat structure implements feature splicing.

[0072] 4) The prediction module is used for the final prediction output of the network, that is, predicting the damaged area on the fish body surface; it uses the reparameterization module RepConv to adjust the number of channels of the three different sizes of features output by the neck module, and then the prediction module uses the convolution operation Conv to obtain the location and confidence of the damaged area.

[0073] The two main improvements are described below:

[0074] 1. Coordinate Attention Module

[0075] Fish damage recognition in an aquaculture environment is easily affected by image background interference. Therefore, this embodiment embeds a coordinate attention mechanism in the backbone network of YOLOv7, so that the network can extract the identification features of damage in the image and improve the detection accuracy.

[0076] Coordinate attention decomposes channel attention into two parallel encoding operations and fuses information along two spatial directions, thereby integrating position information into channel attention, which enables the model to effectively identify and locate surface damage on fish bodies.

[0077] like Figure 3 As shown, the process of the coordinate attention mechanism includes two steps: coordinate information embedding and coordinate attention generation.

[0078] (1) In the process of embedding coordinate information, the average pooling method is used to encode each channel of a given input along the horizontal and vertical axes respectively.

[0079] Given an input x, an average pooling operation with two pooling kernels (H, 1) and (1, W) is used to encode the input feature map in the vertical and horizontal dimensions respectively, and a pair of direction-aware feature maps z are obtained. (h) and z (w) Each feature map captures the long-range feature dependencies of the input features along one spatial direction and the precise localization information along another spatial direction, enabling the network to better locate the target;

[0080]

[0081] Among them, x c is the input feature map of the cth channel, H and W represent the height and width of the input feature map respectively, z c (h) Represents the output direction-aware feature map z (h) The cth channel, z c (w) Represents the output direction-aware feature map z (w) The cth channel of .

[0082] (2) Coordinate attention generation process, specifically:

[0083] First, by splicing, the obtained pair of direction-aware feature maps z (h) and z (w) The images are merged and passed through a 1×1 convolution to reduce the number of channels.

[0084] Then, through normalization and nonlinear activation function, the intermediate feature representation f∈R containing horizontal and vertical spatial information is obtained C(H+W) / r :

[0085] f=δ(F 1×1 (cat(z (h) ,z (w) )) (3)

[0086] Among them, F 1×1 is a 1×1 convolution, δ is a nonlinear activation function, r is a hyperparameter.

[0087] Next, the feature map f is split into f along the spatial dimension (h) ∈R CHr and f (w) ∈R CWr .

[0088] Then, use 1×1 convolution to adjust f (h) and f (w) to match the number of input channels.

[0089] Then, the attention weights in the vertical and horizontal directions are obtained through the sigmoid activation function.

[0090] g (h) =σ(F 1×1 (f (h) )) (4)

[0091] g (w) =σ(F 1×1 (f(w) )) (5)

[0092] Among them, σ is the sigmoid activation function.

[0093] Finally, the two attention weights are multiplied with the input feature map of the coordinate attention module to obtain the weighted output feature y,.

[0094]

[0095] Among them, y c (i,j) represents the c-th channel of the output feature.

[0096] 2. SIOU Loss

[0097] YOLOv7 uses CIoU as the loss function to calculate the distance, overlapping area and aspect ratio between the predicted box and the true box. However, it ignores the degree of directional mismatch between the true box and the predicted box, which causes the predicted box to "wander around" during training.

[0098] To solve this problem, this embodiment uses SIoU loss to replace CIoU. SIoU takes into account the vector angle between the predicted box and the true box, thereby improving the training speed and inference accuracy.

[0099] SIOU loss consists of four parts: angle loss, distance loss, shape loss and IOU loss. The SIOU loss function is defined as follows:

[0100]

[0101] Among them, Δ is the distance loss considering the angle loss, and Ω is the shape loss.

[0102] The angle loss is defined as follows:

[0103]

[0104] Among them, c h is the vertical distance between the center of the predicted box and the center of the true box; σ is the Euclidean distance between the center of the predicted box and the center of the true box.

[0105] The distance loss considering the angle loss is defined as:

[0106]

[0107]

[0108] in, and is the coordinate of the center point of the real frame; and is the coordinate of the center point of the prediction box.

[0109] The shape loss is defined as follows:

[0110]

[0111] Among them, w and h are the width and height of the prediction box; w gt and h gt are the width and height of the real box; θ is the degree of attention paid to shape loss, which is set to 1 in this embodiment.

[0112] In the process of using dataset training to improve YOLOv7, SIOU is used as the loss function to constrain the training process of the network, where the dataset is constructed using experimental data.

[0113] The experimental data comes from an actual aquaculture ship in the Yellow Sea of ​​China. The fish farmed in the ship are Atlantic salmon. The data acquisition device is a GOPOR mobile camera. The recorded video resolution is 3840×2160 and the frame rate is 25fps.

[0114] After image extraction and screening, a total of 1056 images were obtained. The data set was divided into a training set and a test set in a ratio of 8:2. Figure 4 As shown in , the training data set is expanded to 1688 images by using data enhancement techniques such as brightness adjustment, rotation, and cropping; Figure 5 As shown, labeling technology is used to mark the location of damage on the fish surface in the image.

[0115] The effect of improving the YOLOv7 network is verified by experiments, specifically:

[0116] (1) Implementation details and evaluation metrics

[0117] The experiment was implemented on the Pytorch platform, equipped with NVIDIA TM Ge-ForceRTX 3090 GPU; Adam optimizer was used to train the detection model with a batch size of 8 and a learning rate of 0.001; the detection model based on the improved YOLOv7 network was trained for 400 epochs to fully optimize the network parameters; precision, recall, AP50 and mAP were used to evaluate the performance of the proposed method.

[0118] Precision is the ratio of correctly identified fish damage samples to the total number of samples predicted to be damaged, indicating the accuracy of damage prediction; Recall is the ratio of correctly identified damage samples to all actual damage samples, indicating the accuracy of prediction. The specific formula is:

[0119]

[0120] Among them, true positives (TP) represent the number of samples correctly classified as lesions, false negatives (FN) represent the number of samples classified as background but are actually lesions, and false negatives (FP) represent the number of samples classified as lesions but are actually background.

[0121] Average precision (AP) represents the area under the precision-recall curve. AP50 represents the average precision of the recall rate when the IOU is 0.5. The specific formula is:

[0122]

[0123] in, Pi(R) is the precision value of the i-th target, and N is the number of target categories.

[0124] (2) Ablation experiment

[0125] In order to evaluate the effectiveness of the coordinate attention mechanism and SIOU in the proposed method, this embodiment conducted an ablation experiment. The YOLOv7+CA and YOLOv7+SIOU models represent the addition of the coordinate attention mechanism and SIOU module on the basis of YOLOv7. Table 1 shows the ablation experiment results of these methods.

[0126] Table 1 Ablation experiment results

[0127]

[0128]

[0129] As can be seen from Table 1, the coordinate attention mechanism and SIOU in the proposed method are both helpful to improve the detection performance; compared with YOLOv7, YOLOv7+SIOU improves the detection accuracy from 88.08 to 89.68, which shows that the introduction of SIOU loss function effectively improves the detection accuracy; in addition, by introducing the coordinate attention mechanism in YOLOv7, the accuracy of the fish damage model is further improved; the proposed method achieves the best results, with an accuracy of 88.83%, a recall of 73.23%, an AP50 of 80.60%, and a MAP of 35.80%. This result shows that the discriminative information extracted by coordinate attention can effectively improve the recognition accuracy of fish damage in images.

[0130] (3) Comparison with existing methods

[0131] To further evaluate the superiority of the proposed method in fish damage, the proposed method is compared with existing detection methods (including Faster CNN, CenterNet and YOLOV5), and Table 2 shows the quantitative results of these methods.

[0132] Table 2 Comparison of quantitative results of different methods

[0133]

[0134] As can be seen from Table 2, the improved YOLOv7 has the highest detection accuracy on the test dataset; compared with FasterRCNN, the precision, recall, AP50 and MAP of the improved YOLOv7 are improved by 29.05%, 3.83%, 20.70% and 11.7% respectively. Compared with CenterNet, the improved YOLOv7 has improved recall, AP50 and MAP by 0.64%, 13.2% and 8.6% respectively; compared with YOLOV5, the improved YOLOv7 has improved recall, AP50 and MAP by 11.99%, 6.1% and 2.8% respectively.

[0135] In order to further compare the fish damage detection performance of these methods intuitively, Figure 6 The representative damage detection results of the above methods are shown, e.g. Figure 6 As shown in the figure, for fish body injuries of different sizes and numbers, the proposed method effectively reduces false detections and improves the accuracy of fish body injury detection; it can be seen that the detection performance of the proposed method is better than that of the existing methods.

[0136] Embodiment 2

[0137] In one embodiment of the present disclosure, a fish damage detection system based on improved YOLOv7 is provided, comprising:

[0138] The image module is configured to: obtain an image of a school of fish to be detected;

[0139] The detection module is configured to: input the fish school image into the trained improved YOLOv7 network, identify the damaged area on the surface of the fish body, and obtain the fish body damage detection result;

[0140] Among them, the improved YOLOv7 network introduces the coordinate attention mechanism and SIOU loss in YOLOv7. The coordinate attention mechanism embedded in the backbone network of YOLOv7 is used to capture cross-channel direction perception and position-sensitive information, enhance the discriminative features of fish body damage and suppress background interference; the SIOU loss considers the direction information between the real box and the predicted box as a loss function to constrain the training process of the network.

[0141] Embodiment 3

[0142] The purpose of this embodiment is to provide a computer-readable storage medium.

[0143] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in a fish damage detection method based on improved YOLOv7 as described in Embodiment 1 of the present disclosure.

[0144] Embodiment 4

[0145] The purpose of this embodiment is to provide an electronic device.

[0146] An electronic device includes a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, the steps in a fish damage detection method based on improved YOLOv7 as described in Embodiment 1 of the present disclosure are implemented.

[0147] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A fish damage detection method based on improved YOLOv7, characterized in that: include: Acquire an image of a school of fish to be detected; The fish school image is input into the trained improved YOLOv7 network to identify the damaged area on the fish body surface and obtain the fish body damage detection result; Among them, the improved YOLOv7 network introduces the coordinate attention mechanism and SIOU loss in YOLOv7. The coordinate attention mechanism embedded in the backbone network of YOLOv7 is used to capture cross-channel direction perception and position-sensitive information, enhance the discriminative features of fish body damage and suppress background interference; the SIOU loss considers the direction information between the real box and the predicted box, and is used as a loss function to constrain the network training process.

2. A fish body damage detection method based on improved YOLOv7 as claimed in claim 1, characterized in that: The improved YOLOv7 network includes an input module, a backbone module, a neck module and a prediction module; The input module is used to pre-process the input image; The backbone module is used to extract multi-level features from the preprocessed image; The neck module is used to fuse multi-level features; The prediction module is used to predict the final damaged area on the fish body surface.

3. A fish body damage detection method based on improved YOLOv7 as claimed in claim 2, characterized in that: The preprocessing includes adaptive image scaling and mosaic data enhancement.

4. A fish body damage detection method based on improved YOLOv7 as claimed in claim 2, characterized in that: The backbone module consists of CBS, ELAN, coordinate attention module and MPconv; The CBS is used for feature extraction and channel conversion; The ELAN controls the different lengths of the gradient paths so that the deep network can converge effectively during the training process; The coordinate attention module uses the coordinate attention mechanism to decompose the channel attention into two parallel encoding operations, fusing information along two spatial directions, thereby integrating the position information into the channel attention; The MPconv module is used to fuse feature maps obtained by different downsampling methods to retain more feature information.

5. A fish body damage detection method based on improved YOLOv7 as claimed in claim 4, characterized in that: The coordinate attention mechanism consists of two steps: Coordinate information embedding: Use the average pooling method to encode each channel of a given input along the horizontal and vertical axes respectively, and obtain a pair of direction-aware feature maps; Coordinate attention generation: Based on a pair of direction-aware feature maps, the attention weights in the vertical and horizontal directions are calculated, and then weighted fusion is performed along the two spatial directions to obtain features that enhance direction perception and position-sensitive information.

6. A fish body damage detection method based on improved YOLOv7 as claimed in claim 2, characterized in that: The neck module is composed of SPPCSPC, ELANW, UPSample and Cat; The ELANW module adds two splicing operations to the ELAN module.

7. A fish body damage detection method based on improved YOLOv7 as claimed in claim 1, characterized in that: The SIOU loss consists of four parts: angle loss, distance loss, shape loss and IOU loss.

8. A fish damage detection system based on improved YOLOv7, characterized in that: include: The image module is configured to: obtain an image of a school of fish to be detected; The detection module is configured to: input the fish school image into the trained improved YOLOv7 network, identify the damaged area on the surface of the fish body, and obtain the fish body damage detection result; Among them, the improved YOLOv7 network introduces the coordinate attention mechanism and SIOU loss in YOLOv7. The coordinate attention mechanism embedded in the backbone network of YOLOv7 is used to capture cross-channel direction perception and position-sensitive information, enhance the discriminative features of fish body damage and suppress background interference; the SIOU loss considers the direction information between the real box and the predicted box as a loss function to constrain the training process of the network.

9. An electronic device, comprising: a memory for non-transitory storage of computer readable instructions; a processor for executing the computer-readable instructions; Wherein, when the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 7 is executed.

10. A storage medium, characterized in that: The computer-readable instructions are non-transitorily stored, wherein when the computer-readable instructions are executed by a computer, the method of any one of claims 1 to 7 is performed.

Citation Information

Cited By

  • Fish behavior analysis device and method based on underwater image processing

    CN120032423A

  • An apparatus and method for fish behavior analysis based on underwater image processing

    CN120032423B