A data enhancement method for small sample images of cervical liquid-based pathological cell detection

The foreground and background contrast of cervical liquid-based cell images was adjusted by calculating the threshold using the bimodal method, and the images were processed using the Mixup, Cutout, and Mosaic algorithms. This solved the problem of insufficient samples in the cervical liquid-based cell image dataset and enhanced the generalization ability and detection accuracy of the model.

CN116664614BActive Publication Date: 2025-09-26SHANDONG COMP SCI CENTNAT SUPERCOMP CENT IN JINAN +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310526366.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-06
Publication Date
2025-09-26
Estimated Expiration
2043-05-06

AI Technical Summary

Technical Problem

The insufficient number of samples in the cervical liquid-based cell image dataset leads to insufficient model training, poor generalization ability, and an imbalance between normal and abnormal cell categories, which affects detection accuracy.

Method used

The bimodal method is used to calculate the thresholds of the image foreground and background, and the image contrast is adjusted through Mixup and Cutout operations. The Mosaic algorithm is combined to perform image stitching, cropping and rotating sub-image blocks to enhance the dataset.

Benefits of technology

Effectively increase the amount of data, improve the generalization ability of the model, balance the distribution of cell categories, and improve the recognition accuracy and robustness of the detection model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116664614B_ABST
    Figure CN116664614B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of image processing, and provides a method for enhancing few-sample image data in cervical liquid-based pathological cell detection, including removing non-critical information from the collected square images, fixing the image size, and performing preprocessing to enhance the data set; after taking out a batch of images from the data set, using the bimodal method to calculate the threshold for separating the foreground and background of each image; calculating the contrast between the foreground and background of each image according to the pixel ratio of the foreground to the background; setting contrast thresholds P1 and P2, and P1 < P2; performing corresponding image processing according to the range of the contrast of each input image in the batch until all images meet the requirements of the image foreground target and background contrast: after the above processing, randomly select four pictures that meet the requirements of the image foreground target and background contrast from the batch for post-processing of Mosaic and output. The present invention solves the problems of insufficient image samples and sample imbalance in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image processing, and more specifically, relates to a method for enhancing small sample image data for cervical liquid-based pathological cell detection. Background Art

[0002] With the development of artificial intelligence technology and its widespread application in medical imaging, AI can present information in images that is difficult for the human eye to capture, such as color and texture, as characteristic data. By combining algorithms such as cell segmentation and cell classification, and integrating the reading skills of pathologists, a computer-assisted screening system for cervical cancer can be realized. Its application in cervical liquid-based cytology can significantly improve work efficiency and reduce the workload of readers, which is of great significance for early cervical cancer screening. The implementation and promotion of pathology AI is expected to fill the shortage of nearly 100,000 pathologists, solve the serious shortage of pathology industry supply and the imbalanced distribution of medical resources, and greatly promote the implementation of tiered diagnosis and treatment.

[0003] Convolutional neural networks, used for image recognition and classification tasks, require large image datasets for training. Because medical pathology cell images involve patient privacy, they must be obtained through consultation with hospitals, and the quantity required for the task is insufficient. Because datasets of cervical exfoliated cell slide images are too small, to improve cervical cancer cell recognition and generalization learning capabilities, the data stored in the original cervical exfoliated cell dataset needs to be expanded.

[0004] There are many ways to augment medical image data. The commonly used methods are mainly the following:

[0005] Mirror (filp), flip the image horizontally and vertically. Horizontal flip is usually adopted. Vertical flip can be obtained by rotating the image 180° and then performing horizontal flip.

[0006] Rotation: rotating the image at any angle can cause the image size to change;

[0007] Scale: The image can be scaled inward or outward. Scaling outward will increase the size of the image, which is often done after cropping an image to make the image larger than or equal to the original image; scaling inward will reduce the size of the image, in which case the image needs to be padded.

[0008] Cropping: randomly extracting a portion of the original image and then scaling it outward to the size of the original image. This method is usually called random cropping.

[0009] Color jittering, color data enhancement, image brightness, saturation and contrast transformation.

[0010] A variety of sample augmentation methods have been proposed to address the problem of insufficient image samples. These methods, based on the original dataset, modify the raw data to generate similar yet distinct samples, increasing the dataset size. This allows for adequate model training and reduces overfitting. Furthermore, altering the original samples can reduce the model's reliance on certain attributes of the target, thereby improving the model's generalization capabilities. Therefore, data augmentation can be used not only to address insufficient sample size but also to address sample imbalance.

[0011] Chinese patent document CN106803268A discloses a method for simulating orientation diversity samples of fruit lesion images, including: removing non-critical signals from the collected image to reconstruct a square image; calculating the pixels surrounded by the largest inscribed circle of the square image and removing some pixels outside the inscribed circle to obtain a circular image; and obtaining simulation samples of different orientations by rotating the obtained circular image multiple times at the same angle interval.

[0012] In summary, the cervical liquid-based cell image dataset is generated by cropping cervical liquid-based cell pathology digital slides. The cervical liquid-based cell pathology slides are scanned using a scanner to obtain cervical liquid-based cell whole-field pathology digital images (WSIs). The whole-field digital slide WSI images at 20x magnification are selected and trimmed into several image regions of 1000×1000 pixels. The dataset images used for network model training are obtained by cropping, and there are incomplete cell features around the images, which affects the accuracy of cell recognition and the division of foreground and background. The disadvantage of mosaic data augmentation is that the dataset itself contains many small objects, which makes the small objects smaller after data augmentation, ultimately leading to poor model generalization ability. Secondly, when the instance categories of normal and abnormal cells in the input image are unbalanced, it cannot be changed. Cell images are color images, and cell color should be retained as a major feature of abnormal cells and cannot be easily changed. Traditional image enhancement methods that use image rotation may cause some information in the original image to be blocked and lost after rotation. Summary of the Invention

[0013] The present invention aims to overcome at least one of the above-mentioned defects of the prior art and provide a method for enhancing small sample image data for cervical liquid-based pathological cell detection.

[0014] The detailed technical solutions of the present invention are as follows:

[0015] A method for enhancing small sample image data for cervical liquid-based pathological cell detection comprises the following steps:

[0016] S1. Remove non-critical information from the collected square images, fix the image size, and perform preprocessing to enhance the dataset;

[0017] S2. After taking out a batch of images from the dataset, use the bimodal method to calculate the threshold for separating the foreground and background of each image, include normal cells in the background, and consider abnormal cells as the foreground;

[0018] S3. Calculate the contrast between the foreground and background of each image based on the pixel ratio of the foreground to the background pixel ratio;

[0019] S4. Set the contrast threshold P1 with the overall average gray value as the threshold for separating the foreground and background of the image, and set the contrast threshold P2 with the average gray value of the background as the threshold for separating the foreground and background of the image, and P1 < P2; Use P1 and P2 as the range boundaries for the contrast of the foreground and background of the image that meets the requirements;

[0020] S5. Perform corresponding image processing according to the range of the contrast of each input image in the batch until all images meet the requirements of the foreground target and background contrast of the image:

[0021] If the input image P < P1, select images in the batch with a contrast that can satisfy P1 ≤ P ≤ P2 for Mixup until P1 ≤ P ≤ P2 is satisfied;

[0022] If the input image P satisfies P1 ≤ P ≤ P2, it meets the requirements of the foreground target and background contrast of the image;

[0023] If the input image P > P2, perform random pixel inactivation by random Cutout until P1 ≤ P ≤ P2 is satisfied;

[0024] S6. After the above processing, randomly select four pictures that meet the requirements of the foreground target and background contrast of the image from the batch for post-processing of Mosaic and output.

[0025] The preprocessing of S1 includes:

[0026] S101. Connect the center points of the two pairs of opposite sides of the image as a line, and crop the image into four sub-image blocks of the same size;

[0027] S102. Let the height of the image be H and the width be W, then the height of the sub-image block is H / 2 and the width is W / 2, which are respectively marked as block1, block2, block3, and block4, and the four sub-image blocks are randomly horizontally mirrored;

[0028] The horizontal mirroring: Mirror the left and right parts of the image with the vertical central axis of the image as the symmetry line;

[0029] S103 , splicing the sub-image blocks processed in S102 in the order of the original image positions, and shifting the spliced ​​sub-image blocks horizontally or vertically counterclockwise by the distance of one sub-image block to generate three new images of the same size and shape as the original images.

[0030] The pre-processing of S1 also includes a maximum inscribed circle clipping method:

[0031] S111, removing non-critical information from the collected square image, fixing the image size, and performing maximum inscribed circle cropping to obtain an inscribed circle image and a square boundary image; the square boundary image is the boundary image remaining after the maximum inscribed circle cropping is performed on the square image;

[0032] S112, cutting the obtained inscribed circle image into four fan-shaped sub-image blocks of equal size according to the two perpendicular diameter line segments, and marking them as block1, block2, block3, and block4 respectively;

[0033] S113, stitching the four cropped sub-image blocks together, and then rotating them according to specific angles: a fixed rotation angle sequence of a sub-image block is sequentially rotated 90°, 180°, and 270°; each time the fixed sub-image block is rotated, the other sub-image blocks are randomly rotated 90°, 180°, or 270°, and the positions of the sub-image blocks after rotation cannot be the same, thereby generating three new inscribed circle images;

[0034] S114 , merging the new inscribed circle image obtained in S113 with the square boundary image in S1 to form three final new images.

[0035] S2, after extracting a batch of images from the dataset, uses the bimodal method to calculate the threshold for separating the foreground and background of each image, including normal cells in the background and abnormal cells as the foreground, specifically including:

[0036] S21. Take a batch of images from the dataset and find the maximum and minimum grayscale values ​​of each image, which are denoted as g l and g u , let the initial threshold be:

[0037]

[0038] S22, according to the initial threshold T 0 Divide the image into foreground and background, and calculate the average gray value A of the foreground f , the average gray value of the background A b and the overall average gray value Normal cells are included in the background and abnormal cells are placed in the foreground;

[0039]

[0040]

[0041] In formulas (2) and (3), g i represents the gray value of a pixel, and [(g) represents the number of pixels with this gray value in the image.

[0042] In step S4, the overall average gray value is used as the threshold for separating the foreground and background of the image to set the contrast threshold P1, and the average gray value of the background is used as the threshold for separating the foreground and background of the image to set the contrast threshold P2, which specifically includes:

[0043] According to the image contrast, set the contrast double thresholds P1 and P2, where P1 < P2; use P1 and P2 as the range boundaries of the foreground and background contrast of the compliant image;

[0044] The calculation of P1 is as follows: Let the threshold be [[ID=第十九]]After separating the foreground and background of the image and performing contrast calculation, calculate P1. The formula is:

[0045]

[0046] In formula (5), y represents the number of images, and P i represents the contrast of the foreground target of the i-th image under the division of the threshold ;

[0047] The calculation of P2 is as follows: Let the threshold be T K = A b After separating the foreground and background of the image and performing contrast calculation, calculate P2. The formula is:

[0048]

[0049] In formula (6), y represents the number of images, and P i represents the contrast of the foreground target of the i-th image under the division of the threshold T K = A b .

[0050] The Mixup of the image in step S5 specifically includes:

[0051] S501: If the P of the input first image < P1, then select a second image from the batch whose contrast can satisfy P1 ≤ P ≤ P2 and perform Mixup with the first image:

[0052] Obtain a random number λ, which is a random number subject to a β distribution, representing the weight value, and the range is (0, 1); randomly select a second image from the batch that satisfies P1 ≤ P ≤ P2;

[0053] S502, performing weighted image fusion on the first image and the second image using weights λ and 1-λ respectively;

[0054] S503, output the Mixup image, and determine whether the contrast satisfies P1≤P≤P2;

[0055] If satisfied, proceed to S6;

[0056] If it is not satisfied, the output Mixup image P>P2, and random Cutout is used to perform random pixel inactivation on the image;

[0057] The random pixel deactivation by random cutout specifically includes:

[0058] If the input image P>P2, random Cutout is used to perform random pixel inactivation, and the Cutout image is output to determine whether the contrast satisfies P1≤P≤P2;

[0059] If satisfied, proceed to S6;

[0060] If not, the output Cutout image inactivates the foreground target pixels, and then the image is mixed up.

[0061] The post-processing of S6 Mosaic includes:

[0062] Randomly select 4 images from the batch, combine them, crop and splice them at random positions to form a new image, repeat batch_size times, and get batch_size mosaic data enhanced images.

[0063] Compared with the prior art, the present invention has the following beneficial effects:

[0064] (1) The present invention provides a method for enhancing small sample image data for cervical liquid-based pathological cell detection, which includes normal cells in the background, uses a bimodal method to calculate the threshold for dividing the foreground and background in the image, and then calculates the image contrast; the bimodal method statistically calculates the pixel features of the grayscale image and calculates the threshold, so that the image processing result obtained by this threshold can better divide the foreground and background.

[0065] (2) The present invention provides a method for data enhancement of a small number of samples of images for cervical liquid-based pathological cell detection. The method crops the image at the divided positions, sends the cropped four sub-image blocks to Mosaic data enhancement, and splices and combines them into a new image through the Mosaic algorithm. This method not only does not change the original background of the image, but also corrects a major disadvantage of mosaic data enhancement, that is, there are many small targets in the data set itself, and the small targets after data enhancement are smaller, resulting in poor generalization ability of the model. The method of cropping the image into sub-image blocks for data enhancement is more suitable for the situation of the data set and can effectively increase the data volume to 4 times the original data set.

[0066] (3) The present invention provides a method for enhancing small sample image data for cervical fluid-based pathological cell detection. This method involves cropping the image to its maximum inscribed circle, rotating the inscribed circle image about its center, and then splicing the image back to the original image size. Compared to traditional methods that use image rotation for image enhancement, the enhanced image of the present invention does not lose original image information, and the rotation angle is controlled to prevent duplicate images.

[0067] (4) The present invention provides a method for enhancing small sample image data for cervical liquid-based pathological cell detection, which uses a cropping and splicing operation to better fit the characteristics of the sliced ​​cell image and can adapt to the presence of incomplete cell features around the cervical liquid-based cell pathology image, thereby enhancing the recognition ability of the detection model.

[0068] (5) The present invention provides a method for enhancing small-sample image data for cervical liquid-based pathological cell detection. By improving the Mosaic algorithm, the contrast between the target and the background in each image is calculated based on the original algorithm. Then, through the contrast double threshold, images that meet the conditions are output, and images that do not meet the conditions need to be processed. The improved Mosaic algorithm processes the imbalance between foreground and foreground categories, and can make the instance categories of normal cells and abnormal cells in the image balanced.

[0069] (6) The present invention provides a method for enhancing data of a small number of samples of images for cervical liquid-based pathological cell detection. When the input image does not meet the contrast threshold condition, the contrast of the input image can be increased after the Mixup operation, the number of abnormal cell instances can be increased, the sample distribution can be expanded, and the trained model can be more robust; or a random Cutout operation can be taken to randomly inactivate pixels in the image; on the one hand, the image contrast can be adjusted to prevent the imbalance of foreground cell categories caused by an excessively high proportion of abnormal cells; on the other hand, the target features of occluded cells can be simulated to prevent overfitting and improve the generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] Figure 1 It is a schematic diagram of the business process described in the present invention.

[0071] Figure 2 This is a schematic diagram of the cutting process in Example 1 of the present invention.

[0072] Figure 3 It is a schematic diagram of a sub-image block in Example 1 of the present invention.

[0073] Figure 4 This is a schematic diagram of horizontal mirroring in Example 1 of the present invention.

[0074] Figure 5 This is the horizontal mirroring result diagram in Example 1 of the present invention.

[0075] Figure 6 This is a schematic diagram of the maximum inscribed circle cutting process in Example 2 of the present invention.

[0076] Figure 7 This is a schematic diagram of the maximum inscribed circle cutting in Example 2 of the present invention.

[0077] Figure 8 Schematic diagram of the maximum inscribed circle sub-image block in embodiment 2 of the present invention.

[0078] Figure 9 Schematic diagram of the rotation of the maximum inscribed circle sub-image block in embodiment 2 of the present invention.

[0079] Figure 10 This is an improved Mosaic image enhancement flow chart in Example 1 of the present invention.

[0080] Figure 11 This is a schematic diagram of the Mixup process in Example 1 of the present invention.

[0081] Figure 12 2 is a schematic diagram of the random pixel deactivation process performed by Cutout in Example 1 of the present invention. DETAILED DESCRIPTION

[0082] The present disclosure will be further described below with reference to the accompanying drawings and embodiments.

[0083] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of the present disclosure. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as commonly understood by those skilled in the art to which the present disclosure belongs.

[0084] In the absence of conflict, the embodiments of the present disclosure and the features thereof may be combined with each other.

[0085] Example 1

[0086] This embodiment provides a method for enhancing small sample image data for cervical liquid-based pathological cell detection;

[0087] S1, remove non-critical information from the collected square image, fix the image size, and perform preprocessing to enhance the dataset;

[0088] Furthermore, the pre-processing of S1 is as follows: Figure 2 Shown, including:

[0089] S101, using the center points of two opposite sides of the image as a line, cut the image into four sub-image blocks of the same size, such as Figure 3 As shown;

[0090] S102, let the image height be H and width be W, then the sub-image blocks have a height of H / 2 and a width of W / 2, and are labeled as block1, block2, block3, and block4 respectively. The four sub-image blocks are randomly mirrored horizontally;

[0091] The horizontal mirroring is to mirror the left and right parts of the image with the vertical axis of the image as the symmetry line, such as Figure 4 As shown;

[0092] Then the coordinates of (x0, y0) in the original image become after horizontal mirroring It can be expressed as a matrix:

[0093]

[0094] The inverse transform is:

[0095]

[0096] Right now:

[0097]

[0098] S103, the sub-image blocks processed in S102 are spliced ​​in the order of the original image positions, and the spliced ​​sub-image blocks are translated counterclockwise horizontally or vertically by the distance of one sub-image block to generate three new images of the same size and shape as the original image, such as Figure 5 As shown;

[0099] Translation is to process the coordinates (x0, y0) of the pixel in the image. Let the translation amounts in the X and Y directions be dx and dy respectively, and the coordinates after translation be (x2, y2). The calculation formula is:

[0100]

[0101] First, perform padding transformation on the above formula:

[0102]

[0103] The above two equations can be expressed through matrix operations:

[0104]

[0105] S2. After taking a batch of images (set manually based on the amount of data) from the dataset, use the bimodal method to calculate the threshold for separating the foreground and background of each image, incorporating normal cells into the background and abnormal cells as the foreground;

[0106] Furthermore, after taking a batch of images from the dataset, we use the bimodal method to calculate the threshold for separating the foreground and background of each image, incorporating normal cells into the background and abnormal cells into the foreground. Specifically, we include:

[0107] S21. Take a batch of images from the dataset and find the maximum and minimum grayscale values ​​of each image, which are denoted as g l and g u , let the initial threshold be:

[0108]

[0109] S22, according to the initial threshold T0, the image is divided into foreground and background, and the average gray value A of the foreground is calculated respectively. f , the average gray value of the background A b and the overall average gray value Normal cells are included in the background and abnormal cells are placed in the foreground;

[0110]

[0111]

[0112] In formula (2) and formula (3), g i Represents the grayscale value of the pixel, and h(g) represents the number of pixels with this grayscale value in the image.

[0113] S3, calculating the contrast between the foreground and the background of each image based on the pixel ratio of the foreground and the pixel ratio of the background;

[0114] Contrast calculation method: After loading the image, perform image threshold segmentation to divide the image into black and white parts; the white part represents the foreground object, and the black part represents the background. The threshold is obtained using the bimodal method;

[0115] Then perform an "opening operation" on the image, first perform an erosion operation on the image, and then perform an expansion operation on the image. The final binary image is used to calculate the contrast between the foreground object and the background based on the proportion of white pixels and the proportion of black pixels.

[0116] Contrast calculation method:

[0117] Calculate the proportion of foreground pixels and denote it as T;

[0118] Calculate the proportion of background pixels and denote it as B;

[0119] Contrast:

[0120] S4. Set the contrast threshold P1 with the overall average gray value as the threshold for separating the foreground and background of the image, and set the contrast threshold P2 with the average gray value of the background as the threshold for separating the foreground and background of the image, and P1 < P2; Use P1 and P2 as the range boundaries of the contrast between the foreground and background of the image that meets the requirements;

[0121] Furthermore, setting the contrast threshold P1 with the overall average gray value as the threshold for separating the foreground and background of the image, and setting the contrast threshold P2 with the average gray value of the background as the threshold for separating the foreground and background of the image specifically includes:

[0122] Set the contrast double thresholds P1 and P¬2 according to the image contrast, where P1 < P2; Use P1 and P2 as the range boundaries of the contrast between the foreground and background of the image that meets the requirements;

[0123] The calculation of P1 is: Let the threshold be After separating the foreground and background of the image and performing contrast calculation, calculate P1. The formula is:

[0124]

[0125] In formula (5), y represents the number of images, and P i represents the contrast of the foreground target of the i-th image under the division of the threshold ;

[0126] The calculation of P2 is: Let the threshold be T K = A b , After separating the foreground and background of the image and performing contrast calculation, calculate P2. The formula is:

[0127]

[0128] In formula (6), y represents the number of images, and P i represents the contrast of the foreground target of the i-th image under the division of the threshold T K = A b ;

[0129] Threshold selection strategy:

[0130] The selection of P1 meets the average level of the proportion of abnormal cells in all images, so that in image preprocessing, the contrast ratio of abnormal cells in each image is greater than this average value, enhancing the proportion of abnormal cells;

[0131] The selection of P2 meets the average level of all cells in all images, so that in image preprocessing, the contrast ratio of abnormal cells in each image is less than this average value, thereby preventing the imbalance of cell categories caused by too high proportion of abnormal cells.

[0132] S5. Perform corresponding image processing according to the range of the contrast ratio of each input image in the batch until all images meet the requirements of the foreground object and background contrast ratio of the image:

[0133] If the input image P < P1, select an image with a contrast ratio that satisfies P1 ≤ P ≤ P2 from the batch for Mixup until P1 ≤ P ≤ P2 is satisfied;

[0134] If the input image P satisfies P1 ≤ P ≤ P2, it meets the requirements of the foreground object and background contrast ratio of the image;

[0135] If the input image P > P2, perform random pixel inactivation by random Cutout until P1 ≤ P ≤ P2 is satisfied;

[0136] Furthermore, the Mixup of the images in S5 is as Figure 11 shown, specifically including: <000034​​​​​​​​​​​​​​​​​​​​​As shown, specifically including:

[0144] If the input image P>P2, random Cutout is used to perform random pixel inactivation, and the Cutout image is output to determine whether the contrast satisfies P1≤P≤P2;

[0145] If satisfied, proceed to S6;

[0146] If not, the output Cutout image inactivates the foreground target pixels, and then the image is mixed up;

[0147] Cutout is used to perform random pixel inactivation. On the one hand, it adjusts the image contrast to prevent cell category imbalance caused by an excessively high proportion of abnormal cells; on the other hand, it can simulate occlusion, prevent overfitting, and improve the generalization ability of the model.

[0148] S6. After the above processing, four images that meet the requirements of image foreground object and background contrast are randomly selected from the batch for post-processing of Mosaic and output;

[0149] Furthermore, the post-processing of the Mosaic includes:

[0150] Randomly select 4 images from the batch, combine them, crop and splice them at random positions to form a new image, repeat batch_size times, and get batch_size mosaic data enhanced images.

[0151] Example 2

[0152] The pre-processing of S1 also includes the following methods: Figure 6 As shown:

[0153] S111, remove non-critical information from the collected square image, fix the image size, and perform maximum inscribed circle cropping (if it is a rectangle, the maximum inscribed circle cropping can also be performed on the center position), to obtain an inscribed circle image and a square boundary image, the square boundary image is the boundary image remaining after the maximum inscribed circle cropping of the square image, such as Figure 7 As shown;

[0154] S112, cutting the obtained inscribed circle image into four fan-shaped sub-image blocks of equal size according to the two perpendicular diameter segments, and marking them as block1, block2, block3, and block4 respectively. Figure 8 As shown;

[0155] S113, stitching the four cropped sub-image blocks together, and then rotating them according to specific angles: fixing the rotation angle sequence of a sub-image block, and rotating it 90°, 180°, and 270° in sequence; each time a fixed sub-image block is rotated, the other sub-image blocks are randomly rotated 90°, 180°, or 270°, and the positions of the sub-image blocks after rotation cannot be the same, generating three new inscribed circle images, such as Figure 9 As shown;

[0156] For example, to fix the rotation angle sequence of block1:

[0157] Image rotation should rotate around the center point, but the origin of the image is in the upper left corner. When calculating, the origin of the upper left corner needs to be moved to the center of the image. The center of the image is the center of the inscribed circle. Suppose a point (X0, Y0), the maximum inscribed circle diameter is R, and the point after the origin transformation is (X1, Y1). The transformation is as follows:

[0158]

[0159] The image rotation angle is θ. Let the point after the origin is transformed and rotated by θ be (X2, Y2). The formula is as follows:

[0160]

[0161] The formula for transforming the rotated inscribed circle image from the Cartesian coordinate origin back to the upper left corner is as follows:

[0162]

[0163] A point (X0, Y0) of the original image is rotated to (X3, Y3).

[0164] S114 , merging the new inscribed circle image obtained in S113 with the square boundary image in S1 to form three final new images.

[0165] Obviously, the above embodiments of the present invention are merely examples for the purpose of clearly illustrating the technical solutions of the present invention, and are not intended to limit the specific implementation methods of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the claims of the present invention shall be included within the scope of protection of the claims of the present invention.

Claims

1. A method for enhancing small sample image data for cervical liquid-based pathological cell detection, characterized in that: including; S1. Remove non-critical information from the collected square images, fix the image size, and perform preprocessing to enhance the dataset; S2. After taking out a batch of images from the dataset, use the bimodal method to calculate the threshold for separating the foreground and background of each image, include normal cells in the background, and abnormal cells as the foreground; S3. Calculate the contrast between the foreground and background of each image based on the pixel ratio of the foreground to the pixel ratio of the background; S4. Set the contrast threshold P1 with the overall average gray value as the threshold for separating the foreground and background of the image, and set the contrast threshold P2 with the average gray value of the background as the threshold for separating the foreground and background of the image, and P1 < P2; Use P1 and P2 as the range boundaries for the contrast of the foreground and background of the compliant images respectively; S5. Perform corresponding image processing according to the range of the contrast of each input image in the batch until all images meet the requirements of the foreground target and background contrast of the image: If the input image P < P1, select an image with a contrast that satisfies P1 ≤ P ≤ P2 from the batch for Mixup until P1 ≤ P ≤ P2 is satisfied; If the input image P satisfies P1 ≤ P ≤ P2, it meets the requirements of the foreground target and background contrast of the image; If the input image P > P2, perform random pixel inactivation using random Cutout until P1 ≤ P ≤ P2 is satisfied; S6. Randomly select four pictures that meet the requirements of the foreground target and background contrast of the image from the batch for post-processing of Mosaic and output; The specific content of S2 includes: S21. Take a batch of images from the data set and find the maximum and minimum grayscale values ​​of each image, which are recorded as and , let the initial threshold be: (1) S22, according to the initial threshold Divide the image into foreground and background, and calculate the average gray value of the foreground , the average gray value of the background and the overall average gray value , normal cells are included in the background and abnormal cells as the foreground; (2) (3) In formula (2) and formula (3), Represents the grayscale value of the pixel, Indicates the number of pixels with this gray value in the image; The specific content of S4 includes: Set contrast double threshold according to image contrast , , < ; Use P1 and P2 as the range boundaries that meet the requirements of image foreground and background contrast; The calculation of P1 is: let the threshold be , separate the image foreground and background, perform contrast calculation, and calculate , the formula is: (5) In formula (5) Indicates the number of images, Indicates the The image is at the threshold The contrast of the foreground target under the division; The calculation is: Let the threshold be , separate the image foreground and background, perform contrast calculation, and calculate , the formula is: (6) In formula (6) Indicates the number of images, Indicates the The image is at the threshold The contrast of the foreground target under the division; The Mixup of the images in S5 specifically includes: S501. If the P of the input first image < P1, select a second image with a contrast that satisfies P1 ≤ P ≤ P2 from the batch for Mixup with the first image: Get a random number , is a random number that follows the β distribution, representing the weight, ranging from (0, 1); randomly select the second image in the batch that satisfies P1≤P≤P2; S502: The first image and the second image are weighted and 1- Perform image weighted fusion; S503. Output the Mixup image and judge whether the contrast satisfies P1 ≤ P ≤ P2; If satisfied, perform S6; If not satisfied, the P of the output Mixup image > P2, and perform random pixel inactivation on the image using random Cutout; The specific content of performing random pixel inactivation using random Cutout includes: If the input image P > P2, perform random pixel inactivation using random Cutout, output the Cutout image, and judge whether the contrast satisfies P1 ≤ P ≤ P2; If satisfied, perform S6; If not satisfied, perform Mixup operation on the Cutout image after inactivating the foreground target pixels.

2. The method for enhancing small sample image data for cervical liquid-based pathological cell detection according to claim 1, characterized in that: The preprocessing of S1 includes: S101. Connect the center points of the two pairs of opposite sides of the image as a line, and crop the image into four sub-image blocks of the same size; S102. If the height of the image is H and the width is W, the height of the sub-image block is H / 2 and the width is W / 2, and the four sub-image blocks are randomly horizontally mirrored; The horizontal mirroring: Mirror-transform the left and right parts of the image with the vertical central axis of the image as the symmetry line; S103 , splicing the sub-image blocks processed in S102 in the order of the original image positions, and shifting the spliced ​​sub-image blocks horizontally or vertically counterclockwise by the distance of one sub-image block to generate three new images of the same size and shape as the original images.

3. The method for enhancing small sample image data for cervical liquid-based pathological cell detection according to claim 2, characterized in that: The post-processing of Mosaic in S5 includes: Randomly select 4 images from the batch, combine them, crop and splice them at random positions to form a new image, repeat batch_size times, and get batch_size mosaic data enhanced images.

4. The method for enhancing small sample image data for cervical liquid-based pathological cell detection according to claim 3, characterized in that: The preprocessing of S1 includes: S111, performing maximum inscribed circle cropping on the image to obtain an inscribed circle image and a square boundary image; S112, cutting the obtained inscribed circle image into four fan-shaped sub-image blocks of equal size according to the two perpendicular diameter line segments, and marking them as block1, block2, block3, and block4 respectively; S113, stitching the four cropped sub-image blocks together, and then rotating them according to specific angles: fixing the rotation angle sequence of a sub-image block, and rotating it 90°, 180°, and 270° in sequence; each time the fixed sub-image block is rotated, the other sub-image blocks are randomly rotated 90°, 180°, or 270°, and the positions of the sub-image blocks after rotation are different, thereby generating three new inscribed circle images; S114 , merging the new inscribed circle image obtained in S113 with the square boundary image in S1 to form three final new images.

Citation Information

Patent Citations

  • Fruit body lesion image direction diversity sample simulation method and system

    CN106803268A

  • Data enhancement method based on target overlapping degree calculation and adaptive adjustment

    CN114418898A

  • Cell detection method and system based on deep learning and machine vision

    CN115170518A