ABCNet: Real-time Scene Text Spotting with Adaptive Bezier-Curve Network
- Publication
- CVPR 2020Conference
- First submitted to arXiv
- arXiv:2002.10200
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{textspottingabcnet2020,
title = {{ABCNet: Real-time Scene Text Spotting with Adaptive Bezier-Curve Network}},
author = {Yuliang Liu and Hao Chen and Chunhua Shen and Tong He and Lianwen Jin and Liangwei Wang},
year = {2020},
eprint = {2002.10200},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2002.10200}
}
OCR has been advancing for years, but text detection and recognition tasks remain challenging.
Defining the Problem
Text detection and recognition are the two primary tasks of OCR.
-
Text Detection identifies the location of text within an image. Many methods for this task are derived from object detection and segmentation techniques. However, text often appears distorted, slanted, or curved, making detection difficult.
-
Text Recognition converts detected text into recognizable characters. The performance of recognition is heavily influenced by detection errors. Therefore, many approaches assume irregular text as input, developing methods based on STN (Spatial Transformer Networks) or 2D attention mechanisms.
Below is a recap of some past approaches:
The authors argue that complex multi-stage systems are slow and difficult to maintain in practice. To handle deformed text, they introduce Bezier curves to model its shape and BezierAlign to connect text detection with recognition.
Wait, what’s a Bezier curve?
Bezier Curves
A Bezier curve is a mathematical curve used to describe smooth shapes. It is widely applied in computer graphics, typography, animation, and UI design to create smooth, scalable curves. A Bezier curve is defined by a set of control points that determine how the curve bends. The first and last control points define the curve's endpoints, while the intermediate points shape the curve without necessarily lying on it.
These curves retain their smoothness under scaling, making them ideal for modeling various shapes, from straight lines to complex geometries.
Here’s a glimpse of different types of Bezier curves:
-
Linear Bezier Curve (Degree 1): Straight line between two control points.
-
-
Quadratic Bezier Curve (Degree 2): Uses three control points.
-
-
Cubic Bezier Curve (Degree 3): Four control points, often used in fonts, animation, and UI.
-
-
Quartic Bezier Curve (Degree 4): Five control points.
-
-
Quintic Bezier Curve (Degree 5): Six control points.
-
Solution Overview
After learning about Bezier curves, it seems like we’ve read the paper. (Not! Yet!)
Model Architecture
The authors use a single-stage, anchor-free detector and Bezier curves to describe text shapes, forming an end-to-end framework for detecting and recognizing text of arbitrary shapes.
The authors find that cubic Bezier curves can represent most curved text shapes, so they use 8 control points to represent the upper and lower boundaries of each text region.
Control points are learned by relative displacement to simplify the model and improve accuracy:
Here, and are the minimum and values of the bounding box vertices.
The curve-control-point regression branch adds just one convolutional layer with 16 output channels to learn and , adding little computation.
Generating GroundTruth
Since existing datasets do not have Bezier curve annotations, the authors propose a method to generate Bezier curve ground truth from the polygonal annotations of Total-Text and CTW1500 using the least squares method.
The equation looks like this:
The annotated points come from the upper and lower text boundaries, with a separate cubic Bezier curve fitted to each. The indices run from 0 through , so there are annotated points in this expression. Each is determined by the cumulative length along its boundary polyline. An example follows:
Synthetic Data
To train an end-to-end scene text detection model, large amounts of synthetic data can help. However, the existing SynthText dataset (containing 800,000 images) only provides quadrilateral bounding boxes for mostly straight text, which is insufficient for handling arbitrarily shaped scene text. To address this limitation, the authors expanded the dataset by synthesizing 150,000 diverse images to enhance the model's ability to detect curved text.
The composition of the new dataset is as follows:
- 94,723 images: Containing mostly straight text.
- 54,327 images: Containing mostly curved text.
The sources for these images are:
- VGG synthesis method: Used to generate the synthetic images.
- 40,000 background images: Sourced from the COCO-Text dataset.
Each background image from COCO-Text is prepared with a segmentation mask, along with scene depth information, to improve the blending of text with the background. To further increase the variety of text shapes, the authors modified the VGG synthesis method by incorporating various artistic fonts and a rich text corpus. They applied curved distortions and diverse layouts to the generated text, simulating a wide range of real-world text styles. For each text instance, polygonal annotations were automatically generated to describe the shape.
Additionally, the polygonal annotations were converted into cubic Bezier curves as ground truth, providing fitting targets for curved text shapes. These processes simplify the data generation workflow while effectively enhancing the model's ability to detect arbitrarily shaped text, meeting the demands of real-world applications.
The results of the synthetic data generation are shown below:
Bezier Alignment
Traditional sampling methods include:
BezierAlign extends RoIAlign to curved regions. For each sampled curve parameter, it connects the corresponding top and bottom boundary points, then interpolates along that segment. The segments need not be perpendicular to the boundaries. Arc-length spacing also depends on the curve’s geometry. Bilinear interpolation reads features at the resulting positions.
Given a feature map and the control points of a Bezier curve, the pixel positions in the rectangular output feature map are calculated as follows:
Assume the size of the output feature map is .
The process is as follows:
-
For the -th pixel its grid position is denoted as .
-
The parameter is computed using the formula:
-
Using and the Bezier curve equation, the top boundary point and bottom boundary point are calculated.
-
Based on and , the position of the sampling point is determined using:
-
Once the position is obtained, bilinear interpolation is applied to compute the final value at that point.
BezierAlign samples features along curved text regions for the recognition branch. The figure below compares the positions of different sampling grids; the quantitative recognition scores appear later in the ablation study.
Text Recognition Head
Using the backbone features shared with the detection branch and BezierAlign, the authors build a lightweight text recognition branch, shown above:
- 6 convolutional layers: The first four use stride 1; the last two use vertical stride 2 and horizontal stride 1.
- Average pooling: Compresses the height dimension to produce .
- Channel permutation: Reorders the tensor for the BLSTM.
- BLSTM: Produces and captures context in both sequence directions.
- Fully connected layer: Outputs , where covers uppercase and lowercase letters, digits, symbols, an other-symbol class, and the paper's special EOF class.
During training, recognition features are sampled from ground-truth Bezier regions, so early detection-boundary errors do not directly affect recognition sampling. The branches still share a backbone and are trained jointly. CTC loss aligns recognition outputs with text annotations.
During inference, the detected Bezier curves replace the ground-truth regions as the RoIs, aligning recognition features with the curved text.
Training Configuration
- Backbone: ResNet-50 with a Feature Pyramid Network (FPN).
- RoIAlign scales reported in the paper’s implementation description:
- Resolutions are , , , , and of the input image.
- BezierAlign: Applied on feature maps of 3 different sizes:
- Sizes are , , and of the input image.
- Pretraining datasets:
- 150,000 synthetic images.
- 15,000 selected images from the COCO-Text dataset.
- 7,000 images from the ICDAR-MLT dataset.
The model is pretrained on public English word-level datasets and fine-tuned on the target dataset.
Data Augmentation Strategies
- Random scaling during training:
- The shorter side of the input is randomly chosen between 560 and 800 pixels.
- The longer side is constrained to a maximum of 1333 pixels.
- Random cropping:
- Ensures the cropped region covers at least half of the original image and does not truncate text.
- If the cropping conditions cannot be met, cropping is skipped.
Hardware Setup
- 4 Tesla V100 GPUs are used for training.
- Batch size: 32 images per batch.
Training Parameters
- Maximum iterations: 150,000.
- Initial learning rate: 0.01.
- Learning rate schedule:
- Reduced to 0.001 at 70,000 iterations.
- Further reduced to 0.0001 at 120,000 iterations.
The entire training process takes approximately 3 days to complete.
Discussion
The authors conducted comparisons and ablation studies on the Total-Text dataset to evaluate the performance of their method. The results are as follows:
BezierAlign Analysis
To validate the effectiveness of BezierAlign, the authors performed ablation experiments on Total-Text, exploring the impact of different sampling point configurations, as shown in the table above.
The results show that the number of sampling points affects both performance and speed. With (7, 32) sampling points, the table reports 61.9% F-measure at 22.8 FPS, the accuracy–speed balance chosen by the authors for later experiments.
Compared with earlier sampling methods, BezierAlign reaches 61.9% end-to-end text recognition F-measure, versus 38.4% for horizontal sampling and 44.7% for quadrilateral sampling. Table 3 reports F-measure for this comparison, without an FPS measurement:
BezierCurve Analysis
Without Bezier-curve detection, the table reports 22.8 FPS; with it, 22.5 FPS. The additional cost is small in this ablation measurement.
Experimental Results on Total-Text
The authors compared ABCNet with other methods, as shown in the table above:
- Single-scale inference: ABCNet scores 64.2% without a lexicon and 75.7% with the full lexicon, at 17.9 FPS. The faster ABCNet-F scores 61.9%/74.1% at 22.8 FPS.
- Multi-scale inference: ABCNet-MS reaches the table's highest scores, 69.5%/78.4%, while speed falls to 6.9 FPS. Training data and backbones differ across methods in this comparison.
- ABCNet-F versus Mask TextSpotter’19: The speeds are 22.8 versus 2.0 FPS, about 11.4 times as fast, while the no-lexicon F-measures are 61.9% versus 65.3%.
Conclusion
ABCNet introduces Bezier curves to an anchor-free detector and uses BezierAlign to align features with curved text boundaries for recognition. The authors also synthesize varied text images to help the model generalize.
The design philosophy of this paper provides new perspectives and directions for future text detection and recognition tasks, worthy of further research and exploration.