Datasets:
dataset_info:
features:
- name: id
dtype: string
- name: image
dtype: image
- name: mol
dtype: string
- name: smiles
dtype: string
- name: selfies
dtype: string
- name: inchi
dtype: string
splits:
- name: train
num_bytes: 40758554
num_examples: 5719
download_size: 23312328
dataset_size: 40758554
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
task_categories:
- image-to-text
tags:
- chemistry
- science
- ocr
- ocsr
- structure
pretty_name: USPTO OCSR Benchmark
size_categories:
- 1K<n<10K
Dataset Card for USPTO OCSR Benchmark
This dataset is a large validation and benchmark set for Optical Chemical Structure Recognition (OCSR), containing 5,719 chemical structure images. The data was sourced from US Patent Office (USPTO) documents and has been curated to provide accurate ground truth MOL files. This Hugging Face version further enriches the dataset by providing pre-computed SMILES, InChI, and SELFIES strings for each molecule.
Dataset Details
Dataset Description
The USPTO OCSR Benchmark was created to serve as a high-quality validation set for OCSR software. It consists of images derived from the US Patent Office Complex Work Units, with each image containing a single chemical structure. The dataset was made possible through a collaboration with Dr. Steve Boyer and Dr. John Kinney and was later updated by Aniko Valko and Keymodule Ltd., who corrected the ground truth MOL files and removed invalid images.
The original distribution included the images, their corresponding MOL files, and a Perl script for benchmarking performance by comparing the standard InChI of predicted structures against the ground truth. This Hugging Face version processes the curated MOL files to generate additional, widely-used chemical representations—canonical SMILES, InChI, and SELFIES—making it immediately useful for training modern deep learning models on image-to-text tasks.
- Curated by: Original set by Dr. Steve Boyer and Dr. John Kinney. Updated by Aniko Valko and Keymodule Ltd. This Hugging Face version prepared by Hunter Heidenreich.
- License: Data sourced from the US Patent Office is typically in the public domain. No explicit license was provided with the original dataset.
Dataset Sources
- Repository:
- Paper: While there is no dedicated paper for the dataset, it is closely associated with the OSRA tool. Citing the OSRA paper is recommended.
Uses
Direct Use
This dataset is ideal for benchmarking, validating, and training OCSR models, particularly those intended to work with chemical diagrams from patent literature. Common use cases include:
- Image-to-SMILES translation
- Evaluating the accuracy of OCSR tools by comparing generated InChIs
- Fine-tuning vision-language models for the chemistry domain
Out-of-Scope Use
The dataset consists of segmented, single-structure images. It is not suitable for developing or evaluating the document segmentation stage of an OCSR pipeline, which involves finding and isolating chemical diagrams from a full document page. The drawing styles are also specific to patent documents and may not represent the full diversity of diagrams found in textbooks, journals, or handwritten notes.
Dataset Structure
The dataset contains a single split ('train') with 5,719 examples. Each example includes the following fields:
id(string): A unique identifier for the example, which is the original filename without the extension.image(image): A PIL-encoded image of the chemical structure.mol(string): The corrected ground truth structure in MOL file format.smiles(string): The canonical SMILES string for the molecule, generated from themoldata using RDKit.selfies(string): The SELFIES (SELF-referencIng Embedded Strings) representation, generated from thesmilesstring.inchi(string): The standard InChI string for the molecule, generated from themoldata using RDKit.
Dataset Creation
Curation Rationale
The dataset was created to provide a robust and standardized tool for the OCSR community to benchmark and validate their software against a large set of real-world examples from a significant source (US patents).
Source Data
Data Collection and Processing
The source data consists of chemical structure images from US Patent Office Complex Work Units. The initial dataset was later refined by Aniko Valko and Keymodule Ltd. by correcting errors in the ground truth MOL files and removing invalid image-molecule pairs to improve its quality as a benchmark.
For this Hugging Face Hub version, a script was used to process the corrected MOL files. This script utilized the RDKit library to generate canonical SMILES and standard InChI strings, and the selfies library to generate SELFIES representations from the SMILES strings. This pre-processing makes the dataset more accessible for machine learning workflows.
Who are the source data producers?
The underlying chemical structure data originates from documents filed with the US Patent Office. The dataset was curated and released by academic and commercial collaborators.
Bias, Risks, and Limitations
- Domain Specificity: The data is exclusively from US patents. The conventions, resolution, and styles of chemical drawings may differ from those in patents from other regions or in other types of scientific publications.
- Pre-processed Images: The images contain only single, segmented structures. This simplifies the recognition task and means models trained on this data will not learn to handle complex pages with multiple diagrams, text, and other figures.
- Lack of Negative Examples: The dataset contains only valid chemical structure images. It does not include examples of diagrams that are malformed or non-chemical, which could be important for building a truly robust real-world system.
Recommendations
Users should consider this dataset a high-quality validation set for the core task of recognizing segmented chemical structures from patents. For creating a more general-purpose OCSR tool, it is advisable to combine this dataset with others that include different drawing styles (e.g., UOB, CLEF) and more complex, unsegmented document images.
Citation
If you use this dataset, please consider citing the original OSRA paper, as the dataset is a key part of its validation suite. Please also cite this Hugging Face dataset to ensure reproducibility.
BibTeX:
@article{filippov2009optical,
title={Optical structure recognition software to recover chemical information: OSRA, an open source solution},
author={Filippov, Igor V and Nicklaus, Marc C},
journal={Journal of chemical information and modeling},
volume={49},
number={3},
pages={740--743},
year={2009},
publisher={ACS Publications}
}
@misc{huggingface_dataset_USPTO,
author = {Heidenreich, Hunter},
title = {USPTO OCSR Benchmark},
year = {2025},
publisher = {Hugging Face},
journal = {Hugging Face repository},
howpublished = {\url{[https://huggingface.co/datasets/hheiden/USPTO_OCSR_benchmark](https://huggingface.co/datasets/hheiden/USPTO_OCSR_benchmark)}}
}