| --- |
| library_name: glyph |
| pipeline_tag: image-to-text |
| tags: [chemistry, ocsr, optical-chemical-structure-recognition, image-to-smiles] |
| --- |
| # OCSRGlyph |
|
|
| ## Installing the code |
|
|
| The commands below use the **`glyph`** package. Install it from the code repository: |
|
|
| ```bash |
| git clone https://github.com/EdisonScientific/glyph |
| cd glyph |
| uv venv && uv sync --extra ocsr # or: pip install -e ".[ocsr]" |
| ``` |
|
|
| See the repo's `README.md` (quickstart + inference) and `REPRODUCE.md` (frozen eval contract). |
|
|
|
|
| Optical Chemical Structure Recognition for ordinary molecules: image -> SMILES. Swin-B/384 image encoder + a |
| 6-layer transformer decoder (single inference model; ImageNet-pretrained backbone, no OCSR-specific pretraining). |
|
|
| ## Results - USPTO-OCSR-5719 (greedy decode, light postprocess) |
|
|
| | Convention | Full 5719 | Parseable 5704 | |
| |---|---|---| |
| | A - canonical (full stereo) | 5362/5719 = **93.8%** | 93.97% | |
| | B - chirality-kept | 5372/5719 = **93.9%** | 94.14% | |
| | C - graph (connectivity) | 5499/5719 = **96.2%** | 96.35% | |
| | valid SMILES | - | 99.79% | |
|
|
| ## Usage |
| ```bash |
| glyph ocsr eval --checkpoint EdisonScientific/OCSRGlyph --benchmark <uspto_ocsr_5719_complete.csv> |
| ``` |
| See the code repository's `REPRODUCE.md` for the full contract. Files: `model.pth`, `ocsrglyph-recipe.json`. |
|
|
| **License:** pending. **Citation:** to be added on publication. |
|
|