Research question and scope

MolScribe reads a drawing of a molecule and predicts a structure. The research task here is to turn a figure into a reviewed structure record, not merely to obtain a parseable string. Use this when extracting structures from a paper or a local image; keep the original image and its provenance. The project README documents SMILES and molfile output and optional atom, bond and confidence data.

Prerequisites

Prepare one legible image per structure, a local Python environment with MolScribe and RDKit, and the project checkpoint named in the official README. Record package versions, checkpoint identifier, image hash, image source and any crop or resize. The project example calls predict_image_file after checkpoint download; the checkpoint is an external dependency. Confirm the current download terms before processing restricted images.

Workflow

  1. Run the official MolScribe example on a copy of the image. Preserve its raw smiles, molfile, optional atom/bond list and confidence fields.
import torch
from huggingface_hub import hf_hub_download
from molscribe import MolScribe

checkpoint = hf_hub_download("yujieq/MolScribe", "swin_base_char_aux_1m.pth")
model = MolScribe(checkpoint, device=torch.device("cpu"))
predicted = model.predict_image_file(
    "assets/example.png", return_atoms_bonds=True, return_confidence=True
)
  1. Parse the proposed SMILES with RDKit. The following small check uses the RDKit Python guide API. Code not executed for this article.
from rdkit import Chem

smiles = predicted["smiles"]  # predicted is the MolScribe output dictionary
mol = Chem.MolFromSmiles(smiles)
if mol is None:
    raise ValueError("SMILES could not be parsed")
print(Chem.MolToSmiles(mol, isomericSmiles=True))
  1. Compare the parsed structure with the image atom by atom: element symbols, charge, bond order, disconnected fragments, ring closures, abbreviated groups and stereochemical marks. Use MolScribe atom/bond coordinates as review aids, not ground truth. Log each manual correction and reviewer.

How to interpret and check the output

A successful parse shows that RDKit can construct a molecule under its parser rules. It does not prove that the molecule matches the picture. Accept only when a person has checked the drawn connectivity and all chemistry-bearing annotations; otherwise mark the record unresolved. Preserve both original and corrected strings so later users can audit the change.

Limits and common errors

Blur, overlapping labels, cropped bonds, salts and wedge/hash bonds can change the predicted structure. A high model confidence is a model score, not an experimental or editorial validation. If the figure contains a reaction scheme or multiple structures, split the task and review each component. Check the project and model licenses independently before reuse.

Related ChemAI Atlas pages

Resources: MolScribe, RDKit. Related guide: Building an AI Cheminformatics Workflow with RDKit.

Primary sources

  • https://github.com/thomas0809/MolScribe (official source; accessed 2026-10-13)
  • https://github.com/thomas0809/MolScribe/blob/main/molscribe/interface.py (official source; accessed 2026-10-13)
  • https://www.rdkit.org/docs/GettingStartedInPython.html (official source; accessed 2026-10-13)