Fish feeding condition real-time detection model training method and system based on YOLOv8

Through the lightweight neural network model based on YOLOv8, combined with the global attention module and ReLU activation function, the problem of high-precision real-time monitoring of the existing fish feeding detection model in computing resource limitations and complex environments is solved, and stable deployment and efficient detection on low-power devices are achieved.

CN120451857APending Publication Date: 2025-08-08ZHEJIANG QINGYUTANG AGRI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510495688.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-21
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

Existing computer vision and deep learning-based fish feeding detection models are difficult to achieve high-precision real-time monitoring under computing resource limitations and complex environments, especially on low-power devices.

Method used

A lightweight neural network model based on YOLOv8 is adopted, combining the global attention module, layer jump connection and ReLU activation function, video data is acquired through the camera and data augmentation and preprocessing, and a lightweight neural network model is built to improve detection accuracy and real-time.

Benefits of technology

It improves detection accuracy and real-time, enhances the generalization ability and robustness of the model, and enables the model to run stably in complex environments, making it easy to deploy on ordinary cameras and computing devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451857A_ABST
    Figure CN120451857A_ABST
Patent Text Reader

Abstract

The invention discloses a fish ingestion condition real-time detection model training method and system based on YOLOv8, and the method comprises the steps: S1, obtaining the video data of the water surface spray form during fish ingestion through a camera, carrying out the processing of the obtained video data, and obtaining a fish ingestion condition real-time detection model; the processed image data is obtained; s2, constructing a lightweight neural network model based on a YOLOv8 network architecture; the lightweight neural network model comprises a backbone network, a detection neck and an output end; s3, a global attention module is introduced into the backbone network, a skip layer connection mode is adopted in the detection neck, and a ReLu activation function is adopted; and S4, inputting the processed image data into the lightweight neural network model to extract feature information and carry out feature fusion to generate a final detection model of the water surface spray during fish ingestion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of aquaculture technology, and in particular to a YOLOv8-based fish feeding situation real-time detection model training method and system. Background Art

[0002] Monitoring fish feeding behavior and intelligent feeding technology are important research areas in aquaculture. Traditional methods based on manual observation are inefficient, subject to high errors, and prone to feed waste. However, methods based on computer vision and deep learning are becoming increasingly mainstream, enabling precise feeding through real-time monitoring of fish feeding patterns. However, when applied to real-world aquaculture scenarios, existing models based on computer vision and deep learning still face challenges with limited computing resources and complex environments. Most deep learning algorithms have large parameter counts, making them difficult to migrate and deploy to embedded devices. Two-stage models may achieve high accuracy but suffer from poor real-time performance, while single-stage models offer good real-time performance but may suffer from low accuracy. Consequently, most existing methods rely on high computing resources and struggle to run on low-power devices, limiting their widespread application and implementation in real-world aquaculture environments. Model accuracy is low, and generalization is particularly limited in complex environments, making them incapable of adapting to the variability of aquaculture scenarios.

[0003] In response to the above technical problems, the present invention proposes a real-time fish feeding detection model training method and system based on YOLOv8. Summary of the Invention

[0004] The purpose of the present invention is to address the defects of the existing technology and provide a real-time fish feeding detection model training method and system based on YOLOv8.

[0005] In order to achieve the above objectives, the present invention adopts the following technical solutions:

[0006] A YOLOv8-based real-time fish feeding detection model training method includes:

[0007] S1. Obtain video data of the water surface splash morphology when fish are feeding through a camera, and process the acquired video data to obtain processed image data;

[0008] S2. Build a lightweight neural network model based on the YOLOv8 network architecture; the lightweight neural network model includes a backbone network, a detection neck, and an output terminal;

[0009] S3. Introducing a global attention module into the backbone network, adopting skip-layer connections in the detection process, and using the ReLu activation function;

[0010] S4. Input the processed image data into a lightweight neural network model to extract feature information and perform feature fusion to generate a final detection model for water splashes when fish are feeding.

[0011] Furthermore, the processing of the acquired video data in step S1 includes performing frame cutting processing on the acquired video data.

[0012] Furthermore, after obtaining the processed image data in step S1, the method further includes: using a labeling tool to label the splash level in the image data to obtain labeled image data;

[0013] Furthermore, the labeling tool is a Labelme tool.

[0014] Furthermore, before step S4, the following steps are further included:

[0015] The image data processed in step S1 is subjected to data enhancement and preprocessing.

[0016] Furthermore, the data enhancement includes color perturbation, random perturbation, mosaic data splicing and hybrid enhancement.

[0017] Furthermore, the global attention module is introduced into the backbone network in step S3 as follows:

[0018] Channel attention module: The input feature map undergoes maximum pooling and average pooling operations to generate two different types of feature maps. The two generated feature maps of different types are then input into a shared multi-layer perceptron for processing, and the two feature maps output by the shared multi-layer perceptron are added together to generate the channel attention weight.

[0019] Spatial attention module: The feature map processed by the channel attention module is again subjected to maximum pooling and average pooling operations to generate two two-dimensional feature maps. The two two-dimensional feature maps are convolved to generate a spatial attention map. The generated spatial convolution output is activated to generate the final spatial attention map. Finally, the feature map processed by the channel attention module is multiplied pixel by pixel with the spatial attention map to obtain the final output feature map.

[0020] Furthermore, the specific method of adding a skip layer connection to the detection neck in step S3 is:

[0021] Shallow feature maps and deep feature maps at different levels are extracted from the backbone network, the deep feature maps are fused with the shallow feature maps, and the fused feature maps are convolutionally operated and output.

[0022] Furthermore, the ReLu activation function in step S3 is expressed as:

[0023] f(x)=max(0,x)

[0024] Among them, f(x) represents the output value of the ReLu activation function; max(0,x) means taking the maximum value between 0 and the input value x.

[0025] Accordingly, a YOLOv8-based real-time fish feeding detection model training system is also provided, including:

[0026] An acquisition module is used to acquire video data of the water surface splash morphology when fish feed through a camera, and process the acquired video data to obtain processed image data;

[0027] A construction module for constructing a lightweight neural network model based on the YOLOv8 network architecture; the lightweight neural network model includes a backbone network, a detection neck, and an output end;

[0028] A module is introduced to introduce a global attention module into the backbone network, adopt a skip-layer connection method in the detection neck, and use the ReLu activation function;

[0029] The generation module is used to input the processed image data into the lightweight neural network model to extract feature information and perform feature fusion to generate the final detection model of water surface splashes when fish feed.

[0030] Compared with the prior art, the present invention has the following beneficial effects:

[0031] 1. Improved detection accuracy: By preserving the correlation between spatial and channel information, the target area can be captured more accurately, reducing false detections and missed detections, and improving target detection accuracy. Combining deep semantic information with shallow position information, it takes into account both the position and semantic characteristics of the target, further improving detection accuracy.

[0032] 2. Real-time Monitoring: The use of the ReLU activation function and an optimized network architecture reduces the model's computational complexity and improves inference speed, enabling real-time monitoring of fish feeding activity. The real-time monitoring model rapidly outputs results, providing instant feedback to farmers and enabling timely adjustments to feeding strategies.

[0033] 3. Strong generalization capabilities: Through methods such as color perturbation, random perturbation, mosaic stitching, and hybrid enhancement, the diversity of the training dataset is expanded, enabling the model to adapt to complex environments such as different lighting, angles, and distances. Through methods such as Gaussian noise and random cropping, the model's robustness to noise and edge cases is improved, ensuring stable performance in real-world farming environments.

[0034] 4. Easy to expand and deploy: The detection model adopts a modular design, which allows for easy expansion and optimization based on actual needs. The model has low hardware requirements and can run on common cameras and computing devices, making it easy to deploy in actual farming environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 This is a flow chart of a method for training a real-time fish feeding detection model based on YOLOv8 provided in the first embodiment;

[0036] Figure 2 This is a network architecture diagram of the lightweight neural network model provided in this embodiment. DETAILED DESCRIPTION

[0037] The following describes the embodiments of the present invention through specific examples. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed 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 unless they conflict.

[0038] The purpose of the present invention is to address the defects of the existing technology and provide a real-time fish feeding detection model training method and system based on YOLOv8.

[0039] Example 1

[0040] This embodiment provides a method for training a real-time fish feeding detection model based on YOLOv8. Figure 1 Shown, including:

[0041] S1. Obtain video data of the water surface splash morphology when fish are feeding through a camera, and process the acquired video data to obtain processed image data;

[0042] S2. Build a lightweight neural network model based on the YOLOv8 network architecture; the lightweight neural network model includes a backbone network, a detection neck, and an output terminal;

[0043] S3. Introducing a global attention module into the backbone network, adopting skip-layer connections in the detection process, and using the ReLu activation function;

[0044] S4. Input the processed image data into a lightweight neural network model to extract feature information and perform feature fusion to generate a final detection model for water splashes when fish are feeding.

[0045] In step S1, video data of the water surface splash morphology when fish are feeding is acquired through a camera, and the acquired video data is processed to obtain processed image data.

[0046] Select a camera with high resolution, high frame rate, and waterproof and dustproof functions, and install the camera above or on the side of the feeding area. When the fish feed, the camera records video data, and the video data includes the water surface splash pattern every time the fish feeds.

[0047] The acquired video data is cut into frames. According to the speed of the water splash shape change, a reasonable frame cutting interval is set. According to actual needs, the total number of cut frames is set (for example, 500 frames per video), thereby obtaining 5,000 processed image data. Then, the Labelme annotation tool is used to annotate the cut-frame images, and the annotation content includes the water splash level (such as mild water splash, medium water splash, and severe water splash).

[0048] In step S2, a lightweight neural network model is constructed based on the YOLOv8 network architecture; the lightweight neural network model includes a backbone network, a detection neck and an output end.

[0049] The network architecture of YOLOv8 mainly includes the following parts:

[0050] Backbone network: used to extract image features.

[0051] Neck detection: used for feature fusion and enhancement.

[0052] Head / output end (Head): used for final target detection output.

[0053] In step S3, a global attention module is introduced into the backbone network, a skip-layer connection method is adopted in the detection neck, and a ReLu activation function is used.

[0054] like Figure 2 The above is a lightweight neural network model built based on the yolov8 network architecture.

[0055] To adapt to embedded devices and scenarios with high real-time requirements, YOLOv8 is lightweight, specifically including the following aspects:

[0056] (1) Introducing the global attention module (GAM) into the backbone network.

[0057] The Global Attention Module (GAM) improves the performance of the model by preserving the association between spatial and channel information, while effectively capturing the correlation between different channels, allowing the model to pay more attention to the target area and improve the accuracy of target detection.

[0058] The global attention module includes channel attention and spatial attention.

[0059] Channel attention module: The input feature map undergoes maximum pooling and average pooling operations to generate two different types of feature maps. The two generated feature maps of different types are then input into a shared multi-layer perceptron for processing, and the two feature maps output by the shared multi-layer perceptron are added together to generate the channel attention weight.

[0060] Spatial attention module: The feature map processed by the channel attention module is again subjected to maximum pooling and average pooling operations to generate two two-dimensional feature maps. The two two-dimensional feature maps are convolved to generate a spatial attention map. The generated spatial convolution output is activated to generate the final spatial attention map. Finally, the feature map processed by the channel attention module is multiplied pixel by pixel with the spatial attention map to obtain the final output feature map.

[0061] (2) Add skip-layer connection method in the detection neck.

[0062] Skip Connections fuses deep and shallow feature information, taking into account both positional and semantic information. This can effectively reduce the loss of useful information features, making the model more precise in target detection and recognition, and more accurate in target frame positioning.

[0063] The skip-layer connection extracts feature maps of different levels from the backbone network, including shallow feature maps and deep feature maps; the deep feature map is upsampled to the same size as the shallow feature map, and the upsampled deep feature map is spliced with the shallow feature map in the channel dimension. The spliced feature map is then further processed by the convolution layer to extract the fused feature information; then, through multiple skip-layer connections, the feature maps of different scales are fused to generate a multi-scale feature map. The fused feature map is input to the detection head for the final target detection output. This embodiment enhances the model's ability to capture target location and semantic information through feature fusion.

[0064] (3) Use ReLu activation function.

[0065] The ReLu activation function prevents model overfitting, reduces the interdependence between parameters, and improves the running speed of the model.

[0066] This embodiment uses the ReLu activation function in each layer of the network to ensure nonlinear transformation and efficient calculation of the model. The ReLu activation function is expressed as:

[0067] f(x)=max(0,x)

[0068] Among them, f(x) represents the output value of the ReLu activation function; max(0,x) means taking the maximum value between 0 and the input value x.

[0069] In this embodiment, before step S4, the step further includes: performing data enhancement and preprocessing on the image data processed in step S1.

[0070] In this embodiment, the data enhancement processing performed on the image data includes color perturbation, random perturbation, mosaic data splicing, mixed enhancement, random cropping and filling, and Gaussian noise.

[0071] Color perturbation: Use image processing tools in deep learning frameworks (such as PyTorch, TensorFlow) to randomly perturb the hue, saturation, and brightness of the image to make the model more robust to lighting changes.

[0072] Random perturbations (angle, scale, translation): Use random transformation tools in deep learning frameworks to randomly rotate, scale, or translate images to simulate fish feeding at different positions, angles, and distances.

[0073] Mosaic data stitching: Multiple images are stitched into a large image. The size and position of each image are randomly adjusted during stitching, thereby enhancing the model's ability to detect small targets and preventing them from being lost.

[0074] MixUp: Mix the pixel values and labels of two images through linear interpolation to generate new image data, thereby enhancing the model's robustness to boundary conditions and reducing overfitting.

[0075] Random Crop and Fill: Randomly crop a portion of the image and fill it with background or random color to simulate fish feeding at different viewing angles.

[0076] Gaussian noise: Add Gaussian noise to the image to simulate the noise interference in the real environment and improve the robustness of the model.

[0077] In this embodiment, preprocessing the image data includes image size adjustment, normalization, denoising, and edge enhancement.

[0078] Image resizing: resize the images to the size required by the model input (e.g., 640x640 pixels), ensuring that all images are of the same size for easy model processing.

[0079] Normalization: Normalize the image pixel values to the range of [0, 1] or [-1, 1] to improve the convergence speed and stability of the model.

[0080] Denoising: Use median filtering or Gaussian filtering to remove noise from the image, thereby reducing the interference of noise on model detection.

[0081] Edge enhancement: Use the Sobel operator or Canny operator to enhance the image edges, thereby improving the model's ability to detect target edges.

[0082] Finally, the data-augmented and preprocessed images were divided into training and validation sets in a 9:1 ratio, and the processed image data was input into a lightweight neural network model for training. Through these steps, the model's generalization ability and detection accuracy can be effectively improved, making it perform more stably and accurately in real aquaculture environments.

[0083] In step S4, the processed image data is input into a lightweight neural network model to extract feature information and perform feature fusion to generate a final detection model for water surface splashes when fish are feeding.

[0084] The processed image data is input into the lightweight neural network model to extract feature information:

[0085] The processed image data is fed into the backbone network of the lightweight neural network model for feature extraction. The backbone network is responsible for extracting location and object details from the image. The Global Attention Module (GAM) is introduced into the backbone network to improve model performance by preserving the correlation between spatial and channel information. It also effectively captures the correlation between different channels, thereby better distinguishing different objects.

[0086] The feature fusion of the extracted feature information is as follows:

[0087] The extracted feature information is sent to the detection node for feature fusion. The detection node uses skip-layer connections to fuse deep and shallow feature information. The shallower the layers of the deep learning network, the more accurate the positional information; the deeper the layers, the more pronounced the semantic information. Skip-layer connections better balance positional and target information, effectively reducing the loss of useful features. This results in more accurate target recognition and precise object bounding box positioning.

[0088] Generate the final detection model of water splash when fish feed, specifically:

[0089] The fused feature information is input to the output terminal for target category screening. The output terminal generates the target category based on the fused feature information, that is, the predicted result of the water surface splash when the fish feeds.

[0090] Through these steps, the model continuously learns and optimizes, ultimately generating a detection model that can perform real-time detection on input video or image data and output the water surface splashes caused by fish feeding.

[0091] After step S4, the method further includes: inputting the image data to be detected into a trained detection model, and the detection model outputs the splashes on the water surface when the fish feeds.

[0092] S41. Before inputting the image to be detected into the detection model, the image needs to be preprocessed as in step S1 to ensure that its format and size are consistent with those during model training.

[0093] S42. The preprocessed image is input into the trained detection model. The backbone network of the detection model extracts the feature information in the image. The obtained feature information is input into the detection neck for feature fusion processing to obtain the fused feature information. The fused feature information is input into the output end to screen the target category and position results. The detection model outputs the splash on the water surface when the fish feeds and judges the level of the splash (such as slight splash, medium splash, severe splash).

[0094] The YOLOv8-based real-time fish feeding situation detection model of this embodiment not only improves the detection accuracy and real-time performance, but also enhances the generalization ability and robustness of the model.

[0095] Example 2

[0096] This embodiment provides a real-time fish feeding status detection model training system based on YOLOv8, including:

[0097] An acquisition module is used to acquire video data of the water surface splash morphology when fish feed through a camera, and process the acquired video data to obtain processed image data;

[0098] A construction module for constructing a lightweight neural network model based on the YOLOv8 network architecture; the lightweight neural network model includes a backbone network, a detection neck, and an output end;

[0099] A module is introduced to introduce a global attention module into the backbone network, adopt a skip-layer connection method in the detection neck, and use the ReLu activation function;

[0100] The generation module is used to input the processed image data into the lightweight neural network model to extract feature information and perform feature fusion to generate the final detection model of water surface splashes when fish feed.

[0101] It should be noted that the real-time fish feeding detection model training system based on YOLOv8 provided in this embodiment is similar to that in Example 1, so it will not be described in detail.

[0102] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the concept of the present invention. The scope of the present invention is determined by the scope of the appended claims.

Claims

1. A real-time fish feeding detection model training method based on YOLOv8, characterized in that: include: S1. Obtain video data of the water surface splash morphology when fish are feeding through a camera, and process the acquired video data to obtain processed image data; S2. Build a lightweight neural network model based on the YOLOv8 network architecture; the lightweight neural network model includes a backbone network, a detection neck, and an output terminal; S3. Introducing a global attention module into the backbone network, adopting skip-layer connections in the detection process, and using the ReLu activation function; S4. Input the processed image data into a lightweight neural network model to extract feature information and perform feature fusion to generate a final detection model for water splashes when fish are feeding.

2. The method for training a real-time fish feeding situation detection model based on YOLOv8 according to claim 1, characterized in that: The processing of the acquired video data in step S1 includes performing frame cutting processing on the acquired video data.

3. The method for training a fish feeding situation real-time detection model based on YOLOv8 according to claim 2, characterized in that: After obtaining the processed image data in step S1, the method further includes: using a labeling tool to label the splash levels in the image data to obtain labeled image data.

4. The method for training a fish feeding situation real-time detection model based on YOLOv8 according to claim 3, characterized in that: The labeling tool is the Labelme tool.

5. The method for training a fish feeding situation real-time detection model based on YOLOv8 according to claim 1, characterized in that: Before step S4, the following steps are also included: The image data processed in step S1 is subjected to data enhancement and preprocessing.

6. The method for training a real-time fish feeding situation detection model based on YOLOv8 according to claim 5, characterized in that: The data enhancement includes color perturbation, random perturbation, mosaic data splicing and hybrid enhancement.

7. The method for training a real-time fish feeding situation detection model based on YOLOv8 according to claim 1, characterized in that: The specific steps of introducing the global attention module into the backbone network in step S3 are: Channel attention module: The input feature map undergoes maximum pooling and average pooling operations to generate two different types of feature maps. The two generated feature maps of different types are then input into a shared multi-layer perceptron for processing, and the two feature maps output by the shared multi-layer perceptron are added together to generate the channel attention weight. Spatial attention module: The feature map processed by the channel attention module is again subjected to maximum pooling and average pooling operations to generate two two-dimensional feature maps. The two two-dimensional feature maps are convolved to generate a spatial attention map. The generated spatial convolution output is activated to generate the final spatial attention map. Finally, the feature map processed by the channel attention module is multiplied pixel by pixel with the spatial attention map to obtain the final output feature map.

8. The method for training a real-time fish feeding situation detection model based on YOLOv8 according to claim 1, wherein: The specific method of adding a skip layer connection in the detection neck in step S3 is: Shallow feature maps and deep feature maps at different levels are extracted from the backbone network, the deep feature maps are fused with the shallow feature maps, and the fused feature maps are convolutionally operated and output.

9. The method for training a real-time fish feeding situation detection model based on YOLOv8 according to claim 1, wherein: The ReLu activation function in step S3 is expressed as: f(x)=max(0,x) Among them, f(x) represents the output value of the ReLu activation function; max(0,x) means taking the maximum value between 0 and the input value x.

10. A training system based on the YOLOv8-based fish feeding situation real-time detection model training method according to any one of claims 1 to 9, characterized in that: include: An acquisition module is used to acquire video data of the water surface splash morphology when fish feed through a camera, and process the acquired video data to obtain processed image data; A construction module for constructing a lightweight neural network model based on the YOLOv8 network architecture; the lightweight neural network model includes a backbone network, a detection neck, and an output end; A module is introduced to introduce a global attention module into the backbone network, adopt a skip-layer connection method in the detection neck, and use the ReLu activation function; The generation module is used to input the processed image data into the lightweight neural network model to extract feature information and perform feature fusion to generate the final detection model of water surface splashes when fish feed.