An underwater sea cucumber detection method combined with image enhancement
Through image enhancement technology and k-means clustering algorithm, combined with Focal Loss, the problem of low image quality in underwater sea cucumber recognition is solved and the recognition accuracy is significantly improved.
Patent Information
- Application Number
- CN202011458021.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-11
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-12-11
AI Technical Summary
The low contrast and image quality degradation of underwater images increase the difficulty of sea cucumber identification, and existing technology cannot effectively improve the accuracy of underwater sea cucumber identification.
Image enhancement technology is used, including contrast stretching, color space conversion and fusion, combined with k-means clustering algorithm to adjust the a priori frame size, and Focal Loss is used as the classification loss function to improve the training and recognition process of the yolov4 network model.
Significantly improves the clarity of underwater sea cucumber images, making features more obvious, reducing the problem of positive and negative sample imbalance, and improving the accuracy of sea cucumber recognition.
Smart Images

Figure CN112465803B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of underwater sea cucumber identification, and in particular to an underwater sea cucumber detection method combined with image enhancement. Background Art
[0002] Underwater sea cucumber identification is a very important link in the automated fishing of sea cucumbers. Only by correctly identifying underwater sea cucumbers can automatic and correct fishing be achieved. The traditional methods are mainly the following two: the first is to use seabed trawling, but seabed trawling will destroy the seabed ecological environment. The second is to use divers to dive to the seabed to collect seafood. Diving all year round, even at the bottom of the sea about 15 meters, will cause irreversible physical damage to divers. Underwater automated fishing can not only protect the life and health of divers, but also put seafood into deep-sea areas for breeding without the maximum diving depth of divers, which is more conducive to improving the quality of seafood. An important link in realizing automated fishing is underwater sea cucumber identification.
[0003] At present, deep learning recognition technology has gradually matured. By extracting features from data and analyzing features through the network, it has made good progress in speech recognition, text recognition, image recognition, medicine, and objects.
[0004] Although deep learning has made great progress in the field of recognition, due to the absorption of light by water, light tends to decay exponentially when propagating in water, which results in generally low contrast in underwater images. At the same time, the presence of plankton and suspended particles in the water will amplify the scattering effect, causing degradation of image quality, unclear images, and reduced image saturation. Summary of the invention
[0005] The purpose of the present invention is to overcome the shortcomings of the prior art and to provide an underwater sea cucumber detection method combined with image enhancement, which improves the clarity of underwater images through image enhancement and reduces the difficulty of identifying sea cucumbers.
[0006] The technical solution for achieving the purpose of the present invention is:
[0007] An underwater sea cucumber detection method combined with image enhancement comprises the following steps:
[0008] 1) The acquired underwater sea cucumber image is framed with the target and the target position through labelme, and then the sea cucumber image is manually labeled by generating the corresponding JSON file to obtain the labeled image;
[0009] 2) Converting the annotated sea cucumber image into VOC2007 format data to obtain annotated data;
[0010] 3) obtaining a sea cucumber image and preprocessing the image to obtain an enhanced image;
[0011] 4) Use the k-means clustering algorithm to modify the prior frame of the detection network yolov4 network model to the corresponding scale, and then take the average of the corresponding maximum and minimum scales to replace the middle value;
[0012] 5) Preprocess the image to be recognized to obtain an enhanced image;
[0013] 6) Using the labeled data obtained in step 2) and the image preprocessed in step 3) as training data, training the network model in step 4) to obtain a trained model;
[0014] 7) Input the enhanced image in step 5) into the trained model to recognize the image.
[0015] In step 3) and step 5), the preprocessing is to split the image into three channels of R, G, and B and perform contrast stretching to improve the contrast; then convert the RGB color space into HSV and HSI color space, and use these two color space enhancement images as components to be fused for fusion. The specific steps are as follows:
[0016] a) Assume I(i,j) is an image of size M×N, where i=1,2,...,Μ; j=1,2,...,N; split the image into three channels: R, G, and B. The values of the red, green, and blue colors in the three channels are represented by I R (i,j),I G (i,j),I B (i, j) represents, then the average value of each channel pixel is R avg , G avg , B avg :
[0017]
[0018] Underwater has R avg <<G avg And R avg <<G avg , set the red channel to channel 3, and the blue and green channels to channels 1 and 2;
[0019] b) Stretch the three channels:
[0020] For channel 1 and channel 2, the stretching formula is as follows:
[0021] P o =(P i -a)×(ba) / (cd)+d
[0022] Where P o and P i are the pixels of the output and input images, respectively, c and d represent the maximum and minimum pixel values in the output image, a and b represent the minimum and maximum pixel values in the input image, respectively;
[0023] For channel 3, the stretching formula is as follows:
[0024]
[0025] Where P o and P i are the pixels of the output and input images respectively, c represents the maximum pixel value in the output image, and a represents the minimum pixel value in the input image;
[0026] c) Then convert the RGB color space into HSI and HSV color space, and perform contrast stretching in the HSI color space. The stretching formula is as follows:
[0027]
[0028] Where a is the minimum value of the input image pixel, b is the maximum value of the input image pixel, y is the pixel value after stretching, and x is the pixel value of the input image;
[0029] d) Perform gamma correction in the HSV color space, and the correction formula is as follows:
[0030] T(l)=l max (l / l max ) γ
[0031] Among them l max is the maximum intensity of the input image pixel, and γ is 0.5;
[0032] e) The enhanced images of the HSI and HSV color spaces are taken as components to be fused to obtain an enhanced image.
[0033] In step 4), the YOLOv4 network model uses the K-means clustering algorithm to calculate the required size of the prior box, and averages the maximum and minimum values of the corresponding scale. The learning rate adjustment method is set to the adam optimized gradient descent method, 32 images are batch processed, and iterated 400 times. Focal Loss is used as the classification loss function to reduce the problem of serious imbalance between positive and negative samples. The formula is as follows:
[0034]
[0035] The invention provides an underwater sea cucumber detection method combined with image enhancement, which applies improved contrast stretching and image fusion to improve image clarity and make the features in the image more obvious. In addition, a more suitable prior frame size is obtained by using k-means clustering, so that yolov4 can better perform the detection task. By using Focal Loss as the classification loss function, the problem of serious imbalance between positive and negative samples in the task is reduced, and the recognition of underwater sea cucumbers is finally achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A flow chart of an underwater sea cucumber detection method combined with image enhancement;
[0037] Figure 2 is a flow chart of the image enhancement method in the present invention;
[0038] Figure 3 Comparison chart of the original image and the enhanced image. DETAILED DESCRIPTION
[0039] The present invention is further described below with reference to the accompanying drawings and embodiments, but the present invention is not limited thereto.
[0040] Example:
[0041] like Figure 1 As shown, an underwater sea cucumber detection method combined with image enhancement comprises the following steps:
[0042] 1) The acquired underwater sea cucumber image is framed with the target and the target position through labelme, and then the sea cucumber image is manually labeled by generating the corresponding JSON file to obtain the labeled image;
[0043] 2) Converting the annotated sea cucumber image into VOC2007 format data to obtain annotated data;
[0044] 3) obtaining a sea cucumber image and preprocessing the image to obtain an enhanced image;
[0045] 4) Use the k-means clustering algorithm to modify the prior frame of the detection network yolov4 network model to the corresponding scale, and then take the average of the corresponding maximum and minimum scales to replace the middle value;
[0046] 5) Preprocess the image to be recognized to obtain an enhanced image;
[0047] 6) Using the labeled data obtained in step 2) and the image preprocessed in step 3) as training data, training the network model in step 4) to obtain a trained model;
[0048] 7) Input the enhanced image in step 5) into the trained model to recognize the image.
[0049] In step 3) and step 5), if Figure 2 As shown, the preprocessing is to split the image into three channels of R, G, and B and perform contrast stretching to improve it; then convert the RGB color space into HSV and HSI color spaces, and use these two color space enhancement images as components to be fused for fusion. The specific steps are as follows:
[0050] a) Assume I(i,j) is an image of size M×N, where i=1,2,...,Μ; j=1,2,...,N; split the image into three channels: R, G, and B. The values of the red, green, and blue colors in the three channels are represented by I R (i,j),I G (i,j),I B (i, j) represents, then the average value of each channel pixel is R avg , G avg , B avg :
[0051]
[0052] Underwater has R avg <<G avg And R avg <<G avg , set the red channel to channel 3, and the blue and green channels to channels 1 and 2;
[0053] b) Stretch the three channels:
[0054] For channel 1 and channel 2, the stretching formula is as follows:
[0055] P o =(P i -a)×(ba) / (cd)+d
[0056] Where P o and P i are the pixels of the output and input images, respectively, c and d represent the maximum and minimum pixel values in the output image, a and b represent the minimum and maximum pixel values in the input image, respectively;
[0057] For channel 3, the stretching formula is as follows:
[0058]
[0059] Where P o and P iare the pixels of the output and input images respectively, c represents the maximum pixel value in the output image, and a represents the minimum pixel value in the input image;
[0060] c) Then convert the RGB color space into HSI and HSV color space, and perform contrast stretching in the HSI color space. The stretching formula is as follows:
[0061]
[0062] Where a is the minimum value of the input image pixel, b is the maximum value of the input image pixel, y is the pixel value after stretching, and x is the pixel value of the input image;
[0063] d) Perform gamma correction in the HSV color space, and the correction formula is as follows:
[0064] T(l)=l max (l / l max ) γ
[0065] Among them l max is the maximum intensity of the input image pixel, and γ is 0.5;
[0066] e) The enhanced images of the HSI and HSV color spaces are taken as the components to be fused and fused to obtain an enhanced image, such as Figure 3 shown.
[0067] In step 4), the YOLOv4 network model uses the K-means clustering algorithm to calculate the required size of the prior box, and averages the maximum and minimum values of the corresponding scale. The learning rate adjustment method is set to the adam optimized gradient descent method, 32 images are batch processed, and iterated 400 times. Focal Loss is used as the classification loss function to reduce the problem of serious imbalance between positive and negative samples. The formula is as follows:
[0068]
Claims
1. A method for detecting underwater sea cucumbers combined with image enhancement, characterized in that: The steps include: 1) The acquired underwater sea cucumber image is framed with the target and the target position through labelme, and then the sea cucumber image is manually labeled by generating the corresponding JSON file to obtain the labeled image; 2) Converting the annotated sea cucumber image into VOC2007 format data to obtain annotated data; 3) obtaining a sea cucumber image and preprocessing the image to obtain an enhanced image; 4) Use the k-means clustering algorithm to modify the prior frame of the detection network yolov4 network model to the corresponding scale, and then take the average of the corresponding maximum and minimum scales to replace the middle value; 5) Preprocess the image to be recognized to obtain an enhanced image; 6) Using the labeled data obtained in step 2) and the image preprocessed in step 3) as training data, training the network model in step 4) to obtain a trained model; 7) Inputting the enhanced image in step 5) into the trained model to recognize the image; In step 3) and step 5), the preprocessing is to split the image into three channels of R, G, and B and perform contrast stretching to improve the contrast; then convert the RGB color space into HSV and HSI color space, and use these two color space enhancement images as components to be fused for fusion. The specific steps are as follows: a) Assume I(i,j) is an image of size M×N, where i=1,2,...,Μ; j=1,2,...,N; split the image into three channels: R, G, and B. The values of the red, green, and blue colors in the three channels are represented by I R (i,j),I G (i,j),I B (i, j) represents, then the average value of each channel pixel is R avg , G avg , B avg : Underwater has R avg <<G avg And R avg <<G avg , set the red channel to channel 3, and the blue and green channels to channels 1 and 2; b) Stretch the three channels: For channel 1 and channel 2, the stretching formula is as follows: P o =(P i -a)×(b-a) / (c-d)+d Where P o and P i are the pixels of the output and input images, respectively, c and d represent the maximum and minimum pixel values in the output image, a and b represent the minimum and maximum pixel values in the input image, respectively; For channel 3, the stretching formula is as follows: Where P o and P i are the pixels of the output and input images respectively, c represents the maximum pixel value in the output image, and a represents the minimum pixel value in the input image; c) Then convert the RGB color space into HSI and HSV color space, and perform contrast stretching in the HSI color space. The stretching formula is as follows: Where a is the minimum value of the input image pixel, b is the maximum value of the input image pixel, y is the pixel value after stretching, and x is the pixel value of the input image; d) Perform gamma correction in the HSV color space, and the correction formula is as follows: T(l)=l max (l / l max ) γ Among them l max is the maximum intensity of the input image pixel, and γ is 0.5; e) The enhanced images of the HSI and HSV color spaces are taken as components to be fused to obtain an enhanced image.
2. The underwater sea cucumber detection method combined with image enhancement according to claim 1, characterized in that: In step 4), the YOLOv4 network model uses the K-means clustering algorithm to calculate the required size of the prior box, and averages the maximum and minimum values of the corresponding scale. The learning rate adjustment method is set to the adam optimized gradient descent method, 32 images are batch processed, and iterated 400 times. Focal Loss is used as the classification loss function to reduce the problem of serious imbalance between positive and negative samples. The formula is as follows:
