Method for detecting and counting glass eels
By improving the YOLOv10 network and combining multi-scale feature extraction and Focal-DIOU Loss loss function, the accuracy and robustness issues of glass eel detection in underwater environments were solved, achieving efficient and accurate fish fry counting.
Patent Information
- Application Number
- CN202411100812.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-12
- Publication Date
- 2024-11-05
AI Technical Summary
Existing fish fry detection methods suffer from difficulties in underwater environments, such as the inability to identify small targets, insufficient lighting, noise interference, and frequent blurring, resulting in poor detection accuracy and reliability. In particular, there is a lack of targeted research on the physiological characteristics and growth environment of eel fry.
An improved YOLOv10 network was adopted, and feature fusion was performed through multi-scale feature extraction, SimSPPF module and AFFM module. Combined with Focal-DIOU Loss function, the detection of glass eel’s eye features was focused on, the bounding box regression was optimized, and the contrast and sharpness of image samples were enhanced. A glass eel detection model based on improved YOLOv10 was constructed.
It improves the accuracy and robustness of glass eel detection, better identifies small targets, and enhances detection efficiency and precision, especially performing exceptionally well in complex underwater environments.
Smart Images

Figure CN118898858A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of fishery automation, in particular to a method for detecting and counting glass eels. Background Art
[0002] As a traditional precious fish, eel is called "soft gold in water". Eel skin is not only rich in a variety of essential amino acids, but also rich in minerals such as iron, zinc, magnesium, etc. These ingredients play an important role in human health. For fish farming, it is very important to detect underwater fish populations. Traditional methods of detecting and counting fry: manual counting method, volume method, and weight method. Manual counting method is the most primitive and common method, which is carried out by visual inspection and manual counting. This method is simple and direct, but labor-intensive and prone to errors. The volume method and weight method measure the number of fry in a certain volume and weigh the number of fry of a certain weight respectively. The counting method must ensure that the individual size of the fish body is relatively consistent, and there is a certain error in the counting.
[0003] Compared with traditional technical methods, by taking images of fry and processing the images for detection and counting, the efficiency and accuracy of counting can be greatly improved. However, in actual underwater environments, image acquisition often faces many challenges, which significantly affect the accuracy and reliability of fish detection. First, there are a large number of small targets in the underwater environment. These small targets are difficult to be accurately identified by traditional detection algorithms due to their small size and rapid movement. In addition, underwater lighting conditions are usually poor, and light scattering and absorption are common, resulting in insufficient lighting in the image, which further increases the difficulty of detection. Excessive noise is another significant problem. In underwater environments, water flow, bubbles, plankton, etc. will introduce a lot of noise into the image, interfering with the identification and positioning of fish. Blurring also occurs frequently, especially when the water flow is strong or the device is moving, blurred images will reduce the effectiveness and accuracy of the detection algorithm.
[0004] Eels go through six developmental stages in their lifetime. In order to adapt to different environments, their body shape and color change greatly in different stages. Although existing research has achieved a certain degree of small target detection, there is a lack of target detection research based on the physiological characteristics and growth environment characteristics of eel fry. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a method for detecting and counting glass eels, which can accurately and quickly detect glass eels.
[0006] The technical solution adopted by the present invention to solve the technical problem is: to provide a method for detecting and counting glass eels, comprising the following steps:
[0007] S0 obtains a glass eel image sample and preprocesses the image sample;
[0008] S1: marking the glass eel eyes in the preprocessed image samples, and performing image enhancement on the marked image samples, thereby establishing an image detection data set;
[0009] S2 constructs a glass eel detection model based on an improved YOLOv10 network, and trains the glass eel detection model using the image detection dataset; the improved YOLOv10 network includes:
[0010] Perform multi-scale feature extraction on the input image and use the SimSPPF module as the pooling layer;
[0011] The extracted features are fused at multiple scales and the attention mechanism is introduced through the AFFM module during feature fusion to generate four detection heads of different sizes.
[0012] Optimize the bounding box regression loss function;
[0013] S3 uses the glass eel detection model to identify the glass eel eyes in the image to be detected, and counts the number of glass eels according to the identification result.
[0014] Furthermore, the image feature extraction is performed on the input image, and the SimSPPF module is used as the pooling layer, including:
[0015] The input image sample is convolved and then input into the first C3 module to generate a first feature map;
[0016] The first feature map is convolved and input into a second C3 module to generate a second feature map;
[0017] The second feature map is processed by the SCDown module and input into the third C3 module to generate a third feature map;
[0018] The third feature map is processed by the SCDown module and input into the C2fCIB module, and then processed by the SimSPPF module and the PSA module in sequence to generate the fourth feature map.
[0019] Furthermore, the extracted features are subjected to multi-scale feature fusion and an attention mechanism is introduced through the AFFM module during feature fusion, thereby generating four detection heads of different sizes, including:
[0020] The fourth feature map is processed by the SCDown module and up-sampled, and then compared with the third feature map. Figure 1 The first fused feature map is generated after the fused feature map is successively passed through the fourth C3 module and the convolution operation;
[0021] The first fused feature map is upsampled and then concatenated with the second feature map. The concatenated feature map is sequentially subjected to a fifth C3 module and a convolution operation to generate a second fused feature map.
[0022] The second fused feature map is upsampled and then concatenated with the first feature map. The concatenated feature map is input into the first C2f module to output a third fused feature map, thereby generating a fourth detection head.
[0023] The third fused feature map is convolved with the second fused feature map, and the concatenated feature map is input into the second C2f module to output a fourth fused feature map, thereby generating a third detection head;
[0024] The fourth fused feature map is convolved with the first fused feature map, and the spliced feature map is input into the third C2f module to output the fifth fused feature map, thereby generating a second detection head;
[0025] The fifth fused feature map is convolved with the fourth feature map processed by the SCDown module, and the spliced feature map is input into the fourth C2f module to output the sixth fused feature map, thereby generating the first detection head.
[0026] Furthermore, the AFFM module includes:
[0027] Performing an alignment operation of the channel dimensions of two input feature maps respectively through two alignment modules to obtain a first processing feature and a second processing feature;
[0028] Performing a splicing operation on the first processing feature and the second processing feature to obtain a third processing feature;
[0029] The third processing feature is processed by the LSK attention module and divided into a fourth processing feature and a fifth processing feature of the same channel dimension;
[0030] multiplying the fourth processing feature by the first processing feature to obtain a sixth processing feature;
[0031] multiplying the fifth processing feature by the second processing feature to obtain a seventh processing feature;
[0032] adding the first processing feature and the seventh processing feature to obtain an eighth processing feature;
[0033] adding the second processing feature to the sixth processing feature to obtain a ninth processing feature;
[0034] The eighth processing feature and the ninth processing feature are spliced and then output.
[0035] Furthermore, the characteristic size of the first detection head is 1 / 32 of the input image sample, the characteristic size of the second detection head is 1 / 16 of the input image sample, the characteristic size of the third detection head is 1 / 8 of the input image sample, and the characteristic size of the fourth detection head is 1 / 4 of the input image sample.
[0036] Furthermore, the optimized bounding box regression loss function is implemented by using Focal-DIOU Loss as the loss function, and the Focal-DIOU Loss is calculated by the following formula:
[0037] L Focal-DIoU =-α t (1-L DIoU ) γ log(L DIoU )
[0038] Among them, L DIoU is the DIoU function, α and γ are hyper parameters.
[0039] Furthermore, performing image enhancement on the annotated image sample includes:
[0040] Performing noise reduction processing on the labeled image samples;
[0041] The contrast of the marked area in the image sample after noise reduction is enhanced.
[0042] Furthermore, the denoising process for the labeled image samples is achieved by a fast non-local mean denoising algorithm.
[0043] Furthermore, the step of enhancing the contrast of the marked area in the image sample after noise reduction includes:
[0044] Dividing the image sample after noise reduction into a plurality of image blocks;
[0045] Performing histogram equalization on each of the image blocks and increasing the contrast threshold of the marked area;
[0046] The marked area is sharpened.
[0047] Furthermore, performing histogram equalization on each of the image blocks and simultaneously increasing the contrast threshold of the marked area includes:
[0048] Setting a contrast threshold of the image block within the marked area;
[0049] Calculating the restricted contrast histogram of all the image blocks in the image sample and performing histogram equalization processing;
[0050] The image blocks after equalization processing are spliced together, and the boundaries between the image blocks are smoothed.
[0051] Beneficial Effects
[0052] Due to the adoption of the above technical solution, the present invention has the following advantages and positive effects compared with the prior art:
[0053] (1) The present invention fully considers the growth environment characteristics and physiological characteristics of glass eels, marks the eyes of fry as identification targets, and enhances image samples based on the eye characteristics of glass eels, so that the model can more accurately identify the eyes of fry in image samples, thereby obtaining more accurate fry counts;
[0054] (2) The present invention adopts an improved YOLOv10-m model. By improving the spatial pyramid pool, the adaptive feature fusion is used to connect the feature information of small targets, and a layer of 160×160 detection head is added. Compared with the ordinary connection, it can pay more attention to the features of the glass eel eyes and improve the model's detection ability for small targets. At the same time, Focal_DIoU_Loss is designed as the loss function, which combines the focus loss and the center point distance loss, so that the prediction frame is more accurate, especially when processing small targets and unbalanced data sets. It also achieves a good balance between accuracy and speed and improves the robustness of the system. At the same time, the C3 module is used to replace the C2f module, and the C2f module is used to replace part of the C2fCIB module, which can ensure that the model extracts sufficiently good feature information, avoiding the problem that the YOLOv10-m model is insufficient in feature extraction due to the pursuit of lightweight and high speed, thereby reducing the accuracy and precision of small target detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 is a flow chart of an embodiment of the present invention;
[0056] Figure 2 is a diagram of an eel fry according to an embodiment of the present invention;
[0057] Figure 3 is a diagram of an eel fry after enhancement treatment according to an embodiment of the present invention;
[0058] Figure 4 AFFM-YOLOv10 model network structure diagram of an embodiment of the present invention;
[0059] Figure 5 is a block diagram of an AFFM module according to an embodiment of the present invention;
[0060] Figure 6 is a structural diagram of the LSK attention mechanism according to an embodiment of the present invention;
[0061] Figure 7 It is a structural diagram of the SimSPPF module of an implementation mode of the present invention;
[0062] Figure 8 is the Focal-DIoU loss for bounding box regression in an embodiment of the present invention;
[0063] Fig. 9 This is a diagram showing the effect of glass eel detection and counting according to an embodiment of the present invention;
[0064] Fig.10 This is a comparison diagram of the effects of using different loss functions in the implementation mode of the present invention. DETAILED DESCRIPTION
[0065] The present invention will be further described below in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention. In addition, it should be understood that after reading the content taught by the present invention, those skilled in the art can make various changes or modifications to the present invention, and these equivalent forms fall within the scope limited by the appended claims of the application equally.
[0066] The embodiments of the present invention relate to a glass eel detection and counting method based on AFFM-YOLOv10, such as Figure 1 As shown, the following steps are included:
[0067] Step 1: Collect glass eel image samples;
[0068] Step 2: Construct a feature dataset for glass eel image detection;
[0069] Step 3: Establish an AFFM-YOLOv10 detection model, train the model on the acquired glass eel image detection feature dataset, and use the trained model to detect the glass eel image to be detected;
[0070] Step 4: Count and count the fish fry test results obtained after the test and obtain the final result.
[0071] Step 1: Collect glass eel image samples
[0072] The underwater activities of eel fry were recorded using a surface camera. The image dataset extracted from the videos taken at the fishery showed the different activity states of eel fry, such as Figure 2 As shown, eel larvae have the following characteristics:
[0073] Transparent: The newly hatched willow leaf larvae are transparent, with a slender, cylindrical body, a pointed front end, and gradually tapering to the back end.
[0074] Head features: The head is small and flat, with a pair of small black eyes at the front.
[0075] Fins: There is a pair of transparent fins on both sides of the body, and the whole body appears transparent.
[0076] Density and lines: The density of eel fry is relatively high and the lines are long, making them difficult to distinguish with the naked eye.
[0077] Step 2: Create an image sample dataset
[0078] The acquired images are two-dimensional, and there are problems in the data images, such as glass eels overlapping in space, missing fry structures in the images, visual errors when light passes through different media, and reflections on the water surface. Considering the above problems, in the process of making the data set, make sense was used to annotate the eyes of glass eels. The eels in the images were annotated with rectangles and only had one category label "eel fry". The images and their corresponding annotated data sets were enhanced. The enhancement processing included local feature enhancement, sharpening, dark processing, rotation, etc. In this study, there were 912 images in total, divided into 768 training sets and 144 validation sets.
[0079] Among them, local feature enhancement processing is to improve image quality and enhance the visibility of specific areas through a series of image processing steps. By detecting black areas in the image (such as the eyes of fry) and enhancing the contrast of these areas, these features are made more obvious, and the Fast Non-Local Means Denoising algorithm is used to reduce the noise in the image while maintaining the details of the image. The formula is as follows:
[0080]
[0081] in represents the value of pixel i after denoising, I(j) represents the value of pixel j in the original image, C(i) represents the normalization factor, and w(i,j) represents the weight between i and j. The weight formula is as follows:
[0082]
[0083] I(N i ) represents the neighborhood centered on pixel i, ||·||2 represents the L2 norm (Euclidean distance), and h represents the degree of weight attenuation.
[0084] The denoised image is then divided into several small blocks, and the histogram equalization technique is used to enhance the contrast only in the area within the marked box without affecting other areas.
[0085] The formula for limiting the contrast histogram is as follows:
[0086]
[0087] H(i) represents the histogram of the i-th gray level, clip_limit represents the contrast threshold, and N is the sum of the pixels in the small block.
[0088] The cumulative distribution function (CDF) is calculated based on the restricted histogram and the histogram equalization transformation formula is applied to each pixel in each small block as follows:
[0089]
[0090] I' tile (x,y)=CDF(I tile (x,y))×(L-1) (5)
[0091] I tile (x, y) represents the original grayscale value of the pixel in the small block, I' tile (x, y) represents the transformed grayscale value of the pixel in the small block, and L represents the total number of gray levels.
[0092] Finally, bilinear interpolation is used to stitch together the equalized results of all the small blocks, and the boundaries between the small blocks are smoothed. A sharpening filter is applied to enhance the edges and details of the image to make the image clearer. Bilinear interpolation is used to smooth the edges and sharpen the image for dark and bright processing. After the enhancement processing, some images and data sets are shown as follows Figure 3 shown.
[0093] Step 3: Build the detection model AFFM-YOLOv10 based on the improved YOLOv10
[0094] The YOLOv10 network consists of three main parts: backbone, neck, and head. This implementation method comprehensively optimizes its network structure, including improvements to the backbone network, neck, detection head, and loss calculation, such as Figure 4 As shown, including:
[0095] 1) Construct a multi-scale attention feature fusion module to connect feature information, and introduce the attention module of AFFM based on the improved LSK attention mechanism to enhance the model's ability to generate fine-grained and accurate predictions;
[0096] 2) In feature extraction, the C3 module is used to replace the C2f module, so that the model can extract better feature information; in the feature fusion part, the C2f module is used to replace the C2fCIB module to reduce the number of model parameters and abandon the large convolution kernel convolution of the C2fCIB module;
[0097] 3) Improve spatial pyramid pooling and use SimSPPF pyramid pooling to capture multi-scale features with different kernel sizes;
[0098] 4) Design a Focal-DIOU Loss loss function for small targets to perform bounding box regression, combined with higher resolution feature maps and more sophisticated feature representation, thereby significantly improving the detection effect of glass eel eyes. This implementation adopts DIoU loss to add a center point distance penalty term. By calculating the Euclidean distance between the center point of the predicted box and the true box, Focal Loss adds an adjustment factor to the loss function, so that the model can pay more attention to those difficult-to-classify samples during training, that is, pay less attention to easy-to-classify samples, thereby improving the accuracy of difficult-to-detect targets and providing more accurate bounding box regression capabilities;
[0099] 5) Use a deeper detection head to extract more complex features.
[0100] Among them, the adaptive feature map fusion module AFFM (Adaptive Feature Fusion Module) uses the attention mechanism to enhance feature representation by effectively fusing two input feature maps that may have different channel dimensions. Figure 5 As shown in , the module uses 1x1 convolution to adaptively align the channel dimensions of the two input feature maps so that they both become the same C×H×W shape. Through this adaptive alignment, AFFM ensures that feature maps from different sources can be further operated and fused on the same dimension. Then, the adjusted feature maps are spliced on the channel dimension to generate a combined feature map whose dimension becomes 2C×H×W. This spliced feature map contains the comprehensive information from the two input feature maps, so that subsequent processing can make better use of this information. In order to further enhance the feature representation capability, the combined feature map is Figure 6 The LSK attention mechanism shown in the figure is used for processing. The LSK attention mechanism uses a large-sized convolution kernel, which enables the network to capture a wider range of contextual information, thereby improving the ability of feature representation. This large receptive field design can better preserve the details and edge information of the image and generate a weighted attention feature map.
[0101] The generated weighted attention feature map not only contains more contextual information, but also can better highlight important feature areas. In this way, AFFM can significantly improve the quality of feature representation while maintaining efficient calculation, making the network perform better when processing complex image tasks. Whether it is for the detection of small targets or the recognition of targets in complex backgrounds, AFFM has demonstrated its powerful capabilities and wide applicability.
[0102] The LSK attention mechanism formula is as follows:
[0103]
[0104] AC =W 1×1 *Z C (8)
[0105]
[0106] in represents the output of the depthwise convolution after dilation, Z C represents the output of the depthwise convolution operation, W C represents the convolution kernel in the convolution operation, W 1×1 is a 1×1 convolution, F represents the input feature map, A C Represents the attention map obtained by 1×1.
[0107] After the weighted feature maps are processed by the LSK attention mechanism, they are first split back into two independent feature maps, each with a dimension of C×1×1. Next, these split feature maps are element-wise multiplied with the original input feature maps. Through this multiplication operation, the weights generated by the attention mechanism are directly applied to the original input feature maps, significantly enhancing their representation capabilities. This process not only highlights the key information in the original feature maps, but also preserves their details, making the feature representation richer and more accurate.
[0108] Finally, the weighted feature maps are concatenated again in the channel dimension to generate the final fused output feature map. This fused output feature map combines multiple information from the two input feature maps, and forms a more powerful and expressive feature representation through weighting and enhancement by the attention mechanism. Through this fusion and enhancement process, AFFM significantly improves the representation ability of feature maps, making it particularly outstanding in applications that require detailed and differentiated feature representations.
[0109] like Figure 7 As shown in the figure, the SimSPPF module (Simplified Spatial Pyramid Pooling-Fast) is an efficient spatial pyramid pooling module that aims to improve model performance through optimized design. Compared with the traditional SPP (Spatial Pyramid Pooling), SimSPPF adopts a more simplified structural design, which significantly reduces the complexity of redundant calculations and feature fusion processes, thereby improving computational efficiency and inference speed. Through simplified design, SimSPPF significantly reduces the consumption of computing resources and time while maintaining multi-scale feature extraction capabilities.
[0110] Several key advantages of SimSPPF include high computational efficiency, multi-scale feature extraction, simple structure and improved performance. Despite its simpler structure, SimSPPF still retains the multi-scale feature extraction capability of SPP, which can effectively capture features of different scales and enhance the model's detection capabilities for targets of different sizes. Its efficient feature extraction capability and simplified design not only improve the model's reasoning speed and accuracy, but also reduce the difficulty of implementation and model complexity, and improve its operability and applicability in practical applications.
[0111] This implementation method designs the Focal-DIOU Loss loss function to solve the problem of small glass eel target detection. In target detection tasks, we often encounter situations where the number of background classes and target classes is extremely unbalanced. In this case, the traditional cross entropy loss function will cause the model to pay more attention to the background class and ignore the target class. Focal Loss adds an adjustment factor to the loss function so that the model can pay more attention to samples that are difficult to classify during training, that is, pay less attention to samples that are easy to classify, thereby improving the accuracy of difficult-to-detect targets. The focal loss formula is as follows:
[0112] FL(p t )=-α t (1-p t ) γ log(p t ) (10)
[0113] where p t is the estimated probability of the model for the true category, α t is a balancing factor and γ is a focusing parameter that adjusts the rate at which simple examples are simplified.
[0114] The existing loss faces the following problems: 1. The regression error approaches zero, but the limit of the gradient value is not zero. 2. In the area with small regression error, the gradient amplitude changes little, and in the area with large regression error, the gradient amplitude changes little. Combining the focal loss and using Focal-EIOU Loss as IoU loss on COCO data effectively solves the defects of the existing loss, and balances the gradients derived from high-quality and low-quality examples, so that more high-quality regression losses can be obtained.
[0115] This implementation adopts DIoU loss and adds a center point distance penalty term. The penalty term is obtained by calculating the Euclidean distance d between the center points of the predicted box and the true box, and normalizing it to the square of the minimum external box diagonal length C.
[0116]
[0117] Where d is the Euclidean distance between the center of the predicted box and the true box, C is the diagonal length of the minimum bounding box covering the predicted box and the true box, and the DIoU loss is as follows Figure 8 shown.
[0118] The Focal-DIOU Loss formula is as follows:
[0119] L Focal-DIoU =-α t (1-L DIoU ) γ log(L DIoU ) (12)
[0120] Among them, α and γ are hyperparameters, which are used to control the weight of loss and the focus parameter respectively. α is generally used to balance positive and negative samples, and γ is used to adjust the focus factor so that difficult examples get more attention.
[0121] Glass eels have unique features such as transparent bodies, round bodies, no black cells on the caudal peduncle, and small eyes, which significantly increase the complexity of object detection and counting. To address these challenges, this implementation narrows the detection range and focuses on the head of the glass eel. The traditional YOLO model divides the detection targets into three sizes: large, medium, and small. On this basis, an enhanced network framework is proposed, which adds a small detection head of 160x 160 pixels, introduces small anchor points, and sets the anchor box size [4, 5, 8, 10, 22, 18]. This framework uses a total of four detection heads to identify large, medium, small, and tiny targets, effectively addressing the detection difficulties of glass eels.
[0122] like Fig. 9 As shown in the model detection effect diagram, by focusing on the head of the glass eel, its unique anatomical features are used to improve detection accuracy. The added small detection head and specialized small anchor points ensure that even the tiniest targets can be accurately identified. This multi-scale detection method enables the model to better handle the subtle and complex features of the glass eel, improving the accuracy of detection and counting. The addition of a fourth detection head of size 160×160 significantly improves the model's ability to identify small and complex targets that are often missed by traditional models. This improvement ensures that the model can accurately detect and count glass eels despite their challenging features. The proposed network framework not only enhances detection capabilities, but also improves the robustness and reliability of the model in various aquatic environments. This method addresses the inherent challenges posed by the unique features of glass eels and significantly improves the accuracy and efficiency of the detection process.
[0123] The beneficial effects of the present invention are verified by specific experimental data below.
[0124] Experimental platform: The experimental environment is NVIDIA GeForce RTX 4060 Laptop GPU and 12th generation Intel (R) Core (TM) i7-12650H CPU. PyThorch framework is 2.3.0 + cu118. Each model has been trained for 100 cycles with a batch size of 6. The SGD optimizer is used, and the weight decay and initial learning rate are set to 0.0005 and 0.01 respectively. The input image size is 640 × 640.
[0125] To verify the performance of the model, we selected accuracy P (Precision), recall R (Recall), average precision AP (Average Precision), and average precision mAP (meanAverage Precision) as the experimental evaluation indicators. The calculation of P, R, AP, and mAP is as follows:
[0126]
[0127] Where TP represents the number of correctly detected targets, FP represents the number of backgrounds detected as targets, FN represents the number of detections detected as backgrounds, AP represents the average accuracy of each category, mAP represents the average AP of multiple categories, m is the number of categories, and in fry detection m = 1.
[0128] In order to verify the specific impact of these improvements on network performance, an ablation experiment was conducted under the same training environment and hyperparameter settings. In the experiment, the YOLOv10-m model was used as the baseline, the above improvements were implemented one by one, and the contribution of each improvement to the model performance was evaluated. The practical results are shown in Table 1.
[0129] Table 1 Ablation experiment results
[0130]
[0131] The three model improvements SimSPPF, AFFM, and Four-detect improved the YOLOv10-m model by 6.4%, 6.8%, and 8% respectively. Among them, the improvement of Four-detect had the most obvious impact on the model, followed by the improvement of the AFFM module, which greatly improved the model's feature extraction and image representation capabilities for small targets. The three improvements ultimately made the accuracy of the model AFFM-YOLOv10 reach 94.6%, the regression rate reached 95.2%, the average accuracy with an IoU threshold of 0.5 reached 96.8, and the average accuracy with an IoU threshold of 0.5-0.95 reached 42.8%.
[0132] In order to further demonstrate the effectiveness of the IoU loss introduced by the YOLO model (AFFM-YOLOv10) based on the feature fusion module of the attention mechanism, we designed and implemented a series of IoU comparison experiments. These experiments compared the IoU loss of AFFM-YOLOv10 with other common IoU loss functions. By comparing the experimental results, we can clearly show the advantages of AFFM-Model in improving detection accuracy and robustness, thereby verifying the effectiveness and feasibility of our proposed improvement method in practical applications. The experiment is shown in Table 2.
[0133] Table 2 IoU loss comparison experimental results
[0134]
[0135] The experimental results show that DIoU_Loss has a good overall performance and has good results in multiple key indicators. Its precision (P) is 93.7%, recall (R) is 94.2%, and it reaches 96.1% on mAP50 and 41.2% on mAP50-95. In addition, the regression loss of DIoU_Loss is 2.91%, which is the lowest among all the evaluated loss functions, indicating that it performs well in prediction accuracy and stability. On this basis, the focal loss is improved and Focal_DIoU_Loss is adopted, which greatly improves the model's ability to detect the eyes of glass eels. CIoU_Loss has a precision (P) of 92.8% and a recall (R) of 93.9%, reaching 95.6% and 40.6% on mAP50 and mAP50-95 respectively. Its regression loss is 2.99%, second only to DIoU_Loss. These data show that CIoU_Loss performs fairly well on various evaluation metrics and is an ideal choice when stable and efficient performance is required.
[0136] The performance of EIoU_Loss and GIoU_Loss is relatively poor. The mAP50 of EIoU_Loss reaches 94.5%, and the mAP50-95 is 38.5%. The accuracy of GIoU_Loss is 92.2%, the recall rate is 93.6%, the mAP50 reaches 95.0%, and the mAP50-95 is 39.9%, which shows that EIoU_Loss has an advantage in detection accuracy, while GIoU_Loss is suitable for applications with balanced performance in all aspects. The performance of Focal_EIoU_Loss is relatively weak, with an accuracy of 86.5% and a recall of 87.3%, which are lower than other loss functions. In addition, the mAP50 and mAP50-95 of Focal_EIoU_Loss are 90.8% and 34.9%, which are also relatively low, while Focal_DIoU_Loss has excellent performance. Different IoU regression losses such as Fig.10 shown.
[0137] In order to further prove that the improved model proposed in this paper has superior detection performance, comparative experiments are carried out with other mainstream target detection models, including YOLOv3, YOLOv5, YOLOv8, and YOLOv9. For the sake of fairness, we adjust the resolution of all input images to 640×640, 100 rounds, and the number of input samples each time is 4. The results are shown in Table 3.
[0138] Table 3 Model comparison experimental results
[0139]
Claims
1. A method for detecting and counting glass eels, characterized in that: The following steps are involved: S0 obtains a glass eel image sample and preprocesses the image sample; S1: marking the glass eel eyes in the preprocessed image samples, and performing image enhancement on the marked image samples, thereby establishing an image detection data set; S2 constructs a glass eel detection model based on an improved YOLOv10 network, and trains the glass eel detection model using the image detection dataset; the improved YOLOv10 network includes: Perform multi-scale feature extraction on the input image and use the SimSPPF module as the pooling layer; The extracted features are fused at multiple scales and the attention mechanism is introduced through the AFFM module during feature fusion to generate four detection heads of different sizes. Optimize the bounding box regression loss function; S3 uses the glass eel detection model to identify the glass eel eyes in the image to be detected, and counts the number of glass eels according to the identification result.
2. The method according to claim 1, characterized in that The multi-scale feature extraction of the input image and the use of the SimSPPF module as a pooling layer include: The input image sample is convolved and then input into the first C3 module to generate a first feature map; The first feature map is convolved and input into a second C3 module to generate a second feature map; The second feature map is processed by the SCDown module and input into the third C3 module to generate a third feature map; The third feature map is processed by the SCDown module and input into the C2fCIB module, and then processed by the SimSPPF module and the PSA module in sequence to generate the fourth feature map.
3. The method according to claim 2, characterized in that The extracted features are subjected to multi-scale feature fusion and an attention mechanism is introduced through the AFFM module during feature fusion, thereby generating four detection heads of different sizes, including: After the fourth feature map is processed by the SCDown module and up-sampled, it is input into the AFFM module together with the third feature map for feature fusion based on the attention mechanism. The fused feature map is processed by the fourth C3 module and convolution operation to generate the first fused feature map; The first fused feature map is upsampled and then concatenated with the second feature map. The concatenated feature map is sequentially subjected to a fifth C3 module and a convolution operation to generate a second fused feature map. The second fused feature map is upsampled and then concatenated with the first feature map. The concatenated feature map is input into the first C2f module to output a third fused feature map, thereby generating a fourth detection head. The third fused feature map is convolved with the second fused feature map, and the concatenated feature map is input into the second C2f module to output a fourth fused feature map, thereby generating a third detection head; The fourth fused feature map is convolved with the first fused feature map, and the concatenated feature map is input into the third C2f module to output a fifth fused feature map, thereby generating a second detection head; The fifth fused feature map is convolved with the fourth feature map processed by the SCDown module, and the spliced feature map is input into the fourth C2f module to output the sixth fused feature map, thereby generating the first detection head.
4. The method according to claim 3, characterized in that The AFFM module includes: Performing an alignment operation of the channel dimensions of two input feature maps respectively through two alignment modules to obtain a first processing feature and a second processing feature; Performing a splicing operation on the first processing feature and the second processing feature to obtain a third processing feature; The third processing feature is processed by the LSK attention module and divided into a fourth processing feature and a fifth processing feature of the same channel dimension; multiplying the fourth processing feature by the first processing feature to obtain a sixth processing feature; multiplying the fifth processing feature by the second processing feature to obtain a seventh processing feature; adding the first processing feature and the seventh processing feature to obtain an eighth processing feature; adding the second processing feature to the sixth processing feature to obtain a ninth processing feature; The eighth processing feature and the ninth processing feature are spliced and then output.
5. The method according to claim 3, characterized in that: The characteristic size of the first detection head is 1 / 32 of the input image sample, the characteristic size of the second detection head is 1 / 16 of the input image sample, the characteristic size of the third detection head is 1 / 8 of the input image sample, and the characteristic size of the fourth detection head is 1 / 4 of the input image sample.
6. The method according to claim 1, characterized in that The optimized bounding box regression loss function is implemented by using Focal-DIOU Loss as the loss function, and the Focal-DIOU Loss is calculated by the following formula: L Focal-DIoU =-a t (1-L DIoU ) γ log(L DIoU ) Among them, L DIoU is the DIoU function, α and γ are hyper parameters.
7. The method according to claim 1, characterized in that The performing image enhancement on the labeled image samples comprises: Performing noise reduction processing on the labeled image samples; The contrast of the marked area in the image sample after noise reduction is enhanced.
8. The method according to claim 7, characterized in that The denoising process for the labeled image samples is achieved by a fast non-local mean denoising algorithm.
9. The method according to claim 7, characterized in that: The step of enhancing the contrast of the marked area in the image sample after noise reduction includes: Dividing the image sample after noise reduction into a plurality of image blocks; Performing histogram equalization on each of the image blocks and increasing the contrast threshold of the marked area; The marked area is sharpened.
10. The method according to claim 9, characterized in that performing histogram equalization on each of the image blocks, At the same time, the contrast threshold of the marked area is increased, including: Setting a contrast threshold of the image block within the marked area; The restricted contrast histograms of all the image blocks in the image sample are calculated, and a histogram equalization process is performed; the image blocks after the equalization process are spliced together, and the boundaries between the image blocks are smoothed.
Citation Information
Patent Citations
YOLOv7-MO-based acete chinensis catching target identification and counting system and operation method thereof
CN116311096A
Pig monitoring and counting method based on improved YOLOv7 model
CN116469034A
Fry detection method and system
CN117853477A
