Fish school identification and classification method in complex environment based on particle swarm and improved YOLOv6
By combining particle swarm algorithm and improving YOLOv6, using the multi-scale Retinex algorithm and coordinate attention mechanism, the recognition and classification of blurred light images in complex environments is solved, the image clarity and recognition rate are significantly improved, and the underwater fish swarm is realized efficient identification and classification.
Patent Information
- Application Number
- CN202411192526.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-08-28
AI Technical Summary
In complex environments, traditional fuzzy light image enhancement algorithms lead to low pixel clarity in image pixels and the inability to effectively identify and classify underwater fish seeds. The existing technology fails to effectively combine particle swarm algorithms and YOLOv6 algorithms for image recognition and classification.
Using particle swarm algorithm and improved YOLOv6 method, image enhancement processing is performed through multi-scale Retinex algorithm, combined with YOLOv6's Backbone and BiFormer of bidirectional Transformer layer, and coordinate attention mechanism is introduced to improve non-maximum suppression, define feature matrix and Improved particle swarm algorithm for image recognition and classification.
It significantly improves the clarity and recognition rate of images, improves the monitoring rate and classification performance of underwater fish school images, reduces manpower and computing power costs, and is suitable for bottom fish school recognition and image data processing in complex environments.
Smart Images

Figure CN119274202A_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 a complex environment based on particle swarms and improved YOLOv6. Background Art
[0002] With the development of science and technology, unmanned ship technology has gradually matured and has been used in all walks of life. In the field of aquaculture, unmanned ships have been used as an automated tool to replace human labor to achieve efficient aquatic detection and feeding. Therefore, how to accurately identify and classify fish school images in complex underwater environments has become a hot topic in the development of unmanned ship technology. High-quality images contain richer pixel information and can play a high-quality role in the field of image data. Traditional fuzzy light image enhancement algorithms have problems such as low image pixel clarity and serious degradation of the quality of the acquired images compared to the original physical images. Therefore, it is increasingly important to study the technology of enhancing fuzzy light images.
[0003] In recent years, the YOLO (You Only Look Once) algorithm has attracted widespread attention as an efficient target recognition and detection method. Since YOLOv1 was proposed as a baseline model in 2015, the subsequent YOLO algorithm has continuously introduced new innovations based on the baseline model. The YOLO algorithm has been continuously improved, and its performance has been qualitatively improved after multiple versions of iteration and optimization.
[0004] At the same time, with the continuous advancement of image acquisition technology and the expansion of application fields, image recognition has occupied an increasingly important position in the field of computer vision. As an optimization algorithm, particle swarm optimization has attracted widespread attention and application because of its ability to simulate the intelligent behavior of groups in nature. For example, the paper "Particle Swarm Optimization Method for Image Classification Scene" studied the feature selection problem in image classification and proposed an optimization method based on particle swarm algorithm. The paper "Application of improved particle swarm optimization algorithm in reliability analysis" proposed a multi-swarm adaptive interactive learning improved particle swarm algorithm to address the problems of slow convergence speed of single-swarm particle swarm algorithm, easy loss of population diversity, and easy to fall into local optimal solutions. However, the existing technology has never applied image enhancement processing technology to image acquisition, and how to use the PSO algorithm and YOLOv6 algorithm to identify and classify known images. Joint algorithm technology. Summary of the invention
[0005] The purpose of the present invention is to address the defects and shortcomings of the above-mentioned prior art, and propose a method for fish school recognition and classification in a complex environment based on particle swarm and improved YOLOv6. The method is based on the particle swarm algorithm and the improved YOLOv6. First, the multi-scale Retinex algorithm is used at the image acquisition level to enhance the acquired blurred light image; then the improved BC-YOLOv6 algorithm is used at the image recognition level to combine the Backbone of YOLOv6 with the BiFormer of the Transformer layer of the bidirectional structure, and at the same time, the coordinate attention mechanism module is introduced into its architecture to improve the recognition rate of small targets, improve non-maximum suppression, and design related functions; finally, the feature matrix is defined and the particle swarm algorithm is improved at the image classification level to obtain the selected feature matrix to realize the classification of the image. The simulation results show that the present invention can effectively reduce the manpower and computing power costs, significantly improve the image enhancement processing, and further improve the monitoring rate and accuracy of underwater fish school image recognition and classification under occlusion conditions, feature expression ability and image classification performance.
[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 improved YOLOv6. The method can not only enhance the blurred light image in a complex environment and significantly improve the clarity and quality of the acquired image, but also has a good identification and classification effect on fish schools in underwater changeable environments, and can be easily expanded to other related scenarios of image data processing and identification.
[0007] Method flow:
[0008] A method for identifying and classifying fish schools in complex environments based on particle swarms and improved YOLOv6, the method includes an image acquisition module, an image recognition module, and an image classification module. Specifically, it includes:
[0009] Step 1: The image acquisition module collects image data of various fish in the aquaculture pond from the unmanned boat;
[0010] With the help of multi-scale Retinex algorithm, the acquired blurred light image is enhanced to improve the pixel clarity of the image and provide the database with the fish school image after image enhancement.
[0011] Step 2: The image recognition module recognizes the fish school image taken by the unmanned boat;
[0012] The improved BC-YOLOv6 algorithm is used for image recognition and the particle swarm algorithm is used for image classification. The BC-YOLOv6 algorithm combines the Backbone of YOLOv6 with the BiFormer of the Transformer layer of the bidirectional structure. At the same time, the coordinate attention mechanism module (CA) is introduced into its architecture to improve the recognition rate of small targets, improve non-maximum suppression (NMS), design related functions, and improve the recall rate.
[0013] Step 3: The image classification module classifies the identified fish school images;
[0014] Through the definition of feature matrix and the improvement of 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 by means of 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 with a size of 3*3 to remove noise. 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 the selected threshold to perform wavelet decomposition operation on the blurred light image, and then uses the threshold function to process the low-frequency part, and its 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] Among them, Q and M are the blurred light image sizes; ζ is the standard deviation of noise.
[0022] Establishing nonlinear histogram transformation modelJ * , 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. According to the nonlinear histogram parameter optimization method of image correction: first input the original blurred image O, then preliminarily correct the blurred image and output it as V, finally initialize the settings, and create the initial chromosome and its population through encoding, optimize the variable sum, and 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. 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 the image component processing, the present invention adjusts the S component based on the global color, and the formula is as follows: s′(x, y)=s(x, y)+y(b′(x, y)-v(x, y)×μ(x, y));
[0030] Among them, μ 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 of occluded image training by means 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 area of each token is used as the key and value to participate in the calculation;
[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]
[0048] 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,
[0049] Therefore, the improved NMS is used to improve the recall rate of occluded targets.
[0050] 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 achieve image classification, including the following steps:
[0051] The evaluation function is set to F(S), and its formula is as follows:
[0052] F(S)=α·Discriminative(S)-β·Redundancy(S)
[0053] 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;
[0054] In the optimization process of the particle swarm algorithm, the position vector of the introduced particle swarm is 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:
[0055]
[0056] 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;
[0057] Define a feature matrix X, where X[i,j] represents the jth feature of the i-th sample;
[0058] The feature selection vector S obtained by the particle swarm optimization algorithm, where S[j]=1 means selecting the jth feature, and S[j]=0 means not selecting the jth feature. 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];
[0059] 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:
[0060]
[0061] Among them, L is the loss function.
[0062] Beneficial effects:
[0063] 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 and improves the image pixel clarity. At the same time, it solves the image distortion problem through image correction and improves the edge detail information intensity of the image. Ultimately, it effectively solves the problem that the underwater environment is complex and light will be absorbed and scattered when propagating in the water, resulting in serious quality degradation, low contrast and loss of details of the images acquired underwater compared to the original physical images. The enhanced processing of blurred light images by unmanned ships is completed.
[0064] 2. Image recognition: The present invention shows good performance in underwater fish occlusion image recognition. The BC-YOLOv6 algorithm has high recognition accuracy and strong robustness, which solves 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.
[0065] 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.
[0066] 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
[0067] 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.
[0068] Figure 2 This is a model diagram of the BC-YOLOv6 algorithm for image recognition in the present invention.
[0069] Figure 3 Schematic diagram of the particle swarm algorithm of the present invention.
[0070] Figure 4 A contrast comparison diagram is obtained for images under different schemes of the present invention.
[0071] Figure 5 It is a comparative grid diagram of the accuracy, recall rate and average precision means under different algorithms of the present invention.
[0072] Figure 6 This is a graph showing the accuracy of features selected using particle swarm optimization and all features without feature selection. DETAILED DESCRIPTION
[0073] The invention will be further described in detail below in conjunction with the accompanying drawings.
[0074] Embodiment 1
[0075] 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, and the method comprises the following steps:
[0076] Step 1: For the underwater blurred light image acquired by the camera, the blurred light image is first denoised, and then the denoised blurred light image is corrected based on nonlinear histogram change and parameter optimization. Finally, the multi-scale Retinex algorithm with color restoration is combined with the MSR algorithm to complete the blurred light image enhancement processing, which is defined as follows:
[0077] Step 1.11, perform median filtering to denoise the acquired blurred light image with a size of 3*3. The wavelet transform expression is as follows:
[0078]
[0079] 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;
[0080] Step 1.12, in order to simultaneously obtain the low-frequency information part and the high-frequency information part of the blurred light image, the present invention uses the 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:
[0081]
[0082] Among them, Q and M are the sizes of the blurred light image, and ξ is the standard deviation of the noise. Since most of the noise in the blurred light image exists in the high-frequency noise subband, the following formula is used to estimate the standard deviation of the noise to obtain the denoised blurred light image.
[0083]
[0084] Step 1.21, establish nonlinear histogram transformation model J * , the formula expression is as follows:
[0085]
[0086] Among them, i is a constant, β is a positive control parameter, and when β is large or small, the above formula is transformed into the following formula:
[0087] When β is large,
[0088] When β is small,
[0089] According to the above formula, the histogram output by this method is in a uniform distribution form.
[0090] Step 1.22, first design a fitness function based on the characteristics of the blurred light image and the characteristics of the eye visual system. The formula is as follows:
[0091]
[0092] Among them, τ is the regularization parameter, and the fitness weight value is redistributed according to τ.
[0093] 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 total variables are optimized, and the correction of the blurred light image is completed.
[0094] Step 1.31, after correcting the blurred light image, according to the Retinex theory, the surface light of an object is affected by the surface of the object and its reflected light. The known quantity of V in HSV is:
[0095] I V (x,y)=R(x,y)·T V (x,y)
[0096] Among them, R(x,y) is the lighting, T V (x,y) is the reflection of the object surface.
[0097] The same method is used to apply MSR to the V component, with M representing the number of scales. The formula is as follows:
[0098]
[0099] Among them, δ m is the scale weight, H is the gain coefficient, and n is the offset.
[0100] Step 1.32, in order 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:
[0101] s′(x,y)=s(x,y)+y(b′(x,y)-v(x,y)×μ(x,y))
[0102] Among them, μ is the component coefficient, s′ is the corrected color saturation, s is the original saturation, and y is the ratio value.
[0103] Step 1.33, use the formula to convert the HSV component into RGB component to enhance the blurred light image. The expression is as follows:
[0104]
[0105] The relevant parameter formulas are as follows:
[0106]
[0107] Among them, J o , g, a are variables
[0108] Step 2: Combine the Backbone of YOLOv6 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:
[0109] Step 2.11: Divide the input two-dimensional feature image into S×S blocks 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 according to Q and K. The formula is as follows:
[0110] Q=X r W q ,K=X r W k ,V=X r W v
[0111] Among them, Q is the query vector; K is the key vector; V is the value vector
[0112] Step 2.12, then calculate the attention weight on the coarse-grained area block, the calculation formula is as follows:
[0113] A r =Q r (k r ) T
[0114] T r =topklndex(A r )
[0115] 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.
[0116] In step 2.13, the most relevant Topk coarse-grained region of each Token is used as the key and value in the calculation.
[0117] Step 2.2: Traditional NMS classifies based on the detection box score
[0118]
[0119] Among them, S i is the final score of the prediction box, GIOU is the intersection-over-union ratio of the prediction box and M, and 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:
[0120]
[0121] Therefore, the improved NMS is used to improve the recall rate of occluded targets.
[0122] Step 3, in order to solve the problem of feature selection in image classification tasks, the present invention proposes an optimization method based on particle swarm optimization algorithm, which selects features using particle swarm optimization algorithm and obtains optimized feature selection vectors, which are applied to image classification tasks and are defined as follows:
[0123] In step 3.11, we set the evaluation function to F(S), the formula is as follows:
[0124] F(S)=α·Discriminative(S)-β·Re dundancy(S)
[0125] Among them, F(S) is the fitness value of the feature selection vector S, α and β are parameters that weigh discriminative and redundancy; Discriminative(S) is the discriminativeness of the selected features in image classification; Redundancy(S) is the redundancy between the selected features.
[0126] 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:
[0127]
[0128] 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.
[0129] Step 3.21, the present invention defines a feature matrix X, where X[i,j] represents the jth feature of the i-th sample.
[0130] 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:
[0131] X opt [i,j]=X[i,j]·S[j]
[0132] Step 3.23, finally use the selected feature matrix X opt Perform image classification.
[0133] The present invention uses support vector machine (SVM) as a classifier. The goal is to find a decision function f so that the predicted output Y[i] of a given image sample X[i,;] is as close as possible to the actual label T[i]. The formula is as follows:
[0134]
[0135] 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.
[0136] Embodiment 2
[0137] The present invention includes an image acquisition module, an image recognition module and an image classification module, and uses image enhancement processing technology, PSO and YOLOv6 algorithms to obtain fish species and images at the fastest speed and efficiency. The proposed scheme can well solve the problems of image feature extraction and classification, and can significantly improve the quality and speed of image acquisition. Specifically including:
[0138] 1. Image acquisition module: Multi-scale Retinex algorithm is used to enhance blurred light images.
[0139] Firstly, the impulse noise in the image is removed by median filtering, and then the speckle noise in the image is removed by wavelet filtering. Based on this, the blurred light image denoising is completed.
[0140] The denoising process of the blurred light image with a size of 3*3 is implemented by the median filter. The expression of wavelet transform and wavelet decomposition is as follows:
[0141] f k-1,l =d k,2l+1 -d k,2l
[0142]
[0143] 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; Q and M are the blurred light image sizes; ζ is the standard deviation of the noise.
[0144] By estimating the standard variance of the noise, the expression of the denoised blurred light image is obtained as follows:
[0145]
[0146] 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:
[0147]
[0148] Among them, i is a constant, β is a positive control parameter, and when β is large or small, the above formula is transformed into the following formula:
[0149] When β is large,
[0150] When β is small,
[0151] Since the blurred light image enhancement effect needs to be measured by image quality, the reliance criteria for image distortion information are as follows:
[0152] The blurred light image processed by the gradient algorithm has higher quality edge information.
[0153] The formula is as follows:
[0154]
[0155] where represents the horizontal gradient,
[0156]
[0157] Wherein, k represents the grayscale value of the blurred light image, and ο represents the blurred light image pixel.
[0158] 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:
[0159]
[0160] Among them, τ is the regularization parameter.
[0161] The steps of optimizing and correcting the image based on nonlinear histogram parameters are as follows:
[0162] (1) According to the formula Obtaining chromosome histogram and corresponding image of blurred light image;
[0163] Among them, i is a constant and β is a positive control parameter.
[0164] (2) Based on Assign fitness weights;
[0165] (3) Using various operators to obtain offspring chromosome information;
[0166] (4) constructing a new population using the newly obtained new progeny chromosomes, and recording their optimized variables and sequence information;
[0167] (5) Finally, the final blurred light image mapping correction is completed by optimizing the sum of variables.
[0168] Finally, the RGB channel is converted to the HSV color space, the expression is:
[0169]
[0170] Among them, j0, g, and a represent variables. Then, the image enhancement processing of blurred light is completed by combining the multi-scale Retinex algorithm in visual communication technology with the MSR algorithm.
[0171] 2. Image recognition module: The improved BC-YOLOv6 algorithm is used for image recognition.
[0172] 1. Improve the YOLOv6 algorithm
[0173] First, the Backbone of YOLOv6 is combined with the Biformer of the bidirectional Transformer layer, and the coordinate attention mechanism module (CA) is introduced into the architecture to improve the recognition rate of small targets. The dynamic sparse attention mechanism and multi-scale feature fusion strategy of the Biformer model can not only effectively improve the target calculation complexity, but also improve the calculation efficiency of the model, while optimizing the performance of small target detection.
[0174] 2. Improved non-maximum suppression (NMS)
[0175] Traditional NMS classifies based on the detection box score, using the borders with higher scores and suppressing the borders with low scores and high overlap:
[0176]
[0178] 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.
[0179] When different targets of the same breeding species appear and there is occlusion, because the GIOU value of the solid frame is greater than the predefined threshold, the dotted frame and the solid frame will be suppressed by NMS, and the dotted frame will eventually be suppressed, which will result in another target that is partially occluded and cannot be recalled, and the overall recall rate will decrease. To solve this problem, the NMS algorithm is improved by defining a function:
[0180] Define the function:
[0181] 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:
[0182]
[0183] 3. Image classification module: uses particle swarm algorithm to classify images.
[0184] 1. Feature extraction
[0185] In view of the problem of feature selection in image classification tasks, the present invention proposes an optimization method based on particle swarm algorithm. The optimization of particle swarm algorithm involves minimizing the evaluation function, because the minimization evaluation function comprehensively considers the discriminability and redundancy of the features, so it is used for feature selection.
[0186] Assume the evaluation function is F(S), the formula is:
[0187] F(S)=α·Discriminative(S)-β·Redundancy(S)
[0188] 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.
[0189] The particle position and velocity updates are:
[0190]
[0191] 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.
[0192] 2. Classification method based on image features
[0193] First, define the feature matrix X, where X[i, j] represents the jth feature of the i-th sample. Secondly, use 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 Xopt can be obtained. Finally, the selected feature matrix Xopt is used for image classification.
[0194] Xopt is calculated as: Xopt[i, j] = X[i, j] · S[j]
[0195] 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.
[0196] The performance effect of the present invention can be further illustrated by the following performance analysis, which specifically includes:
[0197] Performance Analysis
[0198] Attached Figure 4The image contrast comparison diagram of the multi-scale Retinex algorithm proposed in the present invention under different schemes is shown. The method of compensating the blue channel in the RGB channel and the method of compressing the grayscale area of the image by a linear mapping function to improve the overall brightness of the image are shown. Considering 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, the problem of serious quality degradation, low contrast and detail loss of underwater images compared with the original images caused by the absorption and scattering of light propagating in the water body in complex underwater environments is effectively solved, and the enhancement processing of blurred light images by unmanned ships is completed.
[0199] Attached Figure 5 A comparative grid diagram of the accuracy, recall rate, and average precision means under different schemes is shown. It is observed that the BC-YOLOv6 algorithm proposed in the present invention is superior to other algorithms in terms of recognition accuracy, recall rate, and average precision means, which shows that the scheme proposed in the present invention shows good performance in underwater fish occlusion image recognition. Therefore, the BC-YOLOv6 algorithm can solve the problems of manual recognition requiring a lot of manpower and material resources, low training efficiency, and insufficient accuracy of deep models.
[0200] Attached Figure 6 The present invention shows the classification performance of features selected with and without particle swarm optimization, and records and analyzes the results of multiple runs. It is observed that in each experiment, the classification accuracy of feature selection using particle swarm optimization is significantly higher than that without feature selection. This shows that the particle swarm optimization method of the present invention has a significant effect in improving image classification performance. In terms of experimental consistency and robustness, although there are certain fluctuations in classification accuracy in different experiments, the overall trend shows that the performance after feature selection is relatively consistent.
[0201] 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 the present invention can enhance the blurred light image in complex environments and significantly improve the clarity and quality of the acquired images. 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 the scenarios of image data processing and recognition.
[0202] The above is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope 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; With the help of multi-scale Retinex algorithm, the acquired blurred light image is enhanced to improve the pixel clarity of the image and provide the database with the fish school image after image enhancement. Step 2: The image recognition module recognizes the fish school image taken by the unmanned boat; The improved BC-YOLOv6 algorithm is used for image recognition and the particle swarm algorithm is used for image classification. The BC-YOLOv6 algorithm combines the Backbone of YOLOv6 with the BiFormer of the Transformer layer of the bidirectional structure, and introduces the coordinate attention mechanism module (CA) into its architecture. Step 3: The image classification module classifies the identified fish school images; Through the definition of feature matrix and the improvement of 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.
2. According to claim 1, a method for identifying and classifying fish schools in complex environments based on particle swarm and improved YOLOv6 is characterized in that: The image recognition module in step 2 performs image enhancement processing on the blurred light image with the help of a multi-scale Retinex algorithm, and the pixel clarity of the image is significantly improved, including: The acquired blurred light image is subjected to median filtering with a size of 3*3 to remove noise. The wavelet transform expression is: 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; In order to obtain the low-frequency information part and high-frequency information part of the blurred light image, the blurred light image is subjected to wavelet decomposition operation using the selected threshold, and then the low-frequency part is processed using the threshold function. 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: Among them, Q and M are the blurred light image sizes; ζ is the standard variance of noise; Establishing nonlinear histogram transformation modelJ * , its formula expression is as follows: 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; 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: Among them, τ is the regularization parameter. According to the nonlinear histogram parameter optimization method of image correction: first input the original blurred image O, then preliminarily correct the blurred image and output it as V, finally initialize the settings, and create the initial chromosome and its population through encoding, optimize the variable sum, and complete the correction of the blurred light image; 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. M is used to represent the number of scales. The formula is as follows: Among them, δ m is the size weight, H is the gain coefficient, and n is the offset; In order to reduce the brightness and saturation in the image component processing, the S component is adjusted based on the global color, and its formula is expressed as follows: s′(x,y)=s(x,y)+y(b′(x,y)-v(x,y)×μ(x,y)); Among them, μ is the component coefficient, s′ is the corrected color saturation, s is the original saturation, and y is the ratio value; The following formula is used to convert HSV components into RGB components to enhance the blurred light image. The expression is: The relevant parameter formulas are as follows: Among them, j0, g, and a represent variables.
3. According to the method of claim 1, the method for fish school recognition and classification in complex environment based on particle swarm and improved YOLOv6 is characterized in that: The image recognition module in step 2 improves the accuracy of the deep model for occluded image training by means of the improved BC-YOLOv6 algorithm, and 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, Q 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 area of each token is used as the key and value to participate in the calculation; 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, Therefore, the improved NMS is used to improve the recall rate of occluded targets.
4. According to claim 1, a method for identifying and classifying fish schools in complex environments based on particle swarm and improved YOLOv6 is characterized in that: The image classification module of step 3, by means 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, and includes the following steps: The evaluation function is set to F(S), and its formula is as follows: F(S)=α·Discriminative(S)-β·Re dundancy(S) Among them, F(S) is the fitness value of feature selection towards S; α and β are parameters that weigh discriminative 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 introduced particle swarm is 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: 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 obtained by the particle swarm optimization algorithm, where S[j]=1 means selecting the jth feature, and S[j]=0 means not selecting the jth feature. 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
Fish school target identification method for intelligent operation of underwater robot
CN111310622A
Insulator pollution flashover detection method based on YOLO-AFPS
CN116503399A
Weak texture scene recognition system, method and device based on image and medium
CN117726790A
Image preprocessing method for fault early warning of extra-high voltage transformer substation
CN118314489A
Object detection in image based on stochastic optimization
US20210097277A1
Cited By
Portable fish detection device and method
CN120147712A