Improved YOLOv8 target detection counting outdoor pond fish intelligent feeding method

Through the improved YOLOv8 target detection counting model, combined with the C2f_Star_CAA structure and dynamic detection head, the technical problem of intelligent feeding in outdoor ponds is solved, and high-precision and low-cost fish population detection is achieved. It is suitable for complex natural environments and reduces feed Waste and environmental pollution.

CN118942110AInactive Publication Date: 2024-11-12INST OF AGRI ECONOMY & INFORMATION AAAS
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202410936320.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-11-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing technology lacks intelligent feeding methods suitable for outdoor ponds, and the traditional feeding methods rely on manual labor, resulting in uneven feeding amounts, waste of feed and environmental pollution. The existing methods are mostly aimed at indoor environments or specific fish species, and the hardware is The cost is high and it is difficult to meet the needs of complex natural environments.

Method used

The improved YOLOv8 target detection counting model is adopted, combined with the backbone network, neck network and head network, and the fish population count is detected through the camera, and the C2f_Star_CAA structure and dynamic detection head are used to achieve detection counting of large, medium and small targets. , reduces hardware costs and is suitable for different fish species and complex environments.

Benefits of technology

It improves detection accuracy and real-time performance, can significantly improve target detection performance without increasing calculation overhead, and achieve finer feeding decision-making particle size, suitable for different fish species and complex natural environments, reducing feed waste and environmental pollution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118942110A_ABST
    Figure CN118942110A_ABST
Patent Text Reader

Abstract

The invention discloses an improved YOLOv8 target detection counting outdoor pond fish intelligent feeding method, relates to the technical field of intelligent aquaculture and intelligent identification, and provides a simple and effective intelligent feeding scheme for solving the problems of less outdoor environment intelligent feeding research, complex feeding decision, complex outdoor environment, variety of fish species and the like. In order to realize an intelligent feeding function, the number of ingestion fish schools is detected in real time by using a target detection counting method, a feeding strategy is controlled according to the change of the number, and an improved YOLOv8 target detection model is constructed in order to improve the accuracy of fish school detection counting. The Star operation is introduced into a C2f module by using the advantage that the Star operation can map the features of different subspaces to a high-dimensional nonlinear feature space; in order to obtain long-distance context information of an input object, a CAA module is introduced into a C2f module; meanwhile, the scale difference, the shape difference and the task difference of a target detection object are solved, and a dynamic detection head module is introduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of intelligent aquaculture and intelligent identification, and specifically to an improved YOLOv8 target detection and counting method for intelligent feeding of fish in outdoor ponds. Background Art

[0002] Developing smart fisheries is a new requirement and new trend in modern aquaculture, and implementing intelligent feeding technology is one of the measures to achieve this goal. However, traditional feeding methods mostly rely on manual labor, and the feeding amount is mainly based on experience, the feeding time is not fixed, and the feeding amount is uneven. Manual feeding not only increases labor and time costs, but may also have a negative impact on aquaculture benefits, such as feed waste caused by excessive feeding and uneven feeding of fish caused by insufficient feeding. Feed costs dominate fish farming. Achieving precise feeding of feed can not only reduce feed waste, optimize farming costs, and increase farming returns, but also avoid pollution of the aquaculture environment caused by improper feeding, such as eutrophication of water bodies. Therefore, promoting automatic and precise intelligent feeding technology has important practical value in fish farming.

[0003] Different researchers have conducted research on intelligent feeding technology using various techniques. Kei et al. used sonar, optical camera images, and neural network technology to monitor fish. Zhou et al. used near-infrared imaging to quantify fish feeding behavior. Zhou et al. used near-infrared computer vision and fuzzy neural models to establish a fish feeding decision-making system. Garcia et al. proposed an automatic feeding system based on sensor data such as temperature, dissolved oxygen, velocity, and particle detection. Subakti et al. installed accelerometers on tilapia to monitor feeding. Li et al. determined whether fish were full by identifying uneaten fish pellets underwater. Ahsan et al. combined time information with deep learning methods to detect underwater fish and classify them. Zhang et al. used underwater machine vision to classify the feeding behavior of Atlantic salmon. Han et al. used convolutional neural networks and spatiotemporal information to detect fish behavior. Lin et al. used deep learning methods to identify fish species using an underwater panoramic drone. Zhao et al. assessed fish appetite in a recirculating aquaculture environment. Cai et al. used MobileNetv1 as the backbone network to improve the YOLOv3 network model for fish detection. Feng et al. used computer vision and a lightweight 3DResNet-GloRe network to quantify fish feeding intensity. Naomi et al. used convolutional neural networks to assess fish feeding intensity. Yang et al. constructed a dual-attention network model based on the EfficientNet-B2 backbone network to analyze the short-term feeding behavior of fish schools. Zhang et al. proposed a MobileNetV2-SENet network model that combined the MobileNetV2 backbone network and the SENet structure to identify fish feeding behavior.

[0004] The above existing technologies mainly include methods using sonar, sensors, near-infrared, underwater residual bait detection, behavioral analysis, and convolutional neural networks; some of these methods require the purchase of hardware equipment, some are only targeted at specific fish species, some decision models are too complex, and some only classify or detect feeding behavior, and the above methods are mainly targeted at indoor breeding environments.

[0005] At present, there are not many intelligent feeding methods for outdoor aquaculture environments. The main ones are the adaptive neuro-fuzzy inference system for grass carp feeding decision-making in outdoor high-density aquaculture ponds proposed by Zhao et al. and the use of biomass factor model and fuzzy logic control technology by Zhao et al. to determine the feed requirements of grass carp in outdoor pond aquaculture systems.

[0006] In response to the above-mentioned technical defects, this patent conducts research on intelligent feeding in outdoor ponds and now proposes a solution; the proposed method is aimed at more complex outdoor natural environment scenarios, can be applied to different fish species, and can provide a finer feeding decision granularity without much investment in hardware costs; the target detection method based on the improved YOLOv8 can, on the one hand, improve the detection accuracy, and on the other hand, meet the real-time detection requirements of actual scenarios. Summary of the Invention

[0007] The purpose of the present invention is to solve the above-mentioned problems and to propose an improved YOLOv8 target detection and counting method for intelligent feeding of outdoor pond fish.

[0008] The purpose of the present invention can be achieved through the following technical solutions:

[0009] An intelligent feeding method for outdoor pond fish based on an improved YOLOv8 target detection and counting model. The specific feeding method is as follows:

[0010] The images captured by the camera are stored in a video recorder, and after reading the images from the video recorder, they are input into an improved YOLOv8 target detection network to obtain the number of feeding fish. The intelligent feeding function is realized according to the change in the number of feeding fish. The improved YOLOv8 network includes a backbone network, a neck network, and a head network. The acquired images are first input into the backbone network to extract image features, and then the extracted features are further fused through the neck network. Finally, the fused features are input into the head network to realize the detection and counting of three target scales: large targets, medium targets, and small targets.

[0011] As a preferred embodiment of the present invention, the improved YOLOv8 detection network is based on the YOLOv8n model, and the C2f structure of the backbone network and the neck network in the original YOLOv8n is replaced by the C2f_Star_CAA structure. The C2f_Star_CAA structure is composed of C2f adding a Star operation and a CAA module. The Star operation refers to element multiplication, and the CAA module refers to a context anchor attention module.

[0012] As a preferred embodiment of the present invention, the improved YOLOv8 detection model changes the original YOLOv8 detection head to a dynamic detection head; the dynamic detection head module consists of scale attention, spatial attention and task attention. In order to unify the above attention mechanisms, the above attentions are combined in a sequential manner.

[0013] As a preferred embodiment of the present invention, scale attention, spatial position attention and channel attention are combined in the manner of formula (1):

[0014] W(F)=π C (π S (π L (F)·F)·F)·F (1)

[0015] Among them, π L ,π S and π C and represent the scale attention function, spatial attention function and channel attention function respectively, F is the input feature tensor, whose shape is (L×S×C), where L is the number of levels in the feature pyramid, indicating the number of scales, S=H×W, where H represents the height of the input, W represents the width of the input, S is the spatial dimension (the product of height and width), and C is the number of channels; Formula (1) illustrates the connection method of the three attentions, that is, the connection method in the order of scale attention, spatial attention, and channel attention.

[0016] As a preferred embodiment of the present invention, scale attention represents dynamically fusing different scale feature information according to the semantic importance of the scale for different scales to enhance the recognition ability of the model at different scales; the definition of scale attention is shown in formula (2);

[0017]

[0018] Where σ(x) represents the hard-sigmoid function, defined as f(g) represents a linear function, S and C are the sum of the spatial dimension and the number of channels, respectively, which are used to normalize the summation term.

[0019] As a preferred embodiment of the present invention, spatial attention refers to enhancing the perception ability of the target spatial position by increasing attention at the spatial position; considering the high dimensionality of space, spatial attention is decomposed into two steps: first, sparse attention information is learned using deformable convolution to reduce the amount of computation, and then features are aggregated across levels at the same spatial position; the definition of spatial attention is shown in formula (3);

[0020]

[0021] Among them, π S (F) represents the spatial perception attention function;

[0022] w l,k is the weight at the lth level and the kth sparse sampling position;

[0023] k is the total number of sparse sampling locations;

[0024] p k is the original coordinate of the kth sampling position;

[0025] Δp k is the self-learned offset, which is used to focus the attention on the discriminative region and can be regarded as the original sampling position p k Adjustment;

[0026] c is the index of the feature channel;

[0027] Δm k is at position p k The importance scalar of the self-learning at that position, which is used to adjust the weight of the feature at that position.

[0028] As a preferred embodiment of the present invention, task attention refers to different channels corresponding to different tasks. By increasing attention in the channel dimension, the perception ability of the detection target on different tasks is enhanced. The definition of task attention is shown in formula (4);

[0029] π C (F)·F=max(α 1 (F)·F c +β 1 (F),α 2 (F)·F c +β 2 (F)) (4)

[0030] Among them, π C (F) represents the task-aware attention function;

[0031] F is the feature tensor of the input;

[0032] Fc It is the feature slice on channel c, that is, all the data of the cth channel extracted from the feature tensor F;

[0033] α 1 ,α 2 and β 1 ,β 2 are the weights and biases learned by the hyperfunction θ(g), which are used to control the activation thresholds of different channels;

[0034] Here the θ function reduces the dimensionality by performing global average pooling on the L×S dimension, then passes through two fully connected layers and a normalization layer, and finally applies a shifted sigmoid function to normalize the output to the interval [-1, 1].

[0035] As a preferred embodiment of the present invention, the backbone network includes a first Conv module, a second Conv module, a first C2f_Star_CAA module, a third Conv module, a second C2f_Star_CAA module, a fourth Conv module, a third C2f_Star_CAA module, a fifth Conv module, a fourth C2f_Star_CAA module and an SPPF module in sequence; the Conv module consists of a standard convolution operation, BatchNorm2d and SiLU activation function.

[0036] As a preferred embodiment of the present invention, the process of feature fusion of the neck network is as follows: feature P3 is obtained from the SPPF module of the backbone network, feature P3 is processed by the first upsampling module and fused with the third C2f_Star_CAA module, the fused features are respectively passed through the fifth C2f_Star_CAA structure, the features obtained after the second upsampling module are fused with the second C2f_Star_CAA module, the fused features are passed through the sixth C2f_Star_CAA module to obtain feature P6, feature P6 is input into the detection head for large target detection; feature P6 is fused with the fifth C2f_Star_CAA module after the sixth Conv operation, the fused features are passed through the seventh C2f_Star_CAA module to obtain feature P5, feature P5 is input into the detection head for medium target detection; the features obtained above are fused with the P3 features after the seventh Conv, and the P4 features are obtained through the eighth C2f_Star_CAA module, and the feature P4 is input into the detection head for small target detection; the Star operation is element multiplication, specifically referring to the multiplication of the features extracted from the left and right branches.

[0037] As a preferred embodiment of the present invention, the CAA module refers to a contextual anchor attention module, which is mainly composed of global average pooling, Conv operation, depthwise separable convolution, and Sigmoid function;

[0038] The CAA module operates as follows:

[0039] First, the input is average pooled (AvgPool), then passes through a (1×1) convolution, then passes through a depth-wise separable convolution (DWConv), but the convolution kernel size is (1×(11+2×n)), then passes through another depth-wise separable convolution (DWConv), but the convolution kernel size is ((11+2×n)×1), then passes through a (1×1) convolution, and finally passes through a Sigmoid function;

[0040] By setting the convolution kernel size of the depthwise separable convolution to (1×(11+2×n)) and ((11+2×n)×1) respectively, the horizontal and vertical strip shape features of the input can be obtained; the change of the parameter n changes with the number of blocks. When the number of blocks increases, the corresponding convolution kernel size will become larger, so that a longer context relationship can be obtained.

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

[0042] In the present invention, YOLOv8n is used as the basic model and improved. The C2 module in the YOLOv8n backbone network is replaced by the C2f_Star_CAA module. In order to improve the feature extraction ability of the neck network, the C2f module in the neck network of the basic model YOLOv8n is replaced by the C2f_Star_CAA module. By setting the convolution kernel size of the depthwise separable convolution to (1×(11+2×n)) and ((11+2×n)×1) respectively, the horizontal long strip shape features and the vertical long strip shape features of the input can be obtained. The change of the parameter n changes with the change of the number of blocks. When the number of blocks increases, the corresponding convolution kernel size will become larger, so that a longer contextual relationship can be obtained. In order to solve the scale differences, shape differences and task differences of the target detection objects, the above differences correspond to scale attention, spatial position attention and channel attention, respectively.

[0043] In order to unify the representation of the above attention mechanisms, by combining the above attentions in a sequential manner, this method can significantly improve the performance of object detection without increasing computational overhead; dynamically fuse different scale feature information according to the semantic importance of scale to enhance the recognition ability of the model at different scales. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] To facilitate understanding by those skilled in the art, the present invention is further described below with reference to the accompanying drawings.

[0045] Figure 1This is the overall flowchart of the improved YOLOv8 target detection.

[0046] Figure 2 This is a schematic diagram of the improved YOLOv8 network model structure in the present invention.

[0047] Figure 3 It is a schematic diagram of the Star operation structure in the present invention.

[0048] Figure 4 This is a schematic diagram of the Conv module structure in the present invention.

[0049] Figure 5 Schematic diagram of the CAA module structure in the present invention.

[0050] Figure 6 This is a structural diagram of the dynamic detection head Detect_DyHead module in the present invention. DETAILED DESCRIPTION

[0051] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0052] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0053] See also Figure 1 As shown in the figure, an improved YOLOv8 target detection and counting method for intelligent feeding of outdoor pond fish is as follows:

[0054] The images captured by the camera are stored in a video recorder, and the images are read from the video recorder and input into an improved YOLOv8 detection model to count the number of feeding fish. The improved YOLOv8 detection model includes a backbone network, a neck network and a head network; the acquired images are first input into the backbone network for feature extraction, and then the acquired features are fused at different scales in the neck network. Finally, the fused features are input into the head network to detect large targets, medium targets and small targets respectively, and obtain the final detection number.

[0055] This embodiment uses YOLOv8n as the basic model and improves it. Figure 2 As shown in the figure, the C2 module in the YOLOv8n backbone network is replaced by the C2f_Star_CAA module; the backbone of the improved YOLOv8 network includes the first Conv module, the second Conv module, the first C2f_Star_CAA module, the third Conv module, the second C2f_Star_CAA module, the fourth Conv module, the third C2f_Star_CAA module, the fifth Conv module, the fourth C2f_Star_CAA module and the SPPF module in sequence; the main function of the backbone network is to extract features of the input image and transmit the extracted features of different scales to the neck network; the number of the first C2f_Star_CAA module, the second C2f_Star_CAA module, the third C2f_Star_CAA module and the fourth C2f_Star_CAA module are all 1.

[0056] like Figure 2 As shown, in order to improve the feature extraction capability of the neck network, this embodiment replaces the C2f module in the neck network of the basic model YOLOv8n with the C2f_Star_CAA module; obtains feature P3 from the SPPF module of the backbone network, and the feature P3 is fused with the third C2f_Star_CAA module after processing by the first upsampling module. The fused features are respectively passed through the fifth C2f_Star_CAA structure and the features obtained after the second upsampling module, and then fused with the second C2f_Star_CAA module. The fused features are passed through the sixth C2f_Star_CAA module to obtain feature P6, which is input into the detection head to detect large targets. ; Feature P6 is fused with the fifth C2f_Star_CAA module after the sixth Conv operation, and the fused feature is passed through the seventh C2f_Star_CAA module to obtain feature P5, and feature P5 is input into the detection head to detect the medium target; the above-obtained feature is fused with the P3 feature after the seventh Conv, and the P4 feature is obtained through the eighth C2f_Star_CAA module, and the feature P4 is input into the detection head to detect the small target; the number of the fifth C2f_Star_CAA module, the sixth C2f_Star_CAA module, the seventh C2f_Star_CAA module, and the eighth C2f_Star_CAA module is 1.

[0057] like Figure 3 As shown, the Star operation refers to element multiplication. Specifically, Figure 3The input in is split into two branches after the Conv operation. One branch is the value obtained after the standard convolution operation and then activated by the ReLU6 activation function, and the other branch is the value after the standard convolution operation. The element-wise multiplication of the values ​​of the above two branches is the Star operation.

[0058] like Figure 4 As shown in the figure, the Conv module consists of a standard convolution, BatchNorm2d, and SiLU activation function. Specifically, the input value first undergoes a standard convolution operation, then undergoes batch normalization by BatchNorm2d, and then passes through a SiLU activation function.

[0059] like Figure 5 As shown in the figure, the CAA module (Context Anchor Attention: CAA) refers to the context anchor attention module, through which the dependency between distant pixels can be obtained; this module mainly consists of average pooling, Conv operation, depthwise separable convolution, and Sigmoid function;

[0060] The specific steps are: first perform average pooling (AvgPool) on the input, then pass through a (1×1) convolution, then pass through a depth-separable convolution (DWConv), but the convolution kernel size is (1×(11+2×n)), then pass through another depth-separable convolution (DWConv), but the convolution kernel size is ((11+2×n)×1), then pass through a (1×1) convolution, and finally pass through a Sigmoid function.

[0061] By setting the convolution kernel size of the depthwise separable convolution to (1×(11+2×n)) and ((11+2×n)×1) respectively, the horizontal and vertical strip shape features of the input can be obtained; the change of the parameter n changes with the number of blocks. When the number of blocks increases, the corresponding convolution kernel size will become larger, so that a longer context relationship can be obtained.

[0062] like Figure 6 As shown in the figure, in order to solve the scale differences, shape differences and task differences of target detection objects, the above differences correspond to scale attention, spatial position attention and channel attention respectively.

[0063] In order to unify the above attention mechanisms, by combining the above attentions in a sequential manner, this method can significantly improve the performance of target detection without increasing the computational overhead.

[0064] In order to achieve a unified dynamic detection head, scale attention, spatial position attention and channel attention are combined according to formula (1).

[0065] W(F)=π C (π S (π L (F)·F)·F)·F (1)

[0066] Among them, π L ,π S and π C and denote the scale attention function, spatial attention function, and channel attention function, respectively. F is the input feature tensor with a shape of (L×S×C), where L is the number of levels in the feature pyramid and represents the number of scales. S = H×W, where H represents the height of the input, W represents the width of the input, S is the spatial dimension (the product of height and width), and C is the number of channels. Formula (1) illustrates the connection method of the three attention methods, namely, the connection method in the order of scale attention, spatial attention, and channel attention.

[0067] Scale attention means dynamically fusing different scale feature information according to the semantic importance of the scale to enhance the recognition ability of the model at different scales. The definition of scale attention is shown in formula (2).

[0068]

[0069] Where σ(x) represents the hard-sigmoid function, defined as f(g) represents a linear function, S and C are the sum of the spatial dimension and the number of channels, respectively, which are used to normalize the summation term.

[0070] Spatial attention refers to enhancing the ability to detect the spatial location of an object by increasing attention to that location. Considering the high dimensionality of space, spatial attention is decomposed into two steps: first, sparse attention information is learned using deformable convolution to reduce computational effort, and then features are aggregated across levels at the same spatial location. Spatial attention is defined as shown in Equation (3).

[0071]

[0072] Among them, π S (F) represents the spatial perception attention function;

[0073] w l,k is the weight at the lth level and the kth sparse sampling position;

[0074] k is the total number of sparse sampling locations;

[0075] p k is the original coordinate of the kth sampling position;

[0076] Δpk is the self-learned offset, which is used to focus the attention on the discriminative region and can be regarded as the original sampling position p k Adjustment;

[0077] c is the index of the feature channel;

[0078] Δm k is at position p k The importance scalar of the self-learning at that position, which is used to adjust the weight of the feature at that position.

[0079] Formula (3) is calculated by taking the weighted sum of the sparse sampling positions k at all levels l; the weight of each sampling position consists of two parts: one is w l,k , which determines the importance of the position at the feature level; the other part is Δm k , which further adjusts the weight of the position to reflect its spatial importance.

[0080] Task attention refers to the fact that different channels correspond to different tasks. By increasing attention in the channel dimension, the detection target's perception ability on different tasks is enhanced. The definition of task attention is shown in formula (4).

[0081] π C (F)·F=max(α 1 (F)·F c +β 1 (F),α 2 (F)·F c +β 2 (F)) (4)

[0082] Among them, π C (F) represents the task-aware attention function;

[0083] F is the feature tensor of the input;

[0084] F c It is the feature slice on channel c, that is, all the data of the cth channel extracted from the feature tensor F;

[0085] α 1 ,α 2 and β 1 ,β 2 are the weights and biases learned by the hyperfunction θ(g), which are used to control the activation thresholds of different channels;

[0086] Here the θ function reduces the dimensionality by performing global average pooling on the L×S dimension, then passes through two fully connected layers and a normalization layer, and finally applies a shifted sigmoid function to normalize the output to the interval [-1, 1].

[0087] Formula (4) dynamically selects or combines features to support different tasks by applying different weights and biases to features of different channels. This attention mechanism allows the model to adaptively adjust the response of feature channels to better complete specific detection tasks.

[0088] Test-related data and test results

[0089] Dataset acquisition: The experimental data were collected from outdoor aquaculture ponds. The data collection started at around 9:00 AM and lasted 15 to 20 minutes. The image resolution was 2560 × 1440 pixels, and the image format was jpg. A total of 1273 images were collected. The collected images were divided into training, validation, and test sets in a 9:1:1 ratio. The training set had 1017 images, the validation set had 127 images, and the test set had 128 images. The training and validation sets were annotated using the Labelimg annotation tool in the XML file format.

[0090] Experimental platform: The experimental operating system is Ubuntu 18.04, the graphics card model is two NVIDIA Tesla V100s, the video memory size is 32G, and the deep learning framework Pytorch is used for simulation experiments.

[0091] Experimental parameter settings: During the training phase, the input image size was resized to (640×640) pixels, the batch size was set to 120, and training was performed for 300 iterations. The SGD (Stochastic Gradient Descent) optimizer was used with an initial learning rate of 0.01, a momentum factor of 0.937, and a weight decay coefficient (weight_decay) of 0.0005.

[0092] Evaluation metrics: To verify the effectiveness of the improved model, we use precision, recall, and mean average precision (mAP) as algorithm evaluation metrics. mAP uses mAP@0.5 and mAP@0.5:0.95 as more detailed evaluation metrics. mAP@0.5 refers to the average mAP value of all categories when the IoU threshold is 0.5; mAP@0.5:0.95 refers to the average mAP value of all categories when the IoU threshold ranges from 0.5 to 0.95, with a step size of 0.05.

[0093] Ablation Comparison Tests: To verify the effectiveness of adding different modules to improve the algorithm, we designed different ablation tests. The designed ablation test schemes are as follows: adding the Star operation to the C2f module, adding the CAA module to the C2f_Star module, and adding the Detect_DyHead header to the C2f_Star_CAA module. The ablation test results are shown in Table 1.

[0094] Table 1. Ablation test results

[0095]

[0096]

[0097] Table 1 shows that the YOLOv8_Star model with the Star operation improves accuracy, recall, precision, mAP@0.5, and mAP@0.5:0.95 by 0.85%, 1.56%, 1.71%, and 2.67%, respectively, compared to the original YOLOv8n model. The YOLOv8_Star_CAA model with the Star operation and CAA module improves accuracy, recall, map@0.5, and map@0.5:0.95 by 1.22%, 1.43%, 2.05%, and 4.28%, respectively, compared to the original YOLOv8n model.

[0098] Comparative test of YOLOv8 model before and after improvement: In order to verify the effect of YOLOv8 model before and after improvement, the comparative test results are shown in Table 2.

[0099] Table 2. Model test results before and after improvement

[0100]

[0101] As shown in Table 2, the improved YOLOv8_Star_CAA_DyHead model improves the accuracy, map@0.5, and map@0.5:0.95 by 3.30%, 2.51%, and 4.28% respectively compared with the original YOLOv8n model. The results show that the improved YOLOv8 model has better detection effect in feeding fish detection.

[0102] The foregoing description is merely a preferred embodiment of the present invention and is intended to help illustrate the present invention. All details are not exhaustive, and the scope of the present invention is not limited thereto. Those skilled in the art will appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be included within the scope of the present invention.

[0103] The above formulas are obtained by collecting a large amount of data and performing software simulation to select a formula close to the actual value. The coefficients in the formula are set by those skilled in the art according to actual conditions;

[0104] When in use, the present invention stores pictures captured by a camera in a video recorder, reads the pictures from the video recorder, and inputs them into an improved YOLOv8 target detection network to obtain the number of feeding fish. An intelligent feeding function is realized according to changes in the number of feeding fish. The improved YOLOv8 network includes a backbone network, a neck network, and a head network. The acquired pictures are first input into the backbone network to extract picture features, and then the extracted features are further fused through the neck network. Finally, the fused features are input into the head network to realize detection and counting of three target scales: large targets, medium targets, and small targets.

[0105] The preferred embodiments of the present invention disclosed above are intended only to help illustrate the present invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the present invention to specific embodiments. Obviously, many modifications and variations are possible based on the contents of this specification. These embodiments are selected and described in detail in this specification to better explain the principles and practical applications of the present invention, thereby enabling those skilled in the art to better understand and utilize the present invention. The present invention is limited only by the claims and their full scope and equivalents.

Claims

1. An intelligent feeding method for outdoor pond fish based on an improved YOLOv8 target detection and counting model, characterized in that: The specific feeding method is as follows: The pictures collected by the camera are stored in a video recorder, and after reading the pictures from the video recorder, they are input into an improved YOLOv8 target detection network to obtain the number of feeding fish, and an intelligent feeding function is realized according to the change in the number of feeding fish. The improved YOLOv8 network includes a backbone network, a neck network and a head network; the acquired pictures are first input into the backbone network to extract picture features, and then the extracted features are further fused through the neck network, and finally the fused features are input into the head network to realize the detection and counting of three target scales: large targets, medium targets and small targets.

2. According to claim 1, a method for intelligent feeding of outdoor pond fish based on an improved YOLOv8 target detection counting model, characterized in that: The improved YOLOv8 detection network takes YOLOv8n as the basic model, and replaces the C2f structure of the backbone network and the neck network in the original YOLOv8n with the C2f_Star_CAA structure. The C2f_Star_CAA structure is composed of C2f adding a Star operation and a CAA module. The Star operation refers to element multiplication, and the CAA module refers to a context anchor attention module.

3. According to claim 2, a method for intelligent feeding of outdoor pond fish based on an improved YOLOv8 target detection counting model, characterized in that: The improved YOLOv8 detection model changes the original YOLOv8 detection head to a dynamic detection head; The dynamic detection head module consists of scale attention, spatial attention and task attention. In order to unify the above attention mechanisms, the above attentions are combined together in a sequential manner.

4. The method for intelligent feeding of outdoor pond fish based on an improved YOLOv8 target detection counting model according to claim 3, characterized in that: The scale attention, spatial position attention and channel attention are combined according to formula (1): W(F)=π C (p S (p L (F)·F)·F)·F (1) Among them, π L , π S and π C and represent the scale attention function, spatial attention function and channel attention function respectively, F is the input feature tensor, whose shape is (L×S×C), where L is the number of levels in the feature pyramid, represents the number of scales, S=H×W, where H represents the height of the input, W represents the width of the input, S is the spatial dimension (the product of height and width), and C is the number of channels; Formula (1) illustrates the connection method of the three attentions, that is, the connection method in the order of scale attention, spatial attention, and channel attention.

5. A method for intelligent feeding outdoor pond fish based on an improved YOLOv8 target detection counting model according to claim 4, characterized in that: Scale attention means dynamically fusing different scale feature information according to the semantic importance of the scale for different scales to enhance the recognition ability of the model at different scales. The definition of scale attention is shown in formula (2); Where σ(x) represents the hard-sigmoid function, defined as f(g) represents a linear function, S and C are the sum of the spatial dimension and the number of channels, respectively, which are used to normalize the summation term.

6. The method for intelligent feeding of outdoor pond fish based on an improved YOLOv8 target detection and counting model according to claim 4, characterized in that: Spatial attention refers to enhancing the perception of the spatial position of the target by increasing attention to the spatial position. Considering the high dimensionality of space, spatial attention is decomposed into two steps: first, sparse attention information is learned using deformable convolution to reduce the amount of calculation, and then features are aggregated across levels at the same spatial position. The definition of spatial attention is shown in formula (3). Among them, π S (F) represents the spatial perception attention function; w l,k is the weight at the lth level and the kth sparse sampling position; k is the total number of sparse sampling locations; p k is the original coordinate of the kth sampling position; Δp k is the self-learned offset, which is used to focus attention on the discriminative region and can be regarded as the original sampling position p k Adjustment of c is the index of the feature channel; Δm k is at position p k The self-learned importance scalar at this position is used to adjust the weight of the feature at that position.

7. The method for intelligent feeding of outdoor pond fish based on an improved YOLOv8 target detection and counting model according to claim 4, characterized in that: Task attention refers to different channels corresponding to different tasks. By increasing attention in the channel dimension, the perception ability of the detection target on different tasks is enhanced. The definition of task attention is shown in formula (4); p C (F)·F=max(α 1 (F)·F c +b 1 (F),a 2 (F)·F c +b 2 (F)) (4) Among them, π C (F) represents the task-aware attention function; F is the input feature tensor; F c It is the feature slice on channel c, that is, all the data of the cth channel extracted from the feature tensor F; α 1 ,α 2 and β 1 ,β 2 are the weights and biases learned by the hyperfunction θ(g), which are used to control the activation thresholds of different channels; Here the θ function reduces the dimensionality by performing global average pooling on the L×S dimension, then passes through two fully connected layers and a normalization layer, and finally applies a shifted sigmoid function to normalize the output to the interval [-1, 1].

8. The method for intelligent feeding of outdoor pond fish based on an improved YOLOv8 target detection and counting model according to claim 1, characterized in that: The backbone network includes a first Conv module, a second Conv module, a first C2f_Star_CAA module, a third Conv module, a second C2f_Star_CAA module, a fourth Conv module, a third C2f_Star_CAA module, a fifth Conv module, a fourth C2f_Star_CAA module and an SPPF module in sequence; the Conv module is composed of a standard convolution operation, BatchNorm2d and SiLU activation function.

9. The method for intelligent feeding of outdoor pond fish based on an improved YOLOv8 target detection and counting model according to claim 1, characterized in that: The process of feature fusion of the neck network is as follows: feature P3 is obtained from the SPPF module of the backbone network, feature P3 is fused with the third C2f_Star_CAA module after being processed by the first upsampling module, the fused features are respectively passed through the fifth C2f_Star_CAA structure, the features obtained after the second upsampling module are fused with the second C2f_Star_CAA module, the fused features are passed through the sixth C2f_Star_CAA module to obtain feature P6, feature P6 is input into the detection head to detect large targets; feature P6 is fused with the fifth C2f_Star_CAA module after the sixth Conv operation, the fused features are passed through the seventh C2f_Star_CAA module to obtain feature P5, feature P5 is input into the detection head to detect medium targets; the features obtained above are fused with the P3 features after the seventh Conv, the P4 features are obtained through the eighth C2f_Star_CAA module, feature P4 is input into the detection head to detect small targets; the Star operation is element multiplication, specifically refers to multiplying the features extracted from the left and right branches.

10. The method for intelligent feeding of outdoor pond fish based on an improved YOLOv8 target detection and counting model according to claim 2, characterized in that: The CAA module refers to the contextual anchor attention module, which is mainly composed of global average pooling, Conv operation, depth-separable convolution, and Sigmoid function; The CAA module runs as follows: First, the input is average pooled, then passed through a (1×1) convolution, then passed through a depth-wise separable convolution, but the convolution kernel size is (1×(11+2×n)), then passed through another depth-wise separable convolution, but the convolution kernel size is ((11+2×n)×1), then passed through a (1×1) convolution, and finally passed through a Sigmoid function; By setting the convolution kernel size of the depthwise separable convolution to (1×(11+2×n)) and ((11+2×n)×1) respectively, the horizontal strip shape features and the vertical strip shape features of the input can be obtained; the change of the parameter n changes with the number of blocks. When the number of blocks increases, the corresponding convolution kernel size will become larger, so that a longer contextual relationship can be obtained.

Citation Information

Cited By

  • Student classroom behavior detection method based on deep learning

    CN119763179A

  • Personnel behavior detection method based on LHNFNet network model

    CN119785425A

  • Fish pond precise feeding robot system based on YOLOv8

    CN119817509A

  • Method for identifying coal flow blocking state of scraper conveyor on fully mechanized coal mining face of coal mine

    CN119851093A

  • SENet-based improved YOLOv8 small target detection method

    CN120783028A