Method, device and equipment for detecting feeding intensity of fish school based on improved YOLOv8n
By improving the YOLOv8n network to identify the feeding intensity of fish schools, the problem of inaccurate feeding in intensive aquaculture was solved, enabling precise detection of fish feeding and optimized feeding, thereby improving the growth and health of aquatic animals.
Patent Information
- Application Number
- CN202510440129.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-08-01
AI Technical Summary
In intensive aquaculture, existing technologies are insufficient to quantify fish feeding behavior in real time, leading to inaccurate feeding and affecting the growth and health of aquatic animals.
Based on the improved YOLOv8n network, a method for detecting the feeding intensity of fish schools is constructed by identifying the splashes and aggregation levels caused by fish feeding. This includes replacing network modules, introducing an attention mechanism, and improving the bounding box regression loss function to enhance detection accuracy and speed.
It enables accurate identification of fish feeding intensity, optimizes feeding strategies, reduces feed waste, and improves the health and growth efficiency of aquatic animals.
Smart Images

Figure CN120411751A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention generally relate to the technical fields of computer vision and ecological monitoring, and particularly to a method, device, and equipment for detecting the feeding intensity of fish schools based on improved YOLOv8n. Background Art
[0002] In intensive aquaculture, the feeding strategy directly affects the growth, health, and breeding efficiency of aquatic animals. Overfeeding not only causes feed waste and increases breeding costs, but also the remaining feed will deposit at the bottom of the water and decompose, releasing harmful substances such as ammonia nitrogen and nitrite, resulting in a decrease in dissolved oxygen and water quality deterioration, and further increasing the risk of disease for aquatic animals; insufficient feed will lead to malnutrition of aquatic animals, growth stagnation or slowness, and aquatic animals will scramble due to lack of food, increasing competition pressure and causing surface damage and health problems.
[0003] Quantifying fish feeding behavior in real time and adjusting feeding based on this can help solve the above problems; detecting the feeding actions of fish can obtain information such as the feeding frequency and feeding time of fish, providing a theoretical basis and data support for optimizing feed delivery. Summary of the Invention
[0004] To solve the above problems, the present invention is based on an improved YOLOv8n network to identify images of the water splashes and aggregation degree caused by fish feeding, accurately identify the strength of fish feeding, and provide a basis for feeding fish farming.
[0005] According to an embodiment of the present invention, there are provided a method, device, and equipment for detecting the feeding intensity of fish schools based on improved YOLOv8n.
[0006] In the first aspect of the present invention, there is provided a method for detecting the feeding intensity of fish schools based on improved YOLOv8n. The method includes:
[0007] Step S01: Collect fish school feeding images, annotate and preprocess the images to obtain a fish school feeding intensity target detection data set;
[0008] Step S02: Divide the fish school feeding intensity target detection data set into a training set, a validation set, and a test set according to a set ratio;
[0009] Step S03: Construct a fish school feeding intensity target detection network based on improved YOLOv8n: In the YOLOv8n network, replace all Conv modules except the 0th layer with SPD-Conv modules; introduce an attention mechanism MLLA after the SPFF module in the Backbone layer; in the Neck layer, replace some C2f modules with C2f_SENetV2 modules;
[0010] Step S04: Import the training set and the validation set into the fish school feeding intensity target detection network based on the improved YOLOv8n for training to obtain the fish school feeding intensity target detection model;
[0011] Step S05: Use the fish school feeding intensity target detection model to detect the fish school feeding intensity of the test set.
[0012] Furthermore, the SPD-Conv described in step S03 introduces convolutions of multiple structures through structural re-parameterization during the training phase. The specific operation process is as follows: During the training phase, the 3×3 convolution kernel is decomposed into two sub-convolutions of 1×3 and 3×1 for separately processing the features in the horizontal and vertical directions:
[0013]
[0014] where: W1 and W2 are the decomposed convolution kernels.
[0015] During the inference phase: The decomposed structure during the training phase is merged into a standard 3×3 convolution:
[0016]
[0017] SPD-Conv combines depthwise convolution and pointwise convolution:
[0018]
[0019] Depthwise convolution is responsible for extracting local features within each channel, and pointwise convolution realizes the interaction of information between channels.
[0020] Furthermore, the operation process of the MLLA described in step S03 is as follows:
[0021] Use GroupNorm to normalize the input features and adjust the distribution range of the features;
[0022] The input features enter the MLLA Block for processing to obtain output features. The core of the MLLA Block is LinearAttention, which is used to capture the long-range dependence relationship between features. Before the attention processing, a Global ContextBlock is added, and the residual connection helps to alleviate the problem of gradient disappearance and enhance the feature retention ability at the same time;
[0023] The output features are further mapped through a multi-layer perceptron;
[0024] Through the second residual fusion, the final feature representation suitable for downstream tasks is generated.
[0025] Further, the C2f_SENetV2 described in step S03 is obtained by integrating the C2f module and the SENetV2 module. The important component of the SENetV2 module is the SE module, and the operation process of the SE module is as follows:
[0026] Starting from the C×W×H feature map processed by the Inception structure or the ResNet structure, global average pooling is performed on the feature map through the Squeeze operation to obtain a 1×1×C feature vector;
[0027] Two FC layers form a Bottleneck structure for modeling the correlation between channels. After the first FC layer, the number of C channels is changed to C / r to reduce the number of parameters, and then through the non-linear activation of ReLU, it reaches the Dropout layer. Dropout is used for model regularization to reduce overfitting by randomly shutting down a certain proportion of neurons during the training process. After that, it reaches the second FC layer. After the second FC layer, the number of feature channels is restored to C to obtain the weight parameters with the attention mechanism;
[0028] After passing through the Sigmoid activation function, finally, through a Scale operation, the normalized weights are weighted to the features of each channel.
[0029] Further, the fish school feeding intensity target detection network that improves YOLOv8n described in step S03 further includes: improving the bounding box regression loss function to construct a Shape-IoU loss function.
[0030] Further, the preprocessing of the image described in step S01 specifically includes: image size adjustment and data augmentation.
[0031] Further, step S04 further includes performing performance evaluation on the fish school feeding intensity target detection model, and using accuracy, recall rate, average precision, frames per second, and weight file size as the evaluation indicators in this article.
[0032] In the second aspect of the present invention, a device for fish school feeding intensity detection based on improved YOLOv8n is provided. The device includes:
[0033] A dataset acquisition module: used to collect fish school feeding images, annotate and preprocess the images, and obtain a fish school feeding intensity target detection dataset;
[0034] A dataset setting module: used to divide the fish school feeding intensity target detection dataset into a training set, a validation set, and a test set according to a set ratio;
[0035] Network construction module: used to construct a fish school feeding intensity target detection network based on the improved YOLOv8n. In the YOLOv8n network, all Conv modules except the 0th layer are replaced with SPD-Conv modules; an attention mechanism MLLA is introduced after the SPFF module in the Backbone layer; in the Neck layer, some C2f modules are replaced with C2f_SENetV2 modules.
[0036] Model establishment module: used to import the training set and validation set into the fish school feeding intensity target detection network based on the improved YOLOv8n for training to obtain a fish school feeding intensity target detection model.
[0037] Target detection module: used to detect the fish school feeding intensity of the test set using the fish school feeding intensity target detection model.
[0038] In the third aspect of the present invention, an electronic device is provided. The electronic device includes: a memory and a processor, and a computer program is stored on the memory. When the processor executes the program, the method according to the first aspect of the present invention is implemented.
[0039] In the fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method according to the first aspect of the present invention is implemented.
[0040] Based on the improved YOLOv8n network, the present invention identifies images of the splashes and aggregation degree caused by fish feeding, accurately identifies the strength of fish feeding, and provides a basis for fish farming feeding.
[0041] It should be understood that the content described in the summary of the invention is not intended to limit the key or important features of the embodiments of the present invention, nor to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description.
[0042] Advantages of the present invention:
[0043] 1. Replace some Conv modules with SPDConv modules, optimize the model's processing ability for small objects and low-resolution images by reducing information loss and improving the accuracy of feature extraction.
[0044] 2. Introduce the attention mechanism MLLA after the SPFF module in the Backbone layer, and replace the forget gate with positional encoding to provide necessary positional information while maintaining parallel computing and fast inference speed.
[0045] 3. In the Neck layer, replace some C2f modules with C2f_SENetV2 modules to enhance the feature expression ability, improve the accuracy of classification and localization, and at the same time have stronger adaptability to small target detection and complex scenarios;
[0046] 4. Improve the bounding box regression loss function, construct the Shape-IoU loss function, pay attention to the shape and scale differences of the bounding boxes at the same time, improve the regression accuracy, and thus locate the target more accurately. Brief Description of the Drawings
[0047] Combined with the drawings and with reference to the following detailed description, the above and other features, advantages and aspects of the embodiments of the present invention will become more obvious. Among them:
[0048] Figure 1 Shows a flowchart of a method for detecting the feeding intensity of fish schools based on improved YOLOv8n according to an embodiment of the present invention;
[0049] Figure 2 Shows a network structure diagram of improved YOLOv8n according to an embodiment of the present invention;
[0050] Figure 3 Shows a schematic diagram of the structure of the MLLA module according to an embodiment of the present invention;
[0051] Figure 4 Shows a flowchart of the operation of the C2f_SENetV2 module according to an embodiment of the present invention;
[0052] Figure 5 Shows a comparison diagram of the accuracy between the improved YOLOv8n and the original model according to an embodiment of the present invention;
[0053] Figure 6 Shows a comparison diagram of the recall rate between the improved YOLOv8n and the original model according to an embodiment of the present invention;
[0054] Figure 7 Shows a comparison diagram of mAP@0.5 between the improved YOLOv8n and the original model according to an embodiment of the present invention
[0055] Figure 8 Shows a comparison diagram of mAP@0.5-0.95 between the improved YOLOv8n and the original model according to an embodiment of the present invention
[0056] Figure 9 Shows a comparison diagram of PR between the improved YOLOv8n and the original model according to an embodiment of the present invention;
[0057] Figure 10 Shows an effect diagram of identifying the feeding intensity of fish according to an embodiment of the present invention;
[0058] Figure 11 The block diagram of the device for detecting the feeding intensity of fish schools based on the improved YOLOv8n according to an embodiment of the present invention is shown;
[0059] Figure 12 The schematic diagram of the device for detecting the feeding intensity of fish schools based on the improved YOLOv8n according to an embodiment of the present invention is shown. Specific embodiments
[0060] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0061] According to the embodiments of the present invention, a method, device, and equipment for detecting the feeding intensity of fish schools based on the improved YOLOv8n are proposed. A method and device for detecting the feeding intensity of fish schools based on the improved YOLOv8n are proposed. Based on the improved YOLOv8n network, images of the water splashes and aggregation degree caused by fish feeding are recognized to accurately identify the strength of fish feeding, providing a basis for fish farming feeding.
[0062] Next, with reference to several representative embodiments of the present invention, the principles and spirits of the present invention will be elaborated in detail.
[0063] Figure 1 It is a schematic flowchart of the method for detecting the feeding intensity of fish schools based on the improved YOLOv8n according to an embodiment of the present invention. The method includes:
[0064] Step S01: Collect fish school feeding images, annotate and preprocess the images to obtain a fish school feeding intensity target detection data set;
[0065] Step S02: Divide the fish school feeding intensity target detection data set into a training set, a validation set, and a test set according to a set ratio;
[0066] Step S03: Construct a fish school feeding intensity target detection network based on the improved YOLOv8n: In the YOLOv8n network, replace all Conv modules except the 0th layer with SPD-Conv modules; introduce an attention mechanism MLLA after the SPFF module in the Backbone layer; in the Neck layer, replace some C2f modules with C2f_SENetV2 modules;
[0067] Step S04: Import the training set and validation set into the fish school feeding intensity target detection network based on the improved YOLOv8n for training to obtain the fish school feeding intensity target detection model;
[0068] Step S05: Use the fish school feeding intensity target detection model to detect the fish school feeding intensity of the test set.
[0069] It should be noted that although the operations of the method of the present invention are described in a specific order in the above embodiments and accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step for execution, and / or one step may be decomposed into multiple steps for execution.
[0070] For a clearer explanation of the above method for detecting the fish school feeding intensity based on the improved YOLOv8n, a specific embodiment will be described below. However, it should be noted that this embodiment is only for better explaining the present invention and does not constitute an improper limitation of the present invention.
[0071] The following takes a specific example to further illustrate in more detail the method for detecting the fish school feeding intensity based on the improved YOLOv8n:
[0072] Collect fish school images and classify them according to the feeding intensity of fish, divided into strong feeding and weak feeding, with at least 500 images collected for each type.
[0073] Label and preprocess the collected fish school feeding intensity image set. The specific steps of labeling are as follows: Use the labelimg dataset labeling method to label the fish school type, assign high feeding intensity and low feeding intensity label information, and directly export the labeled data as a YOLO-format txt file, which records the behavior of the fish school, water surface splashes, position information, etc.; when the fish school aggregation degree is high and there are water splashes on the water surface, the feeding intensity is high; when the fish school aggregation degree is low or the fish school is dispersed and the water surface is calm, the feeding intensity is low. Preprocessing includes: image size adjustment and data augmentation.
[0074] Divide the fish school feeding intensity target detection dataset into a training set, a validation set, and a test set according to the ratio of 8:1:1. By writing a python script file, create summary files train.txt and val.txt that store the absolute path of the image, the position and category of the label line by line. Finally, put the divided label tags and jpg images in the same directory for the training set and the test set.
[0075] Construct a fish school feeding intensity target detection network based on the improved YOLOv8n.
[0076] 1) AsFigure 2 As shown in Figure 2 , in the YOLOv8n network, all Conv modules except the 0th layer are replaced with SPD-Conv (Structural Re-parameterized Depthwise Convolution) modules. SPD-Conv introduces convolutions of multiple structures during the training phase through structural re-parameterization to enhance the feature extraction ability. During the inference phase, the complex structure is simplified to a single standard convolution to improve the inference efficiency. The specific operation process is as follows: During the training phase, SPD-Conv decomposes the 3×3 convolution kernel into two sub-convolutions of 1×3 and 3×1 to separately process the features in the horizontal and vertical directions:
[0077]
[0078] where W1 and W2 are the decomposed convolution kernels.
[0079] During the inference phase: The decomposed structure during the training phase is merged into a standard 3×3 convolution:
[0080]
[0081] SPD-Conv combines depthwise convolution and pointwise convolution:
[0082]
[0083] Depthwise convolution is responsible for extracting local features within each channel, and pointwise convolution realizes the interaction of information between channels.
[0084] When scale = 2, the calculation process of SPD-Conv is as follows:
[0085] a) The size of the input feature map is C1×S×S;
[0086] b) Through the Space-to-Depth operation, the feature map is divided into multiple sub-feature maps and stacked in the channel dimension, and the size of the feature map becomes
[0087] c) The channel sum is performed on the partitioned feature map to fuse the spatial information, and the number of channels is reduced back to C1;
[0088] d) Apply a standard convolution (stride = 1) to the fused feature map to extract deep features;
[0089] e) The final output feature map size is
[0090] Through the decomposition and reparameterization techniques, SPD-Conv achieves a good balance between parameter efficiency and model performance.
[0091] 2) Introduce the attention mechanism MLLA (Multi-Level Lightweight Attention) after the SPFF (Spatial Pyramid Fast Pooling) module in the Backbone layer. MLLA is an efficient feature enhancement mechanism designed to enhance the expressive power of feature maps through multi-level and multi-scale attention modeling. It effectively captures important features through lightweight channel attention and spatial attention modules, while significantly reducing computational complexity and the number of parameters.
[0092] Figure 3 Figure [ID number] shows the schematic structure of the MLLA module, demonstrating the operation process of the MLLA module. First, the input features are normalized by GroupNorm to adjust the distribution range of the features. GroupNorm improves the model's performance in small-batch training compared to Norm. Then, the input features enter the MLLA Block, where LinearAttention is the core of the MLLA Block and is used to capture long-range dependencies between features. Before attention processing, a Global Context Block is added, which extracts the global context of the features through convolution operations to address the high computational cost problem of traditional attention mechanisms in capturing global information. SkipConnection helps alleviate the vanishing gradient problem and enhances feature retention ability. Next, the output features are further mapped through a Multi-Layer Perceptron (MLP). Finally, through the second residual fusion, the final feature representation suitable for downstream tasks is generated.
[0093] The MLLA module has significant advantages in extracting the characteristic points of fish feeding behavior. First, by combining convolution operations with the linear attention mechanism, it can capture both local details and global dynamic features simultaneously, enabling the efficient extraction and characterization of the minute details and overall behavior patterns in feeding behavior. Second, linear attention optimizes computational complexity through dimensionality reduction, enabling real-time and efficient processing of high-resolution video data and being suitable for large-scale data analysis in fish feeding behavior monitoring. Finally, the residual connection design in the module ensures that key feeding behavior features are not weakened or lost during transmission, thereby improving the extraction accuracy and robustness of behavior features and providing more accurate support for intelligent feeding decisions.
[0094] Compared with adding MLLA to the Head layer, in this paper, MLLA is added to the tail of the YOLOv8n backbone network, which can enhance the local information extraction ability before the features enter the Neck, making the small object features of the fish school clearer, thus improving the accuracy of fish school feeding intensity detection. At the same time, this method optimizes the multi-scale feature fusion of the Neck, enabling the subsequent detection head to more effectively utilize the small object information. In addition, the early introduction of MLLA reduces the computational redundancy of the subsequent modules, improves the inference efficiency, and enables the model to have a faster detection speed while maintaining high accuracy.
[0095] 3) In the Neck layer, some C2f (Cross Stage Partial Fusion) modules are replaced with C2f_SENetV2 modules. C2f_SENetV2 is integrated from a C2f module and a SENetV2 (Squeeze-and-Excitation Network Version 2) module. The core idea of the SENetV2 module is to further enhance the feature expression ability through a dynamic weighting mechanism between channels. Compared with the original SENet module, while maintaining parameter efficiency, the SENetV2 module optimizes the channel attention mechanism through lightweight design to better suit the needs of large-scale visual tasks and efficient networks. Its core lies in: using the compression and excitation mechanism of global information to adjust the weight of each channel, enabling the network to pay more attention to key features while suppressing irrelevant or redundant features, thereby improving the discriminative ability of features.
[0096] The SE module (Squeeze-and-Excitation Module) is an important part of the SENetV2 module. Its role is to introduce a channel attention mechanism, enhance the model's ability to capture important features by adaptively adjusting the weight of each channel, and at the same time suppress irrelevant or unimportant features, thereby improving the expression ability and performance of the model. Figure 4 The operation process of the SE module is shown as follows:
[0097] a) First, starting from the C×W×H feature map processed by the Inception structure or ResNet structure, the feature map is globally average pooled through the Squeeze operation to obtain a 1×1×C feature vector;
[0098] b) Immediately following, two FC layers form a Bottleneck structure to model the correlation between channels. After the first FC layer, the number of channels is reduced from C to C / r, reducing the number of parameters. Then, through the non-linear activation of ReLU, it reaches the Dropout layer. Dropout is used for model regularization. By randomly turning off a certain proportion of neurons during training, overfitting is reduced, enabling the model to learn richer and more robust features and avoid over-reliance on certain neurons. After that, it reaches the second FC layer. After the second FC layer, the number of feature channels is restored to C, obtaining the weight parameters with the attention mechanism.
[0099] c) Finally, through the Sigmoid activation function, and finally through a Scale operation to weight the normalized weights to the features of each channel.
[0100] The SENetV2 module dynamically adjusts the weights of each channel, enabling the model to pay more attention to the key regions in fish feeding behavior, thereby improving the accuracy of feature extraction. By suppressing irrelevant or redundant channel features and reducing noise interference, the behavior recognition performance is further optimized. The SENetV2 module has a lightweight design. After being added to the C2f module, it has little impact on the computational cost while enhancing the feature processing ability of the Neck layer. Using the C2f_SENetV2 module in the Neck layer can better adapt to the changes in feature distribution under complex scenarios, improving the robustness and detection accuracy of the network for fish feeding behavior. The SENetV2 module can strengthen the feature expression ability of the Neck layer, helping to improve the performance of the network in small object detection, especially suitable for monitoring tiny feature points in feeding behavior.
[0101] The training set and validation set are imported into the fish school feeding intensity target detection network based on the improved YOLOv8n for training to obtain the fish school feeding intensity target detection model.
[0102] Intersection over Union (IoU) is an important metric for measuring the overlap between the predicted box and the ground truth box. It is used to evaluate the performance of the target detection model and helps optimize the localization accuracy of the model. During training, IoU is a key part of calculating the loss function, which can guide the model to generate more accurate predicted boxes. The formula for IoU is:
[0103]
[0104] In the formula, Area of Overlap represents the area of the overlapping region between the Predicted Box and the Ground Truth Box; Area of Union represents the area of the union region of the Predicted Box and the Ground Truth Box.
[0105] The existing YOLOv8n model by default uses CIoU (Complete Intersection over Union) to calculate the regression loss of the bounding box. The formula for CIoU is as follows:
[0106]
[0107] Where:
[0108] |A∩B|: The intersection area of the predicted box and the ground truth box;
[0109] |A∪B|: The union area of the predicted box and the ground truth box;
[0110] ρ(b, b gt ): The Euclidean distance between the centers of the predicted box and the ground truth box;
[0111] c: The diagonal length of the smallest enclosing rectangle;
[0112] The difference in the aspect ratio of the predicted box and the ground truth box;
[0113] Dynamic weight balance coefficient.
[0114] CIoU performs well for regular rectangular boxes, but its adaptability for bounding boxes of complex shapes (such as irregular objects) is insufficient. When the aspect ratio of the target box changes significantly, CIoU may cause the optimization of the predicted box to fall into a local optimum.
[0115] Shape-IoU is an improved bounding box regression loss function. Its core idea is to not only focus on the spatial overlap degree between the predicted box and the ground truth box, but also model the shape consistency of the boxes. By incorporating shape features such as aspect ratio, edge alignment, and corner positions into the optimization objective, Shape-IoU can more precisely adjust the shape of the predicted box to make it more conform to the true shape of the target object. This is particularly effective in complex scenarios, especially in object detection tasks with diverse shapes. In addition, ShapeAlign through regularization design makes the optimization process more stable and avoids convergence difficulties in cases of no intersection or low intersection. Its formula is as follows:
[0116] L shape-IoU = 1 - IoU + distances shape + 0.5×Ω shape
[0117]
[0118] Where ww and hh represent the width w and height h of the predicted box and the width w gt and height h gtThe normalized matching degree; distance shape Represents the weighted Euclidean distance of shape and position, determined by the center point offset and shape difference between the predicted box and the ground truth box; Ω shape Represents the scale shape difference loss, measuring the difference in width and height between the predicted box and the ground truth box; ω w And ω h Represent the difference degrees of width and height respectively.
[0119] Through the shape alignment term, Shape-IoU can more accurately capture the geometric characteristics of the target box, and is suitable for tasks with diverse target shapes; in the case of no intersection or low intersection, the shape alignment term can still guide the optimization of the box to avoid the problem of gradient disappearance; Shape-IoU has higher adaptability to small targets or target detection tasks with complex shapes; Shape-IoU takes into account both the overlap degree (IoU) and the optimization of shape characteristics, and can more effectively improve the prediction accuracy of the model's bounding box.
[0120] To evaluate the performance of the improved model, this paper uses accuracy, recall, mean average precision, frames per second, and weight file size as the evaluation metrics in this paper. The calculation formulas of the relevant evaluation metrics are as follows:
[0121]
[0122] Among them, precision is the accuracy, representing the ratio of correctly detected positive samples to all samples detected as positive; Recall is the recall, representing the ratio of correctly detected positive samples to all actual positive samples; mAP is the average of APs for multiple classes, used to evaluate the performance of multi-class object detection models; FPS is the detection frame rate, representing the processing speed of the model.
[0123] Use the fish school feeding intensity target detection model to detect the fish school feeding intensity of the test set.
[0124] As Figures 5 - 9 Described, compared with the original YOLOv8n network, on the basis of a minimal increase in the number of parameters and the model size, P is increased by 8% to reach 91.1%, R is increased by 9.1% to reach 89.1%, mAP@0.5 is increased by 9.5% to reach 93.3%, and at the same time, FPS is still above 30, meeting the accuracy of detection and the feasibility of deployment to edge devices.
[0125] Improving YOLOv8n has improved the accuracy and detection speed of the model. Figure 10 It is the recognition effect diagram of fish feeding intensity. It can be seen that the improved model also has good detection effects in dense fish images; therefore, the method of the present invention has the advantages of high recognition accuracy, fast recognition speed, low memory occupancy rate, etc.
[0126] Based on the same inventive concept, the present invention also proposes a device for detecting the feeding intensity of fish schools based on improved YOLOv8n. The implementation of this device can refer to the implementation of the above method, and the repeated parts will not be elaborated. As Figure 11 shown, the device 100 includes:
[0127] A dataset acquisition module 101: used to collect fish school feeding images, annotate and preprocess the images, and obtain a fish school feeding intensity target detection dataset;
[0128] A dataset setting module 102: used to divide the fish school feeding intensity target detection dataset into a training set, a validation set, and a test set according to a set ratio;
[0129] A network construction module 103: used to construct a fish school feeding intensity target detection network based on improved YOLOv8n: in the YOLOv8n network, replace all Conv modules except the 0th layer with SPD-Conv modules; introduce an attention mechanism MLLA after the SPFF module in the Backbone layer; in the Neck layer, replace some C2f modules with C2f_SENetV2 modules;
[0130] A model establishment module 104: used to import the training set and the validation set into the fish school feeding intensity target detection network based on improved YOLOv8n for training to obtain a fish school feeding intensity target detection model;
[0131] A target detection module 105: used to use the fish school feeding intensity target detection model to detect the fish school feeding intensity of the test set.
[0132] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the described modules can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.
[0133] As Figure 12 shown, the device includes a central processing unit (CPU), which can execute various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) or computer program instructions loaded from a storage unit into a random access memory (RAM). In the RAM, various programs and data required for device operation can also be stored. The CPU, ROM, and RAM are connected to each other through a bus. An input / output (I / O) interface is also connected to the bus.
[0134] Multiple components in the device are connected to the I / O interface, including: an input unit, such as a keyboard, a mouse, etc.; an output unit, such as various types of displays, speakers, etc.; a storage unit, such as a disk, an optical disc, etc.; and a communication unit, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit allows the device to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0135] The processing unit executes the various methods and processes described above, such as method steps S01 to step S05. For example, in some embodiments, method steps S01 to step S05 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit. In some embodiments, part or all of the computer program may be loaded and / or installed onto the device via the ROM and / or the communication unit. When the computer program is loaded into the RAM and executed by the CPU, one or more of the method steps S01 to step S05 described above may be executed. Alternatively, in other embodiments, the CPU may be configured to execute method steps S01 to step S05 by any other suitable means (e.g., by means of firmware).
[0136] The functions described above herein can be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), and so on.
[0137] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to the processor or controller of a general purpose computer, a special purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program codes can be executed entirely on the machine, partially on the machine, as an independent software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0138] In the context of the present invention, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0139] Moreover, although the operations are depicted in a particular order, this should be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed to achieve the desired result. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, although several specific implementation details are included in the foregoing discussion, these should not be construed as limiting the scope of the present invention. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single implementation. Conversely, various features that are described in the context of a single implementation can also be implemented separately or in any suitable subcombination in multiple implementations.
[0140] Although the subject matter has been described in language specific to structural features and / or methodological acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A method for detecting the feeding intensity of fish schools based on improved YOLOv8n, characterized in that, The method includes: Step S01: Collect fish school feeding images, annotate and preprocess the images to obtain a fish school feeding intensity object detection dataset; Step S02: Divide the fish school feeding intensity object detection dataset into a training set, a validation set, and a test set according to a set ratio; Step S03: Construct a fish school feeding intensity object detection network based on the improved YOLOv8n: In the YOLOv8n network, replace all Conv modules except the 0th layer with SPD-Conv modules; introduce an attention mechanism MLLA after the SPFF module in the Backbone layer; in the Neck layer, replace some C2f modules with C2f_SENetV2 modules; Step S04: Import the training set and the validation set into the fish school feeding intensity object detection network based on the improved YOLOv8n for training to obtain a fish school feeding intensity object detection model; Step S05: Use the fish school feeding intensity object detection model to detect the fish school feeding intensity of the test set.
2. The method for detecting the feeding intensity of fish schools based on the improved YOLOv8n according to claim 1, wherein, The SPD-Conv described in Step S03 introduces convolutions of multiple structures through structural reparameterization during the training phase. The specific operation process is as follows: During the training phase, the 3×3 convolution kernel of SPD-Conv is decomposed into two sub-convolutions of 1×3 and 3×1, which are used to process the features in the horizontal and vertical directions respectively: Where: W1 and W2 are the decomposed convolution kernels. During the inference phase: Merge the decomposed structure during the training phase into a standard 3×3 convolution: SPD-Conv combines depthwise convolution and pointwise convolution: Depthwise convolution is responsible for extracting local features within each channel, and pointwise convolution realizes the interaction of information between channels.
3. The method for detecting the feeding intensity of fish schools based on the improved YOLOv8n according to claim 1, wherein The operation process of the MLLA described in Step S03 is as follows: Use GroupNorm to normalize the input features and adjust the distribution range of the features; The input features enter the MLLA Block for processing to obtain output features. The core of the MLLA Block is LinearAttention, which is used to capture the long-range dependence relationship between features. Before the attention processing, a Global ContextBlock is added, and the residual connection helps to alleviate the gradient disappearance problem and enhance the feature retention ability at the same time; The output features are further mapped through a multi-layer perceptron; Generate the final feature representation suitable for downstream tasks through the second residual fusion.
4. The method for detecting the feeding intensity of fish schools based on the improved YOLOv8n according to claim 1, wherein, The C2f_SENetV2 described in Step S03 is obtained by integrating the C2f module and the SENetV2 module. The important part of the SENetV2 module is the SE module. The operation process of the SE module is as follows: Starting from the C×W×H feature map processed by the Inception structure or the ResNet structure, perform global average pooling on the feature map through the Squeeze operation to obtain a 1×1×C feature vector; Two FC layers form a Bottleneck structure to model the correlation between channels. After the first FC layer, the number of channels is reduced from C to C / r to reduce the number of parameters. Then, through the non-linear activation of ReLU, it reaches the Dropout layer. Dropout is used for model regularization to reduce overfitting by randomly turning off a certain proportion of neurons during training. After that, it reaches the second FC layer. After the second FC layer, the number of feature channels is restored to C to obtain the weight parameters with the attention mechanism. After passing through the Sigmoid activation function, finally, a Scale operation is performed to weight the normalized weights to the features of each channel.
5. The method for detecting the feeding intensity of fish schools based on the improved YOLOv8n according to claim 1, characterized in that, The improved fish school feeding intensity target detection network of YOLOv8n described in step S03 further includes: improving the bounding box regression loss function and constructing the Shape-IoU loss function.
6. The method for detecting the feeding intensity of fish schools based on the improved YOLOv8n according to claim 1, wherein, The preprocessing of the image described in step S01 specifically includes: image size adjustment and data augmentation.
7. The method for detecting the feeding intensity of fish schools based on the improved YOLOv8n according to claim 1, wherein, Step S04 further includes performing performance evaluation on the fish school feeding intensity target detection model, and using accuracy, recall rate, mean average precision, frames per second, and weight file size as the evaluation metrics in this article.
8. An apparatus for detecting the feeding intensity of fish schools based on improved YOLOv8n, characterized in that, The device implements the method described in any one of claims 1 to 7, including: A dataset acquisition module: used to collect fish school feeding images, annotate and preprocess the images, and obtain a fish school feeding intensity target detection dataset; A dataset setting module: used to divide the fish school feeding intensity target detection dataset into a training set, a validation set, and a test set according to a set ratio; A network construction module: used to construct a fish school feeding intensity target detection network based on the improved YOLOv8n: in the YOLOv8n network, replace all Conv modules except the 0th layer with SPD-Conv modules; introduce the attention mechanism MLLA after the SPFF module in the Backbone layer; in the Neck layer, replace some C2f modules with C2f_SENetV2 modules; A model establishment module: used to import the training set and the validation set into the fish school feeding intensity target detection network based on the improved YOLOv8n for training to obtain a fish school feeding intensity target detection model; A target detection module: used to use the fish school feeding intensity target detection model to detect the fish school feeding intensity of the test set.
9. An electronic device, comprising a memory and a processor, wherein a computer program is stored on the memory, characterized in that, When the processor executes the program, it implements the method described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method described in any one of claims 1 to 7.
Citation Information
Cited By
Mutton sheep body size measuring method and device based on target detection network model SVW-YOLO
CN121214484A
Building surface defect detection method and system based on improved YOLOv8
CN121481958A
Method and system for evaluating ingestion intensity of fish shoal based on target detection and acoustic detection
CN121640261A
Method and system for automatically adjusting feeding amount based on feeding behavior of fish school
CN122087773A