A sonar fish school estimation method and system based on multi-scale morphological enhancement and segmented statistical adaptive threshold
The sonar fish swarm estimation method, which combines multi-scale morphological enhancement and piecewise statistical adaptive thresholding, solves the problems of background noise and multi-scale targets in sonar images, achieving more stable fish swarm detection and more accurate fish quantity estimation, thus improving detection accuracy and robustness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FISHERY MACHINERY & INSTR RES INST CHINESE ACADEMY OF FISHERY SCI
- Filing Date
- 2026-04-14
- Publication Date
- 2026-07-10
AI Technical Summary
Existing sonar fish detection and quantity estimation methods cannot adapt to the speckle noise, non-uniform background, multi-scale targets, range scale changes, and inaccurate quantity estimation when fish are clustered together in sonar images, resulting in unstable detection results and inaccurate quantity estimation.
An adaptive fish swarm estimation system is constructed by employing a method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding, including denoising and contrast enhancement, multi-scale top-hat enhancement, local statistical normalization, hysteresis connectivity and range-driven area threshold compensation, combined with connected component analysis and area screening.
It improves the stability and quantity estimation accuracy of fish school detection under different ranges and complex backgrounds, increases the detection accuracy and reduces the false negative and false positive rates, especially significantly reducing the quantity estimation error when fish schools overlap or are close together.
Smart Images

Figure CN122369062A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of underwater acoustic imaging and computer vision technology, and in particular to a sonar fish swarm estimation method and system based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding, which can be applied to aquaculture, fishery resource surveys and underwater monitoring scenarios. Background Technology
[0002] Currently, sonar imaging is widely used in aquaculture, fishery resource surveys, and underwater monitoring. Existing methods for fish school detection and quantity estimation mainly employ fixed threshold segmentation and single-scale filtering combined with global threshold segmentation. Some methods use simple adaptive thresholding (such as global Mean+K·Std) or differential Gaussian enhancement (DoG) for target detection, while estimating fish school numbers by counting connected components. In addition, some tools convert sonar data into images and provide desktop interactive methods for image browsing, detection, and result export, supporting the configuration of detection algorithms, area thresholds, and other parameters.
[0003] The existing technology has the following shortcomings:
[0004] Sonar images contain speckle noise and non-uniform background, which leads to unstable target contrast. Fixed thresholds or global adaptive thresholds cannot adapt to such background differences, and are prone to missed detections or false detections.
[0005] The pixel scale of the same target varies significantly under different measurement ranges. Single-scale filtering cannot take into account the enhancement of fish targets at multiple scales, resulting in large differences in detection performance under different measurement ranges.
[0006] Strong echo structures such as pool walls / boundaries are easily misdetected as fish targets, and existing methods lack targeted processing for them;
[0007] When fish schools overlap or are adjacent, a single connected component may contain multiple fish. Existing simple connected component counting methods will seriously underestimate the number of fish schools and cannot accurately estimate the actual size of the fish schools.
[0008] The threshold of existing methods cannot be adaptively adjusted with changes in radial distance (range), and cannot adapt to the background characteristics of sonar images that attenuate with distance;
[0009] Some methods lack robust cleanup of the detection results, which can easily retain noise or broken connected components, affecting the accuracy of the detection. Summary of the Invention
[0010] This invention is made to solve the above-mentioned problems. It aims to address the issues that existing sonar fish detection and quantity estimation methods cannot adapt to speckle noise, non-uniform background, multi-scale targets, range scale changes, and inaccurate quantity estimation when fish are clustered together in sonar images, thereby improving the stability of fish detection and the accuracy of quantity estimation under different ranges and complex backgrounds.
[0011] This invention provides a sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding, characterized by the following steps: Step 1, acquiring the original sonar image and performing standardization processing to obtain a standardized image; Step 2, performing denoising and contrast enhancement preprocessing on the standardized image to obtain an enhanced image; Step 3, for multiple sets of structural elements at different scales, calculating the top-cap enhancement result at each scale, and fusing the multi-scale top-cap enhancement results to construct a feature map; Step 4, performing local statistical normalization and robust quantile stretching on the feature map to obtain... Step 5: Divide the image into multiple concentric rings based on the distance from the pixel to the image center. Construct threshold bands for each concentric ring and perform hysteresis connections to obtain candidate binary images. Step 6: Perform morphological opening and closing operations on the candidate binary images to obtain cleaned binary images. Step 7: Perform connected component analysis on the cleaned binary images, and perform range scale compensation and segmented area filtering to output the target set. Step 8: Based on the preset physical area range of a single fish, infer the number of fish contained in each target connected component based on the area of each target connected component, and sum the fish count estimates of all target connected components to output the estimated fish population.
[0012] Preferably, in step 2, the denoising and contrast enhancement preprocessing includes median filtering denoising and local contrast enhancement. Median filtering denoising uses median filtering to remove speckle noise from the sonar image and uses boundary replication to process the image boundaries; local contrast enhancement involves dividing the image into multiple grid blocks, cropping and equalizing the histogram of each grid block, and using bilinear interpolation fusion at the block boundaries.
[0013] Preferably, in step 3, the calculation and fusion of the top-hat enhancement results specifically includes: selecting a set of structuring elements, performing an opening operation on the enhanced image at each scale, and then subtracting the opening operation result from the enhanced image to obtain the top-hat enhancement result at that scale; fusing the top-hat enhancement results at each scale, and taking the maximum response as the feature map.
[0014] Preferably, in step 4, the local mean and second moment of the feature map are calculated using box filtering, and the feature map is locally normalized; the normalized feature map is subjected to robust quantile stretching to obtain the 10th quantile and 90th quantile of the entire image sample, and the normalized feature map is mapped to the range [0,255] to obtain the normalized feature map.
[0015] Preferably, in step 5, the image center is set as the origin, and the image is divided into multiple concentric rings according to a preset distance interval, and a circular ROI mask is constructed. For each concentric ring, the predetermined quantile of the normalized feature map within the ROI is calculated and used as the strong threshold and weak threshold, respectively. Then, a strong mask and a weak mask are generated, the strong mask is expanded to serve as a seed growth region, and hysteresis connections are performed on the weak mask to obtain a hysteresis connection binary map. Finally, the candidate binary map and the hysteresis connection binary map are fused to obtain the final candidate binary map.
[0016] Preferably, the strong threshold and the weak threshold are the first quantile and the second quantile of the normalized feature map within each concentric ring, respectively; a one-dimensional smooth convolution is performed on the thresholds of adjacent concentric rings to suppress inter-ring jumps.
[0017] Preferably, in step 7, the range scale compensation specifically includes: setting a reference range and a current range, calculating the scale compensation factor as the square of the ratio of the reference range to the current range; setting a benchmark area threshold for each concentric ring, and performing compensation to obtain the actual area threshold of each ring; segmented area filtering includes: calculating the ring where the center point of each connected domain is located, and if the area of the connected domain falls within the actual area threshold range of the ring, then the connected domain is retained as the target, otherwise it is discarded, and finally the target set is output.
[0018] Preferably, step 8 includes: step 8-1, converting the preset single fish physical area range into a single fish pixel area range; step 8-2, for each target connected region, calculating the feasible range of the number of fish it contains; taking the average area of a single fish, calculating the fish number point estimate of the connected region; summing the fish number estimates of all target connected regions to obtain the estimated value of the total number of fish in the whole image.
[0019] Preferably, the sonar fish swarm estimation based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding in this invention further includes a pool wall processing step: obtaining the inner wall mask of the pool wall, performing an AND operation between the candidate binary image or the purified binary image and the pool wall mask to remove false detections caused by strong echoes from the pool wall.
[0020] This invention provides a sonar fish swarm estimation system based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding, comprising: an image input module for acquiring and standardizing raw sonar images; a preprocessing module for denoising and contrast enhancement of the standardized images; a feature enhancement module for calculating the top-cap enhancement results at each scale of multiple sets of structuring elements and fusing the multi-scale top-cap enhancement results to construct a feature map; a segmentation module for performing local statistical normalization and robust quantile stretching on the feature map, dividing the image into multiple concentric rings based on the distance from the pixel to the image center, constructing threshold bands for each concentric ring and performing hysteresis connections to obtain candidate binary images; a connected component and filtering module for performing morphological opening and closing operations on the candidate binary images to obtain cleaned binary images, performing connected component analysis on the cleaned binary images, performing range scale compensation and piecewise area filtering, and outputting a target set; a fish swarm estimation module for inferring the number of fish contained in each connected component based on the area interval of a single fish and outputting a fish swarm estimation value; and a result display and export module for visualizing the results and outputting a CSV file.
[0021] Technical effect
[0022] Compared with the prior art, the present invention has the following beneficial effects:
[0023] 1. Multi-scale morphological top-hat enhancement can simultaneously enhance fish targets of different scales, effectively suppress slowly changing backgrounds, and improve the visibility of weak targets. Compared with single-scale filtering, the detection accuracy of fish targets of different sizes is improved by more than 30%.
[0024] 2. By employing local statistical normalization and piecewise statistical thresholding, it can adapt to the background non-uniformity caused by radial / distance in sonar images. Compared with global threshold segmentation, the false negative rate is reduced by 25% and the false positive rate is reduced by 20%.
[0025] 3. Introducing hysteresis connection operations can effectively suppress isolated noise while preserving the connectivity of high-confidence target structures, reducing false detections caused by noise, and improving the robustness of detection results;
[0026] 4. Range-driven area threshold compensation ensures that area screening remains consistent across different ranges, solving the problem of inaccurate screening caused by changes in target pixel scale across different ranges, and maintaining the detection accuracy above 85% across different ranges.
[0027] 5. The method of inferring the number of fish from the area interval can effectively reduce the risk of underestimating the number of fish when they are clustered together. Compared with simple connected component counting, the error of fish number estimation is reduced by 40%, and the estimation accuracy is improved to more than 90% in the scenario of fish clustered together.
[0028] 6. Supports self-calibration of threshold parameters, which can automatically adjust threshold parameters when echo statistics of different water bodies and different devices drift, maintain the stability of detection results, and adapt to different application scenarios. Attached Figure Description
[0029] The above and other objects, features, and advantages of this application will become more apparent from the following detailed description of the embodiments in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the embodiments of this application to explain the application and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.
[0030] Figure 1 This is a flowchart of the sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive threshold in an embodiment of the present invention;
[0031] Figure 2 This is a comparison diagram of the CLAHE enhancement effect in embodiments of the present invention;
[0032] Figure 3 This is a comparison diagram of the multi-scale morphological enhancement effects in embodiments of the present invention;
[0033] Figure 4 This is a schematic diagram of segmented concentric rings in an embodiment of the present invention;
[0034] Figure 5 This is a schematic diagram of threshold calculation and hysteresis connection in an embodiment of the present invention;
[0035] Figure 6 This is a schematic diagram illustrating connected component extraction and quantity estimation in an embodiment of the present invention;
[0036] Figure 7 This is a block diagram of the sonar fish swarm estimation system based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding in an embodiment of the present invention. Detailed Implementation
[0037] To make the technical means, creative features, objectives and effects of this invention easy to understand, the following embodiments, in conjunction with the accompanying drawings, specifically illustrate a sonar fish swarm estimation method and system based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding.
[0038] Example
[0039] This embodiment provides a sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding.
[0040] Figure 1This is a flowchart of a sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding in an embodiment of the present invention.
[0041] like Figure 1 As shown, the sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding in this embodiment includes the following steps:
[0042] Step S1, Image Acquisition and Standardization: Scale the original sonar image to 600×600 pixels. If the input is a color image, first perform grayscale conversion. The grayscale conversion formula is:
[0043]
[0044] In the formula, (I_g(x,y)) is the grayscale image, and (R(x,y)), (G(x,y)), and (B(x,y)) are the pixel values of the red, green, and blue channels of the color image, respectively.
[0045] Step S2, Preprocessing: Noise reduction is achieved using a 3×3 median filter, contrast enhancement is performed using CLAHE, the grid size is set to 8×8, and a clipping limit (Lc=2) is applied. The specific implementation process is as follows:
[0046] Step S2-1: Median filtering for noise reduction;
[0047] The speckle noise in sonar images is removed using a 3×3 median filter, with the following formula:
[0048] In the formula, I0 is the standardized image, I d This is the denoised image. To avoid boundary artifacts, image boundaries are processed using boundary duplication:
[0049]
[0050] In the formula, W0 and H0 are the width and height of the standardized image, respectively.
[0051] Step S2-2, Local Contrast Enhancement (CLAHE):
[0052] The image is divided into 8×8 grid blocks. The histogram of each grid block is cropped and equalized to improve the visibility of weak targets in local areas. The histogram (h_t(k)) of the (t)th block is cropped as follows:
[0053]
[0054] In the formula, Lc is the cutting limit value. Calculate the cutting overflow:
[0055]
[0056] The overflow will be evenly reinjected into the histogram:
[0057]
[0058] In the formula, Used for allocating the remainder. Calculate the cumulative distribution function:
[0059] Map pixel values to a new grayscale range:
[0060]
[0061] Bilinear interpolation is used at block boundaries to fuse the mapping results of adjacent blocks. Let pixel (x, y) be located at the boundary of four adjacent blocks (t{00}, t{10}, t{01}, t{11}), with the interpolation weights as follows:
[0062]
[0063] The final enhanced image is: In the formula, f{ab} represents the mapping value of the corresponding block.
[0064] Figure 2 This is a comparison image of the CLAHE enhancement effect in an embodiment of the present invention. It shows a comparison between the original sonar image and the image enhanced by CLAHE.
[0065] Step S3, Multi-scale morphological enhancement: For multiple sets of structural elements at different scales, calculate the top-hat enhancement result at each scale, and fuse the multi-scale top-hat enhancement results to construct a feature map.
[0066] In this embodiment, a set of structure elements with odd-numbered dimensions is selected. (In this embodiment, it is) The process involves performing opening operations and top-hat enhancements on each scale, then fusing the responses with the maximum values. The specific implementation is as follows:
[0067] Select a set of structure elements with odd-numbered dimensions. For each scale k, first perform an opening operation on the enhanced image (I_e):
[0068]
[0069] The corrosion operation is as follows:
[0070]
[0071] The expansion operation is:
[0072]
[0073] In the formula, radius A collection of circular structural elements.
[0074] Calculate the cap enhancement results at this scale:
[0075]
[0076] The results of multi-scale top-hat enhancement are fused, and the maximum response is taken as the feature map:
[0077]
[0078] The pixel values of the feature map are then truncated to the range [0, 255].
[0079] .
[0080] Figure 3 This is a comparison image of the multi-scale morphological enhancement effect in an embodiment of the present invention.
[0081] It should be noted that the fusion method of the multi-scale top-hat enhancement results in step S3 is not limited to the maximum response fusion described in the above embodiments. As an alternative implementation, weighted maximum fusion can also be used:
[0082]
[0083] in For weighting coefficients at different scales, or by using normalized weighted summation:
[0084] in By adjusting the weights, targets at different scales can be highlighted.
[0085] Furthermore, the top-hat enhancement used in step S3 can be replaced with other detection feature extraction methods. For example, differential Gaussian enhancement (DoG) can also be used as a detection feature, which enhances the target by subtracting the Gaussian filtering results at different scales.
[0086] Step S4, Local Statistical Normalization: Calculate the local mean and standard deviation using a 31×31 window. After local normalization, stretch the feature by taking the 10% and 90% quantiles, mapping the feature to the range [0, 255]. The specific implementation process is as follows:
[0087] Box filtering is performed using a 31×31 window, and the local mean of the feature map (F_u) is calculated. And the second moment (q(x,y)):
[0088]
[0089] In the formula, Given the set of pixels within the window. Calculate the local variance and standard deviation:
[0090]
[0091] in To avoid dividing by small constants of 0.
[0092] Local normalization of the feature map:
[0093]
[0094] Robust quantile stretching is performed on the normalized feature map, and the entire image (or the detection ROI) sample set is taken. 10th and 90th percentiles:
[0095]
[0096] Map the normalized feature map to the range [0, 255]:
[0097]
[0098] Segmented statistical thresholding and hysteresis connection: The image is divided into multiple concentric rings based on the distance from the pixel to the image center. Threshold bands are constructed for each concentric ring and hysteresis connection is performed to obtain candidate binary images.
[0099] In this embodiment, the image is divided into 10 concentric rings, each ring having a... Set to 0.5. The threshold is set to 2.0, with a strong threshold at the 90th quantile and a weak threshold at the 80th quantile. A smoothing kernel of [1 / 4, 1 / 2, 1 / 4] is used to smooth the thresholds before hysteresis connections are applied. The specific implementation process is as follows:
[0100] Step S5-1, concentric ring segmentation mapping:
[0101] Let the center of the image be Calculate the distance from the pixel to the center:
[0102]
[0103] Let the radius of the largest inscribed circle of the image be... If the range is unknown, divide the image into 10 concentric rings, with the ring indices as follows:
[0104]
[0105] If the range (L) (in meters) is known, then the mapping is performed in 1-meter loops:
[0106]
[0107] The ring index is then truncated to the range [0,9].
[0108] Define a circular ROI mask to perform detection only within the inscribed circle:
[0109]
[0110] in This is an indicator function that takes the value 1 if the condition is met, and 0 otherwise.
[0111] Figure 4 This is a schematic diagram of segmented concentric rings in an embodiment of the present invention. It shows the ROI region, which is divided into multiple concentric rings with the image center as the origin and at distance intervals.
[0112] Step S5-2, Segmented K-threshold (pixel-level threshold band):
[0113] For each ring (r), configure parameters Construct pixel-level threshold bands:
[0114] Generate candidate binary images:
[0115]
[0116] Step S5-3, Segmented strong and weak thresholds and hysteresis connections
[0117] For each ring (r), the 90th and 80th quantiles of the normalized feature map (U) within the ROI are used as the strong threshold (T_s(r)) and weak threshold (T_w(r)):
[0118]
[0119] Perform a one-dimensional smooth convolution on the threshold to suppress inter-ring transitions:
[0120]
[0121] The boundary areas are handled using boundary copying: .
[0122] Generate strong and weak masks:
[0123]
[0124] The strong mask was expanded to a 3×3 size to serve as the seed growth zone:
[0125]
[0126] Perform a hysteresis join to obtain a binary graph with the hysteresis join:
[0127]
[0128] The candidate binary image is fused with the binary image after hysteresis connection to obtain the final candidate binary image:
[0129]
[0130] Figure 5 This is a schematic diagram of threshold calculation and hysteresis connection in an embodiment of the present invention.
[0131] It should be noted that the segmented statistics method based on concentric rings in step S5 is not limited to the method described in the above embodiments. As an alternative implementation, the segmented statistics can also be extended to a polar coordinate grid of "sector + ring" to achieve azimuth non-uniform compensation. The index mapping between the ring and the sector is as follows:
[0132]
[0133] in The distance from the pixel to the center. The azimuth angle of the pixel. The distance between the rings is the interval. The angular interval of the sector is used to adapt to the background non-uniformity in the angular direction.
[0134] Furthermore, the segmented statistical threshold parameters in step S5 can be self-calibrated in unlabeled or weakly labeled scenarios. As an alternative implementation, the threshold band parameter for each loop can be set as an optimizable variable. Construct an objective function for self-calibration:
[0135]
[0136] in The mean of the binary graph within the (r)th ring is... The expected target percentage for the (r)th ring. The total variation of the binary image is used to suppress noise. These are the weighting coefficients, and feasible region constraints are applied simultaneously:
[0137]
[0138] in The upper bound of the threshold, This is the minimum width of the threshold band, which allows the segmented threshold band to be automatically calibrated and maintain smoothness between rings during environmental drift.
[0139] Step S6, Morphological Cleaning: Perform morphological opening and closing operations on the candidate binary image to obtain a cleaned binary image. In this embodiment, 3×3 elliptical structuring elements are used for opening operations, and 5×5 elliptical structuring elements are used for closing operations. The specific implementation process is as follows:
[0140] The candidate binary image is opened using a 3×3 elliptical structuring element to remove noise.
[0141]
[0142] Then, a 5×5 elliptical structuring element is used to perform a closing operation to fill the holes and connect the broken connected components:
[0143]
[0144] In the formula, the binary opening operation is: Binary closing operation is Binary erosion operation is Binary dilation operation is .
[0145] It should be noted that the present invention may also include a pool wall treatment step. As an alternative implementation, a boundary detection module can be added to output the inner wall mask (M) of the pool wall. b Constrain the ROI at each stage of the detection process, and perform a bitwise AND operation between the binary image and the pool wall mask:
[0146]
[0147] This eliminates false detections caused by strong echoes from the pool wall.
[0148] Step S7, Connectivity Analysis and Piecewise Area Constraint: Perform connectivity analysis on the purified binary graph, and then perform range scale compensation and piecewise area filtering to output the target set. The specific implementation process is as follows:
[0149] The purified binary graph (B3) is labeled with 8-neighbor connected components to obtain the set of connected components. Calculate the area for each connected component. , outer frame and center point The outer bounding box is calculated as follows:
[0150]
[0151]
[0152]
[0153] Step S7-1, Range Scale Compensation:
[0154] Given a reference range (L0=4m) and a current range (L=6m), the pixel area of the same object at different ranges follows an inverse square relationship. The scale compensation factor is:
[0155]
[0156] In this embodiment, the scale compensation factor (s(L)=(4 / 6)^2=4 / 9) is used to set a reference area threshold for each ring (r). The compensated area threshold is:
[0157]
[0158]
[0159] If range information is unavailable, the reference area threshold is used directly. In this embodiment, the reference area threshold is set to: (A) for Ring 0 to Ring 2. min 0 (r)=10), (A max 0 (r)=50); Ring 3~Ring 5 (A min 0 (r)=20), (A max 0 (r)=100); Ring 6~Ring 9 (A min 0 (r)=30), (A max 0 (r)=200).
[0160] Step S7-2, Segmented Area Filtering:
[0161] For each connected component (i), calculate the ring containing its center point. If the area of the connected region satisfies If the condition is met, the connected component is retained as the target; otherwise, it is discarded. The final output target set is:
[0162]
[0163] Step S8: Based on the preset physical area range of a single fish, the number of fish contained in each target connected region is inferred from the area of each target connected region, and the fish number estimates of all target connected regions are summed to output the estimated value of the fish population.
[0164] In this embodiment, the physical area range of a single fish is ([20,50]) cm². The number of fish is estimated by inversely calculating the area of each connected region. The specific implementation process is as follows:
[0165] Step S8-1, Single fish area range (physical quantity → pixel quantity)
[0166] Let the physical area range of a single fish be... (Unit: cm²) (In this embodiment, it is ([20,50]) cm²), minimum side pixel count of the reference image (P=\min(W,H)), current range is L (m), and the conversion factor for pixels / cm is:
[0167]
[0168] The pixel area range of a single fish is:
[0169]
[0170] Step S8-2, reverse the estimation of fish number intervals and points:
[0171] The area (A) of each target connected region i ), calculate the feasible interval for the number of fish it contains:
[0172]
[0173]
[0174] Take the average area of a single fish:
[0175]
[0176] The estimated number of fish in this connected component is:
[0177]
[0178] The total number of fish in the entire graph is estimated as the sum of the fish count estimates for all target connected components:
[0179]
[0180] Optionally, a probabilistic model can be introduced for more accurate estimation: Let the area of a single fish be a random variable (A_f) (mean). ,variance The connected component consists of (n) superimposed fish and includes background error. Then the distribution of the area of the connected region is as follows:
[0181]
[0182] Given the prior probability (P(n)) of the number of fish, the number of fish is obtained through maximum a posteriori estimation:
[0183]
[0184] Where the posterior probability is .
[0185] Figure 6 This is a schematic diagram illustrating connected component extraction and quantity estimation in an embodiment of the present invention.
[0186] This embodiment also provides a sonar fish swarm estimation system with multi-scale morphological enhancement and piecewise statistical adaptive thresholding.
[0187] Figure 7 This is a block diagram of the sonar fish swarm estimation system based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding in an embodiment of the present invention.
[0188] like Figure 7 As shown, this system includes the following modules:
[0189] The image input module acquires the original sonar image using the steps in S1 of this embodiment and performs standardization processing.
[0190] The preprocessing module uses the steps in S2 of this embodiment to denoise and enhance the contrast of the standardized image.
[0191] The feature enhancement module uses the steps in S3 of this embodiment to collect multiple sets of structural elements at different scales, calculates the top-hat enhancement result at each scale, and fuses the multi-scale top-hat enhancement results to construct a feature map.
[0192] The segmentation module performs local statistical normalization and robust quantile stretching on the feature map using the steps in S4-S5 of this embodiment, and divides the image into multiple concentric rings based on the distance from the pixel to the image center. Threshold bands are constructed for each concentric ring and hysteresis connections are performed to obtain candidate binary images.
[0193] The connected component and filtering module performs morphological opening and closing operations on the candidate binary graph using the steps in S6-S7 of this embodiment to obtain a cleaned binary graph. It then performs connected component analysis on the cleaned binary graph, performs range scale compensation and segmented area filtering, and outputs the target set.
[0194] The fish population estimation module uses the steps in S8 of this embodiment to infer the number of fish contained in each connected region based on the area interval of a single fish, and outputs an estimated value of the fish population.
[0195] The results display and export module visualizes the results and outputs them as CSV files.
[0196] The above embodiments are preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention.
[0197] Comparative Example 1: This comparative example uses a global threshold segmentation method.
[0198] This comparative example uses the existing global Mean+K·Std threshold segmentation method, with K set to 2. Other steps are the same as in the above embodiment. The detection results are compared.
[0199] The detection accuracy rate of the above embodiment is 92%, and the fish population estimation error is 8%.
[0200] The detection accuracy of Comparative Example 1 was 68%, and the fish population estimation error was 35%. The missed detections were mainly concentrated on weak targets at a distance and fish that were stuck together, while the false detections were mainly due to strong echoes from the pool wall.
[0201] Comparative Example 2: Using a single-scale morphological enhancement method
[0202] This comparative example uses single-scale (structural element size 7) morphological cap reinforcement. Other steps are the same as in the above embodiments. The test results are compared:
[0203] The above embodiments achieve a detection accuracy of 85% for small fish (pixel area < 20) and 95% for large fish (pixel area > 100).
[0204] Comparative Example 2 showed a detection accuracy of 55% for small-sized fish and 90% for large-sized fish, indicating that multi-scale enhancement can effectively improve the detection effect of targets of different sizes.
Claims
1. A sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding, characterized in that, Includes the following steps: Step 1: Acquire the original sonar image and perform standardization processing to obtain a standardized image; Step 2: Perform noise reduction and contrast enhancement preprocessing on the standardized image to obtain the enhanced image; Step 3: For multiple sets of structural elements at different scales, calculate the top-cap enhancement result at each scale, and fuse the top-cap enhancement results at multiple scales to construct a feature map; Step 4: Perform local statistical normalization and robust quantile stretching on the feature map to obtain a normalized feature map; Step 5: Divide the image into multiple concentric rings based on the distance from the pixel to the image center, construct a threshold band for each concentric ring and perform hysteresis connection to obtain a candidate binary image; Step 6: Perform morphological opening and closing operations on the candidate binary image to obtain a cleaned binary image; Step 7: Perform connected component analysis on the purified binary graph, and perform range scale compensation and segmented area filtering to output the target set; Step 8: Based on the preset physical area range of a single fish, infer the number of fish contained in each target connected region according to the area of each target connected region, sum the estimated number of fish in all target connected regions, and output the estimated number of fish in the fish group.
2. The sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding as described in claim 1, characterized in that: In step 2, the denoising and contrast enhancement preprocessing includes median filtering for denoising and local contrast enhancement. The median filtering denoising method removes speckle noise from the sonar image and uses boundary replication to process the image boundary. The local contrast enhancement involves dividing the image into multiple grid blocks, cropping and equalizing the histogram of each grid block, and then using bilinear interpolation to fuse the blocks at their boundaries.
3. The sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding as described in claim 1, characterized in that: In step 3, the calculation and fusion of the top-hat enhancement results specifically include: selecting a set of structuring elements, performing an opening operation on the enhanced image at each scale, and then subtracting the opening operation result from the enhanced image to obtain the top-hat enhancement result at that scale; fusing the top-hat enhancement results at each scale, and taking the maximum response as the feature map.
4. The sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding as described in claim 1, characterized in that: In step 4, box filtering is used to calculate the local mean and second moment of the feature map, and the feature map is locally normalized; robust quantile stretching is performed on the normalized feature map to obtain the 10% quantile and 90% quantile of the entire image sample, and the normalized feature map is mapped to the range [0, 255] to obtain the normalized feature map.
5. The sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding as described in claim 1, characterized in that: In step 5, the image center is set as the origin, and the image is divided into multiple concentric rings according to a preset distance interval, and a circular ROI mask is constructed. For each concentric ring, the predetermined quantile of the normalized feature map within the ROI is calculated and used as the strong threshold and weak threshold, respectively. Then, a strong mask and a weak mask are generated, the strong mask is expanded to serve as a seed growth region, and hysteresis connections are performed on the weak mask to obtain a hysteresis connection binary map. Finally, the candidate binary map is fused with the hysteresis connection binary map to obtain the final candidate binary map.
6. The sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding as described in claim 5, characterized in that: The strong threshold and weak threshold are the first quantile and the second quantile of the normalized feature map within each concentric ring, respectively; a one-dimensional smooth convolution is performed on the thresholds of adjacent concentric rings to suppress inter-ring jumps.
7. The sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding as described in claim 1, characterized in that: In step 7, the range scale compensation specifically includes: setting a reference range and a current range, calculating the scale compensation factor as the square of the ratio of the reference range to the current range; setting a reference area threshold for each concentric ring, and performing compensation to obtain the actual area threshold of each ring; The segmented area filtering includes: calculating the ring where the center point of each connected component is located; if the area of the connected component falls within the actual area threshold range of the ring, the connected component is retained as the target; otherwise, it is discarded, and the target set is finally output.
8. The sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding according to claim 1, characterized in that: Step 8 includes: Step 8-1: Convert the preset single fish physical area range into a single fish pixel area range; Step 8-2: For each target connected component, calculate the feasible interval of the number of fish it contains; take the average area of a single fish and calculate the fish count point estimate of that connected component; sum the fish count estimates of all target connected components to obtain the estimated fish population of the entire map.
9. The sonar fish swarm estimation method based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding as described in claim 1, characterized in that, Also includes: Pool wall processing steps: Obtain the inner wall mask of the pool wall, and perform an AND operation between the candidate binary image or the purified binary image and the pool wall mask to remove false detections caused by strong echoes from the pool wall.
10. A sonar fish swarm estimation system based on multi-scale morphological enhancement and piecewise statistical adaptive thresholding, characterized in that, include: The image input module is used to acquire raw sonar images and perform standardization processing; The preprocessing module is used to denoise and enhance the contrast of the standardized image. The feature enhancement module is used to collect multiple sets of structural elements at different scales, calculate the top-hat enhancement result at each scale, and fuse the multi-scale top-hat enhancement results to construct a feature map. The segmentation module is used to perform local statistical normalization and robust quantile stretching on the feature map, and divide the image into multiple concentric rings based on the distance from the pixel to the image center. Threshold bands are constructed for each concentric ring and hysteresis connections are performed to obtain candidate binary images. The connected component and filtering module is used to perform morphological opening and closing operations on the candidate binary graph to obtain a cleaned binary graph, and to perform connected component analysis on the cleaned binary graph, as well as range scale compensation and segmented area filtering, and output the target set. The fish population estimation module is used to infer the number of fish contained in each connected region based on the area range of a single fish, and outputs an estimated value of the fish population. The results display and export module is used to visualize the results and output CSV files.