Shrimp seed tracking method based on improved YOLO v8 network model

By improving the YOLO V8 network model and combined with a variety of innovative technologies, the target movement in shrimp seedlings tracking the unstable and complicated background and the complicated background problems have been solved, and higher detection accuracy and tracking accuracy have been achieved.

CN119360272APending Publication Date: 2025-01-24SHANGHAI OCEAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411400211.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-09
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

The prior art has problems in the tracking of shrimp seedlings with unstable target movement and complex background and is not effective when dealing with small targets that move quickly.

Method used

Using the improved YOLO v8 network model, combined with the BiFormer attention mechanism and CARAFE upsampling layer, using the Wise-Focaler-ShapeIoU loss function, and introducing the pyramid LK optical flow method, distance matching algorithm and angle matching algorithm to build an accurate and stable tracker.

Benefits of technology

It effectively solves the problem of tracking errors caused by the fast movement and similar appearance of shrimp seedlings, improves the detection accuracy and tracking accuracy, and significantly reduces missed detections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119360272A_ABST
    Figure CN119360272A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of shrimp seed image tracking, and particularly discloses a shrimp seed tracking method based on an improved YOLO v8 network model, which comprises the following steps: S1, adopting the improved YOLO v8 network model as a detector, performing target detection on a video sequence by the detector, and taking a detection result as the input of a tracker; s2, in the tracker, the position information and the optical flow information of the prawn seeds are extracted firstly, the optical flow information serves as detailed description of the motion state of the prawn seeds and can be called motion information, then the matching degree of a front frame target and a rear frame target is calculated according to the two kinds of information, and tracking of the prawn seeds is achieved; according to the method, the pyramid LK optical flow method is introduced, so that an accurate and stable tracker is constructed, and the problem of tracking errors caused by fast shrimp seed movement and similar appearance is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of shrimp seedling image tracking, and more specifically, to a shrimp seedling tracking method based on an improved YOLOv8 network model. Background Art

[0002] At present, most aquaculture farms use workers to observe the activity of shrimp fry with their naked eyes to evaluate the vitality and quality of shrimp fry. The evaluation given is subjective and time-consuming. In order to reduce the error of manual observation in shrimp fry farms as much as possible, the shrimp fry can be tracked to obtain information such as the swimming trajectory and speed of the shrimp fry to obtain the activity of the shrimp fry. Traditional machine learning technology tracks aquatic animals, and uses a method based on the Bayesian filter algorithm to achieve tracking of underwater fish. Based on the echo threshold setting of fish targets and combined with the α-β trajectory tracking algorithm, accurate tracking of fish is achieved in acoustic data processing. The above methods have high accuracy in discrete target tracking. However, problems such as complex feature extraction, insufficient generalization, and difficulty in extracting small target features limit the effectiveness of these methods in practical applications.

[0003] In the field of aquatic animal tracking, detection-based tracking (DBT) methods are widely used due to their stability and adaptability. The early SORT algorithm and the later DeepSORT algorithm are representatives of DBT, but they are prone to losing track when the target motion is unstable or the background is complex, and there are still challenges in dealing with fast-moving small targets.

[0004] Most tracking algorithms usually consider the appearance features of the target to improve the accuracy of target tracking. When the appearance of the tracked targets is similar, relying on appearance features for data association may interfere with the tracking results. If the appearance information is discarded and only the motion information and position information are used, combined with the YOLO v7 detector, accurate tracking of multiple categories of marine delicacies is achieved; however, there is still a high similarity between fish fry, and the rapid movement of the target is not fully considered. In addition, the small size and translucent characteristics of shrimp fry can easily lead to the omission of small targets during the detection process. The shrimp fry are similar in appearance and the posture changes are not obvious. In addition, the shrimp fry move quickly, which can easily lead to tracking errors.

[0005] In view of this, the present invention provides a shrimp fry tracking method based on an improved YOLO v8 network model to solve the above problems. Summary of the invention

[0006] In order to overcome the problems in the prior art, the present invention proposes a shrimp fry tracking method based on an improved YOLO v8 network model.

[0007] The present invention provides a shrimp seed tracking method based on an improved YOLO v8 network model, comprising the following steps:

[0008] Step S1: Using the improved YOLO v8 network model as the detector, the detector detects the target in the video sequence and uses the detection result as the input of the tracker;

[0009] Step S2: In the tracker, first extract the shrimp fry position information and optical flow information. The optical flow information is a detailed description of the movement state of the shrimp fry and can be called motion information. Then, the matching degree of the previous and next frames of targets is calculated based on these two types of information to achieve the tracking of the shrimp fry.

[0010] As a preferred technical solution provided by the present invention, the improved YOLO v8 network model includes:

[0011] The main part combines the Bi Former attention mechanism and C2f to propose the C2f-BFB module to replace the C2f module;

[0012] In the Neck part, replace the original model Upsample upsampling layer with the CARAFE upsampling layer;

[0013] The proposed Wise-Focaler-ShapeIoU loss function is used to replace the CIOU loss function of the original model, and the bounding box regression loss function is modified.

[0014] As a preferred technical solution provided by the present invention, the BiFormer attention mechanism captures features in images at different scales through a dual-layer routing attention mechanism BRA mechanism module. The BiFormer attention mechanism includes high-level semantic information and transitions from low-level visual features to high-level features, retaining key details.

[0015] As a preferred technical solution provided by the present invention, the tracking algorithm of shrimp seedlings includes:

[0016] Combined with the movement information and position information of the shrimp seedlings, the detection frame with a confidence level greater than the preset confidence level is selected as the high-score detection frame; at the same time, the pyramid LK optical flow method is used to predict the new position of each trajectory in the current frame;

[0017] In the first match, the predicted trajectory and the current frame high-score detection frame are matched by distance matching algorithm; if the matching result only contains unmatched trajectories or unmatched detection sets, the pseudo code is directly executed; if both exist at the same time, it indicates that there may be a fast-moving target that causes the matching to fail, and a second match is required at this time;

[0018] In the second matching, three candidate detection frames with the closest distance are selected from the unmatched detection set for each predicted frame in the unmatched trajectory, and angle matching is performed through the angle matching algorithm; for the remaining unmatched trajectory set, it is regarded as a lost tracking target and deleted; for the remaining unmatched detection set, it is regarded as a newly appeared target and initialized as a new trajectory.

[0019] As a preferred technical solution provided by the present invention, the distance matching algorithm includes:

[0020] By calculating the Euclidean distance between the center point of the target frame in the prediction trajectory of the previous frame and the center point of the target frame in the detection set of the current frame, the two are matched according to the principle of minimum Euclidean distance.

[0021] Set a distance threshold. Only when the Euclidean distance is less than this threshold, the match is considered valid.

[0022] As a preferred technical solution provided by the present invention, the distance matching algorithm includes a nearest neighbor search algorithm based on a kD tree, wherein the kD tree is a space partitioning data structure, which constructs a binary tree in a k-dimensional space by recursively dividing data points into different dimensions;

[0023] Calculate the variance of the horizontal and vertical dimensions of the center point of the detected target in the current frame, select the dimension feature with the largest variance as the root node to build a kD tree, and then use the kD tree to perform a nearest neighbor search for each predicted target to find the nearest detection target center point.

[0024] As a preferred technical solution provided by the present invention, the angle matching algorithm includes:

[0025] Select three candidate matching targets with the closest distance for the target, calculate the swimming angle, and then match them according to the principle of minimum change in the swimming angle.

[0026] Based on the image pyramid structure of the pyramid Lucas-Kanade optical flow method, the optical flow is estimated from the top layer of the pyramid, and the motion vector of the top layer is calculated using it as the initial value of the top layer iteration. The tracking result of the previous layer is used as the initial value of the optical flow iteration of the next layer, and so on, until the original image of the pyramid is reached, the key point matching between adjacent images is achieved, so as to obtain the motion trajectory of the target.

[0027] As a preferred technical solution provided by the present invention, the logic for obtaining the shrimp fry experimental data set is as follows:

[0028] Step A1: Establish a shrimp fry video collection platform at the breeding base, and collect the shrimp fry experimental data set of the target shrimp based on the shrimp fry video collection platform;

[0029] Step A2: Based on the shrimp fry experimental data set, the detection evaluation indicators and tracking evaluation indicators of the target shrimp are obtained; the detection evaluation indicators include precision P, recall rate R, mAP@0.5, parameter quantity Para, and frame rate FPS; the tracking evaluation indicators include tracking accuracy MOTA, tracking precision MOTP, ID switching number IDSW and comprehensive indicator IDF.

[0030] As a preferred technical solution provided by the present invention, the shrimp fry video acquisition platform includes a water tank, a camera, a computer and a light source device. Before the experiment begins, the aquaculture water reserved in the aquaculture farm is first added to the water tank, and then the shrimp fry is put in;

[0031] The light source device has three adjustable gears: the first gear is a relatively low light intensity, providing a weak light environment inside the water tank; the second gear is a warmer tone, providing a medium light intensity; the third gear is a higher light intensity, providing a bright and cooler light environment. During shooting, videos under different light intensities can be obtained by adjusting the gear of the light source device.

[0032] In a second aspect, the present invention provides an electronic device, comprising:

[0033] at least one processor; and,

[0034] A memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can execute the first aspect.

[0035] The specific advantages of the present invention are as follows:

[0036] The present invention selects the improved YOLO v8 network model as the detector, and uses the CARAFE upsampling layer to replace the Upsample upsampling layer of YOLOv8. The CARAFE upsampling layer adaptively upsamples to retain the translucent edges and morphological features of the shrimp seedlings and reduce distortion. Combining the BiFormer attention mechanism and C2f, the C2f-BFB module is proposed to optimize the backbone network, while keeping the model lightweight, and improving the accuracy of the model when processing small targets. The CIOU loss of the original model is then replaced with the Wise-Focaler-ShapeIoU loss function, which further improves the detection accuracy.

[0037] The present invention introduces the pyramid LK optical flow method to construct an accurate and stable tracker, which effectively solves the tracking error problem caused by the fast movement and similar appearance of shrimp fry. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 This is a flow chart of the shrimp seed tracking method of the present invention;

[0039] Figure 2 This is a structural diagram of the improved YOLO v8 network model of the present invention;

[0040] Figure 3(a) is the structure diagram of the BRA mechanism module in the backbone network; Figure 3(b) is the structure diagram of the BiFormer attention mechanism Block in the backbone network; Figure 3(c) is the structure diagram of the C2f-BFB module in the backbone network;

[0041] Figure 4 This is the flow chart of the CARAFE upsampling layer of the present invention;

[0042] Figure 5 This is a schematic diagram of the intersection-union ratio of the predicted frame and the real frame of the present invention;

[0043] Figure 6 The present invention is a flow chart of the tracking algorithm for shrimp seedlings;

[0044] Figure 7 This is a schematic diagram of the movement of shrimp fry of the present invention;

[0045] Figure 8 This is a schematic diagram of shrimp seed tracking of the present invention;

[0046] Fig. 9 It is a statistical diagram of swimming angle and speed of the present invention;

[0047] Fig.10 This is the image pyramid flow chart of the present invention;

[0048] Fig.11 This is the image pyramid flow chart of the present invention;

[0049] Fig.12 The image pyramid flow chart detection results comparison of the present invention;

[0050] Fig.13 This is a comparison chart of the tracking results of the present invention;

[0051] Fig.14 This is a comparison chart of the tracking trajectory results of the present invention;

[0052] Fig.15 The figure is a tracking trajectory diagram of shrimp fry under different activity conditions of the present invention. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in 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. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] In the field of aquaculture, the YOLO series detectors are widely used as detectors for tracking algorithms due to their outstanding performance. Among them: the DT-YOLOv5 algorithm is used for sea cucumber identification, and multi-target behavior tracking is achieved based on automatic frame matching coordinates. Combining StereoYolo with DeepSORT, a fish tracking framework is proposed. Combining YOLOv3 with a parallel correlation filter enables real-time tracking of fish. The YOLO series detectors also have good results in shrimp identification and tracking tasks. Therefore, this embodiment selects YOLO v8 of the YOLO series as the shrimp seedling detector.

[0055] Example 1

[0056] See also Figure 1 This embodiment provides a shrimp seedling tracking method based on an improved YOLOv8 network model, comprising the following steps:

[0057] Step S1: Using the improved YOLOv8 network model as the detector, the detector detects the target in the video sequence and uses the detection result as the input of the tracker;

[0058] Specifically, the improved YOLOv8 network model includes:

[0059] The proposed C2f-BFB module is used in the backbone to replace the C2f module;

[0060] In the Neck part, replace the original model Upsample upsampling layer with the CARAFE upsampling layer;

[0061] The proposed Wise-Focaler-ShapeIoU loss function is used to replace the CIOU loss function of the original model and modify the bounding box regression loss function;

[0062] It should be noted that this embodiment makes targeted improvements to the YOLOv8 network model to meet the specific needs of shrimp fry detection. The improved model structure is as follows Figure 2 As shown in the figure, the improved parts are marked with bold borders. The improved YOLOv8 network model includes Backbone, Neck and Head parts; among them:

[0063] The Backbone part of the original YOLOv8 network model includes the C2f structure and the SPPF structure. The C2f structure and the SPPF structure extract image features through convolution and pooling. The C2f module of the improved YOLOv8 is replaced by the C2f-BFB module.

[0064] It should be noted that shrimp fry targets are small and often occupy very few pixels in the image, making them easily ignored by high-level features. The BiFormer attention mechanism can capture features in images at different scales through the bi-level routing attention mechanism BRA mechanism module (bi-level routing attention), which means that it can simultaneously focus on the subtle features of shrimp fry and a wider range of background information, thereby reducing the possibility of missed detection. When processing features, the BRA mechanism module not only relies on high-level semantic information, but can also transition from low-level visual features to high-level features. This transition enables the model to better retain key details when detecting small targets, improving the model's recognition accuracy for shrimp fry.

[0065] Specifically, as shown in Figure 3(a), the BRA mechanism module adopts a two-layer structure. The attention mechanism first converts the input features into Figure X ∈R H×W×C Divide into S×S non-overlapping regions, so that X is transformed into Then use the fully connected layer to r Perform linear projection to obtain Q, K and V, and calculate the mean of Q and K to obtain Q r , K r , and then through A r =Q r (K r ) T Calculate the adjacency matrix A r , which measures the semantic similarity between different regions.

[0066] The BRA mechanism module effectively removes redundant information by first filtering out most of the irrelevant key-value pairs in the coarse area, retaining only a small number of key routing areas. This method applies a more refined attention mechanism to the retained routing areas after preliminary screening. This layer-by-layer refinement process enables the BRA mechanism module to significantly reduce the amount of computation while maintaining detection accuracy. Compared with directly using the self-attention mechanism on a global scale, this method avoids the overhead of processing a large amount of irrelevant information. The BiFormer attention mechanism Block structure constructed by combining the BiFormer attention mechanism with the BRA mechanism module is shown in Figure 3(b). At the beginning, the relative position information of the input is implicitly encoded using the deep separable convolution (DWConv), and then the BRA mechanism module and the multi-layer perceptron (MLP) module are used in turn to model the cross-position relationship and embed the input information position by position.

[0067] In this embodiment, the Bottleneck in the C2f module is replaced with the BiFormer attention mechanism Block, thereby proposing a new module C2f-BFB, as shown in Figure 3(c). The purpose of this replacement is to utilize the BRA mechanism module and efficient feature modeling capabilities of the BiFormer attention mechanism Block to enhance the backbone network's ability to capture and process multi-scale features. By introducing the BiFormer attention mechanism Block in the C2f module, the accuracy of the model in processing small targets is improved while keeping the model lightweight. The Wise-Focaler-ShapeIoU loss function replaces the CIOU loss function of the original model.

[0068] The feature fusion method used in the Neck part is FPN module + PAN module;

[0069] FPN stands for Feature Pyramid Networks, which aims to solve the problem of simultaneously detecting objects of different sizes, and adds a bottom-up PAN module on this basis; PAN stands for path aggregation network, which aims to solve the problem of simultaneously detecting the location of objects of different sizes; the FPN module conveys strong semantic features from top to bottom, while the PAN module conveys strong positioning features from bottom to top.

[0070] It should be noted that the translucency of shrimp fry makes it difficult to distinguish them from other shrimp fry or background in the image. This translucency makes the edges of shrimp fry blurred when the color is similar to the background, making it difficult to accurately distinguish and track. The Upsample upsampling layer of YOLO v8 mainly uses the nearest neighbor interpolation method, which simply copies the adjacent pixel values, which is easy to cause feature distortion and information loss, especially for images with rich details and small targets. The CARAFE upsampling layer can adaptively generate upsampling kernels based on the content of the image, which allows it to better retain important features in the image and reduce distortion or blur that may be introduced by upsampling. This is particularly important for translucent shrimp fry images because the details in these images are usually more complex and tiny. The CARAFE upsampling layer is able to aggregate information over a large range, which means that it can capture a wider range of contextual information, which helps to identify and retain subtle image details, such as the edges and morphological features of shrimp fry.

[0071] The CARAFE upsampling layer process is as follows Figure 4 As shown in the figure, it includes an upsampling kernel prediction module and a feature reorganization module. First, the feature map is compressed to reduce the amount of calculation, and then content encoding and upsampling kernel prediction are performed to generate a standardized upsampling kernel. The feature reorganization module maps each position back to the input feature map and performs a dot product operation with the predicted upsampling kernel to generate an output feature map.

[0072] The head part includes the use of YOLOX's decoupled head operation to separate classification and positioning, and also changes from Anchor-Based to Anchor-Free. The loss calculation covers classification loss and regression loss. BCE (binary cross-entropy) is used to calculate the classification loss, and DFL (distribution focal loss) and CIoU loss functions are used to calculate the regression loss.

[0073] It should be noted that the regression loss CIoU of YOLO v8 cannot fully deal with the low-quality examples and sample imbalance problems in the data set in some cases. For this reason, this embodiment proposes the Wise-Focaler-ShapeIoU loss function to replace CIoU, further optimizing the loss function.

[0074] Specifically, the Focaler-IoU loss function is:

[0075] The existing IoU loss function improves regression performance by utilizing the geometric relationship between bounding boxes, but ignores the impact of the distribution of difficult and easy samples on bounding box regression. Focaler-IoU focuses on regression samples of different difficulties to improve the performance of the detector in various detection tasks. The formula of the Focaler-IoU loss function is as follows:

[0076]

[0077] In the formula, IoU represents the intersection-over-union ratio of the true box and the predicted box; d represents the lower threshold; u represents the upper threshold; this embodiment is designed to make the loss function sensitive to certain intervals of the IoU value, so as to focus more on samples with medium overlap between the predicted bounding box and the true bounding box. This helps the model learn features better from samples of medium difficulty, rather than just focusing on the easiest or most difficult samples.

[0078] The Focaler-ShapeIoU loss function is:

[0079] Existing bounding box regression methods usually consider the geometric relationship between the GT box and the predicted box, and use relative position and shape to calculate the loss, but ignore the impact of the shape and scale of the bounding box itself on the regression result. Small-scale ground truth boxes are more sensitive to changes in IoU values, especially in small targets such as shrimp seedlings, where the deviation of IoU values ​​of ground truth boxes of different shapes is large. The Shape-IoU loss function can focus on the shape and scale of the target box itself to calculate the loss, thereby improving accuracy. Figure 5 , the calculation process of shape-iou loss function is as follows:

[0080]

[0081] In the formula, w and w gt Represents the horizontal length of the predicted box and the real box; scale represents the scaling factor, which is related to the scale of the target in the data set; ww represents the horizontal weight coefficient, and its value is related to the shape of the real box;

[0082]

[0083] In the formula, h and h gt Indicates the vertical length of the predicted box and the real box; scale indicates the scaling factor, which is related to the scale of the target in the data set; hh indicates the horizontal weight coefficient, whose value is related to the shape of the real box;

[0084] distance scale =hh×(x c -x c gt ) 2 / c 2 +ww×(y c -y c gt ) 2 / c 2 (4)

[0085] In the formula, distance represents the distance cost, which reflects the distance between the predicted box and the real box; x c and x c gt Indicates the x-axis coordinate value of the center point of the predicted box and the real box; c 2 Represents a constant associated with a data set;

[0086]

[0087] In the formula, Ω represents the shape cost, which is a measure of the shape deviation between the predicted box and the true box; scale represents the scaling factor, which is related to the scale of the target in the dataset; e represents a constant, representing an infinite non-repeating decimal; w t Indicates w w and w h ; t represents the subscripts corresponding to the horizontal direction w and the vertical direction h, and the subscripts at different positions are summed;

[0088]

[0089] In the formula, w w and w h Represents the weight coefficients of the real frame in the horizontal and vertical directions, and its value is positively correlated with the width and height of the real frame;

[0090] In order to integrate the advantages of the Focaler-IoU loss function and the Shape-IoU loss function, this embodiment introduces the idea of ​​Focaler-IoU into the IoU calculation of Shape-IoU, and optimizes the new loss function to focus on the shape scale characteristics of samples of medium difficulty and bounding boxes at the same time. The corresponding border regression loss is as follows:

[0091] L Focaler-ShapeIoU =1-IoU focaler +distance shape +0.5×Ω shape (7)

[0092] Wise-Focaler-ShapeIoU loss function:

[0093] The WIoU loss function can effectively solve the problem of sample imbalance and accelerate the convergence of the model, thereby improving the detection accuracy. In order to further optimize the model performance, the outlier degree is defined to describe the quality of the anchor box, which is defined as follows:

[0094]

[0095] Where, L * IoU represents the monotonic focusing coefficient; L IoU represents the sliding average with momentum m; β is used to construct the non-monotonic focusing coefficient r, and multiplied with the Focaler-ShapeIoU loss function to form Wise-Focaler-ShapeIoU, which is defined as follows:

[0096] L Wise-Focaler-ShapeIoU = r·L Focaler-ShapeIoU (9)

[0097]

[0098] In summary, the Wise-Focaler-ShapeIoU loss function combines the sample attention of the Focaler-IoU loss function, the shape scale sensitivity of the Shape-IoU loss function, and the sample quality evaluation of the WIoU loss function, providing a more comprehensive and efficient solution to the bounding box regression problem.

[0099] Step S2: In the tracker, first extract the shrimp fry position information and optical flow information. The optical flow information is a detailed description of the movement state of the shrimp fry and can be called motion information. Then, the matching degree of the previous and next frames of targets is calculated based on these two types of information to achieve the tracking of the shrimp fry.

[0100] Specifically, combining the movement information and position information of the shrimp fry, a strategy of integrating distance matching and angle matching is proposed, and the pyramid LK optical flow method is used to predict the trajectory of the shrimp fry, and the pyramid LK optical flow method is used to predict the trajectory of the next frame, and the distance matching algorithm and the angle matching algorithm are used to perform data association frame by frame. A major advantage of the tracking algorithm of this embodiment is that it does not need to rely on the appearance characteristics of the shrimp fry (such as color, texture, etc.), but only uses optical flow vectors (i.e., motion information), thereby effectively solving the problem that the shrimp fry are difficult to accurately track due to their similar appearance and fast movement. The specific process of the tracking algorithm of this embodiment is as follows Figure 6 shown.

[0101] The tracking algorithm for shrimp fry includes:

[0102] First, select the detection box with a confidence greater than 0.25 as the high-score detection box D h ; At the same time, the pyramid LK optical flow method is used to predict the new position of each track in T in the current frame;

[0103] In the first matching, the predicted trajectory T k and the current frame high-resolution detection box D h Perform distance matching; the matching result only contains unmatched trajectories T remain Or there is only an unmatched detection set D remain Directly execute pseudo code lines 33 to 38 when both exist. If both exist at the same time, it indicates that there may be a fast-moving target that causes the match to fail, and a second match is required;

[0104] In the second match, from D remain T in the middle remain For each prediction box in , three candidate detection boxes with the closest distance are selected and angle matching is performed; for the remaining unmatched trajectory set T re-remain , is considered as a lost tracking target and deleted; for the remaining unmatched detection set D re-rematch , it is regarded as a newly appeared target and initialized as a new trajectory.

[0105] The pseudo code of the shrimp seed tracking algorithm is shown in Table 1:

[0106]

[0107]

[0108]

[0109] Specifically, the application logic of the distance matching algorithm is:

[0110] By calculating the Euclidean distance between the center point of the target frame in the prediction trajectory of the previous frame and the center point of the target frame in the detection set of the current frame, the two are matched according to the principle of minimum Euclidean distance. The calculation formula is:

[0111]

[0112] Where p represents the i-th predicted target in the t-1th frame, and the coordinates of the i-th predicted target in the t-1th frame are q represents the jth detected target in the tth frame, and the coordinates of the jth detected target in the tth frame are D(p,q) is the Euclidean distance between the i-th predicted target in the t-1th frame and the j-th detected target in the t-th frame;

[0113] Set a distance threshold. Only when the Euclidean distance is less than this threshold, the match is considered valid.

[0114] In order to save computing resources, a nearest neighbor search algorithm based on a kD tree is introduced. The kD tree is a space partitioning data structure that recursively divides data points into different dimensions to construct a binary tree in a k-dimensional space. In this embodiment, the specific implementation is as follows: First, the variance of the x and y dimensions of the center point of the detection target of the current frame is calculated, and the dimension feature with the largest variance is selected as the root node to construct a kD tree. Then, for each predicted target, the kD tree is used to perform a nearest neighbor search to find the nearest detection target center point.

[0115] It has been observed that shrimp fry may suddenly move rapidly during exercise, such as Figure 7 As shown in the figure, when shrimp I in the t-1th frame quickly moves to the position in the tth frame, d is the distance between the two shrimps, θ deg is the swimming angle), according to the distance matching principle, the shrimp fry I in the t-1th frame will be matched with the shrimp fry J in the tth frame, resulting in a matching error. Therefore, it is necessary to set an appropriately small distance threshold to avoid this matching error. However, setting a threshold that is too small results in the shrimp fry I in the t-1th frame and the shrimp fry I in the tth frame cannot be correctly matched. At this time, the situation in line 20 of the pseudocode occurs, and a second match is required.

[0116] To solve the problem that the rapid movement of shrimp fry may lead to matching failure, this embodiment proposes an angle matching algorithm. Figure 8 The figure shows the tracking of shrimp fry in 10 consecutive frames. It is observed that when the shrimp fry moves quickly, its swimming direction and trajectory almost coincide with the same straight line, that is, the swimming angle of the shrimp fry does not change much when moving quickly.

[0117] The swimming angle and speed of each shrimp fry were counted. The speed is defined as the size of the displacement of the center pixel of the shrimp fry between the previous and next two frames. Fig. 9 The results show that when the speed increases, the swimming angle becomes smaller, which further confirms that the fast-swimming shrimp fry have a smaller swimming angle change characteristic. Based on this finding, this embodiment proposes an angle matching algorithm, which aims to optimize the matching process by identifying the stable pattern of the shrimp fry's swimming angle, thereby solving the matching failure problem that may be caused by the fast movement of the shrimp fry.

[0118] The specific idea of ​​the angle matching algorithm is as follows: first, select three candidate matching targets with the closest distance for the target, calculate the swimming angle, and then match them according to the principle of minimum change of the swimming angle. The formula of the swimming angle is:

[0119]

[0120] In the formula, represents the shrimp fry direction vector; Represents the shrimp fry moving direction vector;

[0121] The Pyramidal Lucas-Kanade Optical Flow method is an optical flow estimation algorithm widely used in computer vision, especially for motion estimation in the presence of large displacements. The large displacement caused by the rapid movement of shrimp fry is a major challenge in the tracking process. In the high-level image, the fast-moving target can be represented as a smaller displacement, which makes it easier for the tracking algorithm to keep up with the target's motion trajectory. This method introduces an image pyramid structure based on the basic Lucas-Kanade optical flow method, enabling it to handle a wider range of motion.

[0122] The Lucas-Kanade optical flow method involves three assumptions: (1) brightness is constant; (2) time is continuous or the motion is a small motion; and (3) space is consistent. From assumption (1), the optical flow constraint equation can be derived as follows:

[0123] I(x,y,t)=I(x+dx,y+dy,t+dt) (13)

[0124] Where I(x,y,t) represents the brightness of point (x,y) at time t;

[0125] According to assumption (2), that is, assuming that the pixel movement is small enough, Taylor's formula can be applied to formula (13), and we can get:

[0126] I x v x +I y v y +I t =0 (14)

[0127] In the formula, and Respectively represent the optical flow speed in the horizontal and vertical directions, and transform into the following matrix form:

[0128]

[0129] Using the least squares method to solve it, we get:

[0130]

[0131] When the displacement in the image is large, assumption (2) is not met and the Lucas-Kanade method cannot accurately estimate the motion. To solve this problem, the concept of image pyramid is introduced, such as Fig.10 As shown in the figure, the pyramid is constructed by reducing the original image layer by layer until the resolution of the top image is small enough and the pixel movement is small enough to meet the assumption (2) of the LK optical flow method. The optical flow is estimated from the top layer of the pyramid and used as the initial value of the top layer iteration to calculate the motion vector of the top layer. Then, the tracking result of the previous layer is used as the initial value of the optical flow iteration of the next layer, and so on, until the lowest layer of the pyramid (original image) is reached. This process obtains the final motion vector and realizes the key point matching between adjacent images.

[0132] Example 2: The part not described in detail in this example is as shown in Example 1. This example also provides a shrimp fry experimental data set. Taking the white shrimp (Litopenaeus vannamei) as an example, the white shrimp (Litopenaeus vannamei) is one of the shrimp species with the largest farming volume in aquaculture. The health status of the shrimp fry is reflected based on the activity of the shrimp fry, so as to scientifically cultivate the shrimp fry and maintain the high quality and high yield of the shrimp products;

[0133] Step A1: Establish a shrimp fry video collection platform at the breeding base, and collect the shrimp fry experimental data set of the target shrimp based on the shrimp fry video collection platform;

[0134] It should be noted that the growth and development stages of Penaeus vannamei include nauplii, zoea, mysid larvae and postlarvae, among which the postlarvae stage can be further subdivided into multiple stages such as P1 to P20. In the aquaculture industry, workers usually judge the health status of shrimp fry by observing the behavior, vitality and other indicators of the shrimp fry at the postlarvae stage. At this time, the shrimp fry already has certain morphological characteristics and identifiability. This embodiment selects the postlarvae of Penaeus vannamei at the P15 stage as the research object, and the size of the shrimp fry is about 1.5 cm; that is, the target shrimp is the postlarvae of Penaeus vannamei at the P15 stage,

[0135] like Fig.11As shown, the shrimp fry video acquisition platform includes a water tank, a camera, a computer and a light source device. The size of the water tank is a radius of 37 cm and a water depth of 40 cm;

[0136] All videos were shot from a bird's-eye view, with the camera 50 cm from the water surface.

[0137] Before the experiment started, the farm's spare breeding water was added to the water tank, and then the shrimp fry were put in.

[0138] The light source device has three adjustable gears: the first gear is a relatively low light intensity, providing a weak light environment inside the water tank; the second gear is a warmer tone, providing a medium light intensity; the third gear is a higher light intensity, providing a bright and cooler light environment. During shooting, videos under different light intensities can be obtained by adjusting the gear of the light source device.

[0139] The activities of shrimp fry usually include normal swimming, swimming against the current and stress response.

[0140] When healthy shrimp fry are stimulated by water flow, they will swim counterclockwise or clockwise against the current around the edge of the water tank. When the container is knocked, the shrimp fry, which are very sensitive to external stimuli, will quickly disperse, showing an obvious stress response. During the video shooting process, not only were videos of the shrimp fry swimming normally collected, but also their swimming against the current was recorded by manually creating water flow, and videos of their stress responses were obtained by knocking on the water tank.

[0141] After extracting frames from the video and removing unqualified images, 786 images were obtained for the detector. To eliminate unnecessary background interference, the resolution was 1080×1080 pixels by cropping. The shrimp fry images were annotated using LabelImg software, and the dataset was divided into training set, validation set, and test set according to the ratio of 7:2:1. The test video set is shown in Table 2. To evaluate the multi-target tracking algorithm, 5 shrimp fry videos under different lighting conditions and different activity conditions were selected, and the shrimp fry IDs were annotated frame by frame using DarkLabel software.

[0142] Table 2 Test dataset

[0143] Video ID Light intensity Activities Number of shrimp fry Video Length 01 weak normal 30 79s 02 medium normal 50 76s 03 powerful normal 68 38s 04 powerful against the current 105 102s 05 powerful Stress 79 93s

[0144] Step A2: Obtain the detection evaluation index and tracking evaluation index of the target shrimp based on the shrimp fry experimental data set;

[0145] The detection evaluation indicators include precision P, recall rate R, mAP@0.5, parameter quantity Para, and frame rate FPS;

[0146] The accuracy P is expressed as the actual proportion of the real class samples predicted by the model;

[0147] The recall rate R represents the proportion of all actual true class samples that the model successfully predicts as true;

[0148] mAP stands for Average Precision. mAP@0.5 means that the detection frame is correct only when the IoU between the detection frame and the true target is greater than 0.5.

[0149] The number of parameters Para can reflect the complexity of the model. Fewer parameters usually means a lighter model.

[0150] The frame rate FPS indicates the model inference speed, that is, the number of image frames that the model can process per second.

[0151] The tracking evaluation indicators include tracking accuracy MOTA, tracking precision MOTP, ID switching number IDSW and comprehensive indicator IDF1;

[0152] Tracking accuracy indicates the performance of the tracking algorithm in detecting objects and maintaining tracks. The larger the value, the better the performance.

[0153] Tracking accuracy indicates the positioning accuracy of the quantified detector, and the larger the value, the higher the accuracy;

[0154] The ID switching number evaluates the continuity of the same target ID, and the smaller the value, the better;

[0155] The comprehensive index evaluates the stability of the tracking algorithm, and the larger the value, the more stable it is. These indicators jointly evaluate the overall effect of multi-target tracking.

[0156] Example 3

[0157] This embodiment selects white shrimp fry at the p15 stage as the research object, and proposes a white shrimp fry tracking method based on improved YOLOv8. First, the improved YOLO v8 network model is selected as the detector, and the CARAFE upsampling layer is used to replace the Upsample upsampling layer of YOLO v8. The CARAFE upsampling layer adaptively upsamples to retain the translucent edges and morphological features of the shrimp fry and reduce distortion; the C2f-BFB module is proposed to optimize the backbone network by combining the BiFormer attention mechanism and C2f, while keeping the model lightweight, the accuracy of the model in processing small targets is improved; finally, the CIOU loss of the original model is replaced by the Wise-Focaler-ShapeIoU loss function, which further improves the detection accuracy. This embodiment proposes a matching strategy that integrates the distance matching algorithm and the angle matching algorithm, and introduces the pyramid LK optical flow method to construct an accurate and stable tracker, which effectively solves the tracking error problem caused by the fast movement and similar appearance of the shrimp fry. Experiments show that the improved YOLO v8 improves mAP by 1.1% and recall by 2.9% compared with the original model, significantly reducing missed detections and improving detection accuracy. The tracking accuracy MOTA of the tracker proposed in this embodiment is 74.52%, the tracking precision MOTP is 75.624%, and the ID switching number IDF1 is 76.42%. Compared with the DeepSORT algorithm, SORT algorithm and ByteTrack algorithm, the tracking accuracy MOTA is significantly improved, and the tracking effect is good. It provides strong technical support for automated shrimp seedling farming and also provides new ideas and methods for research in related fields.

[0158] The comparative experiment based on shrimp fry detector is analyzed, including:

[0159] To verify the reliability of the improved YOLO v8 network model for shrimp seedling identification, the improved YOLO v8 network model was compared with the Faster RCNN network model, SSD network model, FCOS network model, EfficientDet network model, and YOLO v9 network model of the YOLO series; the experimental results are shown in Table 3.

[0160] Table 3 Comparison results of detectors

[0161]

[0162]

[0163] The YOLO v8 network model, the benchmark model selected in this embodiment, is superior to other models in terms of evaluation indicators such as precision, recall rate and mAP@0.5. While having the least number of parameters, the YOLO v8 network model has the fastest detection speed and the best overall performance. The various evaluation indicators of the YOLO v8 network model are higher than those of the YOLO v9 network model of the YOLO series, indicating that the YOLO v8 network model is the most preferred in the shrimp seedling detection task.

[0164] Ablation comparison experiment: The YOLO v8 network model is subjected to an ablation test. Based on the YOLOv8 model, the model performance is verified by using different modules. The results are summarized in Table 4, where: Yolov8-1 represents the CARAFE upsampling layer; Yolov8-2 represents the C2f-BFB model structure; Yolov8-3 represents the Wise-Focaler-ShapeIoU loss function;

[0165] Table 4. Comparison results of ablation experiments

[0166]

[0167] Through comparative experiments, it was found that the improved YOLOv8 model achieved a significant improvement of 1.1% in mean average precision (mAP) compared to the original model. It is particularly noteworthy that the improvement in its recall rate (R) is particularly significant, reaching 2.9%, which means that the improved YOLOv8 model effectively reduces the missed detection of shrimp seedlings. In addition, the improved model also performs well in terms of parameter volume and detection speed. The improved YOLOv8 model not only reduces the number of parameters from 3.077M to 2.494M, but also significantly improves the inference speed, with FPS increasing from 130.7 to 159.6. These improvements ensure that the model can still perform high-precision detection at a faster speed when computing resources are limited, fully demonstrating that the improved YOLO v8 network model has higher detection performance in the shrimp seedling detection task.

[0168] The detection effects of the YOLO v8 network model and the improved YOLO v8 network model on the validation set are compared to verify the effectiveness of the improved model. Fig.12The detection effects under weak light, medium light, and strong light conditions are shown respectively. By comparison, it is found that the confidence of the target frame detected by the improved YOLO v8 network model is mostly higher than that of the original model, which fully demonstrates that the improved YOLO v8 network model has higher accuracy. Under different light intensities, the original model YOLO v8 network model has many missed detections, especially when the shrimp seedlings are small and dense, while the improved YOLO v8 network model has fewer missed detections than the original model. This shows that the improved YOLO v8 network model can accurately identify shrimp seedlings under different light intensities, and can better adapt to small target detection, effectively improve the detection accuracy of shrimp seedlings, and improve missed detection.

[0169] In order to further analyze the generalization ability of the improved YOLO v8 network model, this embodiment also collected shrimp seedling images at the P5, P8, and P12 stages for verification. The results are shown in Table 5.

[0170] Table 5 shows the verification results of shrimp seedlings at different stages

[0171] Shrimp fry stage Shrimp fry size / cm Number of images P / % R / % P5 0.5 68 80.4 81.6 P8 0.8 74 90.6 91.5 P12 1.2 103 91.5 93.4 P15 1.5 89 93.0 96.0

[0172] In Table 4, the recall rate is relatively low because the shrimp fry at the P5 stage have unclear characteristics and small size, which indicates that there are some missed detections. However, for shrimp fry at the P10, P12, and P15 stages, the detection index of the model is over 90%. This shows that the model has good generalization ability as a whole and can effectively cope with the shrimp fry detection tasks at different developmental stages.

[0173] 2. Shrimp fry tracking experiment and result analysis

[0174] In order to make an overall performance evaluation of the tracking algorithm of this embodiment, DeepSORT, SORT, and ByteTrack were selected as trackers for comparative experiments, and the evaluation results are shown in Table 5. In Table 5, the improved YOLO v8 network model is used as a detector. Compared with the original YOLO v8 network model, the various tracking evaluation indicators under the same tracker have been significantly improved, which also proves the effectiveness of the improved YOLO v8 network model. The tracking algorithm proposed in this embodiment surpasses the current mainstream DeepSORT and ByteTrack algorithms in various indicators. Both algorithms introduce the appearance information of the target as a consideration in the design, but in the shrimp seedling farming scene, due to the similarity of the appearance features of the shrimp seedlings, the appearance features become interference factors, affecting the accuracy of the tracking algorithm. The DeepSORT algorithm is an improvement on the basis of SORT, but its various tracking indicators are not as good as SORT, which further verifies that the introduction of appearance information in the case of similar appearance features of the shrimp seedlings makes the tracking performance worse. The tracking algorithm of this embodiment introduces the pyramid Lucas-Kanade optical flow method, and proposes an angle matching algorithm to solve the tracking problem caused by the rapid movement of shrimp fry. Therefore, in Table 6, the tracking algorithm of this embodiment surpasses the SORT algorithm in all indicators.

[0175] Table 6 shows the performance comparison results of the tracking algorithm of this embodiment and different trackers

[0176]

[0177] Table 7 shows the tracking results of the tracking algorithm of this embodiment on 5 different test videos. Among them, video 05 shows the best tracking performance. This superior performance is mainly attributed to the specific conditions in the video scene: the distribution of shrimp fry under stress is relatively uniform, without forming too dense aggregation, and in a strong light environment. This environmental feature helps to reduce occlusion and confusion during tracking, thereby significantly improving the accuracy and robustness of the tracking algorithm.

[0178] Table 7 shows the tracking results of the test video

[0179]

[0180]

[0181] like Fig.13This embodiment shows the tracking effect comparison of DeepSORT algorithm, SORT algorithm, ByteTrack algorithm and the algorithm of this embodiment. The maximum IDs of the four algorithms in shrimp seed allocation are 124, 105, 98, and 91 respectively, while the number of shrimp seedlings in the figure is actually 79. This comparison reflects that with the extension of tracking time, these four algorithms will have different degrees of loss in the process of tracking shrimp seedlings, resulting in the gradual increase of the ID assigned to the shrimp seedlings. The maximum shrimp seedling ID of the tracking algorithm of this embodiment is the smallest under the same conditions. This data shows that compared with the other three algorithms, the algorithm of this embodiment has the least number of ID switching during the tracking process, maintaining good tracking stability.

[0182] like Fig.14 As shown, for the convenience of observation, this embodiment selects four shrimp seedlings closest to the four corners of the image under different light intensities as tracking objects. When tracking to the 10th frame, the four algorithms all showed similar tracking effects in the initial stage. However, with the increase in the number of frames, there are significant differences in the continuous tracking capabilities of each algorithm. During the tracking process, the DeepSORT algorithm can only maintain continuous tracking of one shrimp seedling under strong light conditions, while all the shrimp seedlings are lost under other lighting conditions. The SORT and ByteTrack algorithms can only keep track of three shrimp seedlings under strong light conditions, and the SORT algorithm even has a tracking error for one shrimp seedling under medium light conditions, which leads to differences in its trajectory drawing with other algorithms. In contrast, the algorithm proposed in this embodiment shows excellent tracking stability under different lighting conditions. Specifically, under medium light conditions, although the tracking of two shrimp seedlings was lost, the algorithm can achieve stable tracking of four shrimp seedlings under other lighting conditions. This result shows that the algorithm of this embodiment has higher robustness and stability than other algorithms in the shrimp seedling tracking task.

[0183] In the daily management of the farm, in order to evaluate the condition of the shrimp fry, workers will place the shrimp fry in a white basin and manually create a water flow. When the water flow slows down, they will observe whether the shrimp fry swim against the water flow along the edge of the white basin. By recording the percentage of shrimp fry swimming against the water flow, it is used as an indicator to evaluate the quality of the shrimp fry. Workers will also knock on the white basin to simulate a stressful environment, and then observe the reaction of the shrimp fry to such stimulation. At the same time, they will put their hands in the basin to feel whether the shrimp fry reacts quickly to this stimulation. The above method was also used to evaluate the vitality of the shrimp fry in the study of Yang Qibin and others. In order to visually observe the condition of the shrimp fry, the algorithm of this embodiment is used to track the shrimp fry, and the trajectory of the shrimp fry is plotted as follows: Fig.15 As shown, the trajectories of shrimp fry swimming upstream are mainly concentrated at the edge of the white basin, while the trajectories of shrimp fry under stress are distributed in a disordered manner.

[0184] Embodiment 4: For details of the parts not described in detail in this embodiment, please refer to Embodiment 1. This embodiment provides an electronic device including:

[0185] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned shrimp seedling tracking method based on the improved YOLO v8 network model.

[0186] Among them, the memory and the processor are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors and memories together. The bus can also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor is transmitted on a wireless medium via an antenna, and further, the antenna also receives data and transmits the data to the processor.

[0187] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory can be used to store data used by the processor when performing operations.

[0188] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

[0189] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A shrimp seedling tracking method based on an improved YOLO v8 network model, characterized in that: The steps include: Step S1: Using the improved YOLO v8 network model as the detector, the detector detects the target in the video sequence and uses the detection result as the input of the tracker; Step S2: In the tracker, first extract the shrimp fry position information and optical flow information. The optical flow information is a detailed description of the movement state of the shrimp fry and can be called motion information. Then, the matching degree of the previous and next frames of targets is calculated based on these two types of information to achieve the tracking of the shrimp fry.

2. A shrimp seed tracking method based on an improved YOLO v8 network model according to claim 1, characterized in that: The improved YOLO v8 network model includes: The backbone part combines BiFormer attention mechanism and C2f to propose C2f-BFB module to replace C2f module; In the Neck part, replace the original model Upsample upsampling layer with the CARAFE upsampling layer; The proposed Wise-Focaler-ShapeIoU loss function is used to replace the CIOU loss function of the original model, and the bounding box regression loss function is modified.

3. A shrimp seed tracking method based on an improved YOLO v8 network model according to claim 2, characterized in that: The BiFormer attention mechanism captures features in images at different scales through a dual-layer routing attention mechanism BRA mechanism module. The BiFormer attention mechanism includes high-level semantic information and transitions from low-level visual features to high-level features, retaining key details.

4. A shrimp seed tracking method based on an improved YOLO v8 network model according to claim 1, characterized in that: The tracking algorithm for shrimp fry includes: Combined with the movement information and position information of the shrimp seedlings, the detection frame with a confidence level greater than the preset confidence level is selected as the high-score detection frame; at the same time, the pyramid LK optical flow method is used to predict the new position of each trajectory in the current frame; In the first match, the predicted trajectory and the current frame high-score detection frame are matched by distance matching algorithm; if the matching result only contains unmatched trajectories or unmatched detection sets, the pseudo code is directly executed; if both exist at the same time, it indicates that there may be a fast-moving target that causes the matching to fail, and a second match is required at this time; In the second matching, three candidate detection frames with the closest distance are selected from the unmatched detection set for each predicted frame in the unmatched trajectory, and angle matching is performed through the angle matching algorithm; for the remaining unmatched trajectory set, it is regarded as a lost tracking target and deleted; for the remaining unmatched detection set, it is regarded as a newly appeared target and initialized as a new trajectory.

5. A shrimp seed tracking method based on an improved YOLO v8 network model according to claim 4, characterized in that: The distance matching algorithm includes: By calculating the Euclidean distance between the center point of the target frame in the prediction trajectory of the previous frame and the center point of the target frame in the detection set of the current frame, the two are matched according to the principle of minimum Euclidean distance. Set a distance threshold. When the Euclidean distance is less than this threshold, the match is valid.

6. A shrimp seed tracking method based on an improved YOLO v8 network model according to claim 4, characterized in that: The distance matching algorithm includes a nearest neighbor search algorithm based on a kD tree, wherein the kD tree is a space partitioning data structure that recursively divides data points into different dimensions to construct a binary tree in a k-dimensional space; Calculate the variance of the horizontal and vertical dimensions of the center point of the detected target in the current frame, select the dimension feature with the largest variance as the root node to build a kD tree, and then use the kD tree to perform a nearest neighbor search for each predicted target to find the nearest detection target center point.

7. A shrimp seed tracking method based on an improved YOLO v8 network model according to claim 6, characterized in that: The angle matching algorithm includes: Select three candidate matching targets with the closest distance for the target, calculate the swimming angle, and then match them according to the principle of minimum change in the swimming angle. Based on the image pyramid structure of the pyramid Lucas-Kanade optical flow method, the optical flow is estimated from the top layer of the pyramid, and the motion vector of the top layer is calculated using it as the initial value of the top layer iteration. The tracking result of the previous layer is used as the initial value of the optical flow iteration of the next layer, and so on, until the original image of the pyramid is reached, the key point matching between adjacent images is achieved, so as to obtain the motion trajectory of the target.

8. A shrimp seed tracking method based on an improved YOLO v8 network model according to claim 1, characterized in that: The logic for obtaining the shrimp seedling experiment data set is as follows: Step A1: Establish a shrimp fry video collection platform at the breeding base, and collect the shrimp fry experimental data set of the target shrimp based on the shrimp fry video collection platform; Step A2: Based on the shrimp fry experimental data set, the detection evaluation indicators and tracking evaluation indicators of the target shrimp are obtained; the detection evaluation indicators include precision P, recall rate R, mAP@0.5, parameter quantity Para, and frame rate FPS; the tracking evaluation indicators include tracking accuracy MOTA, tracking precision MOTP, ID switching number IDSW and comprehensive indicator IDF.

9. A shrimp seed tracking method based on an improved YOLO v8 network model according to claim 8, characterized in that: The shrimp fry video collection platform includes a water tank, a camera, a computer and a light source device. Before the experiment begins, the aquaculture water reserved in the aquaculture farm is first added to the water tank, and then the shrimp fry is put in; The light source device has three adjustable gears: the first gear is a relatively low light intensity, providing a weak light environment inside the water tank; the second gear is a warmer tone, providing a medium light intensity; the third gear is a higher light intensity, providing a bright and cooler light environment. During shooting, videos under different light intensities can be obtained by adjusting the gear of the light source device.

10. An electronic device, characterized in that: include: at least one processor; as well as, A memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a shrimp fry tracking method based on an improved YOLO v8 network model as described in any one of claims 1 to 9.