{'fraction_non_alphanumeric': 0.03463599529473271, 'fraction_numerical': 0.015771358863765086, 'mean_word_length': 4.452256532066508, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 1, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Automatic Label Correction for the Accurate Edge Detection of Overlapping Cervical Cells

Accurate labeling is essential for supervised deep learning methods. In this paper, to accurately segment images of multiple overlapping cervical cells with deep learning models, we propose an automatic label correction algorithm to improve the edge positioning accuracy of overlapping cervical cells in manual labeling. Our algorithm is designed based on gradient guidance, and can automatically correct edge positions for overlapping cervical cells and differences among manual labeling with different annotators. Using the proposed algorithm, we constructed an open cervical cell edge detection dataset (CCEDD) with high labeling accuracy. The experiments on the dataset for training show that our automatic label correction algorithm can improve the accuracy of manual labels and further improve the positioning accuracy of overlapping cells with deep learning models. We have released the dataset and code at https://github.com/nachifur/automatic-label-correction-CCEDD.

and diagnosis of cervical cancer. The diagnostic procedure requires a cytologist or pathologist to locate abnormal cells from countless normal cells under the microscope, which is very tedious, labor intensive and highly subjective to human errors [2]. Compared with manual analysis, automatic Papsmear analysis can reduce time and improve the accuracy of slide inspection by a cytologist. For an automatic Papsmear analysis system, accurate cell segmentation is essential. However, overlapping clumps of cervical cells often cause false segmentation and affect the slide examination in cervical cell image analysis. Accurate and automatic segmentation of overlapping and small cells is still an essential problem in cervical cell image analysis.
For cytoplasm and nucleus segmentation, some traditional techniques, such as watersheds, active contours and level sets, are widely applied [3], [4], [5], [6], [7]. Recently, Saha et al. [8] proposed a cervical nucleus segmentation framework. It generates superpixels through a statistical region merging (SRM) algorithm, and fuses the superpixels using paired region contrast and gradient boundaries. Tareef et al. [7] introduced a fast multiwatershed pass method to segment the cell nuclei through one watershed pass utilizing the intensity gradient information and segment the cytoplasm through two watershed passes. Song et al. [9] presented an approach that leverages more shape constraints through joint shape template matching for segmenting overlapping cytoplasm of cells. In their other work, under the a priori guidance of the modeled shape, a constrained polymorphism evolution method is used to evolve the shape of each cytoplasm while segmenting all overlapping cytoplasm in the clump [10]. Although all these methods have achieved relatively good segmentation results, they sometime fail in highly overlapping cytoplasm nuclei, noisy background and uneven illumination.
With advances in computational power, deep learning has been applied for cervical cell segmentation [11], [12], [13]. [14] proposed a two-stage cellular segmentation framework. In the framework, the first step is to identify the region of interest by cell detection. Then, the detection result is used as the input for subsequent cytoplasmic segmentation. Zhang et al. [15] proposed attention U-Net and graph-based random walk to segment the cell nucleus and cytoplasm. In their work, U-Net is used twice: one predicts the nuclei, and another predicts the cytoplasm edge after polar coordinate sampling.
Using deep learning-based methods can improve the accuracy and robustness of cytoplasm and nuclear segmentation. However, the premise of supervised deep learning methods requires a rich data set and accurate annotations. Currently, cytoplasmic and nuclear segmentation datasets include Shenzhen University dataset [16], Beihang University dataset [14] and ISBI 2015 challenge dataset [17]. The only public dataset, the ISBI Challenge dataset, has a small amount of data and simple image types. The small amount of ISBI data makes it difficult to apply deep learning to cervical cell segmentation. Medical image datasets are generally annotated by professional physicians. However, labeling medical images is time consuming and labor intensive. One main problem is that even if the label standard is unified, it is still difficult to guarantee the edge positioning accuracy of manual labels. In addition, differences between different annotators are inevitable. At present, most label correction works are concentrated on the semi-supervised training process [18], and there are also some applications in annotations via crowdsourcing [19], [20], classification [21], [22], [23], [24] and natural language processing [25]. Northcutt et al. [26] found that label errors in the test sets are numerous and universal: the average error rate in 10 datasets is 3.4%. They find that if the error rate of test labels only increases by 6%, ResNet-18 outperforms ResNet-50 on ImageNet [27] with corrected labels. This indicates that the wrong label will seriously affect the accuracy of the model evaluation. The deployed model for computer-aided diagnosis is selected from many candidate models through model evaluation. The accuracy of the evaluation determines whether the optimal model can be selected, which may affect an accurate diagnosis by the doctor. Therefore, the automatic correction algorithm based on manual labeling is valuable for correcting the errors of manual labeling to generate uniform and accurate annotations.
For accurate edge detection of overlapping cervical cells, we construct a cervical cell image dataset, namely, CCEDD, which contains 686 images with multiple complex types of cervical cells and accurately labeled images. CCEDD can basically satisfy the training of supervised deep learning models in terms of quantity and richness. To eliminate the influence of edge positioning errors and differences between annotators in manual annotation, we proposed a method for automatically correcting labels to generate higher-quality annotated images based on manual labeling. Experiments on some state-of-the-art deep learning models validate our method and CCEDD dataset.
Our main contributions are summarized as follows: • We proposed an automatic label correction method for edge detection and image segmentation. By using our corrected label, 7% AP improvement in multiple baseline deep learning models can be observed. • By using our automatic label correction algorithm, we constructed a larger public cervical cytoplasmic and nuclear edge detection dataset with higher labeling accuracy, which contains 686 annotated images with a resolution of 2048 × 1536 pixels.

II. AUTOMATIC LABEL CORRECTION
Our proposed label correction algorithm contains four parts: label point correction based on gradient, interpolation in a large gap, smooth edge curve generation based on fusion of the piecewise curve using improving local linear fitting and curve sampling, as shown in Fig. 1. I(x, y) is a cervical cell image, and g(x, y) is the gradient image after smoothing through the Gaussian filter. We denote (x i , y i ) as x i s , which is an original labeled point in I(x, y) by manual annotation. First, we process label point correction as shown in (a), and Second, we insert extra points in a large gap, as shown in (b), and x i c → x j I . j ∈ {1, 2, . . . , n I } . n s and n I are the number of points before and after interpolation, respectively. Third, we divide the point set x j I into n c groups. Each set of points is expressed as Φ k . We use an improved local linear method to fit the curve C k on Φ k . k ∈ {1, 2, . . . , n c } . The set of curves {C k } is spliced into a closed curve C c as shown in (c). Finally, we sample C c to obtain discrete edges with connectivity C d as shown in (d).

A. Label Point Correction
Although the annotations are provided by professional doctors, due to human error, the label points usually deviate from the gradient edge. To solve this problem, we designed a label point correction method based on gradient guidance. To eliminate human error to the greatest extent, retain the originally correct label information and generate accurate labels, we correct the label points only in the strong gradient region, while retaining the original label points in the weak edge region. Our label point correction consists of three steps as follows: 1) Detecting whether the position of each mutual label point is in the strong gradient region. 2) Determining the candidate point set.
3) Correcting the candidate point to a new position with the local largest gradient value. For an original labeled point x i s , we search for the point x i max with the largest gradient value along the normal direction of the mutual label edge and the search radius is r, which constitutes the candidate point set Ω We judge whether a point x i s is in the strong gradient region through ∆. If ∆ > 0, the original labeled point x i s needs to be corrected; otherwise, no correction is required. To be robust against image noise, the gradient value of the candidate point g(x i sj ) is weighted by ω j . We compute the weight as where κ h is a weighted kernel function, and the bandwidth is h. κ(x) is a Gaussian function with zero mean and one variance. We empirically set the parameters r = 7, h = r/2, λ t = 20. After label point correction,

B. Smooth Edge Curve Generation
Due to noise, the edges generated directly by the corrected points x i c are not smooth, so we consider obtaining smooth edges by fitting. We divide a closed curve into several segments and fit each segment separately based on improved local linear fitting to generate smooth cell edge curves.
Interpolation: In the labeling process, we observed that to accurately and quickly outline the geometry of the cells, the annotators densely label the points with large curvature and sparsely label the places with small curvature. We assume that linear fitting can be used on sparsely labeled points. We perform linear interpolation on larger intervals before curve fitting. First, the sparse label point pairs step is the maximum interval between points after interpola- We divide a set of labeled points x j I corresponding to a closed edge into n c groups. j ∈ {1, 2, . . . , n I } . The number of points in each group n g is odd. The radius of each group is r f = (n g − 1)/2 . n c = n I /sapce . The interval of each group center point is space = 2 · (r f − n d ) as shown in Fig. 2. The overlapping length of adjacent curves is 2n d to reduce the fitting error of boundary points. In the last curve fitting process, the number of repeated points is n r = space · n c − n I . Each set of points is expressed as In each set of points, the straight line passing through the point x ic I and the point x is used as the xaxis, and the point x ic I is used as the origin to establish a new plane rectangular coordinate system. After coordinate transformation, the sets of points Φ k → Φ r k . We generate a curve C k using local linear weighted fitting on Φ r k . This is equivalent to solving the following problem at the target point x.
The improved kernel function is otherwise.
We increase the weight of the point x ic+ n d I and the point x ic+2·r f −nr− n d I so that the adjacent curves are connected. The above parameter solution is expressed by a matrix as in which X = . . . .
We stitch {C k } curves into a closed curve C c and sample on the interval x . Then, we convert the coordinates of the sampling point to the original coordinate system. Finally, we can obtain discrete edges with connectivity C d .
Bandwidth Selection: Ghanem and Zhang [28] chose h = a × b and used b = 2σn 1/2 proposed in the bandwidth selection guide [29]. In the paper, we adopt h = a × b + c for edge fitting. For cytoplasm edge fitting, n g = max ( step · n I /40 , 7), a = 10. For nucleus edge fitting, n g = max ( step · n I /10 , 3), a = 5. b = 2σ k n 1/2 g , c = step · n g /6. σ k is the standard deviation of the ordinate on Φ r k . Smooth Closed Curve: When r f is fixed, if space is smaller, then n d is larger, the number of curve segments used to stitch a closed curve is larger, and it is smoother at the nodes of the curve segment. If n d = r f − 0.5, then space = 1 and n c = n I . We fit a curve C j at each point in the set x j I . We do not sample on the interval x but only sample at the point x j I . In other words, only the position of points is adjusted by curve fitting, and the number of points is not changed by sampling. Because no curves are spliced, the curve C c is smooth at each point. The sampling point interval can be adjusted by step. The smaller the step is, the denser the sampling points of the curve. Considering that the digital image is discrete, we set step = 1.

C. Comparison with the Original Label
We successively connect the label points to a closed polygon and perform discrete sampling to obtain edges (Fig. 3). We use this method to generate the original label. It takes 38 s to generate 100 original edge labels from annotated points with a size of 2048 × 1536 pixels on a CPU. Our automatic label correction algorithm takes 270 s to generate corrected edge labels under the same test conditions. Because our corrected label is generated offline and does not affect the neural network model inference time, we have not further optimized it. If the algorithm runs on a GPU, the speed can be further improved, which can save more time for the correction of very largescale datasets. Fig. 4 is a comparison of the original label and corrected label.

III. EXPERIMENTAL DESIGN
To verify the effectiveness of the label correction method, we evaluated the performance of various models on CCEDD. We uniformly use PyTorch as a deep learning framework. In each experiment, only the model structure and loss function are different, and the training methods and hyperparameter settings are the same. All experiments of this paper are executed on an Intel(R) Xeon(R) Silver 4110 CPU (8 cores, 16 threads, 32 GB memory) and a NVIDIA TITAN V GPU with 12 GB memory.

A. Data Description
We compared CCEDD with other cervical cytology datasets in Table I. CCEDD contains 686 scanned cervical cytology images between 2016 and 2017 from the Liaoning Cancer Hospital & Institute. All of the cases are anonymized. For negative and positive cervical cancer patients with 100 × and 400 × optical magnifications, digital imaging was performed with a Nikon ELIPSE Ci slide scanner, SmartV350D lens and 3 million pixel digital camera. CCEDD includes 686 cervical images with a size of 2048 × 1536 pixels (Table II). Six expert cytologists delineated the closed cytoplasm and nucleus contours in the cytological images using the labelme annotation tool [30]. In order to ensure the reliability of the test results, we divided the dataset by random shuffle into training set, validation set and test set according to a ratio of 6:1:3. We cut an image with a size of 2048 ×1536 into 49 image patches with a size of 512 × 384 pixels (Fig. 5). The actual image resolution is 256×192 for training.

B. Data Augmentation
Augmentor [31] supports multiple image augmentation and randomized elastic distortions. We use the Augmentor software package for data augmentation. The CCEDD consists of  RGB images. Therefore, we implemented brightness, contrast, hue, saturation adjustment, affine transformation and elastic deformation for training.

C. Baseline Model
Our baseline detectors are RCF [32], UNet [33] and ENDE [34], [35]. RCF is an advanced edge detector in natural images. UNet is a symmetrical encoding and decoding network using short connections and has achieved outstanding success in medical image segmentation [36], [37], [38]. ENDE is an encoding and decoding structure with no skip connection. The bottleneck layer of ENDE uses four residual blocks. We add a layer of regular convolution before dilated convolution with a dilation factor of two in ENDE.

D. Evaluation Metrics
Edge detection accuracy is evaluated using three standard measures: ODS (the best F = 2·precision·recall precision+recall for a fixed scale), OIS (the F for the best scale in each image), and AP (the average precision: the area under the precision-recall curve) [39]. We rewrite the evaluation code [39] for fast evaluation on a GPU. On the benchmark model ENDE, the test set (10143 images with a size of 256 × 192 pixels) with an average FPS of 172 is evaluated. An image of BSD500 [39] is annotated by six persons, while an image in our dataset is annotated by one person. We simplified the evaluation code, which is only suitable for an image with a label, not an image with multiple labels.

E. Training and Parameter Setting
To more accurately evaluate the performance of different models and solve overfitting and underfitting, we choose to adaptively adjust the number of iterations instead of using a fixed number of iterations. Relying on our fast evaluation code, we can obtain the AP of the validation set during the training process to adaptively control the learning rate and the number of iterations.
In the training process, using data augmentation can improve the generalization of the model [31]. To perform rotation and shear operations for data augmentation in the training, zero pixels need to be filled around the image. However, there is no zero pixel padding around the image during the test process. The differences in the distribution between the training set and the test set causes the accuracy of the model on the test set to decrease. Therefore, we only perform data augmentation in pre-training and not in fine-tuning.
The learning rate of networks and the number of training iterations are dynamically adjusted as shown in Fig. 6. The learning rate lr decays from 1 −4 to 1 −5 . The maximum number of training iterations is 50 epochs for pre-training and   fine-tuning. The period of model evaluation is 1 epoch for pretraining and 0.1 epoch for fine-tuning. We can obtain M odel i and AP i after the i-th model evaluation. i = 1, 2, · · · , 50. If AP i < AP i−1 , we automatically adjust the learning rate: lr i = 0.5 · lr i−1 . If AP i < min(AP i−j ), the training ends, and we can obtain the optimal model M odel j|max(APj ) . j = 1, 2, 3 in pre-training and j = 1, 2, · · · , 10 in fine-tuning. The model is optimized using Adam optimizer with β 1 = 0 and β 2 = 0.9 [40].

A. Ablation Study for Training Methods
Using data augmentation leads to differences in the distribution between the training set and the test set. This may decrease the accuracy of the model on the test set. Table III can verify the effectiveness of our training method, which can lead to a 3% AP improvement.

B. Model and Loss Function Comparison
Our baseline detectors are RCF [32], UNet [33] and ENDE. We use the original label and the corrected label to train and test these models. The quantitative measurement is shown in Table IV and Fig. 8. Fig. 7 shows the final detection results on CCEDD. We found that the performances of all models are  [41]. improved by 7 % AP. Although RCF is the most advanced edge detector in natural images, it has the worst performance on CCEDD. At the same time, RCF loss does not apply to CCEDD. Because the RCF model and RCFLoss produce coarser edges with poor positioning accuracy, this may be more robust for natural image edge detection, but it is not suitable for accurate cervical cell edge detection. ENDE has one third of UNet's parameters but obtains the highest accuracy. We think this is because ENDE does not skip connections and does not require a feature fusion layer, so the number of parameters is small. ENDE using dilated convolution can obtain a larger receiving field without downsampling, which achieves higher positioning accuracy.
Compared with the original label, using the corrected label data to train multiple models can improve AP by approximately 7%. Table V shows that AP improvement comes from two aspects. First, in the training process, using the corrected label training model can improve the edge positioning accuracy (Fig. 9,Fig. 10). Second, the corrected label can improve  the evaluation accuracy in the testing process (Table V).

C. Computational Complexity
Our benchmark detection model ENDE is a fast one-stage network with a small amount of parameters. The speed of ENDE is as follows. For 207 images with a resolution of 1024×768, the average FPS is 8. For 207 images with a resolution of 512×512, the average FPS is 23. For 10413 images with a resolution of 256×192, the average FPS is 184.
Many cervical cell segmentation approaches [6], [5], [7], [14], [15] consist of three stages, including nucleus candidate detection, cell localizations and cytoplasm segmentation. Wan et al. [14] tested the speed on a unified platform using images with a resolution of 512×512. The methods of [14], [3] and [17]  The speed of ENDE is 400× faster than that of [14]. We have not tested the speed of the [14] method on a unified platform, but we obviously have a faster speed. This means that using the edge detected by ENDE as a priori input to the cervical cell segmentation network improves performance at a small cost.

V. CONCLUSIONS
We proposed an automatic correction label method that can be used to eliminate the influence of poor edge position accuracy and differences between different annotators in manual annotation. Using our method can generate higher-quality label images. We verify our method on multiple deep learning models. Compared with the original label, using the corrected label to train deep neural networks can lead to a 7% AP improvement. Our training method can eliminate the influence of different distributions of the training set and test set when using data augmentation and lead to a 3% AP improvement.
We can accurately complete the multicell, large-scale overlapping, complex background cytoplasm and nuclear fast edge detection task by training ENDE on CCEDD. ENDE achieves higher accuracy with one-third of the parameters compared to UNet, which means ENDE can be integrated into other cervical cell segmentation models to enhance the segmentation performance with only a small cost. Our label correction method can be used in the construction of other edge detection and image segmentation datasets to improve the accuracy of annotations. We only conducted experiments on CCEDD to verify the effectiveness of our label correction method, since it is difficult to obtain the original label point of other datasets. In future work, we will use this method to improve the accuracy of other segmentation datasets not limited to CCEDD. At the same time, we plan to develop a method that can improve the quality of annotations without the original annotation points, which will greatly expand the scope of application.