{"id":28033293,"url":"https://github.com/kohulan/decimer-image-to-smiles","last_synced_at":"2025-05-11T09:58:14.940Z","repository":{"id":45101859,"uuid":"267869319","full_name":"Kohulan/DECIMER-Image-to-SMILES","owner":"Kohulan","description":"The repository contains the network and the related scripts for encoder-decoder based Chemical Image Recognition ","archived":false,"fork":false,"pushed_at":"2025-01-30T15:38:08.000Z","size":2607,"stargazers_count":95,"open_issues_count":0,"forks_count":26,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-11T09:58:08.306Z","etag":null,"topics":["chemical-image-recognition","decimer","decimer-image","smiles","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kohulan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-29T13:49:29.000Z","updated_at":"2025-03-22T14:59:47.000Z","dependencies_parsed_at":"2022-07-13T06:20:27.064Z","dependency_job_id":null,"html_url":"https://github.com/Kohulan/DECIMER-Image-to-SMILES","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kohulan%2FDECIMER-Image-to-SMILES","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kohulan%2FDECIMER-Image-to-SMILES/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kohulan%2FDECIMER-Image-to-SMILES/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kohulan%2FDECIMER-Image-to-SMILES/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kohulan","download_url":"https://codeload.github.com/Kohulan/DECIMER-Image-to-SMILES/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253547225,"owners_count":21925544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chemical-image-recognition","decimer","decimer-image","smiles","tensorflow"],"created_at":"2025-05-11T09:58:14.334Z","updated_at":"2025-05-11T09:58:14.875Z","avatar_url":"https://github.com/Kohulan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DECIMER V1.0 is now available, Please check our new repository [DECIMER-Image_Transformer](https://github.com/Kohulan/DECIMER-Image_Transformer) !!\n\n[![DOI](https://zenodo.org/badge/267869319.svg)](https://zenodo.org/badge/latestdoi/267869319)\n# DECIMER-Image-to-SMILES\nThe repository contains the network and the related scripts for encoder-decoder based Chemical Image Recognition \n\n\n### The project contains code which was written throughout the project (Continuously updated)\n\n#### Top-level directory layout\n```bash\n\n  ├── Network/                           # Main model and evaluator scripts\n  +   ├ ─ Trainer_Image2Smiles.py     # Main training script - further could be modified for training\n  +   ├ ─ I2S_Data.py                 # Data reader module for training\n  +   ├ ─ I2S_Model.py                # Autoencoder network\n  +   ├ ─ Evaluate.py                 # To Load trained model and evaluate an image (Predicts SMILES)\n  +   └ ─ I2S_evalData.py             # To load the tokenizer and the images for evaluation\n  +    \n  ├── Utils/                              # Utilities used to generate the text data\n  +   ├ ─ Deepsmiles_Encoder.py        # Used for encoding SMILES to DeepSMILES\n  +   ├ ─ Deepsmiles_Decoder.py        # Used for decoding DeepSMILES to SMILES\n  +   ├ ─ Smilesto_selfies.py          # Used for encoding SMILES to SELFIES\n  +   ├ ─ Smilesto_selfies.py          # Used for encoding SELFIES to SMILES\n  +   └ ─ Tanimoto_Calculator_Rdkit.py  # Calculates Tanimoto similarity on Original VS Predicted SMILES\n  + \n  ├── LICENSE\n  ├── Python_Requirements                 # Python requirements needed to run the scripts without error\n  └── README.md\n  \n  ```\n\n## Installation of required dependencies:\n\n### Installation of TensorFlow\n- This can be done using pip, check the [Tensorflow](https://www.tensorflow.org/install) website for the installation guide. DECIMER can run on both CPU and GPU platforms. Installing Tensorflow-GPU should be done according to this [guide](https://www.tensorflow.org/install/gpu).\n\n### Requirements\n  - matplotlib\n  - sklearn\n  - pillow\n  - deepsmiles\n\n## How to set up the directories:\n\n- Directories can be easily specified inside the scripts.\n  - The path to the SMILES data is specified in I2S_Data.py \n  - The path to the image data is specified in Trainer_Image2Smiles.py\n  - The path to checkpoints will be generated in the same folder where your Trainer script is located, If you would like to use a different path it can be modified in Trainer_Image2Smiles.py.\n  \n #### Recommended layout of the directory\n ```bash\n  ├── Image2SMILES/\n  +   ├ ─ checkpoints/\n  +   ├ ─ Trainer_Image2Smiles.py    \n  +   ├ ─ I2S_Data.py                 \n  +   ├ ─ I2S_Model.py                \n  +   ├ ─ Evaluate.py                 \n  +   └ ─ I2S_evalData.py            \n  + \n  ├── Data/\n  +   ├ ─ Train_Images/\n  +   └ ─ DeepSMILES.txt\n  +\n  └── Predictions/\n      └ ─ Utils/\n       \n ```\n## How to generate data and train Image2SMILES:\n\n- Generating image data:\n  - You can generate your images using SDF or SMILES. The [DECIMER](https://github.com/Kohulan/DECIMER/tree/master/src/org/openscience/decimer) Java repository contains the scripts used to generate images that were used for training in our case. You simply have to clone the repository, get the [CDK](https://cdk.github.io) libraries, and use them as referenced libraries to compile the scripts you want to use.\n  ```bash\n  e.g: \n  javac -cp cdk-2.3.jar:. SmilesDepictor.java   # Compiling the script on your local directory.\n  java -cp cdk-2.3.jar:. SmilesDepictor         # Run the compiled script.\n  ```\n  - The generated images should be placed under /Image2SMILES/Data/Train_Images/\n \n - Generating Text Data:\n    - You should use the corresponding SDF or SMILES file to generate the text data. Here, the text data is [DeepSMILES](https://github.com/baoilleach/deepsmiles) strings. The DeepSMILES can be generated using [Deepsmiles_Encoder.py] under Utils. Split the DeepSMILES strings appropriately after generating them.\n    - Place the DeepSMILES data under /Image2SMILES/Data/\n \n ### Training Image2SMILES\n - After specifying the \"paths\" to the data correctly. you can train the Image2SMILES network on a GPU enabled machine(CPU platform can be much slower for a big number of Images).\n ```bash\n $ python3 Image2SMILES.py \u0026\u003e log.txt \u0026\n ```\n - After the training is finished, you can use your images to test the model trained using the Evaluate.py. to generate a completely new set of test data, you can use the same steps as above mentioned to generate training data.\n\nNote: Training the model yourself is straightforward, but for reference please check [DECIMER V1.0](https://github.com/Kohulan/DECIMER-Image_Transformer) repository\n\n\n### Predicting using the trained model\n- To use the trained model provided in the repository please follow these steps;\n- Model also available here: [Trained Model](https://storage.googleapis.com/decimer_weights/Trained_Models.zip) and should be placed under Trained_Models directory\n  - Clone the repository\n    ```\n    git clone https://github.com/Kohulan/DECIMER-Image-to-SMILES.git\n    ```\n  - Change directory to Network folder\n    ```\n    cd DECIMER-Image-to-SMILES/Network\n    ```\n  - Copy a sample image to the Network folder, check the path to the model inside Predictor.py and run\n    ```\n    python3 Predictor.py --input sample.png\n    ```\n## License:\n- This project is licensed under the MIT License - see the [LICENSE](https://github.com/Kohulan/Decimer-Python/blob/master/LICENSE) file for details\n\n## Citation\n- Use this BibTeX to cite\n```\n\n@article{Rajan2020,\nabstract = {The automatic recognition of chemical structure diagrams from the literature is an indispensable component of workflows to re-discover information about chemicals and to make it available in open-access databases. Here we report preliminary findings in our development of Deep lEarning for Chemical ImagE Recognition (DECIMER), a deep learning method based on existing show-and-tell deep neural networks, which makes very few assumptions about the structure of the underlying problem. It translates a bitmap image of a molecule, as found in publications, into a SMILES. The training state reported here does not yet rival the performance of existing traditional approaches, but we present evidence that our method will reach a comparable detection power with sufficient training time. Training success of DECIMER depends on the input data representation: DeepSMILES are superior over SMILES and we have a preliminary indication that the recently reported SELFIES outperform DeepSMILES. An extrapolation of our results towards larger training data sizes suggests that we might be able to achieve near-accurate prediction with 50 to 100 million training structures. This work is entirely based on open-source software and open data and is available to the general public for any purpose.},\nauthor = {Rajan, Kohulan and Zielesny, Achim and Steinbeck, Christoph},\ndoi = {10.1186/s13321-020-00469-w},\nissn = {1758-2946},\njournal = {Journal of Cheminformatics},\nmonth = {dec},\nnumber = {1},\npages = {65},\ntitle = {{DECIMER: towards deep learning for chemical image recognition}},\nurl = {https://doi.org/10.1186/s13321-020-00469-w https://jcheminf.biomedcentral.com/articles/10.1186/s13321-020-00469-w},\nvolume = {12},\nyear = {2020}\n}\n\n```\n\n## Author:\n- [Kohulan](github.com/Kohulan)\n\n[![GitHub Logo](https://github.com/Kohulan/DECIMER-Image-to-SMILES/raw/master/assets/DECIMER.gif)](https://kohulan.github.io/Decimer-Official-Site/)\n\n## Project Website\n- [DECIMER](https://kohulan.github.io/Decimer-Official-Site/)\n\n## Research Group\n- [Website](https://cheminf.uni-jena.de)\n\n![GitHub Logo](/assets/CheminfGit.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkohulan%2Fdecimer-image-to-smiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkohulan%2Fdecimer-image-to-smiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkohulan%2Fdecimer-image-to-smiles/lists"}