I2M converts molecular structure images into chemical structure strings.
- BondlifeAI: https://www.bondlifeai.cn/
Set up the environment and run inference on a single molecule image:
# 1. Clone the repository
git clone https://github.com/tbwxmu/I2M.git
cd I2M
# 2. Create the environment
conda env create -f environment.yml
conda activate i2m
# 3. Install the package
pip install -e .
# 4. Predict a SMILES string from one image
python infer_single.py test/test_001.pngThe command prints the predicted SMILES string to stdout.
- Linux or WSL environment
- NVIDIA GPU with CUDA support (recommended)
- Conda package manager
- Python 3.10+
The repository includes standard Python packaging metadata, so it can be installed with pip.
# Local source tree
pip install .
# Editable install for development
pip install -e .
# Include optional extras when needed
pip install ".[eval,ocr]"you can install directly from GitHub as the repository is published:
pip install "git+https://github.com/tbwxmu/I2M.git"Current packaging constraints:
- Python
3.10only - Linux only
paddlepaddleis not installed automatically because the correct package depends on your CUDA / platform combination
python infer_single.py test/test_001.pngSample test images are included under test/, for example:
python infer_single.py test/test_001.png
python infer_single.py test/test_010.pngOptional arguments:
--weights: use a different ONNX checkpoint--threshold: adjust the confidence cutoff before graph reconstruction--device: choosecpu,cuda, orauto--print-detections: print filtered detections to stderr before SMILES reconstruction
Dataset-oriented evaluation is still available:
python evaluate/eval_model.py \
--resume weights/I2M_R4.onnx \
--dataname acs \
--data-root data/testThis script is designed for dataset evaluation rather than ad hoc single-image use. It expects a CSV file plus an image directory under --data-root.
Download the official Zenodo datasets and place the extracted files under the repository's data/ directory.
- Training dataset: Zenodo record 15823641,
- Testing dataset: Zenodo record 16034987
- PyTorch training checkpoints: Zenodo record 20442887
Recommended layout:
I2M/
├── data/
│ ├── train/
│ ├── test/
├── test/
│ ├── test_001.png
│ └── ...
└── ...
Suggested usage:
- Put the extracted training dataset under
data/train/ - Use
data/test/for the CSV and image folders consumed byevaluate/eval_model.py
If you evaluate custom benchmark splits with evaluate/eval_model.py, point --data-root to the directory containing the prepared CSV and image folders. The directory conventions are also documented in data/README.md.
- Training guide:
TRAINING.md - Evaluation setup:
evaluate/INSTALL.md - Data download helper:
evaluate/download_data_guide.sh - Supported benchmark datasets include ACS, JPO, UOB, USPTO, CLEF, Staker, and ChemVLOCR
This project is released under the common noncommercial software license PolyForm Noncommercial 1.0.0. See LICENSE for the full terms.
Commercial use is not permitted under the current license.
If you are interested in commercial licensing or collaboration, please contact wuzxmu@gmail.com.