TL;DR
Scientific papers are full of valuable data trapped inside static images of line charts. This paper introduces LINEEX, an open-source, Vision Transformer-based pipeline that reads scientific line charts, maps lines to their legends, and extracts the raw underlying data points. By borrowing ideas from human pose estimation and inventing a geometry-aware loss function, it solves what traditional computer vision systems miss—and brings along a massive new 430,000-image dataset to prove it.
What Problem Does This Paper Address?
Every day, researchers publish thousands of papers packed with charts. For a human, a line chart is an intuitive way to spot a trend; for a machine, it’s a dead end of pixels. Unlocking the raw numbers behind these plots could power next-generation scholarly search engines, auto-generated leaderboards, and screen-readers for visually impaired scientists.
Existing chart-reading systems struggle here. Early rule-based approaches break easily when chart styles change. Newer deep learning tools like ChartOCR do better, but they frequently fail on smooth curves, ignore crucial components like axis ticks or legend mappings (leaving you with nameless lines), or keep their code locked behind closed doors.
The authors set out to build a fully reproducible, publicly available system specifically tailored to master the most common visualization in science: the line chart.
Methods
LINEEX breaks chart extraction down into a three-stage modular pipeline:
- Keypoint Extraction: Instead of tracing lines pixel-by-pixel, LINEEX treats a line like a human skeleton, adapting PE-former (a Vision Transformer built for human pose estimation) to predict up to 64 (x, y) "keypoints" per chart. Because charts have varying numbers of points, unused queries are masked out during training, and a histogram-based background filter sweeps away stray predictions in empty space at test time. To make sure predicted points actually sit on the line, the authors combine standard L1 distance loss with a novel Angular Similarity Error ($\mathcal{L}_A$).
- Chart Element Detection & Text Extraction: A finetuned DETR (DEtection TRansformer) locates bounding boxes for ten distinct chart elements—titles, axes, ticks, plot areas, and legend components. EasyOCR then reads the text inside those boxes.
- Grouping, Legend Mapping, and Scaling: How do you know which keypoints belong to which legend label? LINEEX crops tiny $20 \times 40$ pixel patches around each detected keypoint and resizes the legend markers to match. A Deepranking image-similarity network and a simple MLP compare these patches, grouping points into lines and linking them to their legend labels in one swoop. Finally, a median-ratio scaling algorithm uses the OCR-extracted axis ticks to convert pixel coordinates back into true data values.
Datasets
Curating real-world chart datasets requires grueling manual annotation, so existing public datasets either lack component-level labels or lack visual variety. To fix this, the authors built the largest synthetic line chart dataset to date:
- Our Dataset (New): 430,000 Matplotlib-generated line charts (400k train, 10k validation, 20k test)—roughly 4x larger than the previous largest line-chart collection. It features 2 to 6 lines per plot across 27 distinct plotting styles, varying dark/light backgrounds, gridlines, fonts, colors, marker shapes, and full bounding-box annotations for every component.
They also train and evaluate across established benchmarks: ExcelChart400k (~122k real line charts), Adobe Synthetic (200 test line charts), FigureSeer (1,000 real test charts), and a specialized 3,000-image smooth-curve dataset using B-spline and cubic-spline interpolations.
Key Insights and Ideas
- "Close" isn't good enough for chart data: In human pose estimation, predicting a wrist a few pixels off-center is fine. In a line chart, a point 3 pixels off the curve (red dot below) corrupts the data, whereas a point 5 pixels away along the curve (blue dot) still faithfully represents the trend! Standard L1/L2 losses penalize the blue dot more. By introducing Angular Similarity Error—which checks if the angle to the predicted point matches the local slope (first derivative) of the line—the model learns to snap points onto the curve itself.
- Legend mapping via visual patch matching: Rather than writing brittle rules for dashed lines, colors, and triangles, treating legend-to-line matching as a metric-learning image similarity problem allows a single neural network to group points into lines and label them simultaneously.
- Transformers crush CNNs at global chart context: Swapping out a standard ResNet50 backbone for a Cross-Covariance Image Transformer (XCiT) yielded a massive 4x jump in keypoint extraction performance.
Key Results
Note that while the provided manuscript omits the rendered data tables (Tables 3–5), the text highlights several concrete findings:
- Keypoint & Element Detection: The combined loss model ($\text{LINEEX}_{D+A}$) outperformed pure L1 loss ($\text{LINEEX}_D$) and beat the state-of-the-art ChartOCR across synthetic, real, and smooth-spline datasets. (ChartOCR only won on ExcelChart400k, the exact dataset it was trained on, showing poor generalization elsewhere—especially on smooth curves). For element detection, LINEEX beat ChartOCR on Adobe Synthetic and the new 430k dataset, while tying on FigureSeer.
- Legend Mapping & Error Propagation: LINEEX achieved a 0.79 F1 score when mapping predicted lines to legend markers—a task ChartOCR cannot do at all. When fed ground-truth grouped keypoints in an ablation study, legend mapping jumped to 0.87 F1, proving the visual matcher is strong, though sensitive to upstream keypoint errors.
- Encoder Ablation: Replacing the transformer encoder with ResNet50 caused performance to drop by 4x.
Limitations and Future Work
- The "64 Keypoints" Ceiling: Because the transformer decoder uses a fixed $M = 64$ query slots, charts with very simple lines suffer lower precision (too many excess predictions, only partially mitigated by the background filter), while ultra-dense charts with more than 64 points have their ground truth truncated.
- Intersection Ambiguity & Uncommon Symbols: When two lines cross,keypoints right on the intersection are arbitrarily assigned to one of the lines. The visual matcher also struggled on the Adobe dataset due to rare legend symbols like vertical bars and stars, and achieving high mAP on tiny, numerous elements like axis ticks remains tough.
- Future Directions: The authors plan to expand LINEEX beyond line plots to other chart types (like bar or scatter plots) and build higher-precision extractors tailored for real-world downstream scholarly applications.
Summary updated