A sample enhancement method for clue cells
By transferring the texture features of clue cells to epithelial cells using a texture transfer model, the problem of low detection rate of clue cells in vaginal microecology detection is solved, and the generated target cell images improve the detection performance and generalization ability of the model.
Patent Information
- Application Number
- CN202611214437.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-11
- Publication Date
- 2026-11-17
AI Technical Summary
Existing deep learning models have a low detection rate of clue cells in vaginal microecology detection, resulting in insufficient model generalization ability and a tendency to miss detections.
By using a texture transfer model, the texture features of clue cells are transferred to epithelial cells, transforming the epithelial cells in vaginal sample images into clue cells. This increases the number of clue cells in vaginal sample images, providing sufficient training samples to improve the model's detection performance and generalization ability.
The generated target cell images, while maintaining the original macroscopic skeleton and background structure of epithelial cells, include morphological representations of clue cells that conform to clinical reality, increasing the number of clue cells in vaginal sample images and improving the detection performance and generalization ability of the learning model.
Smart Images

Figure CN123118474A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, specifically to a method for sample enhancement of clue cells. Background Technology
[0002] With the in-depth development of medical testing technology and the increasing attention people pay to health, gynecological health, as an important part of women's health, and vaginal microecological testing, as a common gynecological test, can provide important basis for the assessment of related health status by identifying and analyzing the flora and cell status in vaginal secretion samples.
[0003] Currently, with the development of artificial intelligence technology, computer-aided analysis models based on deep learning are gradually being applied to vaginal microecological testing in order to improve testing efficiency and objectivity. However, in actual clinical samples, the detection rate of clue cells is much lower than that of normal epithelial cells. In the training of learning models related to clue cells, there is a serious imbalance between positive samples (clue cells) and negative samples (non-clue cells), making it difficult for deep learning models to fully learn the discriminative texture features of clue cells from a limited number of positive samples. This results in insufficient model generalization ability and a tendency for missed detections in actual testing. Summary of the Invention
[0004] This application discloses a sample enhancement method for clue cells, which can transfer the texture features of clue cells to epithelial cells, thereby changing the epithelial cells in vaginal sample images into clue cells, thereby increasing the number of clue cells in vaginal sample images, providing sufficient training samples for learning models related to clue cells, and improving the detection performance and generalization ability of learning models.
[0005] In a first aspect, embodiments of this application disclose a sample enhancement method for clue cells, applied to a computer device, the method comprising: The computer device acquires images of vaginal samples; the vaginal sample images contain at least one epithelial cell and at least one clue cell; The computer device identifies the epithelial cells in the vaginal sample image and extracts the image regions of the epithelial cells to obtain a first epithelial image, wherein the first epithelial image contains the image region of any one of the at least one epithelial cells. The computer device identifies clue cells in the vaginal sample image and extracts the image regions of the clue cells to obtain a first clue image, wherein the first clue image contains the image region of any one of the at least one clue cells. The computer device acquires the input prompt text and generates an initial text vector based on the input prompt text; The computer device uses a texture transfer model to transfer texture features from the first cue image to the first epithelial image based on the initial text vector, thereby obtaining a target cell image. The computer device fuses the vaginal sample image and the target cell image to generate an enhanced vaginal sample image; The texture transfer model includes a noise-adding module and a noise-removing module; the noise-adding module is used to perform multiple iterations of noise-adding processing on the first cue image to obtain multiple reference noise maps, and to perform multiple iterations of noise-adding processing on the first epithelial image to obtain multiple source noise maps. The denoising module is used to take the source noise map obtained from the last denoising process of the denoising module as the initial generated feature map, and to perform reverse multiple iterative denoising processes on the initial generated feature map to obtain the target cell image. In each denoising process, the generated feature map is filtered based on the current input source noise map and the reference noise map to obtain an image feature vector. Based on an attention mechanism, the generated feature map is texture-rendered based on the current input text vector and the image feature vector to obtain the current output generated feature map. This output generated feature map is then used as the input generated feature map for the next denoising process. The text vector input for the first denoising process is the initial text vector.
[0006] As an optional implementation, in the first aspect of the embodiments of this application, the reference noise map input to the Mth denoising process is the reference noise map obtained by the Xth denoising process; the source noise map input to the Mth denoising process is the source noise map obtained by the Xth denoising process; X is N+1-M; M is a positive integer less than or equal to N; N is the total number of denoising processes performed in the denoising module; When M is greater than 1 and less than or equal to P, the text vector input to the Mth denoising process is the text vector output by the (M-1)th denoising process; where P is less than N / 2. When M is greater than P and less than or equal to N, the text vector input to the Mth denoising process is the text vector output by the Pth denoising process.
[0007] As an optional implementation, in a first aspect of the embodiments of this application, the noise reduction module is further configured to: When M is greater than 0 and less than or equal to P, the loss value of this denoising process is calculated based on the feature difference between the reference noise map and the generated feature map of this input. The gradient of the loss value with respect to the current input text vector is calculated through backpropagation; Based on the gradient and momentum decay coefficient, the gradient momentum of the current input is updated to determine the gradient momentum of the current output, and the gradient momentum of the current output is used as the gradient momentum input for the next denoising process; the gradient momentum input for the first denoising process is a zero vector. The text vector of this input is fine-tuned based on the gradient momentum of this output to obtain the text vector of this output. The generated feature map of the input is denoised based on the text vector of the output, and the generated feature map of the output is obtained.
[0008] As an optional implementation, in a first aspect of the embodiments of this application, the noise reduction module is further configured to: When M is greater than 0 and less than or equal to P, feature extraction is performed on the generated feature map of this input based on the epithelial cell mask corresponding to the first epithelial image to obtain a local generated feature sequence. Based on the clue cell mask corresponding to the first clue image, feature extraction is performed on the reference noise map input this time to obtain a local reference feature sequence; Based on the feature tensors of the locally generated feature sequence in each channel, calculate multiple generation statistical moments of the locally generated feature sequence and each channel; Based on the feature tensors of the local reference feature sequence in each channel, calculate the local reference feature sequence and multiple reference statistical moments corresponding to each channel; The statistical loss of the feature distribution is calculated based on the multiple generated statistical moments and the multiple reference statistical moments corresponding to each channel. Determine the generated centroid vector corresponding to the local generated feature sequence, and determine the reference centroid vector corresponding to the local reference feature sequence; The directional loss of the feature direction is obtained based on the difference between the generated centroid vector and the reference centroid vector; The statistical loss and the directional loss are weighted to obtain the loss value of this denoising process.
[0009] As an optional implementation, in a first aspect of the embodiments of this application, the noise reduction module is further configured to: When M is greater than P and less than or equal to N, the reference noise map and the source noise map of this input are fused according to the epithelial cell mask corresponding to the first epithelial image to obtain a fused feature map; The generated feature map of this input is filtered based on the fused feature map to obtain the image feature vector; Based on the attention mechanism, the text key vector and text value vector corresponding to the input text vector are determined, and the image query vector corresponding to the image feature vector is determined. Cross-attention calculation is performed based on the text key vector, the text value vector, and the image query vector; texture rendering is then performed on the image feature vector to obtain a texture feature map. The texture feature map is fused with the generated feature map of the current input to obtain the generated feature map of the current output.
[0010] As an optional implementation, in a first aspect of the embodiments of this application, the noise reduction module is further configured to: The first fraction matrix is obtained by multiplying the image query vector and the text key vector; Based on the epithelial cell mask corresponding to the first epithelial image and the preset enhancement coefficient, the first fractional matrix is magnified to obtain the second fractional matrix; Multiply the second fractional matrix by the text value vector to obtain the texture feature map.
[0011] As an optional implementation, in a first aspect of this application, the step of identifying epithelial cells in the vaginal sample image and extracting the image region of the epithelial cells to obtain a first epithelial image includes: Target detection is performed on the epithelial cells in the vaginal sample image to identify the location information corresponding to the image region of each epithelial cell; Select any target epithelial cell, and crop the image region of the target epithelial cell according to the position information corresponding to the image region of the target epithelial cell to obtain a first epithelial image and an initial mask corresponding to the first epithelial image.
[0012] As an optional implementation, in a first aspect of the embodiments of this application, the method further includes: Edge detection is performed on the target epithelial cells in the initial mask corresponding to the first epithelial image to obtain multiple edge pixels; The coordinates of each edge pixel are transformed to a polar coordinate system with the centroid of the target epithelial cell as the origin, so as to obtain the polar coordinates corresponding to each edge pixel and calculate the polar diameter of each edge pixel. U target pixels are randomly selected from the plurality of edge pixels, and the polar radius of each target pixel is finely adjusted along the radial direction of each target pixel based on a Gaussian distribution with a negative mean, to obtain U target pixels after fine adjustment; where U is a positive integer. The first cell edge curve is obtained by fitting the U target pixels after fine-tuning using a cubic spline curve. Based on the first cell edge curve, the initial mask corresponding to the first epithelial image is deformed to obtain the epithelial cell mask corresponding to the first epithelial image.
[0013] As an optional implementation, in a first aspect of the embodiments of this application, fusing the vaginal sample image and the target cell image to generate an enhanced vaginal sample image includes: Obtain the target cell mask corresponding to the target cell image; Construct a weight matrix based on the target cell mask; Based on the weight matrix and the location information corresponding to the first epithelial image, the target cell image is fused into the vaginal sample image to obtain an enhanced vaginal sample image.
[0014] As an optional implementation, in a first aspect of the embodiments of this application, constructing a weight matrix based on the target cell mask includes: The clue cells in the target cell mask are identified, and the second cell edge curve corresponding to the mask edge of the clue cells in the target cell mask is determined. Calculate the first distance between each pixel in the target cell mask and the edge curve of the second cell; Calculate the second distance between each pixel in the target cell mask and the corresponding mask edge of the target cell mask; Based on the spatial distance corresponding to each pixel in the target cell mask, the fusion weight corresponding to each pixel in the target cell mask is determined to construct a weight matrix; the spatial distance corresponding to each pixel is the minimum value between the corresponding first distance and the corresponding second distance; The fusion weight corresponding to the pixel within the second cell edge curve is the first weight value; the fusion weight corresponding to the pixel between the second cell edge curve and the mask edge corresponding to the target cell mask is positively correlated with the spatial distance between the pixel.
[0015] Secondly, embodiments of this application disclose a sample enhancement device for clue cells, applied to a computer device, the device comprising: An image acquisition module is used to acquire images of vaginal samples; the vaginal sample images contain at least one epithelial cell and at least one clue cell; The cell recognition module is used to identify epithelial cells in the vaginal sample image and extract the image region of the epithelial cells to obtain a first epithelial image, wherein the first epithelial image contains the image region of any one of the at least one epithelial cells. The cell recognition module is also used to identify clue cells in the vaginal sample image and extract the image region of the clue cells to obtain a first clue image, wherein the first clue image contains the image region of any one of the at least one clue cells. The text acquisition module is used to acquire the input prompt text and generate an initial text vector based on the input prompt text; The texture transfer module is used to transfer the texture features in the first cue image to the first epithelial image based on the initial text vector using a texture transfer model, thereby obtaining the target cell image. The sample enhancement module is used to fuse the vaginal sample image and the target cell image to generate an enhanced vaginal sample image; The texture transfer model includes a noise-adding module and a noise-reducing module. The noise-adding module performs multiple iterations of noise-adding processing on the first cue image to obtain multiple reference noise maps, and performs multiple iterations of noise-adding processing on the first epithelial image to obtain multiple source noise maps. The noise-reducing module uses the source noise map obtained from the last noise-adding processing of the noise-adding module as the initial generated feature map, and performs multiple iterations of reverse noise-reducing processing on the initial generated feature map to obtain the target cell image. In each noise-reducing process, the generated feature map is filtered based on the current source noise map and reference noise map to obtain an image feature vector. Based on an attention mechanism, the generated feature map is texture-rendered based on the current text vector and the image feature vector to obtain the current output generated feature map. The current output generated feature map is used as the generated feature map input for the next noise-reducing process. The text vector input for the first noise-reducing process is the initial text vector.
[0016] Thirdly, embodiments of this application disclose a computer device, including a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor causes the processor to implement the method described in any of the above embodiments.
[0017] Fourthly, embodiments of this application disclose a computer-readable storage medium that stores a computer program, which, when executed by a processor, implements the methods described in any of the above embodiments.
[0018] Fifthly, embodiments of this application disclose a computer program product, including a computer program, wherein the computer program, when executed by a processor, implements the method described above.
[0019] In this embodiment, the computer device uses a texture transfer model to transfer the texture features of clue cells in the first clue image to the epithelial cells in the first epithelial image based on the text vector generated from the input prompt text. This allows for the rendering of the unique edge burrs and granular rough texture of clue cells on the epithelial cells while maintaining their original macroscopic skeleton and background structure. This ensures that the generated target cell image contains cells that conform to the morphological characteristics of real clinical clue cells. Furthermore, since the transferred texture features originate from actual clue cells in the vaginal sample image, the texture features in the generated target cell image maintain consistency with the actual clue cells in the vaginal sample image in terms of morphology, texture distribution, and staining, guaranteeing the realism and biological credibility of the clue cells in the enhanced vaginal sample image. Fusing the target cell image with the vaginal sample image increases the number of clue cell samples in the vaginal sample image, providing sufficient training samples for the learning model related to clue cells without the need for additional vaginal sample collection, thereby improving the detection performance and generalization ability of the learning model. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is an illustration of an application scenario for a clue cell sample enhancement method in one embodiment; Figure 2 This is a flowchart of a sample enhancement method for clue cells in one embodiment; Figure 3A This is one of the schematic diagrams illustrating the generation of a target cell image by a texture transfer model in one embodiment; Figure 3B This is a second schematic diagram illustrating the generation of a target cell image using a texture transfer model in one embodiment. Figure 4 This is a flowchart of obtaining a first epithelial image in one embodiment; Figure 5 This is a flowchart illustrating how to obtain the epithelial cell mask corresponding to the first epithelial image in one embodiment; Figure 6 This is a flowchart illustrating the process of obtaining an enhanced vaginal sample image in one embodiment; Figure 7 This is a block diagram of a sample enhancement device for clue cells in one embodiment; Figure 8 This is a structural block diagram of a computer device in one embodiment. Detailed Implementation
[0022] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0023] It should be noted that the terms "comprising" and "having," and any variations thereof, in the embodiments and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the steps or units listed, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0024] It is understood that the terms "first," "second," etc., used in this application may be used to describe various elements herein, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, without departing from the scope of this application, a first cell edge curve may be referred to as a second cell edge curve, and similarly, a second cell edge curve may be referred to as a first cell edge curve. However, the objects corresponding to the first cell edge curve and the second cell edge curve are different. The first cell edge curve is the deformed cell edge curve obtained by fitting the original contour of the epithelial cells in the first epithelial image onto the corresponding initial mask; the second cell edge curve is the edge curve of the clue cells in the target cell image onto the corresponding target cell mask.
[0025] Figure 1 This is a diagram illustrating an application scenario of a clue cell sample enhancement method in one embodiment. For example... Figure 1 As shown, the clue cell sample enhancement method can be applied to computer device 110. Computer device 110 includes a processor and a memory. The processor executes a computer program stored in the memory to amplify the number of clue cells in a vaginal sample image to achieve sample enhancement.
[0026] The computer device 110 may include, but is not limited to, various personal computers, smart wearable devices, tablets, PCs (Personal Computers), laptops, smartphones, and portable wearable devices, etc., and the embodiments of this application do not limit it.
[0027] With the rapid development of artificial intelligence technology in the field of medical image analysis, computer-aided detection models based on deep learning have been gradually applied to vaginal microecology detection to improve the efficiency and objectivity of clue cell identification and reduce the workload of laboratory physicians. In the development of deep learning models, a large number of annotated vaginal sample images of various cells are required as training data to learn the discriminative features of these cells. Clue cells, as a key marker of bacterial vaginosis, are characterized by a typical texture change of blurred edges and granular roughness on the surface of vaginal epithelial cells due to the adhesion of a large number of pathogenic bacteria such as Gardnerella vaginalis. Therefore, accurate identification and localization of clue cells are necessary during detection.
[0028] Specifically, the learning models related to clue cells may include, but are not limited to, clue cell detection models, clue cell classification models, or vaginal microecological comprehensive assessment models. In practical applications, the learning models related to clue cells can be deployed on the model training device 120 for training, and after training, deployed on the model application device 130 for inference detection on actual clinical samples.
[0029] However, in actual clinical slide preparation, the number of clue cells in vaginal samples is relatively small, and their morphology is easily affected by various factors such as the randomness of cell shedding during the slide preparation process, sampling location deviations, and individual patient differences. Furthermore, the distribution of clue cells is influenced by factors such as patient population, sampling timing, and slide preparation techniques. This results in a significantly lower detection rate of clue cells in vaginal sample images compared to normal epithelial cells, and a severe imbalance generally exists between positive samples (clue cells) and negative samples (non-clue cells). Consequently, during the training of the model related to clue cells, the model training device 120 struggles to fully learn the discriminative features unique to clue cells, such as edge burrs and granular rough texture, due to the insufficient number of positive samples. This makes the learning model prone to overfitting or biased predictions towards negative samples, resulting in insufficient generalization ability. When the model application device 130 uses this learning model, it cannot accurately identify clue cells, leading to a high false negative rate.
[0030] In some embodiments, to address the aforementioned sample imbalance problem, related technologies have attempted to employ traditional data augmentation methods such as flipping, rotating, and color jittering, or to expand the training samples based on generative adversarial networks, neural style transfer, and other generative methods. However, in practical applications, these methods often result in blurred cell boundaries, disrupted background structures, or inconsistent textures with the actual distribution of cue cells, rendering the generated synthetic samples unsuitable for clinical reference.
[0031] This application discloses a sample enhancement method for clue cells, which can transfer the texture features of clue cells to epithelial cells, thereby changing the epithelial cells in vaginal sample images into clue cells, thereby increasing the number of clue cells in vaginal sample images, providing sufficient training samples for learning models related to clue cells, and improving the detection performance and generalization ability of learning models.
[0032] In the embodiments of this application, such as Figure 1 As shown, before the model training device 120 trains the learning model related to clue cells, the acquired vaginal sample image can be augmented by the computer device 110 to increase the number of clue cells in the original vaginal sample image, resulting in an augmented vaginal sample image. After the computer device 110 completes the sample augmentation, it sends the augmented vaginal sample image to the model training device 120, enabling the model training device 120 to train the learning model related to clue cells based on the augmented vaginal sample image. Because the number of clue cells in the augmented vaginal sample image is effectively increased, the learning model related to clue cells can fully learn the discriminative texture features of clue cells during training, thereby improving the detection performance and generalization ability of the learning model for clue cells. Consequently, the learning model deployed on the model application device 130 can accurately identify clue cells and reduce the false negative rate when performing inference detection on actual clinical samples.
[0033] It should be noted that the computer device 110, the model training device 120, and the model application device 130 can be independent devices or integrated into the same device. For example, in one embodiment, a single device can enhance clue cells in a vaginal sample image, as well as perform model training and model application.
[0034] like Figure 2 As shown, in some embodiments, a sample enhancement method for clue cells is provided, which can be applied to the aforementioned computer device. This method may include steps 210 to 260.
[0035] Step 210: Obtain a vaginal sample image.
[0036] The vaginal sample image contains at least one epithelial cell and at least one clue cell.
[0037] In some embodiments, vaginal sample images may be bright-field wet slides. Bright-field wet slides are one of the most commonly used slide preparation methods for vaginal microecological testing. They involve directly smearing vaginal secretion samples onto a glass slide and observing and acquiring images under bright-field illumination using an optical microscope. In bright-field wet slides, normal vaginal epithelial cells appear as large cells with well-defined borders, pale red or pale green cytoplasm, prominent and round or oval nuclei, and uniformly distributed cytoplasm. Clue cells, on the other hand, exhibit morphological characteristics such as spiky edges, a granular and rough texture, and indistinct cell boundaries due to the adhesion of numerous anaerobic bacteria such as Gardnerella vaginalis on the surface of the vaginal epithelial cells.
[0038] Since bright-field wet mounts can clearly present the morphological characteristics of epithelial cells and clue cells at the same time, and the preparation process is simple, quick and inexpensive, using the microscopic images of bright-field wet mounts as vaginal sample images in the embodiments of this application can provide sufficient morphological information for subsequent cell identification and texture migration, and has good clinical applicability.
[0039] Since clue cells are essentially epithelial cells heavily adhered to by pathogenic bacteria, their cytoskeleton, nuclear morphology, and cell outline are highly homologous to normal epithelial cells, differing only in surface texture features (i.e., the edge burrs and granular rough texture brought by bacterial adhesion). This biological basis means that epithelial cells and clue cells share most of the underlying structural information (such as cell size, nuclear morphology, and cytoskeleton distribution), with only texture features differing. Therefore, migrating the texture of clue cells onto epithelial cells can more realistically generate new clue cells. The generated target cell image remains consistent with the real clue cell in basic attributes such as cytoskeleton, nuclear morphology, and cell size, with only biologically consistent changes in texture features, thus ensuring the biological credibility of the generated sample.
[0040] In some embodiments, after acquiring the sample image corresponding to the target vaginal sample, the computer device can preprocess the vaginal sample image. The preprocessed vaginal sample image has better image quality, which is beneficial for subsequent microbial detection models to perform stable feature extraction and accurate microbial identification.
[0041] Specifically, preprocessing may include, but is not limited to, one or more of the following operations: size normalization (to adapt to the fixed size requirements of the model input layer); color normalization (to reduce the impact of differences in brightness of different microscope light sources on image features); contrast enhancement (to make the boundary between microorganisms and the background clearer and enhance the visual recognizability of microorganisms); noise suppression (to remove salt-and-pepper noise or Gaussian noise that may be introduced during image acquisition and improve the signal-to-noise ratio of the image); image enhancement (to highlight the outline details of microorganisms), etc.
[0042] In some embodiments, after preprocessing, the computer device may also perform quality screening on the vaginal sample images. Specifically, the computer device may calculate the sharpness evaluation index of the vaginal sample images and remove vaginal sample images with sharpness below a preset threshold to avoid poor texture transfer effects caused by image blurring.
[0043] Step 220: Identify the epithelial cells in the vaginal sample image and extract the image region of the epithelial cells to obtain the first epithelial image.
[0044] The first epithelial image contains an image region of any one of the epithelial cells in at least one epithelial cell.
[0045] In some embodiments, the computer device may employ a cell detection model to identify epithelial cells in vaginal sample images. Specifically, the cell detection model may employ a target detection network architecture, such as the YOLO series (including YOLOv5, YOLOv8, YOLOv9, etc.), Faster-RCNN (Region-based Convolutional Neural Network), etc.
[0046] Taking YOLOv8 as an example, the computer device inputs the pre-processed vaginal sample image into the pre-trained YOLOv8 cell detection model. This model extracts multi-scale feature maps of the image through the backbone network, performs multi-scale feature fusion through the neck network, and outputs the bounding boxes of each identified cell, along with their class confidence scores and class labels, through the detection head. Based on the class confidence scores output by the detection head, the computer device selects bounding boxes labeled as epithelial cells with a confidence score higher than a preset threshold (e.g., 0.85) as the epithelial cell identification results.
[0047] In some embodiments, after identifying the bounding boxes of each epithelial cell, the computer device randomly selects a target epithelial cell from multiple epithelial cells, and based on the position information of the bounding box of the target epithelial cell in the vaginal sample image, crops out the corresponding image region from the vaginal sample image to obtain a first epithelial image.
[0048] Specifically, when cropping the first epithelial image, the computer device can expand the bounding box outward by a preset number of pixels (e.g., by 20%) to ensure that the cropped image area contains the complete cell structure and avoid losing cell edge information (including structures such as cilia and cytoplasmic protrusions at the edge of epithelial cells) because the bounding box is close to the cell edge.
[0049] Optionally, if the expanded cropped area exceeds the boundary of the vaginal sample image, the excess portion can be filled with zero pixels or processed using a mirror filling method.
[0050] In some embodiments, to improve the accuracy of subsequent texture transfer, the computer device may also generate an epithelial cell mask corresponding to the first epithelial image. The epithelial cell mask is a binary image, where the foreground region (pixel value of 1) represents the region where the epithelial cells are located, and the background region (pixel value of 0) represents the non-cellular region. The epithelial cell mask can precisely define the region for texture transfer during subsequent texture transfer, ensuring that texture transfer only occurs within the cellular region and avoiding interference with the background region.
[0051] Step 230: Identify clue cells in the vaginal sample image and extract the image regions of the clue cells to obtain the first clue image.
[0052] The first cue image contains the image region of any one of the cue cells.
[0053] In some embodiments, the computer device obtains the first clue image in a manner similar to that used in step 220 above to obtain the first epithelial image. The same target detection model or instance segmentation model can be employed, but the target category can be replaced by clue cells instead of epithelial cells. Since the number of clue cells in vaginal sample images is relatively small, to improve the recall rate of clue cells, the confidence threshold for clue cells can be appropriately lowered (e.g., set to 0.6) to detect potential clue cells.
[0054] In some embodiments, the computer device may also generate a cue cell mask corresponding to the first cue image. The cue cell mask may be generated in the same way as the epithelial cell mask. The cue cell mask can be used to identify the precise regions where cue cells are located in the first cue image, so as to accurately extract and render textures during subsequent texture transfer.
[0055] It should be noted that the first epithelial image and the first cue image are the same size, meaning their width and height are identical. This facilitates stable feature mapping and texture alignment during the noise addition and denoising processes of the texture transfer model, improving the quality of texture transfer and the reliability of the generated target cell images.
[0056] Step 240: Obtain the input prompt text and generate an initial text vector based on the input prompt text.
[0057] The input prompt text is a text description used to describe the texture features of the clue cells, in order to guide the texture transfer model to transfer the texture features of the clue cells to the epithelial cells.
[0058] For example, the specific content of the input prompt text could be something like, "The cue cells have burrs on the edges and a grainy, rough texture," or a more detailed description. This text description can convey semantic information about the target texture to the texture transfer model, giving the texture transfer process clear semantic guidance.
[0059] In some embodiments, the input prompt text may be a fixed text pre-stored by the computer device, that is, the same input prompt text is used every time a texture migration is performed, without requiring the user to manually enter it each time.
[0060] In other embodiments, input prompt text can be entered in real time by the user through the input interface of a computer device (such as a keyboard, touch screen, microphone, etc.) to allow the user to flexibly adjust the emphasis of the texture description according to actual needs.
[0061] Optionally, the computer device may use a pre-trained text encoder to convert the input prompt text into an initial text vector. The text encoder may be a pre-trained language model based on the Transformer architecture, such as the text encoder in the CLIP (Contrastive Language-Image Pre-Training) model.
[0062] For example, the computer device inputs the input prompt text into a CLIP text encoder. This encoder first segments the input prompt text into several sub-word units using byte-pair encoding, and then converts each sub-word unit into a word vector through a word embedding layer. Next, multiple word vectors are context-encoded through a multi-layer Transformer encoder. Each Transformer layer includes a multi-head self-attention mechanism and a feedforward neural network, and features are passed through layer normalization and residual connections. Finally, all word vectors are pooled along the sequence dimension, outputting a dense vector of fixed dimensions as the initial text vector. This initial text vector encodes the semantic information of the cue cell texture in the semantic space, providing direction guidance for texture rendering in the subsequent denoising process.
[0063] In some embodiments, if the input prompt text is fixed text, the computer device may pre-calculate the initial text vector of the input prompt text and store it in memory. When performing texture migration, it can be read directly from memory without repeating text encoding each time it is executed, thereby improving processing efficiency and reducing the consumption of computing resources.
[0064] Step 250: Based on the initial text vector, the texture features in the first cue image are transferred to the first epithelial image using a texture transfer model to obtain the target cell image.
[0065] The texture transfer model includes a noise-adding module and a noise-reducing module. The texture transfer model can be built based on a diffusion model architecture, such as DDPM (Denoising Diffusion Probabilistic Model), DDIM (Denoising Diffusion Implicit Model), or improved versions thereof. The diffusion model simulates a Markov chain where data moves from ordered to disordered (noise-adding process) and then back from disordered to ordered (noise-reducing process), enabling high-quality image generation and conditional editing. In this embodiment, texture transfer from clue cells to epithelial cells is achieved by fusing the structural information of epithelial cells with the texture information of clue cells in the noise space of the diffusion model.
[0066] The noise-adding module is used to perform multiple iterations of noise-adding processing on the first cue image to obtain multiple reference noise maps, and to perform multiple iterations of noise-adding processing on the first epithelial image to obtain multiple source noise maps.
[0067] Noise addition refers to the process of gradually adding noise to the original image. Each noise addition is based on the result of the previous step, and the amount of noise added in each step is controlled by preset noise scheduling parameters.
[0068] In some embodiments, the computer device performs N iterations of noise addition on the first cue image and the first epithelial image respectively through the noise addition module of the texture transfer model. Here, N is a positive integer, such as 50, 100, or 200, and the specific value can be determined based on the required texture transfer accuracy and computational resources. It should be noted that the larger the value of N, the finer the step size of the noise addition process and the higher the restoration accuracy of the denoising process, but the computational cost of the computer device also increases accordingly.
[0069] Specifically, in the first noise addition process, the first cue image is denoised according to the first noise scheduling parameter and the first random seed to obtain a reference noise map obtained from the first noise addition process. The reference noise map obtained from the first noise addition process is used as the reference noise map input for the second noise addition process. In each subsequent noise addition process, the reference noise map input is denoised according to the noise scheduling parameter and the random seed to obtain a reference noise map obtained from the current noise addition process. The reference noise map obtained from the current noise addition process is used as the reference noise map input for the next noise addition process. This process continues until N noise addition processes are completed, resulting in reference noise maps obtained from each of the N noise addition processes.
[0070] Similarly, the noise-adding module performs N iterations of noise-adding processing on the first epithelial image to obtain the source noise maps corresponding to the N noise-adding processes.
[0071] Specifically, the reference noise map originates from the progressive noise addition to the first cue image, preserving the texture information of cue cells at different scales under different noise addition processes. In the early stages of noise addition (with fewer iterations), the resulting reference noise map still retains a relatively clear cue cell structure, primarily carrying the high-frequency texture features of the cue cells, including the orientation and density of edge burrs, the distribution pattern of surface granular microbial communities, and the spatial variation of cell surface roughness—all fine-grained information. In the later stages of noise addition (with a gradually increasing number of iterations), the original structural information in the reference noise map gradually weakens, shifting to carrying the mid-frequency texture features of the cue cells, including texture periodicity and self-similarity. Therefore, the reference noise map provides the denoising module with multi-scale texture reference information from fine-grained to coarse-grained, and from local to global, representing a layer-by-layer decomposition and preservation of cue cell texture features at different noise levels.
[0072] Correspondingly, the source noise map originates from the progressive noise addition of the first epithelial image, preserving the structural information of epithelial cells at different scales at different noise addition steps. In the early stages of noise addition (with fewer iterations), the source noise map still retains relatively clear macroscopic structures of epithelial cells, including the location and morphology of the nucleus, the distribution range of the cytoplasm, and spatial structural information such as the overall outline shape of the cell. In the middle and later stages of noise addition (with a gradual increase in the number of iterations), the specific morphology of cells in the source noise map gradually becomes blurred, carrying prior information about the spatial layout and shape of epithelial cells, including the cell's topology, size ratio, and overall outline constraints. Therefore, the source noise map provides the denoising module with multi-scale structural guidance information from fine-grained to coarse-grained, ensuring that the target cell image generated during texture transfer can maintain the original structural and spatial morphological features of the epithelial cells.
[0073] The reference noise map and the source noise map have the exact same tensor dimensions. Specifically, both the reference noise map and the source noise map can exist and be transmitted as a four-dimensional tensor during the noise addition process. The dimensions of this four-dimensional tensor can be represented as [B, C, H, W], where B represents the batch size, i.e., the number of samples processed in parallel at one time; C represents the number of channels; H represents the height of the map; and W represents the width of the feature map.
[0074] For example, when the batch size B=1 (i.e., processing a single image each time), the number of channels C=d, the spatial size H=16, and W=16, the tensor dimensions of the reference noise map and the source noise map are both [1, d, 16, 16].
[0075] It should be noted that the noise addition module performs the same number of noise addition processes on the first cue image as it does on the first epithelial image, which is N iterations of noise addition. The noise scheduling parameters and random seeds used for each noise addition process on the first cue image and the first epithelial image can be the same or different. That is, the noise scheduling parameters and random seeds used when performing the t-th noise addition process on the first cue image can be the same as those used when performing the t-th noise addition process on the first epithelial image, or they can be different. Alternatively, the noise scheduling parameters can be the same but the random seeds can be different, or the random seeds can be the same but the noise scheduling parameters can be different.
[0076] Furthermore, in the N iterations of noise addition processing performed on the first epithelial image, the noise scheduling parameters and random seeds used each time can be the same or different; similarly, in the N iterations of noise addition processing performed on the first cue image, the noise scheduling parameters and random seeds used each time can be the same or different. The specific settings can be determined according to actual needs. Using the same random seed ensures the determinism of the noise addition process, facilitating result reproduction; using different random seeds increases the randomness of the noise addition process, helping to improve the model's generalization ability.
[0077] In some embodiments, after each noise addition process, the noise addition module can also save the noise scheduling parameters used for each noise addition and the added random seed to the memory so that they can be queried and referenced as needed in subsequent noise reduction processes, thereby improving computational efficiency.
[0078] The denoising module uses the source noise map obtained from the last denoising process of the denoising module as the initial generated feature map, and performs multiple iterative denoising processes on the initial generated feature map in reverse to obtain the target cell image.
[0079] The generated feature map refers to the image feature representation that is gradually recovered and generated during the denoising process. In the initial stage of denoising (the first denoising process), it is the source noise map obtained by the last denoising process of the denoising module (i.e., the noise map after N iterations of denoising processing of the first epithelial image, at which point the image structural information is basically lost, and only the noise distribution is retained). As the denoising iteration progresses, the structural and texture information in the generated feature map gradually becomes richer, and the noise component gradually decreases. After the last denoising process (the Nth denoising process) is completed, the generated feature map evolves into a target cell image containing clear structural information and target texture information. It retains the structural information of epithelial cells in the first epithelial image (including macroscopic skeleton and cell morphology), while rendering the texture information of clue cells in the first cue image (including unique edge burrs and granular rough texture). That is, the target cell image is visually represented as a complete cell image with cue cell texture features.
[0080] In some embodiments, during each denoising process, the computer device uses the denoising module of the texture transfer model to filter the generated feature map of the current input based on the source noise map and the reference noise map to obtain the image feature vector. Based on the attention mechanism, the device performs texture rendering on the generated feature map of the current input based on the text vector and the image feature vector to obtain the generated feature map of the current output. The generated feature map of the current output is then used as the generated feature map input for the next denoising process.
[0081] In the denoising module of the texture transfer model, the computer device can use both the source noise map (providing structural priors) and the reference noise map (providing texture priors) to guide the generated feature map. On the one hand, the source noise map preserves the structural information of the epithelial cells, ensuring that the generated feature map is always based on the skeleton of the epithelial cells in the first epithelial image during the denoising process, thus ensuring that the generated target cell image is consistent with the epithelial cells in terms of size, shape, and nucleus position. On the other hand, the reference noise map preserves the texture characteristics of the clue cells. Through the combined guidance of the attention mechanism and text vectors, the texture features of the clue cells are gradually rendered into the generated feature map, achieving texture transfer. This results in the generated target cell image having both the structural skeleton of the epithelial cells and the texture features of the clue cells, thus conforming to the morphological representation of real clue cells in biological morphology.
[0082] The reference noise map input to the Mth denoising process is the reference noise map obtained from the Xth denoising process; the source noise map input to the Mth denoising process is the source noise map obtained from the Xth denoising process; X is N+1-M; M is a positive integer less than or equal to N; N is the total number of denoising processes performed in the denoising module.
[0083] In other words, there is a symmetrical correspondence between the reverse process of the denoising module and the forward process of the noise-adding module. For example, the first denoising process (M=1) corresponds to the last noise-adding process (X=N), the second denoising process (M=2) corresponds to the penultimate noise-adding process (X=N-1), and so on, with the last denoising process (M=N) corresponding to the first noise-adding process (X=1).
[0084] For example, when N=50, the reference noise map input to the 9th denoising process (M=9) is the reference noise map obtained from the 42nd denoising process (X=50+1-9=42), and the input source noise map is the source noise map obtained from the 42nd denoising process; the reference noise map and source noise map input to the 25th denoising process (M=25) correspond to the reference noise map and source noise map output from the 26th denoising process (X=50+1-25=26), respectively. This symmetrical correspondence ensures that the denoising path and the denoising path are aligned at the same noise intensity level, enabling the denoising module to be guided by the source noise map and reference noise map at the corresponding noise intensity in each step, achieving accurate fusion of structural and texture information in the noise space.
[0085] In some embodiments, the N denoising processes of the denoising module of the texture transfer model can be divided into two stages. In the first stage of denoising, dynamically updated text vectors are used to flexibly adapt to and learn the texture features in the reference noise map. In the second stage of denoising, fixed text vectors are used to maintain the stability and consistency of texture rendering. The combination of the two stages can effectively improve the accuracy of texture transfer and the image quality of the generated uploaded feature map.
[0086] When M is 1, that is, the text vector input to the first denoising process is the initial text vector. The initial text vector is generated by the input cue text through a pre-trained text encoder. This initial text vector encodes general semantic information of cue cell texture in the semantic space and has not yet been adapted for the specific first epithelial image and the first cue image.
[0087] When M is greater than 1 and less than or equal to P, the text vector input to the M-th denoising process is the text vector output by the (M-1)-th denoising process; P is less than N / 2.
[0088] From the first denoising process to the Pth denoising process (the first stage), the text vector is iteratively updated through gradient optimization, gradually learning and focusing on the texture features of the current clue cell to be transferred. In this first stage, because the denoising process is in a stage with high noise intensity, the structural information of the generated feature map is not yet complete. At this time, dynamic optimization of the text vector enables the text vector to adaptively adjust according to the difference between the currently generated feature map and the reference noise map, thereby better adapting to the texture characteristics of the clue cell and achieving accurate texture transfer guidance.
[0089] For example, when N=50 and P=10, the denoising module first performs the first to tenth denoising processes (first stage). In this first stage, the text vector starts from the initial text vector, and gradient optimization and updates are performed each time, finally obtaining the optimized text vector (the text vector output by the tenth denoising process). In this process, the text vector gradually evolves from a general description of the cue cell texture to a customized guiding vector that can accurately describe the current cue cell to guide the current texture migration.
[0090] When M is greater than P and less than or equal to N, the text vector input to the Mth denoising process is the text vector output by the Pth denoising process.
[0091] From the (P+1)th denoising process to the Nth denoising process (the second stage), the text vector is fixed and no longer changes. Continuing the example above, from the 11th to the 50th denoising process, the text vector is fixed to the text vector output from the Pth denoising process. Subsequent texture rendering is completed based on the text vector output from the Pth denoising process, ultimately obtaining the target cell image. In this stage, the denoising process has entered a later stage with lower noise intensity, and the structural information of the epithelial cells has been basically restored. At this time, the fixed text vector can provide stable and consistent semantic guidance for subsequent refined texture rendering, avoiding oscillations or inconsistencies in the texture style of the generated features due to continuous changes in the text vector, thereby ensuring the stability of the texture style of the final generated target cell image.
[0092] By employing the segmented control strategy described above, we can ensure the accuracy of texture transfer in adapting to actual cue cells and the stability of generated feature maps, while also effectively controlling computational overhead and improving the overall efficiency of the texture transfer model.
[0093] In some embodiments, the computer device, through the denoising module of the texture transfer model, calculates the loss value of the current denoising process based on the feature difference between the current input reference noise map and the current input generated feature map, when M is greater than 0 and less than or equal to P; calculates the gradient of the loss value with respect to the current input text vector through backpropagation; updates the gradient momentum of the current input based on the gradient and momentum decay coefficient to determine the current output gradient momentum, and uses the current output gradient momentum as the gradient momentum input for the next denoising process; the gradient momentum input for the first denoising process is a zero vector; fine-tunes the current input text vector based on the current output gradient momentum to obtain the current output text vector; and denoises the current input generated feature map based on the current output text vector to obtain the current output generated feature map.
[0094] Since the reference noise map originates from cue cells, its texture features exhibit typical distribution patterns such as edge jaggedness and granular roughness; while the generated feature map originates from epithelial cells, its texture features are relatively smooth and uniform. Therefore, under the same noise intensity level, the deviation between the reference noise map and the generated feature map in terms of feature distribution, statistical properties, and spatial direction can represent the gap between the current generated feature map and the target texture (cue cell texture), thereby driving the text vector to update towards the target texture.
[0095] Specifically, the computer device, through the denoising module of the texture transfer model, extracts features from the generated feature map of the current input based on the epithelial cell mask corresponding to the first epithelial image, when M is greater than 0 and less than or equal to P, to obtain a local generated feature sequence; extracts features from the reference noise map of the current input based on the cue cell mask corresponding to the first cue image, to obtain a local reference feature sequence; calculates multiple generation statistical moments of the local generated feature sequence and each corresponding channel based on the feature tensors of the local generated feature sequence in each channel; calculates multiple reference statistical moments of the local reference feature sequence and each corresponding channel based on the feature tensors of the local reference feature sequence in each channel; calculates the statistical loss of the feature distribution based on the multiple generation statistical moments and the corresponding multiple reference statistical moments of each channel; determines the generation centroid vector corresponding to the local generated feature sequence and the reference centroid vector corresponding to the local reference feature sequence; obtains the directional loss of the feature direction based on the difference between the generation centroid vector and the reference centroid vector; and weights the statistical loss and the directional loss to obtain the loss value of this denoising process.
[0096] Optionally, the denoising module is also used to perform dimensional transformation on the epithelial cell mask corresponding to the first epithelial image to obtain a first mask with the same spatial dimension as the generated feature map of the current input; and then to crop or mask filter the generated feature map of the current input according to the first mask to obtain a local generated feature sequence.
[0097] Specifically, in order to adjust the epithelial cell mask to the same spatial (dimensional) resolution as the generated feature map of this input, so as to ensure that the mask and the feature map correspond in spatial position.
[0098] Specifically, the denoising module is also used to downsample the epithelial cell mask corresponding to the first epithelial image to obtain the first mask; then perform high-dimensional broadcast topology filling along the channel axis to obtain the generated mask sequence; then flatten the generated feature map input this time, so that the generated mask sequence and the flattened generated feature map have the same dimension; and multiply the flattened first mask and the flattened generated feature map by a dot product to obtain the local generated feature sequence.
[0099] For example, suppose the input to this denoising process is the generated feature map. If the dimension is [1, d, H, W] (e.g., H=W=16), then the epithelial cell mask is removed by the denoising module. The first mask is downsampled to [1, 1, H, W]. This first mask is then flattened into a sequence of length H×W, where each spatial location corresponds to a feature vector. The mask values are then broadcast to d channels, resulting in a generated mask sequence of dimension [H×W, d]. ; will generate feature maps Flatten it to [H×W, d]; multiply the two elements one by one to obtain the locally generated feature sequence. ,in, This represents the set of feature tensors on the j-th channel. for The number of spatial raster cells, i.e., the number of mask sequences generated. The number of pixels with a median value of 1.
[0100] Similarly, the denoising module is also used to mask the cue cells corresponding to the first cue image. The second mask is downsampled to the same spatial dimension as the reference noise map of the current input. The sequence of the second mask is then flattened, and the mask values are broadcast to d channels to obtain the reference mask sequence. Flatten the reference noise map input in this step as well; then multiply the two to obtain the locally generated feature sequence. ,in, This represents the set of feature tensors on the j-th channel. for The number of spatial grids, i.e., the reference mask sequence. The number of pixels with a median value of 1.
[0101] In some embodiments, statistical moments may include first-order, second-order, third-order, and fourth-order moments. The first-order moment is the mean, characterizing the macroscopic distribution energy and basic gray-level bias of the clue cell lesion region, reflecting the brightness centrality trend of the overall texture of the clue cells. The second-order moment is the variance, characterizing the local polygonal contrast and texture roughness caused by bacterial adhesion, reflecting the dispersion and visual contrast of the granular texture on the clue cell surface. The third-order moment is the skewness, characterizing the spatial asymmetry and allosteric trend caused by the adhesion of anaerobic bacteria, reflecting the asymmetry and bias of the clue cell texture distribution relative to the center. The fourth-order moment is the kurtosis, characterizing the high-frequency spatial sharpness and local mutation density of irregular sharp burrs and violent edge oscillations under the microscope, reflecting the sharpness of the edge burrs and surface particles of the clue cells and the steepness of the texture distribution. By introducing higher-order statistical moments (third and fourth-order moments), the denoising module can more finely characterize the complex statistical features of the clue cell texture, thereby further improving the accuracy of texture transfer and the quality of the generated feature map.
[0102] Specifically, the denoising module can calculate the four generation statistical moments corresponding to the j-th channel of the locally generated feature sequence based on the feature tensor of the locally generated feature sequence on the j-th channel.
[0103] For example, the denoising module can calculate the four statistical moments corresponding to the j-th channel of the locally generated feature sequence using formulas (1) to (4).
[0104] (1); (2); (3); (4); in, This represents the first-order generating moment of the j-th channel; Let represent the second-order generating moment of the j-th channel; Let represent the third-order generating moment of the j-th channel; Let represent the fourth-order generating moment of the j-th channel; This represents the i-th feature tensor of the j-th channel; express The number of spatial grid cells.
[0105] Similarly, the denoising module can calculate the four reference statistical moments (first-order reference moments) corresponding to the local reference feature sequence and the j-th channel based on the feature tensor of the local reference feature sequence on the j-th channel. Second-order reference moments Third-order reference moments and fourth-order reference moments ).
[0106] Statistical loss measures the difference in feature distribution between the locally generated feature sequence and the local reference feature sequence. This loss function constrains the generated features to approximate the statistical properties of the reference features at each statistical moment, gradually aligning the texture distribution represented by the locally generated feature sequence with the statistical distribution of the cue cell texture. Statistical loss reflects the degree of matching between the locally generated feature sequence and the local reference feature sequence in terms of texture statistical properties. The smaller the statistical loss, the closer the texture distribution represented by the locally generated feature sequence is to the statistical properties of the cue cell texture, indicating a better texture transfer effect.
[0107] Specifically, the denoising module can calculate the statistical loss based on the locally generated feature sequence and the four generated statistical moments corresponding to each channel, as well as the locally reference feature sequence and the four reference statistical moments corresponding to each channel.
[0108] For example, the denoising module can calculate the statistical loss using formula (5). .
[0109] (5); in, These are the weighting coefficients of the first moment; These are the weighting coefficients for the second moment; These are the weighting coefficients for the third moment; These are the weighting coefficients for the fourth moment; for example, .
[0110] The generated centroid vector refers to the representation of the center point of the locally generated feature sequence in the feature space. This generated centroid vector is obtained by taking a weighted average of the feature vectors at all spatial locations within the locally generated feature sequence along the spatial dimension. Each element of the generated centroid vector represents the feature response center of its corresponding channel; that is, if the locally generated feature sequence contains d channels, the generated centroid vector contains d elements. The same logic applies to the reference centroid vector.
[0111] Orientation loss measures the directional deviation between the generated centroid vector and the reference centroid vector in the feature space. This loss function aligns the generated features with the semantic direction of the reference features by constraining their orientation in the feature space, thus gradually bringing the generated features closer to the feature response direction of the cue cell texture in terms of overall semantics. Orientation loss reflects the degree of semantic orientation consistency between the generated and reference features in the feature space. The smaller the orientation loss, the closer the generated features are to the cue cell texture in the semantic direction, meaning the better the texture transfer effect at the semantic level.
[0112] Specifically, the denoising module can calculate the cosine distance between the generated centroid vector and the reference centroid vector to obtain the direction loss.
[0113] For example, the denoising module can calculate the directional loss using formula (6). .
[0114] (6); in, To generate the centroid vector; The reference centroid vector.
[0115] Specifically, after calculating the statistical loss and directional loss, the denoising module weights the statistical loss and directional loss to obtain the loss value for this denoising process.
[0116] For example, the denoising module can calculate the loss value of this denoising process using formula (7). .
[0117] (7); in, is a hyperparameter used to balance the relative contributions of statistical loss and directional loss to the total loss, that is, to balance the approximation of generated features in terms of texture statistics with their alignment in semantic direction. When When the value is large, the orientation loss has a greater weight in the total loss, and the model will focus more on guiding the generated features to align with the feature response directions of the cue cell texture in the semantic direction; when When the value is small, the statistical loss has a larger weight in the total loss, and the model will focus more on making the generated features approximate the statistical distribution characteristics of the cue cell texture on multiple statistical moments.
[0118] Specifically, the computer device, through the denoising module of the texture transfer model, fuses the reference noise map and the source noise map of the current input based on the epithelial cell mask corresponding to the first epithelial image, when M is greater than P and less than or equal to N, to obtain a fused feature map; filters the generated feature map of the current input based on the fused feature map to obtain an image feature vector; determines the text key vector and text value vector corresponding to the text vector of the current input based on an attention mechanism, and determines the image query vector corresponding to the image feature vector; performs cross-attention calculation based on the text key vector, text value vector, and image query vector, performs texture rendering on the image feature vector to obtain a texture feature map; and fuses the texture feature map with the generated feature map of the current input to obtain the generated feature map of the current output.
[0119] Optionally, the denoising module can flatten the input reference noise map and source noise map to obtain flattened reference noise map and flattened source noise map respectively; downsample the epithelial cell mask corresponding to the first epithelial image to obtain the first mask; then perform high-dimensional broadcast topology filling along the channel axis of the first mask to obtain the generated mask sequence; according to the generated mask sequence, fuse the flattened reference noise map and the flattened source noise map to obtain the fused feature map.
[0120] For example, the denoising module can obtain the fused feature map using formula (8). .
[0121] (8); in, To generate the mask sequence, This is the flattened reference noise diagram. This is the flattened source noise diagram.
[0122] Optionally, the denoising module can flatten the input generated feature map to obtain flattened generated feature maps. The flattened generated feature maps and the fused feature map are then input into a state space unit (such as the Mamba module). Leveraging the inherent long-range temporal hidden memory capability of the state space unit's selective scanning mechanism, the flattened generated feature maps and the fused feature map are interacted and fused to obtain the filtered image feature vector. By introducing state space units for state-level selective scanning modulation, smooth filtering can be achieved in the cell boundary region (the region between the epithelial cell background and the clue cell texture), eliminating stitching artifacts and feature antagonism, and improving image quality.
[0123] It should be noted that the dimensions of the fused feature map, the flattened reference noise map, the flattened source noise map, the flattened generated feature map, and the image feature vector can all be [H×W, d].
[0124] Specifically, the denoising module maps the input text vector (i.e., the text vector output from the Pth denoising process) into a text key vector through the first linear projection layer and the second linear projection layer, respectively. and text value vector Simultaneously, the denoising module maps the image feature vectors to image query vectors through a third linear projection layer. .
[0125] Specifically, the computer device obtains a first fractional matrix by multiplying the image query vector and the text key vector through the denoising module of the texture transfer model; it then amplifies the first fractional matrix based on the epithelial cell mask corresponding to the first epithelial image and a preset enhancement coefficient to obtain a second fractional matrix; finally, it multiplies the second fractional matrix with the text value vector to obtain a texture feature map.
[0126] Specifically, the denoising module is used to determine the epithelial cell mask corresponding to the first epithelial image. The generated mask sequence is obtained. Based on the generated mask sequence With preset enhancement coefficient The product of these two fractions is used to enlarge the first fractional matrix, resulting in the second fractional matrix.
[0127] For example, the denoising module can obtain the second fractional matrix using formula (9). .
[0128] (9); in, ; for and The feature dimension length is used as a scaling factor to prevent the dot product result from becoming too large and causing gradient saturation. Its specific value is determined by the network structure of the diffusion model (texture transfer model).
[0129] Specifically, the denoising module is used to perform dimensionality transformation on the texture feature map, and the dimension of the transformed texture feature map is the same as the dimension of the generated feature map input in this operation. The element-wise residuals of the transformed texture feature map and the generated feature map input in this operation are added together to obtain the summed feature map. Then, according to the sampling operator between the current denoising process and the next denoising process, the summed feature map is upsampled to obtain the generated feature map output in this operation.
[0130] The sampling operator between this denoising process and the next denoising process refers to the sampling operation used to adjust the spatial resolution of the feature map between two adjacent denoising processes in the inverse denoising process of the diffusion model.
[0131] Specifically, the computer equipment post-processes the generated feature map output from the Nth denoising process to obtain the target cell image. In the target cell image, the macroscopic skeletal structure of the epithelial cells (including cell size, nuclear morphology, cell outline, etc.) has been completely preserved, while the unique texture features of clue cells (including edge burrs, granular rough texture, gray-level unevenness caused by surface microbial adhesion, etc.) have also been successfully rendered onto the surface of the epithelial cells. In other words, the cells in the target cell image can be regarded as clue cells.
[0132] Optionally, post-processing may include, but is not limited to: mapping the generated feature map from the feature space back to the pixel space (e.g., mapping the number of channels to 3 through a convolutional layer to generate an RGB three-channel image), restoring the pixel values from the normalized range to the pixel value range of the original image, and performing necessary image enhancement or edge smoothing operations.
[0133] In some embodiments, it is assumed that the first cue image 311 corresponds to a cue cell mask 312, the first epithelial image 321 corresponds to an epithelial cell mask 322, and the initial text vector 341; as Figure 3A As shown, in the texture transfer model, the noise-adding module performs multiple iterations of noise-adding processing on the first cue image 311 to obtain multiple reference noise maps (N-times noise-adding processing 310); the noise-adding module also performs multiple iterations of noise-adding processing on the first epithelial image 321 to obtain multiple source noise maps (N-times noise-adding processing 320); the reference noise map 313 output by the Nth noise-adding processing is the reference noise map input by the first noise-adding processing of the denoising module, and the source noise map 323 output by the Nth noise-adding processing is the source noise map input by the first noise-adding processing of the denoising module, and also the generated feature map 331 input by the first noise-adding processing of the denoising module.
[0134] In the texture transfer model, the denoising module is divided into two stages: the first denoising process to the Pth denoising process, and the P+1th denoising process to the Nth denoising process.
[0135] In the first noise reduction process (such as...) Figure 3A As shown, based on the reference noise map 313 and cue cell mask 312 input to the first denoising process, and the generated feature map 331 and epithelial cell mask 322 input to the first denoising process, the loss 351 of the first denoising process is determined; based on the loss 351 of the first denoising process, the text vector input to the first denoising process (i.e., the initial text vector 341) is fine-tuned to obtain the text vector 342 output by the first denoising process (i.e., the text vector input to the second denoising process); based on the text vector 342 output by the first denoising process, the generated feature map 331 input to the first denoising process is denoised to obtain the generated feature map 332 output by the first denoising process (i.e., the generated feature map input to the second denoising process).
[0136] In the second denoising process, the reference noise map input to the second denoising process is the reference noise map 314 output from the (N-1)th denoising process, and the source noise map input to the second denoising process is the source noise map 324 output from the (N-1)th denoising process. The loss of the second denoising process is determined based on the reference noise map 314 input to the second denoising process and the cue cell mask 312, as well as the generated feature map 332 input to the second denoising process and the epithelial cell mask 322. The text vector 342 input to the second denoising process is fine-tuned based on the loss of the second denoising process to obtain the text vector output by the second denoising process. The generated feature map 332 input to the second denoising process is denoised based on the text vector output by the second denoising process to obtain the generated feature map output by the second denoising process. This process is repeated until the text vector 343 and the generated feature map 333 output by the Pth denoising process are obtained.
[0137] During the P-1th denoising process (e.g.) Figure 3BAs shown), the reference noise map input to the P-1th denoising process is the reference noise map output from the N-P+2th denoising process 315, the source noise map input to the P-1th denoising process is the source noise map output from the N-P+2th denoising process 325, the generated feature map input to the P-1th denoising process is the generated feature map output from the P-th denoising process 333, and the text vector input to the P-1th denoising process is the text vector output from the P-th denoising process 343; based on the epithelial cell mask 322, the reference noise map input to the P-1th denoising process 315 and the source noise map input to the second denoising process 325 are fused to obtain the fused feature map 361 of the P-1th denoising process; based on the P- The fused feature map 361 from the first denoising process filters the generated feature map 333 input from the (P-1)th denoising process, resulting in the image feature vector 371 from the (P-1)th denoising process. Based on the image query vector Q of the image feature vector 371 from the (P-1)th denoising process, and the text value vector V and text key vector K of the text vector 343 output from the (P-1)th denoising process, the texture feature map 381 from the (P-1)th denoising process is obtained. The texture feature map 381 from the (P-1)th denoising process is added to the generated feature map 333 input from the (P-1)th denoising process, resulting in the generated feature map 334 output from the (P-1)th denoising process (which is also the generated feature map input from the (P-2)th denoising process). This process continues until the generated feature map 335 output from the Nth denoising process, thus obtaining the target cell image.
[0138] Step 260: The vaginal sample image and the target cell image are fused to generate an enhanced vaginal sample image.
[0139] In some embodiments, the target cell image is fused to the position corresponding to the first epithelial image in the vaginal sample image based on the position information of the first epithelial image in the vaginal sample image to generate an enhanced vaginal sample image.
[0140] In some embodiments, the computer device may perform size and orientation alignment processing on the target cell image before fusing it to the vaginal sample image. Because the target cell image may have undergone a series of feature transformations during texture transfer, its spatial resolution may differ slightly from the original cropped first epithelial image, or it may have experienced minor shifts due to model processing. Therefore, the computer device may resize the target cell image (e.g., by scaling it to the same size as the original first epithelial image using bilinear interpolation) and perform positional alignment based on the centroid position or bounding box of the epithelial cells in the first epithelial image to ensure that the target cell image spatially corresponds precisely to the original background during fusion.
[0141] In some embodiments, the computer device can directly overlay the target cell image onto the corresponding image region in the vaginal sample image. Specifically, the computer device can replace the pixel values of the corresponding image region in the vaginal sample image with the pixel values of the target cell image based on location information, generating an enhanced vaginal sample image. By directly overlaying, the texture details of the target cell image can be fully preserved, avoiding texture blurring caused by blending processing.
[0142] In some embodiments, the computer device may perform edge feathering on the target cell image before overlaying. Edge feathering refers to softening the edge regions of the target cell image so that when the target cell image is overlaid onto the vaginal sample image, its edge pixels can smoothly transition with the surrounding background pixels, avoiding visual unnaturalness caused by abrupt edge changes.
[0143] Specifically, the computer device can acquire the target cell mask corresponding to the target cell image, perform Gaussian blur processing on the target cell mask to obtain a softened weight map, and then perform weighted mixing of the target cell image and the vaginal sample image in the edge region according to the weight map, thereby achieving seamless fusion.
[0144] It should be noted that vaginal sample images typically contain multiple epithelial cells. To further increase the number of clue cells, the computer device can repeatedly execute steps 220-260, performing texture transfer on the first epithelial images corresponding to each of the multiple epithelial cells using a texture transfer model to generate multiple target cell images. Each target cell image is then fused to its corresponding position in the vaginal sample image, resulting in an enhanced vaginal sample image. By repeating this process, multiple clue cells can be generated from multiple epithelial cells in a single vaginal sample image, further increasing the number and diversity of clue cells in the vaginal sample image.
[0145] Specifically, the first epithelial images corresponding to multiple epithelial cells are all different; that is, each first epithelial image contains a different single epithelial cell image region cropped from a vaginal sample image. Because different epithelial cells may differ in cell size, nuclear morphology, cell outline, cell maturity, and their microenvironment, each first epithelial image carries different prior structural information. For each first epithelial image, the computer device performs texture transfer to generate a corresponding target cell image. The first cue image used for texture transfer of each first epithelial image can contain the same or different cue cells.
[0146] In some embodiments, in order to maintain the naturalness and diversity of cell distribution in a vaginal sample image while increasing the number of clue cells, a computer device may select a subset of epithelial cells from multiple epithelial cells identified in a vaginal sample image to perform texture transfer.
[0147] Optionally, the selection strategy may include, but is not limited to: random selection (e.g., randomly selecting 30%–50% of the total number of epithelial cells), selection based on uniform spatial distribution (e.g., ensuring that the selected epithelial cells are evenly distributed in the image, avoiding excessive aggregation or overlap of newly generated clue cells in the image), and selection based on cell morphology (e.g., prioritizing the selection of epithelial cells with sizes and morphologies similar to clue cells to improve the success rate and realism of texture transfer). Through selective enhancement, a certain number of normal epithelial cells and newly added clue cells can be retained simultaneously in the enhanced vaginal sample image, more realistically simulating the cellular composition of clinical vaginal samples.
[0148] In this embodiment, the computer device uses a texture transfer model to transfer the texture features of clue cells in the first clue image to the epithelial cells in the first epithelial image based on the text vector generated from the input prompt text. This allows for the rendering of the unique edge burrs and granular rough texture of clue cells on the epithelial cells while maintaining their original macroscopic skeleton and background structure. This ensures that the generated target cell image contains cells that conform to the morphological characteristics of real clinical clue cells. Furthermore, since the transferred texture features originate from actual clue cells in the vaginal sample image, the texture features in the generated target cell image maintain consistency with the actual clue cells in the vaginal sample image in terms of morphology, texture distribution, and staining, guaranteeing the realism and biological credibility of the clue cells in the enhanced vaginal sample image. Fusing the target cell image with the vaginal sample image increases the number of clue cell samples in the vaginal sample image, providing sufficient training samples for the learning model related to clue cells without the need for additional vaginal sample collection, thereby improving the detection performance and generalization ability of the learning model.
[0149] In some embodiments, such as Figure 4 As shown, the steps of identifying epithelial cells in the vaginal sample image and extracting the image region of the epithelial cells to obtain the first epithelial image may include the following steps 402 to 404.
[0150] Step 402: Target detection is performed on the epithelial cells in the vaginal sample image to identify the location information corresponding to the image region of each epithelial cell.
[0151] In some embodiments, the computer device uses a target detection network (such as YOLOv8, YOLOv9, or YOLO26M) to perform a full scan of the vaginal sample image, identify the position information of all epithelial cells and their corresponding bounding boxes, and determine the original size of each bounding box.
[0152] Specifically, the computer device inputs the pre-processed vaginal sample image into a pre-trained target detection network. Taking the YOLO series network as an example, the network divides the input image into S×S grid cells, with each grid cell responsible for predicting targets whose center point falls within that grid. The network extracts multi-scale feature maps of the image through the backbone network, performs multi-scale feature fusion through the neck network to enhance the detection capability of targets of different sizes, and finally outputs the detection results of epithelial cells through the detection head. Each detection result includes the coordinates (x, y, w, h) of the bounding rectangle, where x and y are the pixel coordinates of the upper left corner of the rectangle in the vaginal sample image, and w and h are the width and height of the rectangle (in pixels), respectively.
[0153] Optionally, the detection results may also include the image region of the bounding rectangle relative to the original size of the vaginal sample image, and the absolute position of the image region of the bounding rectangle in the vaginal sample image, for use in subsequent steps such as cropping, scaling and fusion.
[0154] Step 404: Select any target epithelial cell, and crop the image region of the target epithelial cell according to the position information corresponding to the image region of the target epithelial cell to obtain the first epithelial image and the initial mask corresponding to the first epithelial image.
[0155] In some embodiments, the computer device selects any one target epithelial cell from the identified multiple epithelial cells (e.g., sequentially selected according to the confidence level from high to low, or randomly selected), and crops the corresponding image region from the vaginal sample image according to the coordinate information of the bounding rectangle corresponding to the target epithelial cell to obtain a first epithelial image of the original size.
[0156] In some embodiments, to avoid interference from epithelial cells with incomplete image edges to subsequent texture transfer and modeling, the computer device may also perform edge filtering on the cropped original-size first epithelial image to remove cells with incomplete image edges.
[0157] Specifically, the computer device determines whether the cropped first epithelial image is located in the boundary region of the vaginal sample image. If the distance between any edge of the first epithelial image and any edge of the vaginal sample image is less than a preset pixel threshold (e.g., 10 pixels), the first epithelial image is determined to be located in the boundary region of the vaginal sample image. For the first epithelial image located in the boundary region, the computer device calculates the pixel area of the target epithelial cell within the first epithelial image. If the pixel area is within a preset area range, the target epithelial cell is determined to be a valid cell with complete biological characteristics, and the first epithelial image corresponding to the target epithelial cell can be used to continue subsequent texture migration. If the pixel area is not within the preset area range, the target epithelial cell is determined to be an invalid or damaged cell at the edge, the first epithelial image corresponding to the target epithelial cell is deleted, and a new target epithelial cell is selected.
[0158] In some embodiments, in order to adapt to the fixed standard input resolution of the diffusion model (texture transfer model), the computer device performs scale-normalized resampling on the retained first epithelial image after edge filtering.
[0159] Specifically, the computer device can perform a physical transformation on the retained first epithelial image, scaling it proportionally and applying zero-padding to the boundaries, converting it into a standardized local image (such as 512×512 pixels or 256×256 pixels), resulting in a standardized first epithelial image. Furthermore, during the standardized resampling process, the computer device records the proportional scaling factor and the corresponding boundary padding pixel parameters of this first epithelial image, which are used to subsequently transform the target cell image back to its original spatial scale and fuse it into the vaginal sample image.
[0160] In some embodiments, after normalizing the first epithelial image, the computer device may obtain an initial mask corresponding to the first epithelial image. The initial mask is used to identify the precise pixel region where the epithelial cells are located in subsequent processing, distinguishing the epithelial cell region from the background region.
[0161] Specifically, the computer device can generate an initial mask based on the standardized first epithelial image using an image segmentation model (such as the Segment Anything Model (SAM)). In the initial mask generated from the first epithelial image, pixels belonging to the current target epithelial cell are marked as 1, while background and non-epithelial cell regions are marked as 0. The initial mask has the same spatial resolution as the standardized first epithelial image, achieving accurate differentiation between cellular and background regions.
[0162] In some embodiments, the computer device may also perform post-processing optimization on the initial mask to further improve mask accuracy. Post-processing optimization may include morphological operations, such as using opening operations (erosion followed by dilation) to remove minute noise areas and burrs in the mask, and using closing operations (dilation followed by erosion) to fill small voids and cracks in the mask, making the mask edges smoother and more complete. The morphologically optimized mask can more accurately reflect the true boundaries of epithelial cells, providing more precise spatial constraints for subsequent mask-guided texture migration.
[0163] In this embodiment, the computer device identifies and locates epithelial cells in a vaginal sample image, enabling rapid and accurate identification of the positional information of each epithelial cell. Based on this positional information, the target epithelial cells are precisely cropped to obtain a first epithelial image. This efficient detection and separation of epithelial cells from the vaginal sample image provides precise image regions for subsequent texture transfer, avoiding the subjectivity and inefficiency of manual annotation. Furthermore, the recording and transmission of positional information ensures the alignment of the target cell image with the original spatial position during subsequent fusion.
[0164] like Figure 5 As shown, in some embodiments, a sample enhancement method for clue cells is provided, which can be applied to the aforementioned computer device. This method may include steps 502 to 510.
[0165] Step 502: Perform edge detection on the target epithelial cells in the initial mask corresponding to the first epithelial image to obtain multiple edge pixels.
[0166] Ordinary image erosion or cropping can result in unnatural jagged edges or mechanically irregular sharp corners, which does not conform to the progressive biological characteristics of pathogens adhering to and dissolving the cell edges of clue cells in a jagged manner. The edges of real clue cells are not uniform geometric shapes, but rather exhibit complex morphologies such as irregular spiky, jagged, and locally concave shapes due to the progressive adhesion and erosion of pathogens along the cell surface. Therefore, to accurately simulate this biological change at the mask level, the computer device needs to deform the edges of the epithelial cells in the initial mask of the first epithelial image.
[0167] In some embodiments, the computer device performs edge detection on the target epithelial cells in an initial mask corresponding to the first epithelial image to extract the edge contour information of the target epithelial cells. Since the initial mask is a binary image (a foreground pixel value of 1 represents a cellular region, and a background pixel value of 0 represents a non-cellular region), edge detection can be achieved by extracting the boundary between the foreground region and the background region in the mask.
[0168] Edge pixels are the pixels at the junction of the foreground and background regions of the initial mask in the first epithelial image, that is, the contour boundary points of the target epithelial cells on the initial mask chamber.
[0169] Step 504: Transform the coordinates of each edge pixel to a polar coordinate system with the centroid of the target epithelial cell as the origin, and obtain the polar coordinates corresponding to each edge pixel in order to calculate the polar diameter of each edge pixel.
[0170] In some embodiments, the computer device can calculate the centroid coordinates of the target epithelial cell in the initial mask by averaging the coordinates of all foreground pixels (regions with a pixel value of 1) in the initial mask corresponding to the first epithelial image; construct a polar coordinate system with the centroid as the origin; and obtain the polar coordinates of each edge pixel and the polar radius of each edge pixel based on the relative position between the coordinates of each edge pixel and the centroid coordinates. The polar radius is the relative distance between the corresponding edge pixel and the centroid.
[0171] Through the coordinate transformation described above, the irregular cell edges originally in the Cartesian coordinate system are mapped to the polar coordinate system. In the polar coordinate system, the polar radius, as a function of the polar angle, transforms the complex two-dimensional changes in edge morphology into a one-dimensional functional relationship. That is, the edge contour is represented as a function with the polar angle as the independent variable and the polar radius as the dependent variable. This allows subsequent deformation operations on the edge (such as inward contraction along the radial direction) to be processed from a one-dimensional perspective, thereby simplifying the operational complexity. It also facilitates smooth interpolation of discrete edge points using curve fitting methods to obtain continuous edge curves.
[0172] Step 506: Randomly select U target pixels from multiple edge pixels, and fine-tune the polar radius of each target pixel along the radial direction of each target pixel based on a Gaussian distribution with a negative mean, to obtain the fine-tuned U target pixels.
[0173] U is a positive integer.
[0174] In some embodiments, the computer device randomly selects U target pixels from a plurality of edge pixels. The value of U can be set according to actual needs. For example, U can be 10% to 20% of the total number of edge pixels to ensure that there are enough control points for subsequent curve fitting, while avoiding overfitting of the fitted curve due to excessively dense control points.
[0175] Optionally, the pixel selection method can be either completely random sampling or layered random sampling (that is, dividing the edge pixels into multiple intervals according to the polar angle, and randomly selecting one or more points from each interval) to ensure that the selected target pixels are distributed in all directions (each polar angle interval) of the cell edge, and to avoid all selected points being concentrated in the same area edge, which would lead to uneven deformation.
[0176] It should be noted that although these U target pixels are randomly selected, it is necessary to ensure that the selected target pixels are distributed in multiple directions at the cell edge, avoiding concentration on the same side edge or in the same local area.
[0177] Specifically, the computer device can first sort multiple edge pixels by polar angle from smallest to largest, and divide the entire circumference into U intervals. Then, it can randomly select an edge pixel from each interval as the target pixel, thereby ensuring that the selected target pixel covers all directions of the cell edge, so that the subsequent deformation is evenly distributed in the circumferential direction, avoiding edge distortion caused by excessive concentration of deformation in a certain local area.
[0178] The Gaussian distribution with a negative mean ensures that the fine-tuning values are statistically biased towards negative values, resulting in an overall tendency for edge pixels to shrink inward. This simulates the biological phenomenon of progressive dissolution and erosion of cell edges caused by pathogenic bacteria attachment in cue cells. The pathogens adhere to the cell surface in a serrated pattern, gradually dissolving the cell edges and causing them to shrink inward rather than expand outward. Therefore, compared to outward expansion (with a positive mean), inward shrinkage is more consistent with the morphological changes of real cue cells: the cell edges exhibit blurred boundaries and inward-shrinking appearance due to bacterial adhesion and erosion, rather than outward protrusion.
[0179] Meanwhile, the randomness of the Gaussian distribution results in varying degrees of contraction at different locations. Some locations experience larger contractions (corresponding to areas with dense pathogen adhesion and severe erosion), while others show smaller or near-zero contractions (corresponding to areas with less pathogen adhesion and relatively intact edges). This produces natural, non-uniform edge deformation, avoiding the distortion caused by mechanized uniform contraction. This non-uniform deformation pattern accurately reflects the biological characteristics of pathogens' uneven adhesion to the cell surface. The distribution of bacteria on the cell surface is not uniform but rather clustered or patchy, thus exhibiting local differences in their erosive effect on the cell edge.
[0180] In some embodiments, the standard deviation σ of the Gaussian distribution controls the dispersion of the perturbation. The larger the σ value, the more drastic the change in perturbation amplitude and the stronger the randomness of the edge deformation; the smaller the σ value, the smoother the change in perturbation amplitude and the more uniform the edge deformation. The μ of the Gaussian distribution is less than 0, which is used to control the average amplitude of the contraction.
[0181] Specifically, based on a Gaussian distribution with a negative mean, a random fine-tuning amount is configured for each target pixel. This random fine-tuning amount is a random value in the Gaussian distribution with a negative mean. Then, according to the corresponding random fine-tuning amount, the polar radius of each target pixel is fine-tuned along the radial direction.
[0182] For example, the random fine-tuning amount corresponding to the z-th target pixel. .
[0183] Step 508: Use cubic spline curves to fit the finely adjusted U target pixels to obtain the first cell edge curve.
[0184] Cubic spline curves are an interpolation method that constructs smooth, continuous curves using a series of discrete control points. They fit each pair of adjacent control points using a cubic polynomial and ensure that there are continuous first derivatives (i.e., smooth curves without sharp corners) and continuous second derivatives (i.e., continuous curvature without abrupt changes) at the control points.
[0185] Curve fitting uses U finely tuned target pixels as control points to construct a smooth curve to approximate the shape of the cell edge. Since the finely tuned target pixels are distributed in different directions (different polar angles) of the cell edge, their polar radius values reflect the deformed edge position in the corresponding direction. Curve fitting interpolates between these discrete control points to restore a complete and continuous cell edge contour.
[0186] Specifically, the polar angle of the target pixel is taken as the independent variable and the polar radius as the dependent variable. A functional relationship between the polar radius and the polar angle is constructed by cubic spline interpolation. This function can give the corresponding polar radius value at any polar angle, thus forming a closed and smooth first cell edge curve.
[0187] For example, a computer device can obtain the first cell edge curve using formula (10).
[0188] (10); in, This represents the cubic spline interpolation function; Let represent the polar angle of the z-th target pixel; This represents the polar radius of the z-th target pixel.
[0189] Step 510: Based on the first cell edge curve, deform the initial mask corresponding to the first epithelial image to obtain the epithelial cell mask corresponding to the first epithelial image.
[0190] Specifically, the computer device inversely transforms the first cell edge curve in the polar coordinate system back to the Cartesian pixel coordinate system based on the centroid coordinates, and performs pixel filling inside the first cell edge curve to obtain a deformed epithelial cell mask with the same resolution as the first epithelial image.
[0191] In some embodiments, to simulate the dynamic biological process of epithelial cells being gradually engulfed by pathogenic bacteria such as Gardnerella vaginalis, the computer device morphologically deforms the initial mask. To ensure that the deformed edge never exceeds the physical outline of the original epithelial cell (i.e., the cell area cannot be increased outwards), the computer device sets the initial mask as the upper limit of the spatial hard constraint boundary. Any deformed epithelial cell mask must strictly satisfy formula (11); ensuring that the deformed epithelial cell mask is always contained within the initial mask, that is, the deformed cell region will not exceed the physical outline of the original epithelial cell.
[0192] (11); in, This represents the initial mask corresponding to the first epithelial image; This represents the epithelial cell mask corresponding to the first epithelial image; This represents the empty set.
[0193] In this embodiment, the computer device performs edge detection based on polar coordinate transformation, Gaussian perturbation, and spline curve fitting on the initial mask of the first epithelial image to achieve refined deformation of the cell edge. This results in the cell edge exhibiting a non-uniform and irregular contraction shape caused by the progressive adhesion and erosion of pathogenic bacteria. Compared with traditional image erosion or fixed geometric transformation, the edge deformation generated in this embodiment conforms to the biological characteristics of the real clue cell edge being progressively dissolved by Gardnerella vaginalis, avoiding mechanical jagged or regular sharp corner distortion. This allows the generated epithelial cell mask to be used more accurately for spatial definition of cell and background regions in subsequent texture migration, thereby helping to improve the texture realism and morphological naturalness of the target cell image in the edge region.
[0194] In some embodiments, such as Figure 6 As shown, the steps of fusing the vaginal sample image and the target cell image to generate an enhanced vaginal sample image may include the following steps 602 to 606.
[0195] Step 602: Obtain the target cell mask corresponding to the target cell image.
[0196] Since the target cell image is obtained by processing the normalized first epithelial image using a texture transfer model, its spatial resolution is consistent with that of the normalized first epithelial image. Therefore, the target cell mask corresponding to the target cell image has identified the pixel region where the cue cells in the target cell image are located in the normalized space, and has the same spatial resolution as the target cell image.
[0197] In some embodiments, since the target cell image and the target cell mask are currently in a normalized space, while the original vaginal sample image is in its original image space and resolution, their spatial scales are inconsistent, making direct fusion impossible. Therefore, the computer device can also perform an inverse transformation on the target cell mask based on the proportional scaling factor and boundary padding pixel parameters recorded during the normalized resampling process, to obtain a target cell mask with the same original size as the first epithelial image obtained by the initial cropping in step 404; similarly, an inverse transformation is performed on the target cell image to obtain the target cell image of the original size.
[0198] Step 604: Construct a weight matrix based on the target cell mask.
[0199] In order to achieve a smooth transition between the target cell image and the original vaginal sample image at the pixel level during the fusion process, and to avoid visual unnaturalness or splicing artifacts caused by abrupt changes in the fusion edge, the computer device needs to construct a weight matrix to control the mixing ratio of different regions during fusion.
[0200] To ensure that the generated clue cells in the target cell image replace the original epithelial cells, the weight matrix needs to completely preserve the texture features of the target cell image in the core region inside the target cell image (the image region corresponding to the clue cells) (the fusion weight approaches 1), and retain the pixel information of the original image as much as possible in the background region outside the clue cells, especially to achieve smooth blending (gradual transition of fusion weights) at the edges of the clue cells and the edge regions of the target cell image.
[0201] In some embodiments, the computer device identifies clue cells in a target cell mask and determines a second cell edge curve corresponding to the mask edge of the clue cells in the target cell mask; calculates a first distance between each pixel in the target cell mask and the second cell edge curve; calculates a second distance between each pixel in the target cell mask and the corresponding mask edge of the target cell mask; and determines a fusion weight corresponding to each pixel in the target cell mask based on the spatial distance corresponding to each pixel in the target cell mask to construct a weight matrix; the spatial distance corresponding to a pixel is the minimum value between the corresponding first distance and the corresponding second distance.
[0202] Among them, the fusion weight corresponding to the pixel point within the second cell edge curve is the first weight value; the fusion weight corresponding to the pixel point between the second cell edge curve and the mask edge corresponding to the target cell mask is positively correlated with the spatial distance corresponding to the pixel point.
[0203] Optionally, the first weight value can be a value close to 1, or the first weight value can be 1.
[0204] Specifically, between the second cell edge curve and the mask edge corresponding to the target cell mask, the closer a pixel is to the second cell edge curve and the mask edge (the smaller the spatial distance), the smaller the corresponding fusion weight.
[0205] Step 606: Based on the weight matrix and the location information corresponding to the first epithelial image, the target cell image is fused into the vaginal sample image to obtain the enhanced vaginal sample image.
[0206] Specifically, the computer device determines the original local image in the vaginal sample image corresponding to the original cropped region (i.e., the image region corresponding to the original position of the first epithelial image in the vaginal sample image) based on the location information corresponding to the first epithelial image (including the coordinates of the upper left corner of the original cropped region in the vaginal sample image). Then, the computer device performs weighted fusion of the original local image and the original-sized target cell image according to a weight matrix to obtain the enhanced local image. Finally, the computer device replaces the corresponding original local region in the vaginal sample image with the enhanced local image to obtain the enhanced vaginal sample image.
[0207] For example, a computer device can obtain an enhanced local image using formula (12). .
[0208] (12); in, Represents the original local image; Represents the weight matrix; This represents the original size of the target cell image.
[0209] In this embodiment, the computer device constructs a weight matrix with differentiated weights inside, at the edge and outside of the cell based on the target cell mask. This ensures that the core region (the image region corresponding to the clue cell) is completely preserved, the edge region is gradually blended, and the background region remains unchanged. This achieves seamless fusion of the target cell image and the vaginal sample image, which not only ensures the complete presentation of the texture features of the clue cells generated in the target cell image, but also eliminates splicing traces through smooth blending of the edge transition region. This makes the enhanced vaginal sample image visually natural and realistic, and the newly added clue cells are consistent with the real clue cells in the original image in terms of morphology and texture.
[0210] like Figure 7 As shown, in one embodiment, a cue cell sample enhancement device 700 is provided, which can be applied to the aforementioned computer equipment. The cue cell sample enhancement device 700 may include an image acquisition module 710, a cell recognition module 720, a text acquisition module 730, a texture transfer module 740, and a sample enhancement module 750.
[0211] Image acquisition module 710 is used to acquire images of vaginal samples; the vaginal sample images contain at least one epithelial cell and at least one clue cell.
[0212] The cell recognition module 720 is used to identify epithelial cells in a vaginal sample image and extract the image region of the epithelial cells to obtain a first epithelial image, wherein the first epithelial image contains the image region of any one of the epithelial cells.
[0213] The cell recognition module 720 is also used to identify clue cells in a vaginal sample image and extract the image region of the clue cells to obtain a first clue image, wherein the first clue image contains the image region of any one of the clue cells.
[0214] The text acquisition module 730 is used to acquire the input prompt text and generate an initial text vector based on the input prompt text.
[0215] The texture transfer module 740 is used to transfer texture features from the first cue image to the first epithelial image based on the initial text vector using a texture transfer model, thereby obtaining the target cell image.
[0216] The sample enhancement module 750 is used to fuse vaginal sample images and target cell images to generate enhanced vaginal sample images.
[0217] The texture transfer model includes a noise-adding module and a noise-reducing module. The noise-adding module performs multiple iterations of noise-adding processing on the first cue image to obtain multiple reference noise maps, and performs multiple iterations of noise-adding processing on the first epithelial image to obtain multiple source noise maps. The noise-reducing module uses the source noise map obtained from the last noise-adding processing of the noise-adding module as the initial generated feature map, and performs multiple iterations of reverse noise-reducing processing on the initial generated feature map to obtain the target cell image. In each noise-reducing process, the generated feature map is filtered based on the current source noise map and reference noise map to obtain an image feature vector. Based on an attention mechanism, the generated feature map is texture-rendered based on the current text vector and image feature vector to obtain the current output generated feature map, and the current output generated feature map is used as the input generated feature map for the next noise-reducing process. The text vector input for the first noise-reducing process is the initial text vector.
[0218] Specifically, the detailed descriptions of the noise-adding module and the noise-removing module within the texture transfer model can be found in the relevant description of the texture transfer model in step 250 of the above embodiment, and will not be repeated here.
[0219] In some embodiments, the cell recognition module 720 is further configured to perform target detection on epithelial cells in a vaginal sample image, identify the location information corresponding to the image region of each epithelial cell, select any target epithelial cell, and crop the image region of the target epithelial cell according to the location information corresponding to the image region of the target epithelial cell to obtain a first epithelial image and an initial mask corresponding to the first epithelial image.
[0220] In some embodiments, the sample enhancement device 700 for clue cells may further include a mask deformation module.
[0221] The mask deformation module is used to perform edge detection on the target epithelial cells in the initial mask corresponding to the first epithelial image, obtaining multiple edge pixels; transforming the coordinates of each edge pixel to a polar coordinate system with the centroid of the target epithelial cell as the origin, obtaining the polar coordinates corresponding to each edge pixel, and calculating the polar diameter of each edge pixel; randomly selecting U target pixels from the multiple edge pixels, and fine-tuning the polar diameter of each target pixel along the radial direction of each target pixel based on a Gaussian distribution with a negative mean, obtaining U fine-tuned target pixels; using a cubic spline curve to perform curve fitting on the U fine-tuned target pixels, obtaining the first cell edge curve; deforming the initial mask corresponding to the first epithelial image according to the first cell edge curve, obtaining the epithelial cell mask corresponding to the first epithelial image.
[0222] Specifically, the sample enhancement module 750 is also used to obtain the target cell mask corresponding to the target cell image; construct a weight matrix based on the target cell mask; and fuse the target cell image into the vaginal sample image based on the weight matrix and the position information corresponding to the first epithelial image to obtain the enhanced vaginal sample image.
[0223] Optionally, the sample enhancement module 750 is further configured to identify clue cells in the target cell mask, determine the second cell edge curve corresponding to the mask edge of the clue cells in the target cell mask; calculate the first distance between each pixel in the target cell mask and the second cell edge curve; calculate the second distance between each pixel in the target cell mask and the corresponding mask edge of the target cell mask; determine the fusion weight corresponding to each pixel in the target cell mask based on the spatial distance corresponding to each pixel in the target cell mask, so as to construct a weight matrix; the spatial distance corresponding to a pixel is the minimum value between the corresponding first distance and the corresponding second distance; wherein, the fusion weight corresponding to a pixel within the second cell edge curve is the first weight value; the fusion weight corresponding to a pixel between the second cell edge curve and the corresponding mask edge of the target cell mask is positively correlated with the spatial distance corresponding to the pixel.
[0224] In this embodiment, the computer device uses a texture transfer model to transfer the texture features of clue cells in the first clue image to the epithelial cells in the first epithelial image based on the text vector generated from the input prompt text. This allows for the rendering of the unique edge burrs and granular rough texture of clue cells on the epithelial cells while maintaining their original macroscopic skeleton and background structure. This ensures that the generated target cell image contains cells that conform to the morphological characteristics of real clinical clue cells. Furthermore, since the transferred texture features originate from actual clue cells in the vaginal sample image, the texture features in the generated target cell image maintain consistency with the actual clue cells in the vaginal sample image in terms of morphology, texture distribution, and staining, guaranteeing the realism and biological credibility of the clue cells in the enhanced vaginal sample image. Fusing the target cell image with the vaginal sample image increases the number of clue cell samples in the vaginal sample image, providing sufficient training samples for the learning model related to clue cells without the need for additional vaginal sample collection, thereby improving the detection performance and generalization ability of the learning model.
[0225] Figure 8 This is a structural block diagram of a computer device in one embodiment. For example... Figure 8 As shown, the computer device 110 may include one or more of the following components: a processor 810 and a memory 820 coupled to the processor 810, wherein the memory 820 may store one or more computer programs, which may be configured to implement the methods described in the above embodiments when executed by one or more processors 810.
[0226] Processor 810 may include one or more processing cores. Processor 810 connects to various parts within the computer device 110 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 820, and by calling data stored in memory 820. Optionally, processor 810 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 810 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 810 and may be implemented separately using a communication chip.
[0227] The memory 820 may include random access memory (RAM) or read-only memory (ROM). The memory 820 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 820 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described above. The data storage area may also store data created by the computer device 110 during use.
[0228] Understandably, computer device 110 may include more or fewer structural elements than those shown in the block diagram above, such as power supply, input buttons, camera, speaker, screen, RF (Radio Frequency) circuit, Wi-Fi (Wireless Fidelity) module, Bluetooth module, sensors, etc., and may not be limited herein.
[0229] This application discloses a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the methods described in the above embodiments.
[0230] This application discloses a computer program product, including a computer program, which, when executed by a processor, implements the methods described in the above embodiments.
[0231] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), etc.
[0232] Any references to memory, storage, databases, or other media used herein may include non-volatile and / or volatile memory. Suitable non-volatile memory may include ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which is used as an external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as Static RAM (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), Rambus DRAM (RDRAM), and Direct Rambus DRAM (DRDRAM).
[0233] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Those skilled in the art should also recognize that the embodiments described in the specification are optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0234] In the various embodiments of this application, it should be understood that the sequence number of each process does not necessarily imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0235] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0236] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they can be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0237] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0238] If the integrated units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-accessible memory. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several requests to cause a computer device (which can be a personal computer, server, or network device, specifically a processor in the computer device) to execute some or all of the steps of the methods described in the various embodiments of this application.
[0239] The foregoing has provided a detailed description of a method for enhancing clue cells according to embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there may be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for enhancing clue cell samples, characterized in that, Applied to computer devices, the method further includes: The computer device acquires images of vaginal samples; the vaginal sample images contain at least one epithelial cell and at least one clue cell; The computer device identifies the epithelial cells in the vaginal sample image and extracts the image regions of the epithelial cells to obtain a first epithelial image, wherein the first epithelial image contains the image region of any one of the at least one epithelial cells. The computer device identifies clue cells in the vaginal sample image and extracts the image regions of the clue cells to obtain a first clue image, wherein the first clue image contains the image region of any one of the at least one clue cells. The computer device acquires the input prompt text and generates an initial text vector based on the input prompt text; The computer device uses a texture transfer model to transfer texture features from the first cue image to the first epithelial image based on the initial text vector, thereby obtaining a target cell image. The computer device fuses the vaginal sample image and the target cell image to generate an enhanced vaginal sample image; The texture transfer model includes a noise-adding module and a noise-removing module; the noise-adding module is used to perform multiple iterations of noise-adding processing on the first cue image to obtain multiple reference noise maps, and to perform multiple iterations of noise-adding processing on the first epithelial image to obtain multiple source noise maps. The denoising module is used to take the source noise map obtained from the last denoising process of the denoising module as the initial generated feature map, and to perform reverse multiple iterative denoising processes on the initial generated feature map to obtain the target cell image. In each denoising process, the generated feature map is filtered based on the current input source noise map and the reference noise map to obtain an image feature vector. Based on an attention mechanism, the generated feature map is texture-rendered based on the current input text vector and the image feature vector to obtain the current output generated feature map. This output generated feature map is then used as the input generated feature map for the next denoising process. The text vector input for the first denoising process is the initial text vector.
2. The method according to claim 1, characterized in that, The reference noise map input to the Mth denoising process is the reference noise map obtained from the Xth denoising process; the source noise map input to the Mth denoising process is the source noise map obtained from the Xth denoising process; where X is N+1-M; where M is a positive integer less than or equal to N; and where N is the total number of denoising processes performed in the denoising module. When M is greater than 1 and less than or equal to P, the text vector input to the Mth denoising process is the text vector output by the (M-1)th denoising process. The P is less than N / 2; When M is greater than P and less than or equal to N, the text vector input to the Mth denoising process is the text vector output by the Pth denoising process.
3. The method of claim 2, wherein, The noise reduction module is also used for: When M is greater than 0 and less than or equal to P, the loss value of this denoising process is calculated based on the feature difference between the reference noise map and the generated feature map of this input. The gradient of the loss value with respect to the current input text vector is calculated through backpropagation; Based on the gradient and momentum decay coefficient, the gradient momentum of the current input is updated to determine the gradient momentum of the current output, and the gradient momentum of the current output is used as the gradient momentum input for the next denoising process. The gradient momentum input in the first denoising process is a zero vector; The text vector of this input is fine-tuned based on the gradient momentum of this output to obtain the text vector of this output. The generated feature map of the input is denoised based on the text vector of the output, and the generated feature map of the output is obtained.
4. The method of claim 3, wherein, The noise reduction module is also used for: When M is greater than 0 and less than or equal to P, feature extraction is performed on the generated feature map of this input based on the epithelial cell mask corresponding to the first epithelial image to obtain a local generated feature sequence. Based on the clue cell mask corresponding to the first clue image, feature extraction is performed on the reference noise map input this time to obtain a local reference feature sequence; Based on the feature tensors of the locally generated feature sequence in each channel, calculate multiple generation statistical moments of the locally generated feature sequence and each channel; Based on the feature tensors of the local reference feature sequence in each channel, calculate the local reference feature sequence and multiple reference statistical moments corresponding to each channel; The statistical loss of the feature distribution is calculated based on the multiple generated statistical moments and the multiple reference statistical moments corresponding to each channel. Determine the generated centroid vector corresponding to the local generated feature sequence, and determine the reference centroid vector corresponding to the local reference feature sequence; The directional loss of the feature direction is obtained based on the difference between the generated centroid vector and the reference centroid vector; The statistical loss and the directional loss are weighted to obtain the loss value of this denoising process.
5. The method of claim 2, wherein, The noise reduction module is also used for: When M is greater than P and less than or equal to N, the reference noise map and the source noise map of this input are fused according to the epithelial cell mask corresponding to the first epithelial image to obtain a fused feature map; The generated feature map of this input is filtered based on the fused feature map to obtain the image feature vector; Based on the attention mechanism, the text key vector and text value vector corresponding to the input text vector are determined, and the image query vector corresponding to the image feature vector is determined. Cross-attention calculation is performed based on the text key vector, the text value vector, and the image query vector; texture rendering is then performed on the image feature vector to obtain a texture feature map. The texture feature map is fused with the generated feature map of the current input to obtain the generated feature map of the current output.
6. The method of claim 5, wherein, The noise reduction module is also used for: The first fraction matrix is obtained by multiplying the image query vector and the text key vector; Based on the epithelial cell mask corresponding to the first epithelial image and the preset enhancement coefficient, the first fractional matrix is magnified to obtain the second fractional matrix; Multiply the second fractional matrix by the text value vector to obtain the texture feature map.
7. The method of claim 1, wherein, The step of identifying epithelial cells in the vaginal sample image and extracting the image regions of the epithelial cells to obtain a first epithelial image includes: Target detection is performed on the epithelial cells in the vaginal sample image to identify the location information corresponding to the image region of each epithelial cell; Select any target epithelial cell, and crop the image region of the target epithelial cell according to the position information corresponding to the image region of the target epithelial cell to obtain a first epithelial image and an initial mask corresponding to the first epithelial image.
8. The method of claim 7, wherein, The method further includes: Edge detection is performed on the target epithelial cells in the initial mask corresponding to the first epithelial image to obtain multiple edge pixels; The coordinates of each edge pixel are transformed to a polar coordinate system with the centroid of the target epithelial cell as the origin, so as to obtain the polar coordinates corresponding to each edge pixel and calculate the polar diameter of each edge pixel. U target pixels are randomly selected from the plurality of edge pixels, and the polar radius of each target pixel is finely adjusted along the radial direction of each target pixel based on a Gaussian distribution with a negative mean, to obtain U target pixels after fine adjustment; where U is a positive integer. The first cell edge curve is obtained by fitting the U target pixels after fine-tuning using a cubic spline curve. Based on the first cell edge curve, the initial mask corresponding to the first epithelial image is deformed to obtain the epithelial cell mask corresponding to the first epithelial image.
9. The method of claim 8, wherein, The step of fusing the vaginal sample image and the target cell image to generate an enhanced vaginal sample image includes: Obtain the target cell mask corresponding to the target cell image; Construct a weight matrix based on the target cell mask; Based on the weight matrix and the location information corresponding to the first epithelial image, the target cell image is fused into the vaginal sample image to obtain an enhanced vaginal sample image.
10. The method of claim 9, wherein, The step of constructing a weight matrix based on the target cell mask includes: The clue cells in the target cell mask are identified, and the second cell edge curve corresponding to the mask edge of the clue cells in the target cell mask is determined. Calculate the first distance between each pixel in the target cell mask and the edge curve of the second cell; Calculate the second distance between each pixel in the target cell mask and the corresponding mask edge of the target cell mask; Based on the spatial distance corresponding to each pixel in the target cell mask, the fusion weight corresponding to each pixel in the target cell mask is determined to construct a weight matrix; the spatial distance corresponding to each pixel is the minimum value between the corresponding first distance and the corresponding second distance; The fusion weight corresponding to a pixel point within the second cell edge curve is a first weight value; the fusion weight corresponding to a pixel point between the mask edge corresponding to the second cell edge curve and the target cell mask is positively correlated with the spatial distance of the pixel point.
