Table of Contents
Fetching ...

ChemScraper: Leveraging PDF Graphics Instructions for Molecular Diagram Parsing

Ayush Kumar Shah, Bryan Manrique Amador, Abhisek Dey, Ming Creekmore, Blake Ocampo, Scott Denmark, Richard Zanibbi

TL;DR

ChemScraper tackles robust molecular diagram extraction from PDFs by exploiting born-digital PDF primitives through a four-stage MST-based born-digital parser that produces visual-graph and molecular-graph representations, and by generating annotated data to train a raster-image visual parser. It introduces a graph-based evaluation protocol that aligns molecular graphs to ground truth, enabling automatic diff reporting beyond SMILES-based metrics. The born-digital parser achieves 98.4% recognition on USPTO (1% above prior models) and the raster visual parser achieves 85% with far less training data. The work demonstrates the benefits of combining vector-graphics derived supervision with neural parsing, enabling faster, more accurate molecule recognition, and provides a framework for graph-based evaluation of chemical diagrams. This is significant for chemoinformatics indexing, cross-format molecule recognition, and improved data mining in PDFs.

Abstract

Most molecular diagram parsers recover chemical structure from raster images (e.g., PNGs). However, many PDFs include commands giving explicit locations and shapes for characters, lines, and polygons. We present a new parser that uses these born-digital PDF primitives as input. The parsing model is fast and accurate, and does not require GPUs, Optical Character Recognition (OCR), or vectorization. We use the parser to annotate raster images and then train a new multi-task neural network for recognizing molecules in raster images. We evaluate our parsers using SMILES and standard benchmarks, along with a novel evaluation protocol comparing molecular graphs directly that supports automatic error compilation and reveals errors missed by SMILES-based evaluation. On the synthetic USPTO benchmark, our born-digital parser obtains a recognition rate of 98.4% (1% higher than previous models) and our relatively simple neural parser for raster images obtains a rate of 85% using less training data than existing neural approaches (thousands vs. millions of molecules).

ChemScraper: Leveraging PDF Graphics Instructions for Molecular Diagram Parsing

TL;DR

ChemScraper tackles robust molecular diagram extraction from PDFs by exploiting born-digital PDF primitives through a four-stage MST-based born-digital parser that produces visual-graph and molecular-graph representations, and by generating annotated data to train a raster-image visual parser. It introduces a graph-based evaluation protocol that aligns molecular graphs to ground truth, enabling automatic diff reporting beyond SMILES-based metrics. The born-digital parser achieves 98.4% recognition on USPTO (1% above prior models) and the raster visual parser achieves 85% with far less training data. The work demonstrates the benefits of combining vector-graphics derived supervision with neural parsing, enabling faster, more accurate molecule recognition, and provides a framework for graph-based evaluation of chemical diagrams. This is significant for chemoinformatics indexing, cross-format molecule recognition, and improved data mining in PDFs.

Abstract

Most molecular diagram parsers recover chemical structure from raster images (e.g., PNGs). However, many PDFs include commands giving explicit locations and shapes for characters, lines, and polygons. We present a new parser that uses these born-digital PDF primitives as input. The parsing model is fast and accurate, and does not require GPUs, Optical Character Recognition (OCR), or vectorization. We use the parser to annotate raster images and then train a new multi-task neural network for recognizing molecules in raster images. We evaluate our parsers using SMILES and standard benchmarks, along with a novel evaluation protocol comparing molecular graphs directly that supports automatic error compilation and reveals errors missed by SMILES-based evaluation. On the synthetic USPTO benchmark, our born-digital parser obtains a recognition rate of 98.4% (1% higher than previous models) and our relatively simple neural parser for raster images obtains a rate of 85% using less training data than existing neural approaches (thousands vs. millions of molecules).
Paper Structure (19 sections, 2 equations, 14 figures, 4 tables)

This paper contains 19 sections, 2 equations, 14 figures, 4 tables.

Figures (14)

  • Figure 1: Parsing Nitrobenzene $(C_6H_5NO_2)$ from a PDF image (a). (b) Minimum Spanning Tree (MST) over lines & characters. (c) Visual Graph with additional edges (dashed lines) (d) Tokenized Visual Graph with merged nodes (bonds and named groups). (e) Molecular Graph. Blue nodes show double bonds and atom/group names in (d) and (e). In (e) orange nodes are 'hidden' carbon atoms, and single/double bonds are converted from nodes to edges.
  • Figure 2: ChemScraper Born-Digital Pipeline. Molecules are detected in PNG page images, but symbols are extracted from PDF instructions. Page-Region-Object tables store bounding boxes and the graphics they contain. Molecules are recognized in three stages, producing CDXML containing the page location, appearance, and chemical structure for each. CDXML can then be converted to chemical structure file formats (e.g., SMILES) or rendered as images (e.g., SVG).
  • Figure 3: Molecule Parsing from PDF Symbols. Symbol information is transformed into an MST (Fig. \ref{['fig:mst_to_final']}(b)), a visual structure graph (Fig. \ref{['fig:mst_to_final']}(c)), a tokenized visual graph (Fig. \ref{['fig:mst_to_final']}(d), and finally a molecular structure graph (Fig. \ref{['fig:mst_to_final']}(e))
  • Figure 4: Born-Digital PDF for Propane ($C_3H_8$). Note non-visible (implicit) carbon and hydrogen atoms
  • Figure 5: Instructions for Leftmost Line in PDF Image
  • ...and 9 more figures