SubGrapher: Visual Fingerprinting of Chemical Structures

Lucas Morin, Gerhard Ingmar Meijer, Valéry Weber, Luc Van Gool, Peter W. J. Staar · DOI

Abstract

Extracting chemical information from scientific literature and patents is a critical yet challenging task in drug discovery. Traditional Optical Chemical Structure Recognition (OCSR) methods often struggle with low-quality images and complex Markush structures due to their reliance on full molecular graph reconstruction. We present SubGrapher, a novel deep-learning approach that generates "visual fingerprints" directly from molecular images. By employing instance segmentation to identify functional groups and carbon backbones, SubGrapher constructs a Substructure-based Visual Molecular Fingerprint (SVMF) that is robust to noise and structural complexity. Our results demonstrate that SubGrapher significantly outperforms state-of-the-art OCSR models in chemical structure retrieval tasks, particularly on challenging patent datasets.

Introduction

The rapid growth of chemical literature necessitates efficient automated tools for data extraction. Current OCSR pipelines typically attempt to reconstruct a complete atom-by-atom graph or a SMILES string from images. However, this "all-or-nothing" approach is inherently brittle; minor image artifacts or non-standard drawing conventions can lead to invalid or incorrect molecular representations. Furthermore, for many downstream applications such as database searching or property prediction, a full reconstruction is unnecessary—a molecular fingerprint suffices.

SubGrapher addresses these limitations by shifting the focus from reconstruction to recognition. Instead of building a molecule from scratch, it identifies key chemical components and their spatial relationships to generate a robust numerical summary directly from pixels.

The SubGrapher pipeline facilitates the direct extraction of molecular fingerprints from document images, bypassing full graph reconstruction.

Methodology

The SubGrapher architecture consists of a one-step visual fingerprinting pipeline designed for high-throughput chemical informatics.

Substructure Segmentation

The core of the system utilizes two specialized Mask-RCNN networks. The first network is trained to detect 1,534 expert-defined functional groups, while the second identifies 27 distinct carbon backbone patterns. By utilizing segmentation masks rather than simple bounding boxes, the model achieves a fine-grained understanding of the molecule's topology.

Substructure-Graph and SVMF Generation

Following detection, SubGrapher constructs a "Substructure-graph" where nodes represent detected fragments and edges denote their spatial connectivity (intersections) within the image. This graph is then transformed into a Substructure-based Visual Molecular Fingerprint (SVMF)—a continuous, count-based matrix that encodes both the presence and the connectivity of molecular features. This matrix is subsequently compressed into a vector for efficient large-scale retrieval.

Detailed workflow of SubGrapher: from initial image segmentation to the generation of the Substructure-based Visual Molecular Fingerprint (SVMF).

Evaluation and Results

SubGrapher was evaluated against several challenging benchmarks, including real-world patent images from the Japanese Patent Office (JPO) and complex Markush structures.

  • Retrieval Performance: In head-to-head comparisons with leading models like DECIMER and MolScribe, SubGrapher demonstrated superior retrieval accuracy. In specific benchmarks, SubGrapher achieved a mean rank of 95 for correct molecule identification, significantly outperforming competing methods.
  • Robustness to Noise: On the JPO dataset, characterized by low-quality and non-standard drawings, SubGrapher achieved a Molecule Exact Match (M-EM) score of 83%, the highest among learning-based methods.
  • Scalability: Unlike sequence-to-sequence models that degrade as molecular size increases, SubGrapher maintained consistent performance on large molecules (USPTO-10K-L), highlighting the advantages of object detection for varying image scales.

Discussion and Limitations

SubGrapher provides a robust alternative to traditional OCSR by leveraging the inherent redundancy of molecular structures. Even if certain fragments are missed, the resulting "fuzzy" fingerprint often remains sufficient for accurate retrieval. This approach is particularly effective for Markush structures, which represent families of molecules and are notoriously difficult for standard graph reconstruction.

Despite its strengths, current limitations include a lack of stereochemical awareness (distinguishing enantiomers) and the inability to process common chemical abbreviations (e.g., "Ph", "Et") without integrated OCR. Future iterations of SubGrapher will aim to incorporate these features to further enhance fingerprint precision and utility in diverse chemical informatics workflows.

Summary updated

BibTeX
@article{morin2025subgrapher,
  author = {Lucas Morin and Gerhard Ingmar Meijer and Valéry Weber and Luc Van Gool and Peter W. J. Staar},
  title = {{SubGrapher: Visual Fingerprinting of Chemical Structures}},
  journal = {J. Cheminformatics},
  year = {2025},
  doi = {10.1186/s13321-025-01091-4},
}
Figure