Lightweight style consistency preprocessing method and system for light-stained sperm microscopic images
By combining color normalization, local contrast enhancement, and brightness correction in a preprocessing method, the problems of staining differences and uneven brightness in lightly stained sperm micrographs were solved, improving image quality and model detection performance, and achieving lightweight image preprocessing results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHAOXING BEYOND MEDICAL TECH CO LTD
- Filing Date
- 2026-01-23
- Publication Date
- 2026-05-29
AI Technical Summary
Existing technologies suffer from staining differences, uneven brightness, and blurred boundaries when processing lightly stained sperm microscopic images, leading to decreased detection and segmentation accuracy. Furthermore, increasing the training dataset requires significant manpower, resources, and costs.
The preprocessing method combines color normalization, local contrast enhancement, and brightness correction. This includes converting the lightly stained image from the RGB color space to the Lab color space, performing color normalization and local contrast enhancement, and performing brightness correction based on the structural clarity and background stability of the sperm head, tail, and boundary regions.
Without increasing the number of samples or training burden, it significantly improved the quality of lightly stained sperm microscopic images, enhancing the detection performance of subsequent models, especially the segmentation accuracy and recall of sperm heads and tails.
Smart Images

Figure CN122115590A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a lightweight style consistency preprocessing method and system for lightly stained sperm micrographs. Background Technology
[0002] Sperm morphology analysis is a routine and crucial step in medical imaging and assisted reproductive technologies, as its results directly impact sperm quality and fertilization potential. Traditional methods of sperm morphology analysis rely on manual microscopic observation and counting, which is not only time-consuming and labor-intensive but also heavily influenced by the operator's subjective experience, leading to inconsistent and unobjective results.
[0003] To achieve more efficient and objective sperm morphology analysis, existing technologies utilize deep learning methods for automatic detection and segmentation of sperm microscopic images. Common deep learning methods include feature extraction and classification based on Convolutional Neural Networks (CNNs), semantic segmentation based on encoder-decoder structures such as U-Net, and object detection and instance segmentation based on models such as Mask R-CNN and YOLO. These methods typically achieve high detection and segmentation accuracy on standard, clearly stained sperm images and are increasingly being applied to the automatic identification of sperm head, tail, and overall morphology.
[0004] However, in the actual process of using deep learning methods to automatically detect and segment sperm microscopic images, the quality of sperm images often varies significantly due to differences in the amount of staining agent used, batch differences, microscope lighting conditions, and imaging equipment parameters. Lightly stained samples and samples with blurred boundaries are particularly common, leading to decreased detection and segmentation accuracy and increased false negative rate, especially in the identification of details at the edge of the sperm head and tail.
[0005] To mitigate the decline in recognition performance caused by staining in sperm micrographs, one approach is to increase the training dataset to improve model performance. This can be achieved by collecting additional sperm micrograph samples from different batches and under different staining conditions, or by using data augmentation to simulate various staining intensities. While this approach can alleviate the impact of staining differences on model recognition to some extent, it also has significant drawbacks. First, large-scale collection and annotation of sperm micrographs not only consumes substantial human and material resources but also increases the annotation burden and costs. Second, even with increased sample numbers, the inherent low contrast and blurred boundaries of lightly stained images cannot be fundamentally resolved, still leading to missed detections and missegmentation. Finally, dataset expansion significantly increases the overhead of model training, adding an additional training burden.
[0006] To avoid increasing the training dataset, image preprocessing is sometimes introduced before model training. Image preprocessing improves the quality of lightly stained sperm micrographs, thereby enhancing the recognition performance of subsequent models. However, existing image preprocessing methods often have limited effectiveness when processing lightly stained sperm micrographs, struggling to address issues such as staining differences, uneven brightness, and blurred boundaries. Summary of the Invention
[0007] Therefore, the technical problem to be solved by the present invention is to overcome the shortcomings of the prior art and provide a lightweight style consistency preprocessing method and system for lightly stained sperm microscopic images. This method can solve staining differences, brightness inconsistencies and boundary blurring through image preprocessing without increasing the number of samples or additional training burden, thereby improving the overall quality of lightly stained sperm microscopic images and improving the detection performance of subsequent models.
[0008] To address the aforementioned technical problems, this invention provides a lightweight style consistency preprocessing method for lightly stained sperm micrographs, comprising: A lightly stained sperm microscopic image is obtained, and the lightly stained sperm microscopic image is normalized according to the darkly stained sperm microscopic image to obtain a normalized lightly stained sperm microscopic image. The normalized light-stained sperm micrograph is enhanced by local contrast enhancement based on the local contrast of the sperm head, tail and boundary regions to obtain an enhanced light-stained sperm micrograph. Brightness correction was performed on the enhanced light-stained sperm micrographs based on the clarity of the sperm head, midpiece, and tail structures and background stability to obtain a light-stained sperm micrograph after lightweight style consistency preprocessing.
[0009] Further, the step of color normalizing the light-stained sperm micrograph based on the dark-stained sperm micrograph includes: The lightly stained sperm microscopic images to be processed were converted from the RGB color space to the Lab color space, and the mean and standard deviation of the L, a, and b channels were calculated respectively; let the mean of the lightly stained sperm microscopic images be denoted as . , , This represents the mean value of the L channel. Let be the mean of channel a. Let be the mean of channel b; let the standard deviation of the lightly stained sperm micrograph be . , The standard deviation of channel L. Let be the standard deviation of channel a. The standard deviation of channel b; Obtain the mean and standard deviation of the microscopic images of darkly stained sperm, and perform color normalization on each pixel value in the microscopic images of lightly stained sperm: , In the formula, This represents any pixel value in the color-normalized lightly stained sperm micrograph. This represents any pixel value in the original lightly stained sperm micrograph. The mean value is the value of the microscopic image of the darkly stained sperm. The standard deviation of the microscopic image of deeply stained sperm.
[0010] Further, the step of enhancing the local contrast of the normalized lightly stained sperm micrograph based on the local contrast of the sperm head, tail, and boundary regions includes: Set a candidate set for the shear threshold and a candidate set for the partitioning window. Let the candidate set for the shear threshold be { , Let N1 be the set of the i-th shearing threshold, and N1 be the number of shearing thresholds set; let the candidate set for dividing the window be { , For the j-th partition window, The length of the j-th partition window is set. N1 represents the height of the j-th partitioning window, and N2 represents the number of partitioning windows. Extract the L channel of the normalized lightly stained sperm micrograph, denoted as ,calculate The corresponding gradient magnitude diagram is as follows: , In the formula, G is The corresponding gradient magnitude map, This indicates calculating the gradient. express The norm; The edge set is constructed based on the gradient magnitude map as follows: , In the formula, Let x represent the edge set and x represent the pixel value. This represents the gradient magnitude at pixel value x. As a preset constant, To take the median, This is the absolute median difference; Let the non-edge regions be the background set, denoted as B. , This is a set difference operation; For any cut threshold in the candidate set of cut thresholds and any partition window in the candidate set of partition windows, calculate the enhanced pixel value as follows: , In the formula, To use contrast-limited adaptive histogram equalization for each Histogram equalization is performed independently on the grid, and the shearing threshold for the local histogram is set to... , This represents the enhanced pixel value; Calculate all on the edge set and background set To optimize pixel enhancement, the cropping threshold and segmentation window that achieve the best pixel enhancement effect are selected as the final cropping threshold and final segmentation window. Use the final shearing threshold and the final splitting window to... Histogram equalization is performed, and the portion exceeding the final shearing threshold is proportionally distributed to the remaining gray levels according to the gray-level histogram of the edge set.
[0011] Furthermore, all are calculated on the edge set and the background set. To optimize pixel enhancement, the cropping threshold and segmentation window that provide the best pixel enhancement effect are selected as the final cropping threshold and final segmentation window. Specifically: Calculate all The overall score is: , In the formula, express The corresponding overall score This represents the mean value over the set of edges. This represents the mean value over the background set. The standard deviation is expressed on the background set. As a preset constant, for The corresponding gradient magnitude map, for Brightness saturation pixel ratio, , , , These are preset coefficients; Choose to The maximum shear threshold and the final split window are used as the final shear threshold and the final split window.
[0012] Furthermore, the aforementioned The calculation method is as follows: calculate middle The proportion, in the formula, for The maximum pixel value in This is a preset constant.
[0013] Furthermore, the portion exceeding the final shearing threshold is proportionally distributed to the remaining gray levels based on the gray-level histogram of the edge set, specifically as follows: The final shearing threshold and the final segmentation window will be used to... The overflow amount generated after truncating the histogram within each grid according to the final shearing threshold following histogram equalization is denoted as . Within the same grid, the gray-level histogram of the edge set is statistically analyzed and denoted as... The weights are calculated as follows: , In the formula, g represents the grayscale value. This represents the weight assigned to the grayscale value g. For preset coefficients, This is a preset constant; The overflow will be allocated proportionally as follows: , In the formula, This is the amount of overflow allocated to the grayscale value g.
[0014] Furthermore, the brightness correction of the enhanced lightly stained sperm micrograph based on the clarity of the sperm head, midpiece, and tail structures and background stability specifically involves: Set a candidate set of brightness correction parameters, denoted as . , , This is the kth brightness correction parameter, where K is the number of brightness correction parameters set. Extract the L channel of the enhanced lightly stained sperm micrograph, using each Gamma correction is performed to obtain the corrected L channel, denoted as... ; Calculate on the edge set and the background set Calculate all structural clarity, background fluctuations, and saturation percentages. The corresponding Score for differences in structural clarity, background variability, and saturation percentage: , In the formula, for The significance score of the difference express Structural clarity, express Background fluctuations, express saturation percentage , These are preset coefficients; When the If the difference is less than a preset threshold, it is considered insignificant. In this case, the deep learning model used in subsequent sperm detection and segmentation tasks is applied. Perform a fast forward inference to obtain the average confidence score, denoted as . A selection function for brightness correction parameters is constructed when the differences are not significant, and the selected brightness correction parameters are used as the final brightness correction parameters; when the... When the difference is greater than or equal to a preset threshold, it is considered significant. At this time, a selection function for the brightness correction parameter when the difference is significant is constructed, and the selected brightness correction parameter is used as the final brightness correction parameter. The enhanced lightly stained sperm micrographs were gamma-corrected using the final brightness correction parameters.
[0015] Furthermore, the aforementioned The calculation methods for structural sharpness, background fluctuation, and saturation ratio are as follows: , , ; In the formula, This represents the mean value over the set of edges. The standard deviation is expressed on the background set. for The percentage of pixels with saturated brightness.
[0016] Furthermore, the selection function for the brightness correction parameter when the difference is not significant is: , In the formula, This is the selection function for the brightness correction parameters when the difference is not significant, and argmax represents the function that takes the maximum value. , , , , Represents the normalized result , , , , These are preset coefficients; The function for selecting the brightness correction parameter when the difference is significant is: , In the formula, This is a function for selecting the brightness correction parameters when the differences are significant.
[0017] This invention also provides a lightweight style consistency preprocessing system for lightly stained sperm micrographs, comprising: The image acquisition module is used to acquire microscopic images of lightly stained sperm. The normalization module is used to normalize the color of the light-stained sperm micro-image based on the dark-stained sperm micro-image to obtain the normalized light-stained sperm micro-image. An enhancement module is used to enhance the local contrast of the normalized light-stained sperm micrograph based on the local contrast of the sperm head, tail, and boundary regions, to obtain an enhanced light-stained sperm micrograph. The brightness correction module is used to perform brightness correction on the enhanced light-stained sperm micrograph based on the clarity of the sperm head, midpiece, and tail structures and the stability of the background, so as to obtain a light-stained sperm micrograph after lightweight style consistency preprocessing.
[0018] Compared with the prior art, the above-described technical solution of the present invention has the following advantages:
[0019] This invention achieves the unification and enhancement of lightly stained sperm microscopic images by combining color normalization with darkly stained sperm microscopic images, enhancing local contrast by combining local contrast of sperm head, tail, and boundary regions, and correcting brightness by improving the clarity of sperm head, midpiece, and tail structures and background stability. It can solve staining differences, uneven brightness, and blurred boundaries without relying on additional data expansion or increasing model training burden, thereby improving the overall quality of sperm microscopic images. Attached Figure Description
[0020] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings, wherein: Figure 1 This is a flowchart of a method in a preferred embodiment of the present invention. Detailed Implementation
[0021] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.
[0022] Reference Figure 1 As shown, this invention discloses a lightweight style consistency preprocessing method for lightly stained sperm micrographs, comprising the following steps: S1: Obtain microscopic images of lightly stained sperm.
[0023] S2: Normalize the light-stained sperm micrograph based on the dark-stained sperm micrograph to obtain a normalized light-stained sperm micrograph.
[0024] S2-1: Convert the light-stained sperm microscopic image to be processed from the RGB color space to the Lab color space, and calculate the mean and standard deviation of the L, a, and b channels respectively; let the mean of the light-stained sperm microscopic image be denoted as . , , This represents the mean value of the L channel. Let be the mean of channel a. Let be the mean of channel b; let the standard deviation of the lightly stained sperm micrograph be . , The standard deviation of channel L. Let be the standard deviation of channel a. is the standard deviation of channel b.
[0025] S2-2: Obtain the mean and standard deviation of the microscopic images of darkly stained sperm, and perform color normalization on each pixel value in the microscopic images of lightly stained sperm. , In the formula, This represents any pixel value in the color-normalized lightly stained sperm micrograph. This represents any pixel value in the original lightly stained sperm micrograph. The mean value is the value of the microscopic image of the darkly stained sperm. The standard deviation of the microscopic image of deeply stained sperm.
[0026] By performing color normalization, the differences in color distribution caused by different batches and experimental conditions can be eliminated, so that the light-stained samples can maintain the same overall color as the dark-stained samples.
[0027] S3: The normalized light-stained sperm micrograph is locally contrast-enhanced based on the local contrast of the sperm head, tail, and boundary regions to obtain an enhanced light-stained sperm micrograph.
[0028] S3-1: Set the candidate set for the shearing threshold and the candidate set for the partitioning window. These sets can be adjusted based on the actual lightly stained sperm micrographs. Let the candidate set for the shearing threshold be { , Let N1 be the set of the i-th shearing threshold, and N1 be the number of shearing thresholds set; let the candidate set for dividing the window be { , For the j-th partition window, The length of the j-th partition window is set. N1 represents the height of the j-th partition window, and N2 represents the number of partition windows.
[0029] S3-2: Extract the L channel of the normalized lightly stained sperm micrograph, denoted as... ,calculate The corresponding gradient magnitude diagram is as follows: , In the formula, G is The corresponding gradient magnitude map, This indicates calculating the gradient. express The norm of .
[0030] S3-3: Construct the edge set based on the gradient magnitude map as follows: , In the formula, Let x represent the edge set and x represent the pixel value. This represents the gradient magnitude at pixel value x. As a preset constant, To take the median, This is the absolute median difference; Let the non-edge regions be the background set, denoted as B. , This is a set difference operation.
[0031] S3-4: For any shearing threshold in the candidate set of shearing thresholds and any partitioning window in the candidate set of partitioning windows, calculate the enhanced pixel value as follows: , In the formula, To use Contrast Limited Adaptive Histogram Equalization (CLAHE) for each Histogram equalization is performed independently on the grid, and the shearing threshold for the local histogram is set to... , This represents the enhanced pixel value.
[0032] S3-5: Calculate all values on the edge set and the background set. To optimize pixel enhancement, the cropping threshold and segmentation window that provide the best pixel enhancement effect are selected as the final cropping threshold and final segmentation window.
[0033] S3-5-1: Calculate all The overall score is: , In the formula, express The corresponding overall score This represents the mean value over the edge set (E). This represents the mean value over the background set (B). This represents the standard deviation over the background set (B). As a preset constant, for The corresponding gradient magnitude map, i.e. , for Brightness saturation pixel ratio, , , , For preset coefficients, , , , , The value should be adjusted according to the actual situation; Used to indicate structural separability Used to indicate edge sharpness Used to indicate the degree of background noise amplification This is a saturation penalty term.
[0034] The calculation method is as follows: Calculate middle The proportion, in the formula, for The maximum pixel value in As a preset constant, The value can be adjusted according to the actual situation.
[0035] S3-5-2: Select to make The maximum shear threshold and the final split window are used as the final shear threshold and the final split window.
[0036] Lightweight search on the candidate sets of shearing thresholds and dividing windows avoids over- or under-enhancement caused by fixed shearing thresholds and fixed meshes under different light staining intensities, noise levels, and tail filament structures. The final shearing threshold and dividing window are adaptively determined by the structural clarity and background stability of the input lightly stained sperm micrograph. This approach balances head boundary enhancement, tail filament visibility, and avoids excessive background noise amplification under different light staining intensities, thereby improving structural visibility and suppressing ineffective enhancement of pure background grayscale, resulting in clearer target-background separation.
[0037] S3-6: Use the final shearing threshold and the final segmentation window to... Histogram equalization is performed, and the portion exceeding the final shearing threshold is proportionally distributed to the remaining gray levels according to the gray-level histogram of the edge set.
[0038] The final shearing threshold and the final segmentation window will be used to... The overflow amount generated after truncating the histogram within each grid according to the final shearing threshold following histogram equalization is denoted as . , In the formula, This indicates that the final shearing threshold and the final splitting window are used to... After histogram equalization, the histogram within each grid cell is used to count the number of pixels with a gray value of g in that grid cell. is the final shearing threshold, and max is the maximum value.
[0039] With General Instead of uniformly distributing grayscale values across all gray levels, this invention introduces edge weights related to sperm structure for targeted redistribution. Specifically, the grayscale histogram of the edge set within the same grid is statistically analyzed and denoted as... The weights are calculated as follows: , In the formula, g represents the grayscale value. This represents the weight assigned to the grayscale value g. For preset coefficients, As a preset constant, and The value should be adjusted according to the actual situation; The overflow will be allocated proportionally as follows: , In the formula, This is the amount of overflow allocated to the grayscale value g. By proportionally allocating the overflow, the redistribution can be more biased towards the grayscale ranges related to the head edges and tail linear structures, thereby improving structural visibility while suppressing ineffective enhancement of pure background grayscale.
[0040] S4: The enhanced light-stained sperm micrograph is brightness corrected based on the clarity of the sperm head, midpiece, and tail structures and the stability of the background to obtain a light-stained sperm micrograph after lightweight style consistency preprocessing.
[0041] S4-1: Set the candidate set of brightness correction parameters, denoted as... , , This is the k-th brightness correction parameter, where K is the number of brightness correction parameters set; in this embodiment, The value range of is [0.6, 0.95], and the value range of K is [3, 5], to ensure the lightweight and real-time nature of the parameter search process.
[0042] S4-2: Extract the L channel of the enhanced lightly stained sperm micrograph, using each Gamma correction is performed to obtain the corrected L channel, denoted as... ; Any pixel value in: , In the formula, for Any pixel value in , which is any pixel value in the enhanced lightly stained sperm micrograph.
[0043] S4-3: Calculate on the edge set (E) and the background set (B) Structural sharpness, background variability, and saturation percentage are calculated, with the edge set (E) and background set (B) varying in different ways. The evaluation process remains unchanged to ensure that each candidate The evaluation indicators are comparable within the same reference area.
[0044] The calculation methods for structural sharpness, background fluctuation, and saturation ratio are as follows: , , ; In the formula, This represents the mean value over the edge set (E). This represents the standard deviation over the background set (B). for The percentage of pixels with saturated brightness.
[0045] S4-4: Calculate all The corresponding Score for differences in structural clarity, background variability, and saturation percentage: , In the formula, for The significance score of the difference express Structural clarity, express Background fluctuations, express saturation percentage , For preset coefficients, , The value should be adjusted according to the actual situation.
[0046] S4-5: When the above If the difference is less than a preset threshold (the preset threshold can be adjusted based on actual conditions), it is considered insignificant. In this case, without increasing the training load, the deep learning model used in subsequent sperm detection and segmentation tasks is applied. Perform a fast forward inference to obtain the average confidence score, denoted as . , The average score of the candidate boxes or masks can be used as a feedback term for model adaptation. A selection function for brightness correction parameters when the differences are not significant is constructed, and the selected brightness correction parameters are used as the final brightness correction parameters. The selection function for brightness correction parameters when the differences are not significant is as follows: , In the formula, This is the selection function for the brightness correction parameters when the difference is not significant, and argmax represents the function that takes the maximum value. , , , , Represents the normalized result , , , In this embodiment, , , , Normalize to [0,1] to avoid the influence of differences in the dimensions of different indicators on the weight setting. For preset coefficients, The value should be adjusted according to the actual situation.
[0047] When the When the difference is greater than or equal to a preset threshold, it is considered significant. In this case, a selection function for the brightness correction parameters when the difference is significant is constructed, and the selected brightness correction parameters are used as the final brightness correction parameters. The selection function for the brightness correction parameters when the difference is significant is as follows: , In the formula, This is a selection function for the brightness correction parameters when the differences are significant. The average confidence level is not calculated when the differences are significant in order to reduce computational overhead.
[0048] In this embodiment, when the number of pixels in the edge set is lower than a preset threshold or saturation ratio... When the preset threshold is exceeded, to avoid evaluation instability, the preset brightness correction parameter (e.g., 0.85) can be used as the brightness correction parameter, or the candidate set can be narrowed down. Then choose again.
[0049] S4-6: Perform Gamma correction (brightness correction) on the enhanced light-stained sperm micrograph using the final brightness correction parameters to obtain a light-stained sperm micrograph after lightweight style consistency preprocessing.
[0050] In this invention, the brightness correction parameters are not fixed values. Instead, they are automatically adjusted according to different light staining levels and noise levels through an adaptive strategy that considers structural clarity, background stability, and recognition confidence. This achieves nonlinear enhancement of dark areas, makes sperm heads stand out more in lightly stained samples, and maintains overall brightness balance, thereby more stably improving sperm structure visibility and subsequent recognition performance.
[0051] In this invention, the processing order of the three steps of color normalization, local contrast enhancement and brightness correction is not fixed and can be arbitrarily ordered. In this embodiment, it is preferred to perform color normalization, local contrast enhancement and brightness correction in sequence (i.e., first perform S2, then S3, and finally S4).
[0052] This invention also discloses a lightweight style consistency preprocessing system for lightly stained sperm micrographs, comprising: The image acquisition module is used to acquire microscopic images of lightly stained sperm. The normalization module is used to normalize the color of the light-stained sperm micro-image based on the dark-stained sperm micro-image to obtain the normalized light-stained sperm micro-image. An enhancement module is used to enhance the local contrast of the normalized light-stained sperm micrograph based on the local contrast of the sperm head, tail, and boundary regions, to obtain an enhanced light-stained sperm micrograph. The brightness correction module is used to perform brightness correction on the enhanced light-stained sperm micrograph based on the clarity of the sperm head, midpiece, and tail structures and the stability of the background, so as to obtain a light-stained sperm micrograph after lightweight style consistency preprocessing.
[0053] The present invention also discloses a computer-readable storage medium storing a computer program that, when executed by a processor, implements a lightweight style consistency preprocessing method for lightly stained sperm micrographs.
[0054] The present invention also discloses an apparatus including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a lightweight style consistency preprocessing method for lightly stained sperm micrographs.
[0055] This invention also discloses a sperm microscopic image detection method. After obtaining the lightly stained sperm microscopic image after light style consistency preprocessing using the lightweight style consistency preprocessing method, the lightly stained sperm microscopic image after lightweight style consistency preprocessing is used as the input of a deep learning detection and segmentation model for subsequent automated identification and analysis of sperm head, midpiece, tail and overall morphology.
[0056] This invention presents a lightweight and complementary preprocessing method. It achieves color normalization by combining dark-stained sperm microscopic images, local contrast enhancement by incorporating local contrast in sperm head, tail, and boundary regions, and brightness correction by addressing the clarity of sperm head, midpiece, and tail structures and background stability. This unifies and enhances light-stained sperm microscopic images, resolving staining differences, brightness inconsistencies, and boundary blurring without requiring additional data expansion or increasing model training burden. This improves the overall quality of sperm microscopic images, thereby enhancing the performance and stability of subsequent deep learning models in sperm detection and segmentation tasks. This invention has low computational overhead and good clinical scalability and practical value.
[0057] To further demonstrate the beneficial effects of the present invention, this embodiment uses 200 sperm microscopic images obtained in the laboratory using conventional staining methods for comparative simulation experiments. The resolution of the 200 sperm microscopic images is 1024×1024, of which approximately 40% of the samples show light staining and unclear boundaries between the head and tail.
[0058] When performing color normalization in step S2 using the method of this invention, 50 deeply stained samples from the dataset are selected to construct a reference template. The lightly stained sperm microscopic images, obtained through lightweight style consistency preprocessing using the method of this invention, are used as input to the MaskR-CNN model for automatic segmentation of sperm heads and tails. Compared to unprocessed images, the sperm head recall rate is improved by 13%, the tail segmentation accuracy is improved by 9%, and the overall mIoU is improved by 11%.
[0059] First, the impact of the order of steps S2, S3, and S4 on the image preprocessing results was verified. In the experiment, the same lightly stained images were processed using different combinations of processing orders. To ensure fairness in the comparison, only the processing order was compared; all other parameters remained consistent. CLAHE and Gamma were set with the same fixed parameters (e.g., 8×8 window, clipping threshold 2.0, γ=0.85) to eliminate interference from parameter adaptation. The subsequent detection results using the Mask R-CNN model are shown in Table 1.
[0060] Table 1. Comparison of the impact of different processing orders on image preprocessing results
[0061] As can be seen from Table 1, when the sequence in this embodiment is used, the segmentation performance is the best, with the Dice value of the sperm head and midsegment reaching 83.5% and the Dice value of the tail reaching 78.6%, and the false negative rate being the lowest at only 12.5%.
[0062] Next, 200 additional lightly stained sperm microscopic images were added to the original training set, and the system was retrained. The method of this invention was compared with existing methods that improve the performance of lightly stained samples by expanding the dataset. The experimental conditions were kept consistent, and the Mask R-CNN model was used for segmentation. The detection results of different methods are shown in Table 2.
[0063] Table 2 Comparison of Detection Results from Different Methods
[0064] As shown in Table 2, relying on data augmentation can improve segmentation performance, but it requires additional data collection and annotation costs and significantly increases training time. In contrast, the present invention achieves or even surpasses the performance level of data augmentation schemes without adding any new samples. Therefore, the method of the present invention is more lightweight and practical than schemes that solely rely on data augmentation, making it suitable for rapid deployment in clinical and research environments.
[0065] Compared with the prior art, the advantages of the present invention are as follows: 1. It features dual optimization in color and structure. This invention achieves multi-level optimization from global color consistency to local structural clarity and overall brightness balance through the organic combination of color normalization, local contrast enhancement and brightness correction. It can effectively solve the problems of staining differences, uneven brightness and blurred boundaries that are common in lightly stained sperm micrographs.
[0066] 2. Eliminates the dependence on data expansion. The method of this invention can improve segmentation performance by directly improving the quality of the input image without relying on additional data collection and model retraining. This avoids the high cost and long cycle problems caused by the traditional method of improving robustness by increasing the dataset, and significantly reduces the overhead of manual annotation and training.
[0067] 3. Preprocessed images significantly improve the detection and segmentation performance of subsequent models. In lightly stained samples, the method of this invention can increase the Dice value of sperm head and midpiece by about 13 percentage points, the Dice value of tail by about 9 percentage points, and the overall mIoU by more than 10 percentage points; in the comparison of different operation sequences, the fixed sequence proposed in this invention performs the best, with a significant reduction in the false negative rate.
[0068] 4. Excellent robustness across devices. On datasets acquired using two different microscopes, the method of this invention significantly outperformed both the no-preprocessing and single-preprocessing schemes. The average segmentation accuracy of the head, middle, and tail sections was improved by 8–12 percentage points, and the recall rate was improved by more than 10%. Statistical tests confirmed that the differences were significant, indicating that the method has good generalization ability in cross-device and cross-batch scenarios.
[0069] 5. Lightweight and practical. The method of this invention only requires image processing steps to complete preprocessing. The algorithm is simple to implement, has low computational overhead, and can be directly embedded into existing deep learning segmentation processes without changing the model structure and training method. It is easy to deploy quickly in scientific research and clinical systems and has high application value.
[0070] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0071] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0072] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0073] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0074] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. A lightweight style consistency preprocessing method for lightly stained sperm micrographs, characterized in that, include: A lightly stained sperm microscopic image is obtained, and the lightly stained sperm microscopic image is normalized according to the darkly stained sperm microscopic image to obtain a normalized lightly stained sperm microscopic image. The normalized light-stained sperm micrograph is enhanced by local contrast enhancement based on the local contrast of the sperm head, tail, and boundary regions to obtain an enhanced light-stained sperm micrograph. Brightness correction was performed on the enhanced light-stained sperm micrographs based on the clarity of the sperm head, midpiece, and tail structures and background stability to obtain a light-stained sperm micrograph after lightweight style consistency preprocessing.
2. The lightweight style consistency preprocessing method for lightly stained sperm micrographs according to claim 1, characterized in that: The step of color normalizing the light-stained sperm micrograph based on the dark-stained sperm micrograph includes: The lightly stained sperm microscopic images to be processed were converted from the RGB color space to the Lab color space, and the mean and standard deviation of the L, a, and b channels were calculated respectively; let the mean of the lightly stained sperm microscopic images be denoted as . , , This represents the mean value of the L channel. Let be the mean of channel a. Let be the mean of channel b; let the standard deviation of the lightly stained sperm micrograph be . , The standard deviation of channel L. Let be the standard deviation of channel a. The standard deviation of channel b; Obtain the mean and standard deviation of the microscopic images of darkly stained sperm, and perform color normalization on each pixel value in the microscopic images of lightly stained sperm: , In the formula, This represents any pixel value in the color-normalized lightly stained sperm micrograph. This represents any pixel value in the original lightly stained sperm micrograph. The mean value is the value of the microscopic image of the darkly stained sperm. The standard deviation of the microscopic image of deeply stained sperm.
3. The lightweight style consistency preprocessing method for lightly stained sperm micrographs according to claim 1, characterized in that: The step of enhancing the local contrast of the normalized lightly stained sperm micrograph based on the local contrast of the sperm head, tail, and boundary regions includes: Set a candidate set for the shear threshold and a candidate set for the partitioning window. Let the candidate set for the shear threshold be { , Let N1 be the set of the i-th shearing threshold, and N1 be the number of shearing thresholds set; let the candidate set for dividing the window be { , For the j-th partition window, The length of the j-th partition window is set. N1 represents the height of the j-th partitioning window, and N2 represents the number of partitioning windows. Extract the L channel of the normalized lightly stained sperm micrograph, denoted as ,calculate The corresponding gradient magnitude diagram is as follows: , In the formula, G is The corresponding gradient magnitude map, This indicates calculating the gradient. express The norm; The edge set is constructed based on the gradient magnitude map as follows: , In the formula, Let x represent the edge set and x represent the pixel value. This represents the gradient magnitude at pixel value x. As a preset constant, To take the median, This is the absolute median difference; Let the non-edge regions be the background set, denoted as B. , This is a set difference operation; For any cut threshold in the candidate set of cut thresholds and any partition window in the candidate set of partition windows, calculate the enhanced pixel value as follows: , In the formula, To use contrast-limited adaptive histogram equalization for each Histogram equalization is performed independently on the grid, and the shearing threshold for the local histogram is set to... , This represents the enhanced pixel value; Calculate all on the edge set and background set To optimize pixel enhancement, the cropping threshold and segmentation window that achieve the best pixel enhancement effect are selected as the final cropping threshold and final segmentation window. Use the final shearing threshold and the final splitting window to... Histogram equalization is performed, and the portion exceeding the final shearing threshold is proportionally distributed to the remaining gray levels according to the gray-level histogram of the edge set.
4. The lightweight style consistency preprocessing method for lightly stained sperm micrographs according to claim 3, characterized in that: Calculate all on the edge set and background set To optimize pixel enhancement, the cropping threshold and segmentation window that provide the best pixel enhancement effect are selected as the final cropping threshold and final segmentation window. Specifically: Calculate all The overall score is: , In the formula, express The corresponding overall score, This represents the mean value over the set of edges. This represents the mean value over the background set. The standard deviation is expressed on the background set. As a preset constant, for The corresponding gradient magnitude map, for Brightness saturation pixel ratio, , , , These are preset coefficients; Choose to The maximum shear threshold and the final split window are used as the final shear threshold and the final split window.
5. The lightweight style consistency preprocessing method for lightly stained sperm micrographs according to claim 4, characterized in that: The The calculation method is as follows: calculate middle The proportion, in the formula, for The maximum pixel value in This is a preset constant.
6. The lightweight style consistency preprocessing method for lightly stained sperm micrographs according to any one of claims 3-5, characterized in that: The portion exceeding the final shearing threshold is proportionally distributed to the remaining gray levels based on the gray-level histogram of the edge set, specifically as follows: The final shearing threshold and the final segmentation window will be used to... The overflow amount generated after truncating the histogram within each grid according to the final shearing threshold following histogram equalization is denoted as . Within the same grid, the gray-level histogram of the edge set is statistically analyzed and denoted as... The weights are calculated as follows: , In the formula, g represents the grayscale value. This represents the weight assigned to the grayscale value g. For preset coefficients, This is a preset constant; The overflow will be allocated proportionally as follows: , In the formula, This is the amount of overflow allocated to the grayscale value g.
7. The lightweight style consistency preprocessing method for lightly stained sperm micrographs according to any one of claims 3-5, characterized in that: The brightness correction of the enhanced lightly stained sperm micrograph based on the clarity of the sperm head, midpiece, and tail structures and background stability is specifically as follows: Set a candidate set of brightness correction parameters, denoted as . , , This is the kth brightness correction parameter, where K is the number of brightness correction parameters set. Extract the L channel of the enhanced lightly stained sperm micrograph, using each Gamma correction is performed to obtain the corrected L channel, denoted as... ; Calculate on the edge set and the background set Calculate all structural clarity, background fluctuations, and saturation percentages. The corresponding Score for differences in structural clarity, background variability, and saturation percentage: , In the formula, for The significance score of the difference express Structural clarity, express Background fluctuations, express saturation percentage , These are preset coefficients; When the If the difference is less than a preset threshold, it is considered insignificant. In this case, the deep learning model used in subsequent sperm detection and segmentation tasks is applied. Perform a fast forward inference to obtain the average confidence score, denoted as . A selection function for brightness correction parameters is constructed when the differences are not significant, and the selected brightness correction parameters are used as the final brightness correction parameters; when the... When the difference is greater than or equal to a preset threshold, it is considered significant. At this time, a selection function for the brightness correction parameter when the difference is significant is constructed, and the selected brightness correction parameter is used as the final brightness correction parameter. The enhanced lightly stained sperm micrographs were gamma-corrected using the final brightness correction parameters.
8. The lightweight style consistency preprocessing method for lightly stained sperm micrographs according to claim 7, characterized in that: The The calculation methods for structural sharpness, background fluctuation, and saturation ratio are as follows: , , ; In the formula, This represents the mean value over the set of edges. The standard deviation is expressed on the background set. for The percentage of pixels with saturated brightness.
9. The lightweight style consistency preprocessing method for lightly stained sperm micrographs according to claim 7, characterized in that: The function for selecting the brightness correction parameter when the difference is not significant is: , In the formula, This is the selection function for the brightness correction parameters when the difference is not significant, and argmax represents the function that takes the maximum value. , , , , Represents the normalized result , , , , These are preset coefficients; The function for selecting the brightness correction parameter when the difference is significant is: , In the formula, This is a function for selecting the brightness correction parameters when the differences are significant.
10. A lightweight style consistency preprocessing system for lightly stained sperm micrographs, characterized in that, include: The image acquisition module is used to acquire microscopic images of lightly stained sperm. The normalization module is used to normalize the color of the light-stained sperm micro-image based on the dark-stained sperm micro-image to obtain the normalized light-stained sperm micro-image. An enhancement module is used to enhance the local contrast of the normalized light-stained sperm micrograph based on the local contrast of the sperm head, tail, and boundary regions, to obtain an enhanced light-stained sperm micrograph. The brightness correction module is used to perform brightness correction on the enhanced light-stained sperm micrograph based on the clarity of the sperm head, midpiece, and tail structures and the stability of the background, so as to obtain a light-stained sperm micrograph after lightweight style consistency preprocessing.