Fish school recognition and classification method in complex environment based on particle swarm and improved YOLOv6
Through the multi-scale Retinex algorithm and the improved BC-YOLOv6 algorithm combined with the particle swarm algorithm, the enhancement processing of blurred light images and fish swarm recognition and classification problems in complex environments are solved, and efficient image recognition and classification effects are achieved.
Patent Information
- Application Number
- CN202411192526.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2044-08-28
AI Technical Summary
The prior art has failed to effectively solve the problems of enhanced processing of blurred light images and fish school identification and classification in complex environments, especially in underwater environments, where image quality deteriorates seriously and low recognition and classification efficiency.
The multi-scale Retinex algorithm is used for image enhancement processing, combined with the improved BC-YOLOv6 algorithm and particle swarm algorithm, and the image recognition and classification effect is improved by introducing coordinate attention mechanism and feature matrix optimization.
It significantly improves image clarity and recognition rate, enhances the monitoring ability of underwater fish school images, reduces manpower and material costs, and improves image classification performance and recognition accuracy.
Smart Images

Figure CN119274202B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition and classification, and in particular to a method for identifying and classifying fish schools in complex environments based on particle swarm and improved YOLOv6. Background Art
[0002] With the advancement of science and technology, unmanned vessel technology has gradually matured and is now used in various industries. In aquaculture, unmanned vessels have become an automated tool that replaces manual labor, enabling efficient aquatic product inspection and feeding. Therefore, how to accurately identify and classify fish images in complex underwater environments has become a hot topic in the development of unmanned vessel technology. High-quality images contain richer pixel information and can play a significant role in the field of image data. Traditional fuzzy light image enhancement algorithms suffer from low image pixel clarity and severe degradation of the quality of the acquired images compared to the physical originals. Therefore, research on technologies for enhancing fuzzy light images is becoming increasingly important.
[0003] In recent years, the YOLO (You Only Look Once) algorithm has garnered widespread attention as a highly effective object recognition and detection method. Since YOLOv1 was introduced as a baseline model in 2015, subsequent YOLO algorithms have continuously introduced new innovations based on this baseline model. Through multiple iterations and optimizations, the YOLO algorithm has seen substantial performance improvements.
[0004] At the same time, with the continuous advancement of image acquisition technology and the expansion of its application areas, image recognition has become increasingly important in the field of computer vision. As an optimization algorithm, the particle swarm algorithm has attracted widespread attention and application due to its ability to simulate the intelligent behavior of swarms in nature. For example, the paper "Particle Swarm Optimization Method for Image Classification Scene" studies the problem of feature selection in image classification and proposes an optimization method based on the particle swarm algorithm. The paper "Application of Improved Particle Swarm Optimization Algorithm in Reliability Analysis" addresses the problems of slow convergence, loss of population diversity, and susceptibility to falling into local optimal solutions in single-swarm particle swarm algorithms. It proposes an improved particle swarm algorithm with adaptive interactive learning across multiple swarms. However, current existing technologies do not yet apply image enhancement processing technology to image acquisition, nor do they propose a joint algorithm technology that uses the PSO algorithm and the YOLOv6 algorithm to recognize and classify known images. Summary of the Invention
[0005] The present invention aims to address the defects and shortcomings of the above-mentioned prior art and proposes a method for fish school recognition and classification in complex environments based on particle swarm optimization and improved YOLOv6. The method first uses a multi-scale Retinex algorithm to enhance the acquired blurred light image at the image acquisition level; then, at the image recognition level, an improved BC-YOLOv6 algorithm is used to combine the Backbone of YOLOv6 with the BiFormer of the Transformer layer of the bidirectional structure. At the same time, a coordinate attention mechanism module is introduced into its architecture to improve the recognition rate of small targets, improve non-maximum suppression, and design correlation functions; finally, at the image classification level, a feature matrix is defined and an improved particle swarm algorithm is used to obtain the selected feature matrix to achieve image classification. Simulation results show that the present invention can effectively reduce manpower and computing power costs, significantly improve image enhancement processing, and further improve the detection rate and accuracy, feature expression ability, and image classification performance of underwater fish school image recognition and classification under occlusion conditions.
[0006] The technical solution adopted by the present invention to solve its technical problems is: a method for identifying and classifying fish schools in complex environments based on a particle swarm algorithm and an improved YOLOv6. This method can not only enhance the blurred light images in complex environments, significantly improving the clarity and quality of the acquired images, but also has a good identification and classification effect on fish schools in underwater changeable environments, and can be easily extended to other related scenarios of image data processing and recognition.
[0007] Method flow:
[0008] A method for identifying and classifying fish schools in complex environments based on particle swarm and improved YOLOv6 is proposed. The method includes an image acquisition module, an image recognition module, and an image classification module. Specifically, the method includes:
[0009] Step 1: The image acquisition module collects image data of various fish in the aquaculture pond from the unmanned boat;
[0010] Using the multi-scale Retinex algorithm, the acquired blurred light images are enhanced to improve the pixel clarity of the images and provide the database with enhanced fish images.
[0011] Step 2: The image recognition module identifies the fish school image taken by the unmanned boat;
[0012] This paper proposes a method for image recognition using the improved BC-YOLOv6 algorithm and image classification using the particle swarm optimization algorithm. The BC-YOLOv6 algorithm combines the Backbone of YOLOv6 with the BiFormer of the bidirectional Transformer layer. It also introduces a coordinate attention mechanism (CA) module into its architecture to improve the recognition rate of small objects, improve non-maximum suppression (NMS), and design correlation functions to improve the recall rate.
[0013] Step 3: The image classification module classifies the identified fish images;
[0014] By defining the feature matrix and improving the particle swarm algorithm (PSO), the selected feature matrix is obtained to complete the classification of the image, thereby obtaining the recognition and classification of fish school images.
[0015] Furthermore, the image recognition module in step 2 of the present invention performs image enhancement processing on the blurred light image using a multi-scale Retinex algorithm, and the pixel clarity of the image is significantly improved, including:
[0016] The acquired blurred light image is subjected to median filtering denoising with a size of 3*3. The wavelet transform expression is:
[0017]
[0018] Among them, d is the high-frequency information part of the image; (k, l) is the image coordinate point; f is the low-frequency information part of the image.
[0019] In order to obtain the low-frequency information part and the high-frequency information part of the blurred light image, the present invention uses a selected threshold to perform wavelet decomposition operation on the blurred light image, and then uses the threshold function to process the low-frequency part. The formula expression is as follows: The noise standard deviation is estimated and the denoised blurred light image is obtained. The formula is as follows:
[0020]
[0021] Where Q and M are the blurred light image sizes; ζ is the noise standard deviation.
[0022] Establish nonlinear histogram transformation model J * , its formula expression is as follows:
[0023] Among them, i is a constant, β is a positive control parameter, when β is large or small, the above formula is transformed into the following formula: When β is large, When β is small, The output histogram is in the form of uniform distribution;
[0024] Then, a fitness function is designed based on the characteristics of the blurred light image and the characteristics of the eye visual system. The formula is as follows:
[0025] Among them, τ is the regularization parameter. The image correction method is optimized according to the nonlinear histogram parameters: first, the original blurred image O is input, then the blurred image is preliminarily corrected and output as V. Finally, the settings are initialized, and the initial chromosome and its population are created by encoding. The total variable is optimized to complete the correction of the blurred light image.
[0026] After correcting the blurred light image, according to the Retinex theory, the surface light of the object is affected by the surface of the object and its reflected light. The known quantity I of V in HSV V (x, y) = R(x, y)·T V (x, y) where R(x, y) is the illumination, T V (x, y) is the reflection of the object surface. The same method is used to apply MSR to the V component, and M is used to represent the number of scales. The formula is as follows:
[0027]
[0028] Among them, δ m is the size weight, H is the gain coefficient, and n is the offset;
[0029] In order to reduce the brightness and saturation in image component processing, the present invention adjusts the S component based on global color, which is expressed as follows: s′(x,y)=s(x,y)+y(b′(x,y)-v(x,y)×μ(x,y));
[0030] Where μ is the component coefficient, s′ is the corrected color saturation, s is the original saturation, and y is the ratio value;
[0031] The following formula is used to convert HSV components into RGB components to enhance the blurred light image. The expression is:
[0032]
[0033] The relevant parameter formulas are as follows:
[0034]
[0035] Among them, j0, g, and a represent variables.
[0036] Furthermore, the image recognition module in step 2 of the present invention improves the accuracy of the deep model trained on occluded images with the help of the improved BC-YOLOv6 algorithm, and includes the following steps:
[0037] Divide the input two-dimensional feature image into S×S containing H×W×S2 After linear mapping of the pixels, the correlation of the coarse-grained blocks is calculated based on Q and K. The formula is as follows:
[0038] Q=X r W q ,K=X r W k ,V=X r W v
[0039] Among them, Q is the query vector; K is the key vector; V is the value vector;
[0040] The attention weight is calculated on the coarse-grained area block, and the calculation formula is as follows:
[0041] A r =Q r (k r ) T
[0042] T r =topklndex(A r )
[0043] Among them, Q r and k r is the average value of each area of Q and K; A r is the adjacency matrix of the eigenvalue correlation between regions; T r is the index matrix;
[0044] The most relevant Topk coarse-grained region of each token is used as the key and value in the operation;
[0045] Defines a function This function is used to provide a smaller score for the suppressed detection box, so that some detection boxes are retained with a certain probability:
[0046]
[0047] Among them, S i is the final score of the prediction box; GIOU is the interaction ratio between the prediction box and M; N t is a predefined threshold,
[0048] Thus, the improved NMS is used to improve the recall rate of occluded targets.
[0049] Furthermore, the image classification module in step 3 of the present invention, by means of the definition of the feature matrix and the improvement of the particle swarm algorithm (PSO), obtains the selected feature matrix to implement image classification, including the following steps:
[0050] Set the evaluation function to F(S), and its formula is as follows:
[0051] F(S)=α·Discriminative(S)-β·Redundancy(S)
[0052] Among them, F(S) is the fitness value of the feature selection vector S; α and β are parameters that weigh discriminability and redundancy; Discriminative(S) is the discriminability of the selected features in image classification; Redundancy(S) is the redundancy between the selected features;
[0053] In the optimization process of the particle swarm algorithm, the position vector of the particle swarm is introduced as X i , the velocity vector is V i , each particle represents a feature selection solution, and the element X in the position vector i (j) indicates whether the jth feature in the i-th particle is selected, and the fitness value of the particle swarm is F(X i ), the particle position and velocity are updated as follows:
[0054]
[0055] Among them, w is the inertia weight; c1 and c2 are acceleration factors; r1 and r2 are random numbers; Pbest i is the position with the best fitness in the history of particle i; Gbest is the position with the best fitness in the history of the entire particle swarm; the Sigmoid function is used to map the velocity to the range of [0, 1] to ensure the legitimacy of the binary feature vector;
[0056] Define a feature matrix X, where X[i,j] represents the jth feature of the i-th sample;
[0057] The feature selection vector S is obtained by the particle swarm optimization algorithm, where S[j]=1 means that the jth feature is selected, and S[j]=0 means that the jth feature is not selected. With the help of the feature selection vector S, the optimized feature matrix X can be obtained. opt , which is calculated as follows: X opt [i,j]=X[i,j]·S[j];
[0058] Use the selected feature matrix X opt For image classification, support vector machine (SVM) is used as the classifier. Its goal is to find a decision function f so that for a given image sample X[i,;], the predicted output Y[i] is as close as possible to the actual label T[i]. The formula is as follows:
[0059]
[0060] Among them, L is the loss function.
[0061] Beneficial effects:
[0062] 1. Image acquisition: In addition to the traditional blurred light image enhancement processing method, the present invention adds image denoising processing to avoid noise interference, improves the image pixel clarity, and solves the image distortion problem through image correction, thereby improving the intensity of the image edge detail information. Ultimately, it effectively solves the problem that the underwater environment is complex and light propagating in the water will be absorbed and scattered, resulting in serious quality degradation, low contrast and loss of details of the images acquired underwater compared to the original physical images. The invention completes the enhancement processing of blurred light images by unmanned boats.
[0063] 2. Image recognition: The present invention demonstrates good performance in underwater fish occlusion image recognition. The BC-YOLOv6 algorithm has high recognition accuracy and strong robustness, solving the problem that manual recognition requires a lot of manpower and material resources, resulting in low training efficiency and low accuracy of the trained deep model.
[0064] 3. Image classification: The present invention has a significant effect in improving image classification performance and has excellent robustness in multiple experiments. It solves the problem of weak image feature expression and limited recognition caused by various external interferences in the image, such as water ripples, light, occlusion by other underwater organisms or obstacles, and different complex backgrounds.
[0065] 4. The combined use of the present invention in aquaculture can make aquaculture more intelligent, save a lot of manpower and reduce the efficiency of resource use. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 This is a schematic diagram of the implementation principle of the fish school recognition and classification algorithm in a complex environment based on particle swarm and improved YOLOv6.
[0067] Figure 2 This is a model diagram of the BC-YOLOv6 algorithm for image recognition in the present invention.
[0068] Figure 3 Schematic diagram of the particle swarm algorithm of the present invention.
[0069] Figure 4 A contrast comparison diagram is obtained for images under different schemes of the present invention.
[0070] Figure 5 This is a comparative grid diagram of the accuracy, recall rate, and average precision of different algorithms in the present invention.
[0071] Figure 6 This is a graph showing the accuracy of features selected using particle swarm optimization and all features without feature selection. DETAILED DESCRIPTION
[0072] The present invention will be described in further detail below with reference to the accompanying drawings.
[0073] Example 1
[0074] like Figure 1-Figure 3 As shown, the present invention provides a method for identifying and classifying fish schools in a complex environment based on particle swarm and improved YOLOv6, the method comprising the following steps:
[0075] Step 1: First, denoise the underwater blurred light image acquired by the camera. Then, correct the denoised blurred light image using nonlinear histogram transformation and parameter optimization. Finally, use the multi-scale Retinex algorithm with color restoration combined with the MSR algorithm to enhance the blurred light image. The definition is as follows:
[0076] Step 1.11: Perform median filtering on the acquired blurred light image with a size of 3*3 to remove noise. The wavelet transform expression is as follows:
[0077]
[0078] Where d is the high-frequency information part of the image, (k, l) is the image coordinate point, and f is the low-frequency information part of the image;
[0079] In step 1.12, in order to simultaneously obtain the low-frequency information portion and the high-frequency information portion of the blurred light image, the present invention uses a selected threshold to perform a wavelet decomposition operation on the blurred light image, and then uses a threshold function to process the low-frequency portion. The formula expression is as follows:
[0080]
[0081] Where Q and M are the sizes of the blurred light image, and ξ is the noise standard deviation. Because the noise in the blurred light image mostly exists in the high-frequency noise subband, the noise standard deviation is estimated using the following formula to obtain the denoised blurred light image.
[0082]
[0083] Step 1.21, establish nonlinear histogram transformation model J * , the formula expression is as follows:
[0084]
[0085] Where i is a constant and β is a positive control parameter. When β is large or small, the above formula is transformed into the following formula:
[0086] When β is large,
[0087] When β is small,
[0088] According to the above formula, the histogram output by this method is in a uniform distribution form.
[0089] Step 1.22: First, design a fitness function based on the characteristics of the blurred light image and the characteristics of the eye's visual system. The formula is as follows:
[0090]
[0091] Among them, τ is the regularization parameter, and the fitness weight value is redistributed according to τ.
[0092] Then, the image correction method is optimized according to the nonlinear histogram parameters: first, the original blurred image O is input, then the blurred image is preliminarily corrected and output as V, and finally the settings are initialized, the initial chromosomes and their populations are created by encoding, the variable sum is optimized, and the correction of the blurred light image is completed.
[0093] Step 1.31, after correcting the blurred light image, according to Retinex theory, the surface light of an object is affected by the surface of the object and its reflected light. The known value of V in HSV is:
[0094] I V (x,y)=R(x,y)·T V (x,y)
[0095] Among them, R(x,y) is the lighting, T V (x,y) is the reflection of the object surface.
[0096] The same method is used to apply MSR to the V component, with M representing the number of scales. The formula is as follows:
[0097]
[0098] Among them, δ m is the scale weight, H is the gain coefficient, and n is the offset.
[0099] Step 1.32, to reduce the brightness and saturation in the image component processing, the present invention adjusts the S component based on the global color, and the formula is expressed as follows:
[0100] s′(x,y)=s(x,y)+y(b′(x,y)-v(x,y)×μ(x,y))
[0101] Where μ is the component coefficient, s′ is the corrected color saturation, s is the original saturation, and y is the scale value.
[0102] In step 1.33, use the formula to convert the HSV components into RGB components to enhance the blurred light image. The expression is as follows:
[0103]
[0104] The relevant parameter formulas are as follows:
[0105]
[0106] Among them, J o , g, a are variables
[0107] Step 2: Combine YOLOv6’s Backbone with the Biformer of the bidirectional Transformer layer, introduce CA to improve the recognition rate of small targets, and use the improved NMS technology to improve the recall rate of occluded targets:
[0108] Step 2.11: Divide the input two-dimensional feature image into S×S images containing H×W×S 2 The pixel points of the feature vector are linearly mapped, and the correlation of the coarse-grained blocks is calculated based on Q and K. The formula is as follows:
[0109] Q=X r W q ,K=X r W k ,V=X r W v
[0110] Among them, Q is the query vector; K is the key vector; V is the value vector
[0111] Step 2.12, then calculate the attention weight on the coarse-grained area block, the calculation formula is as follows:
[0112] A r =Q r (k r ) T
[0113] T r =topklndex(A r )
[0114] Among them, Q r and k r is the average value of each region of Q and K, A r is the adjacency matrix of the eigenvalue correlation between regions, T r is the index matrix.
[0115] In step 2.13, the most relevant Topk coarse-grained regions of each token are used as keys and values in the calculation.
[0116] Step 2.2: Traditional NMS classifies based on the detection box score
[0117]
[0118] Among them, S i is the final score of the prediction box, GIOU is the intersection-union ratio of the prediction box and M, N t is a predefined threshold. Due to the problem of missed detection, the present invention improves NMS and defines a function This function is used to provide a smaller score for the suppressed detection box, and some detection boxes are retained with a certain probability so that:
[0119]
[0120] The improved NMS is used to improve the recall rate of occluded targets.
[0121] Step 3: To address the problem of feature selection in image classification tasks, this paper proposes an optimization method based on particle swarm optimization algorithm. The particle swarm optimization algorithm is used to select features and obtain an optimized feature selection vector, which is applied to the image classification task and is defined as follows:
[0122] In step 3.11, we set the evaluation function to F(S), which is as follows:
[0123] F(S)=α·Discriminative(S)-β·Re dundancy(S)
[0124] Among them, F(S) is the fitness value of the feature selection vector S, α and β are parameters that weigh discriminativeness and redundancy; Discriminative(S) is the discriminativeness of the selected features in image classification; Redundancy(S) is the redundancy between the selected features.
[0125] Step 3.12, the optimization process of the particle swarm algorithm, introduces the position vector of the particle swarm as X i , the velocity vector is V i , each particle represents a feature selection solution, and the element X in the position vector i (j) indicates whether the jth feature in the i-th particle is selected, and the fitness value of the particle swarm is F(X i ). The particle position and velocity updates are as follows:
[0126]
[0127] Where: w is the inertia weight, c1 and c2 are acceleration factors, r1 and r2 are random numbers, Pbest i is the position with the best fitness value in the history of particle i, Gbest is the position with the best fitness value in the history of the entire particle swarm, and the Sigmode function is used to map the velocity to the range of [0,1] to ensure the legitimacy of the binary feature vector.
[0128] In step 3.21, the present invention defines a feature matrix X, where X[i,j] represents the jth feature of the i-th sample.
[0129] Step 3.22, the present invention uses the particle swarm optimization algorithm to obtain the feature selection vector S, where S[j] = 1 means selecting the jth feature, and S[j] = 0 means not selecting the jth feature. Through the feature selection vector S, the optimized feature matrix X can be obtained. opt , calculated as follows:
[0130] X opt [i,j]=X[i,j]·S[j]
[0131] Step 3.23, finally use the selected feature matrix X opt Perform image classification.
[0132] The present invention uses support vector machine (SVM) as a classifier. The goal is to find a decision function f so that for a given image sample X[i,;], the predicted output Y[i] is as close as possible to the actual label T[i]. The formula is as follows:
[0133]
[0134] Where: L is the loss function. Through the above process, the particle swarm optimization algorithm is used to select features, and the optimized feature selection vector is obtained and applied to the image classification task.
[0135] Example 2
[0136] The present invention includes an image acquisition module, an image recognition module, and an image classification module. It utilizes image enhancement processing technology, PSO, and YOLOv6 algorithms to obtain fish species and images with maximum speed and efficiency. The proposed solution effectively solves the problems of image feature extraction and classification, significantly improving the quality and speed of image acquisition. Specifically, it includes:
[0137] 1. Image acquisition module: Multi-scale Retinex algorithm is used to enhance blurred light images.
[0138] First, the impulse noise part of the image is removed by median filtering, and then the speckle noise part of the image is removed by wavelet filtering. Based on this, the blurred light image denoising process is completed.
[0139] The denoising process of the blurred light image with a size of 3*3 is implemented by median filtering. The expression of wavelet transform and wavelet decomposition is as follows:
[0140] f k-1,l =d k,2l+1 -d k,2l
[0141]
[0142] Where d is the high-frequency information part of the image; (k, l) is the image coordinate point; f is the low-frequency information part of the image; Q and M are the blurred light image sizes; ζ is the standard deviation of the noise.
[0143] By estimating the standard variance of the noise, the expression of the denoised blurred light image is obtained as follows:
[0144]
[0145] At the same time, considering the distortion generated during the imaging process, which leads to poor quality of blurred light images, the denoised blurred light images are corrected based on nonlinear histogram changes and parameter optimization. Establish a nonlinear model histogram:
[0146]
[0147] Where i is a constant and β is a positive control parameter. When β is large or small, the above formula is transformed into the following formula:
[0148] When β is large,
[0149] When β is small,
[0150] Since the blurred light image enhancement effect needs to be measured by image quality, the image distortion information relies on the following criteria:
[0151] The blurred light image processed by the gradient algorithm has higher quality edge information.
[0152] The formula is as follows:
[0153]
[0154] where represents the horizontal gradient,
[0155]
[0156] Wherein, k represents the grayscale value of the blurred light image, and o represents the pixel of the blurred light image.
[0157] A fitness function is designed based on the characteristics of blurred light images and the characteristics of the eye visual system. The formula is as follows:
[0158]
[0159] Among them, τ is the regularization parameter.
[0160] The steps for optimizing and correcting the image based on nonlinear histogram parameters are as follows:
[0161] (1) According to the formula Obtain chromosome histogram and corresponding image of blurred light image;
[0162] Where i is a constant and β is a positive control parameter.
[0163] (2) According to Assign fitness weights;
[0164] (3) Using various operators to obtain offspring chromosome information;
[0165] (4) constructing a new population of newly obtained progeny chromosomes and recording their optimized variables and sequence information;
[0166] (5) Finally, the final blurred light image mapping correction is completed by optimizing the sum of variables.
[0167] Finally, the RGB channel is converted to the HSV color space, the expression is:
[0168]
[0169] Here, j0, g, and a represent variables. The image enhancement process for blurred light is then completed by combining the multi-scale Retinex algorithm and the MSR algorithm in visual communication technology.
[0170] 2. Image recognition module: uses the improved BC-YOLOv6 algorithm for image recognition.
[0171] 1. Improve the YOLOv6 algorithm
[0172] First, the YOLOv6 Backbone is combined with the Biformer layer of the bidirectional Transformer layer, and the coordinate attention mechanism (CA) is introduced into the architecture to improve the recognition rate of small objects. The dynamic sparse attention mechanism and multi-scale feature fusion strategy of the Biformer model not only effectively improve the target computation complexity, but also enhance the computational efficiency of the model, while optimizing the performance of small object detection.
[0173] 2. Improved non-maximum suppression (NMS)
[0174] Traditional NMS classifies based on the detection box score, using the boxes with higher scores and suppressing the boxes with low scores and high overlap:
[0175]
[0176] Among them, S i is the final score of the prediction box; GIOU is the interaction ratio between the prediction box and M; N t is a predefined threshold.
[0177] When different targets of the same aquaculture species appear and are occluded, because the GIOU value of the solid-line frame is greater than the predefined threshold, the dotted-line frame and the solid-line frame will be subjected to non-maximum suppression through NMS, and the dotted-line frame will eventually be suppressed. This will result in the other partially occluded target being unable to be recalled, and the overall recall rate will decrease. To solve this problem, the NMS algorithm is improved by defining a function:
[0178] Define the function:
[0179] Use the defined function to provide a smaller score for the suppressed detection box, so that the suppressed detection box is retained with a certain probability, thereby improving the recall rate of the occluded target:
[0180]
[0181] 3. Image classification module: uses particle swarm algorithm to classify images.
[0182] 1. Feature extraction
[0183] To address the problem of feature selection in image classification tasks, this paper proposes an optimization method based on the particle swarm algorithm. The optimization of the particle swarm algorithm involves minimizing the evaluation function. Because the minimization of the evaluation function comprehensively considers the discriminability and redundancy of the features, it is used for feature selection.
[0184] Assume the evaluation function is F(S), the formula is:
[0185] F(S)=α·Discriminative(S)-β·Redundancy(S)
[0186] Among them, F(S) is the fitness value of the feature selection vector S; α and β are parameters that weigh discriminability and redundancy; Discriminative(S) is the discriminability of the selected features in image classification; Redundancy(S) is the redundancy between the selected features.
[0187] The particle position and velocity updates are:
[0188]
[0189] Among them, w is the inertia weight; c1 and c2 are acceleration factors; r1 and r2 are random numbers; Pbest i is the position with the best fitness in the history of particle i; Gbest is the position with the best fitness in the history of the entire particle swarm; the Sigmoid function is used to map the velocity to the range of [0, 1] to ensure the legitimacy of the binary feature vector.
[0190] 2. Classification method based on image features
[0191] First, define the feature matrix X, where X[i, j] represents the jth feature of the i-th sample. Next, use the particle swarm optimization algorithm to obtain the feature selection vector S, where S[j] = 1 indicates that the j-th feature is selected, and S[j] = 0 indicates that the j-th feature is not selected. Using the feature selection vector S, we can obtain the optimized feature matrix Xopt. Finally, use this selected feature matrix Xopt for image classification.
[0192] Xopt is calculated as: Xopt[i, j] = X[i, j] · S[j]
[0193] Through the above process, the particle swarm optimization algorithm can be used to select features and obtain optimized feature selection vectors for application in image classification tasks.
[0194] The performance effect of the present invention can be further illustrated by the following performance analysis, specifically including:
[0195] Performance Analysis
[0196] Attachment Figure 4This figure shows a comparison of image contrast obtained using different schemes using the multi-scale Retinex algorithm proposed in this paper. The method of compensating the blue channel in the RGB channels is compared with the method of compressing the grayscale area of the image using a linear mapping function to increase the overall brightness of the image. Taking into account three situations: the present invention adopts a dust image enhancement method based on multi-exposure image fusion (method [1]); a low-light image enhancement model based on grayscale mapping and fusion technology (method [2]), and completes the enhancement effect processing of 6 underwater blurred fish school images. It is observed that when the three methods are used to complete the enhancement processing of blurred light images, the image contrast value of the method of the present invention is higher than that of the other two methods, which shows that the image contrast of the proposed method is high and the image enhancement effect is better. This verifies that the multi-scale Retinex algorithm proposed in the present invention can add image denoising processing to the traditional blurred light image enhancement processing method to avoid noise interference and improve the effectiveness of image pixel clarity. The image distortion problem is solved by image correction, and the edge detail information intensity of the image is improved. Finally, it effectively solves the problem that the underwater acquired image in a complex underwater environment is seriously degraded compared with the original image due to the absorption and scattering of light propagating in the water body, and the contrast is low and the details are lost. The enhancement processing of blurred light images by unmanned boats is completed.
[0197] Attachment Figure 5 A comparative grid plot showing the precision, recall, and mean average precision of different schemes is presented. The proposed BC-YOLOv6 algorithm outperforms other algorithms in terms of accuracy, recall, and mean average precision, demonstrating that the proposed scheme demonstrates good performance in underwater fish occlusion image recognition. Therefore, the BC-YOLOv6 algorithm can address the problems of manual recognition requiring extensive human resources, low training efficiency, and insufficient deep model accuracy.
[0198] Attachment Figure 6 The present invention demonstrates the classification performance of features selected using and without particle swarm optimization, recording and analyzing the results of multiple runs. It was observed that in each experiment, the classification accuracy using particle swarm optimization for feature selection was significantly higher than that without feature selection. This demonstrates that the particle swarm optimization method of the present invention is significantly effective in improving image classification performance. In terms of experimental consistency and robustness, although there was some fluctuation in classification accuracy across experiments, the overall trend showed that the performance after feature selection was relatively consistent.
[0199] Based on the above simulation results and analysis, the fish school recognition and classification algorithm in complex environments based on particle swarm and improved YOLOv6 proposed in this paper can enhance the blurred light image in complex environments, significantly improving the clarity and quality of the acquired image. Moreover, the proposed algorithm can have a good recognition and classification effect on fish schools in underwater changeable environments, and can be easily extended to scenarios of image data processing and recognition.
[0200] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A method for fish school recognition and classification in complex environments based on particle swarm and improved YOLOv6, characterized in that: The method comprises the following steps: Step 1: The image acquisition module collects image data of various fish in the aquaculture pond from the unmanned boat; Using the multi-scale Retinex algorithm, the acquired blurred light images are enhanced to improve the pixel clarity of the images and provide the database with enhanced fish images. Step 2: The image recognition module identifies the fish school image taken by the unmanned boat; This paper proposes a method for image recognition using the improved BC-YOLOv6 algorithm and image classification using a particle swarm optimization algorithm. The BC-YOLOv6 algorithm combines the Backbone of YOLOv6 with the BiFormer of the bidirectional Transformer layer. It also introduces a coordinate attention mechanism (CA) module and an image recognition module into its architecture. With the help of the improved BC-YOLOv6 algorithm, the accuracy of the deep model trained on occluded images is improved. The method includes the following steps: Divide the input two-dimensional feature image into S×S containing H×W×S 2 After linear mapping of the pixels, the correlation of the coarse-grained blocks is calculated based on Q and K. The formula is as follows: Q=X r W q ,K=X r W k ,V=X r W v Among them, δ is the query vector; K is the key vector; V is the value vector; The attention weight is calculated on the coarse-grained area block, and the calculation formula is as follows: A r =Q r (k r ) T T r =topklndex(A r ) Among them, Q r and K r is the average value of each area of Q and K; A r is the adjacency matrix of the eigenvalue correlation between regions; T r is the index matrix; The most relevant Topk coarse-grained region of each token is used as the key and value in the operation; Defines a function This function is used to provide a smaller score for the suppressed detection box, so that some detection boxes are retained with a certain probability: Among them, S i is the final score of the prediction box; GIOU is the interaction ratio between the prediction box and M; N t is a predefined threshold, Thus, the improved NMS is used to improve the recall rate of occluded targets; Step 3: The image classification module classifies the identified fish images; By defining the feature matrix and improving the particle swarm algorithm (PSO), the selected feature matrix is obtained to complete the classification of the image, thereby obtaining the recognition and classification of fish school images; The image classification module, with the help of the definition of the feature matrix and the improvement of the particle swarm algorithm (PSO), obtains the selected feature matrix to classify the image, including the following steps: Set the evaluation function to F(S), and its formula is as follows: F(S)=α·Discriminative(S)-β·Redundancy(S) Where F(S) is the fitness value of feature selection toward S; α and β are parameters that weigh discriminativeness and redundancy; Discriminative(S) is the discriminativeness of the selected features in image classification; Redundancy(S) is the redundancy between the selected features; In the optimization process of the particle swarm algorithm, the position vector of the particle swarm is introduced as X i , the velocity vector is V i , each particle represents a feature selection solution, and the element X in the position vector i (j) indicates whether the jth feature in the i-th particle is selected, and the fitness value of the particle swarm is F(X i ), the particle position and velocity are updated as follows: Among them, w is the inertia weight; c1 and c2 are acceleration factors; r1 and r2 are random numbers; Pbest i is the position with the best fitness in the history of particle i; Gbest is the position with the best fitness in the history of the entire particle swarm; the Sigmoid function is used to map the velocity to the range of [0, 1] to ensure the legitimacy of the binary feature vector; Define a feature matrix X, where X[i,j] represents the jth feature of the i-th sample; The feature selection vector S is obtained by the particle swarm optimization algorithm, where S[j]=1 means that the jth feature is selected, and S[j]=0 means that the jth feature is not selected. With the help of the feature selection vector S, the optimized feature matrix X can be obtained. opt , which is calculated as follows: X opt [i,j]=X[i,j]·S[j]; Use the selected feature matrix X opt For image classification, support vector machine (SVM) is used as the classifier. Its goal is to find a decision function f so that for a given image sample X[i,;], the predicted output Y[i] is as close as possible to the actual label T[i]. The formula is as follows: Among them, L is the loss function.
Citation Information
Patent Citations
Insulator pollution flashover detection method based on YOLO-AFPS
CN116503399A
Weak texture scene recognition system, method and device based on image and medium
CN117726790A