decimer 2.6.0__tar.gz → 2.7.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/DECIMER_EfficinetNetV2_Transfomer_Trainer.py +3 -3
  2. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/Predictor_usingCheckpoints.py +1 -1
  3. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/Repack_model.py +4 -4
  4. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/Utils/Create_image_tokenizer.py +1 -1
  5. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/__init__.py +29 -29
  6. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/config.py +64 -21
  7. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/decimer.py +9 -8
  8. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/efficientnetv2/effnetv2_model.py +1 -1
  9. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/utils.py +9 -6
  10. decimer-2.7.1/PKG-INFO +195 -0
  11. decimer-2.7.1/README.md +171 -0
  12. decimer-2.7.1/decimer.egg-info/PKG-INFO +195 -0
  13. {decimer-2.6.0 → decimer-2.7.1}/decimer.egg-info/SOURCES.txt +1 -0
  14. decimer-2.7.1/decimer.egg-info/entry_points.txt +2 -0
  15. {decimer-2.6.0 → decimer-2.7.1}/decimer.egg-info/requires.txt +1 -1
  16. {decimer-2.6.0 → decimer-2.7.1}/setup.py +55 -52
  17. decimer-2.6.0/PKG-INFO +0 -145
  18. decimer-2.6.0/README.md +0 -121
  19. decimer-2.6.0/decimer.egg-info/PKG-INFO +0 -145
  20. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/Efficient_Net_encoder.py +0 -0
  21. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/Transformer_decoder.py +0 -0
  22. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/Utils/Create_TFrecord_From_pickles.py +0 -0
  23. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/efficientnetv2/effnetv2_configs.py +0 -0
  24. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/efficientnetv2/hparams.py +0 -0
  25. {decimer-2.6.0 → decimer-2.7.1}/DECIMER/efficientnetv2/utils.py +0 -0
  26. {decimer-2.6.0 → decimer-2.7.1}/LICENSE +0 -0
  27. {decimer-2.6.0 → decimer-2.7.1}/decimer.egg-info/dependency_links.txt +0 -0
  28. {decimer-2.6.0 → decimer-2.7.1}/decimer.egg-info/top_level.txt +0 -0
  29. {decimer-2.6.0 → decimer-2.7.1}/setup.cfg +0 -0
@@ -250,7 +250,7 @@ def prepare_for_training(lr_config, encoder_config, transformer_config, verbose=
250
250
  transformer_config["d_model"], lr_config["warm_steps"]
251
251
  )
252
252
 
253
- # Instiate an optimizer
253
+ # Instantiate an optimizer
254
254
  optimizer = tf.keras.optimizers.Adam(
255
255
  lr_scheduler, beta_1=0.9, beta_2=0.98, epsilon=1e-9
256
256
  )
@@ -323,7 +323,7 @@ if ckpt_manager.latest_checkpoint:
323
323
  start_epoch = int(ckpt_manager.latest_checkpoint.split("-")[-1])
324
324
 
325
325
 
326
- # Main training step fucntion
326
+ # Main training step function
327
327
  def train_step(image_batch, selfies_batch):
328
328
  """Main training step function.
329
329
 
@@ -376,7 +376,7 @@ def dist_train_step(image_batch, selfies_batch):
376
376
 
377
377
 
378
378
  """
379
- # Main validation step fucntion
379
+ # Main validation step function
380
380
  def validation_step(image_batch, selfies_batch):
381
381
 
382
382
  selfies_batch_input = selfies_batch[:, :-1]
@@ -45,7 +45,7 @@ tokenizer = pickle.load(
45
45
 
46
46
  max_length = 302
47
47
 
48
- # Image partameters
48
+ # Image parameters
49
49
  IMG_EMB_DIM = (16, 16, 512)
50
50
  IMG_EMB_DIM = (IMG_EMB_DIM[0] * IMG_EMB_DIM[1], IMG_EMB_DIM[2])
51
51
  IMG_SHAPE = (512, 512, 3)
@@ -140,7 +140,7 @@ class DECIMER_Predictor(tf.Module):
140
140
  It loads the saved checkpoint and the necessary tokenizers. The
141
141
  inference begins with the start token (<start>) and ends when the
142
142
  end token(<end>) is met. This class can only work with tf.Tensor
143
- objects. The strings shoul gets transformed into np.arrays before
143
+ objects. The strings should get transformed into np.arrays before
144
144
  feeding them into this class.
145
145
  """
146
146
 
@@ -150,7 +150,7 @@ class DECIMER_Predictor(tf.Module):
150
150
 
151
151
  Args:
152
152
  encoder (tf.keras.model): The encoder model
153
- tokenizer (tf.keras.tokenizer): Output tokenizer, defines which charater is assigned to what token
153
+ tokenizer (tf.keras.tokenizer): Output tokenizer, defines which character is assigned to what token
154
154
  transformer (tf.keras.model): The transformer model
155
155
  max_length (int): Maximum length of a string which can get predicted
156
156
  """
@@ -160,7 +160,7 @@ class DECIMER_Predictor(tf.Module):
160
160
  self.max_length = max_length
161
161
 
162
162
  def __call__(self, Decoded_image):
163
- """This fuction takes in the Decoded image as input and makes the
163
+ """This function takes in the Decoded image as input and makes the
164
164
  predicted list of tokens and return the tokens as tf.Tensor array.
165
165
  Before feeding the input array we must define start and the end tokens.
166
166
 
@@ -225,7 +225,7 @@ class ExportDECIMERPredictor(tf.Module):
225
225
 
226
226
  @tf.function
227
227
  def __call__(self, Decoded_Image):
228
- """This fucntion calls the __call__function from the translator class.
228
+ """This function calls the __call__function from the translator class.
229
229
  In the tf.function only the output sentence is returned. Thanks to the
230
230
  non-strict execution in tf.function any unnecessary values are never
231
231
  computed.
@@ -70,7 +70,7 @@ def data_loader(Smiles_Path):
70
70
  all_img_name = []
71
71
 
72
72
  for line in smiles.split("\n"):
73
- # Split the ID and SMILES to seperate tokens
73
+ # Split the ID and SMILES to separate tokens
74
74
  tokens = line.split(",")
75
75
 
76
76
  image_id = str(tokens[0]) + ".png"
@@ -1,29 +1,29 @@
1
- # -*- coding: utf-8 -*-
2
- """DECIMER V2.6.0 Python Package. ============================
3
-
4
- This repository contains DECIMER-V2,Deep lEarning for Chemical ImagE Recognition) project
5
- was launched to address the OCSR problem with the latest computational intelligence methods
6
- to provide an automated open-source software solution.
7
-
8
-
9
- Typical usage example:
10
-
11
- from decimer import predict_SMILES
12
-
13
- # Chemical depiction to SMILES translation
14
- image_path = "path/to/imagefile"
15
- SMILES = predict_SMILES(image_path)
16
- print(SMILES)
17
-
18
- For comments, bug reports or feature ideas,
19
- please raise a issue on the Github repository.
20
- """
21
-
22
- __version__ = "2.6.0"
23
-
24
- __all__ = [
25
- "DECIMER",
26
- ]
27
-
28
-
29
- from .decimer import predict_SMILES
1
+ # -*- coding: utf-8 -*-
2
+ """DECIMER V2.6.0 Python Package. ============================
3
+
4
+ This repository contains DECIMER-V2,Deep lEarning for Chemical ImagE Recognition) project
5
+ was launched to address the OCSR problem with the latest computational intelligence methods
6
+ to provide an automated open-source software solution.
7
+
8
+
9
+ Typical usage example:
10
+
11
+ from decimer import predict_SMILES
12
+
13
+ # Chemical depiction to SMILES translation
14
+ image_path = "path/to/imagefile"
15
+ SMILES = predict_SMILES(image_path)
16
+ print(SMILES)
17
+
18
+ For comments, bug reports or feature ideas,
19
+ please raise a issue on the Github repository.
20
+ """
21
+
22
+ __version__ = "2.6.0"
23
+
24
+ __all__ = [
25
+ "DECIMER",
26
+ ]
27
+
28
+
29
+ from .decimer import predict_SMILES
@@ -11,6 +11,7 @@ import tensorflow as tf
11
11
  from PIL import Image
12
12
  from PIL import ImageEnhance
13
13
  from pillow_heif import register_heif_opener
14
+ from typing import Union
14
15
 
15
16
  import DECIMER.Efficient_Net_encoder as Efficient_Net_encoder
16
17
  import DECIMER.Transformer_decoder as Transformer_decoder
@@ -95,26 +96,68 @@ def HEIF_to_pillow(image_path: str):
95
96
  return heif_file
96
97
 
97
98
 
98
- def remove_transparent(image_path: str):
99
+ def remove_transparent(image: Union[str, np.ndarray]) -> Image.Image:
99
100
  """
100
- Removes the transparent layer from a PNG image with an alpha channel
101
- Args: image_path (str): path of input image
102
- Returns: PIL.Image
101
+ Removes the transparent layer from a PNG image with an alpha channel.
102
+
103
+ Args:
104
+ image (Union[str, np.ndarray]): Path of the input image or a numpy array representing the image.
105
+
106
+ Returns:
107
+ PIL.Image.Image: The image with transparency removed.
103
108
  """
104
- try:
105
- png = Image.open(image_path).convert("RGBA")
106
- except Exception as e:
107
- if type(e).__name__ == "UnidentifiedImageError":
108
- png = HEIF_to_pillow(image_path)
109
- else:
110
- print(e)
111
- raise Exception
109
+ def process_image(png: Image.Image) -> Image.Image:
110
+ """
111
+ Helper function to remove transparency from a single image.
112
+
113
+ Args:
114
+ png (PIL.Image.Image): The input PIL image with transparency.
115
+
116
+ Returns:
117
+ PIL.Image.Image: The image with transparency removed.
118
+ """
119
+ background = Image.new("RGBA", png.size, (255, 255, 255))
120
+ alpha_composite = Image.alpha_composite(background, png)
121
+ return alpha_composite
112
122
 
113
- background = Image.new("RGBA", png.size, (255, 255, 255))
123
+ def handle_image_path(image_path: str) -> Image.Image:
124
+ """
125
+ Helper function to handle image paths.
126
+
127
+ Args:
128
+ image_path (str): The path to the input image.
129
+
130
+ Returns:
131
+ PIL.Image.Image: The image with transparency removed.
132
+ """
133
+ try:
134
+ png = Image.open(image_path).convert("RGBA")
135
+ except Exception as e:
136
+ if type(e).__name__ == "UnidentifiedImageError":
137
+ png = HEIF_to_pillow(image_path)
138
+ else:
139
+ print(e)
140
+ raise Exception
141
+ return process_image(png)
142
+
143
+ def handle_numpy_array(array: np.ndarray) -> Image.Image:
144
+ """
145
+ Helper function to handle a numpy array.
146
+
147
+ Args:
148
+ array (np.ndarray): The numpy array representing the image.
149
+
150
+ Returns:
151
+ PIL.Image.Image: The image with transparency removed.
152
+ """
153
+ png = Image.fromarray(array).convert("RGBA")
154
+ return process_image(png)
114
155
 
115
- alpha_composite = Image.alpha_composite(background, png)
156
+ # Check if input is a numpy array
157
+ if isinstance(image, np.ndarray):
158
+ return handle_numpy_array(array=image)
116
159
 
117
- return alpha_composite
160
+ return handle_image_path(image_path=image)
118
161
 
119
162
 
120
163
  def get_bnw_image(image):
@@ -185,12 +228,12 @@ def increase_brightness(image):
185
228
  return image
186
229
 
187
230
 
188
- def decode_image(image_path: str):
231
+ def decode_image(image_path: Union[str, np.ndarray]):
189
232
  """Loads an image and preprocesses the input image in several steps to get
190
233
  the image ready for DECIMER input.
191
234
 
192
235
  Args:
193
- image_path (str): path of input image
236
+ image_path (Union[str, np.ndarray]): path of input image or numpy array representing the image.
194
237
 
195
238
  Returns:
196
239
  Processed image
@@ -232,12 +275,12 @@ class Config:
232
275
  defined configurations.
233
276
 
234
277
  Args:
235
- image_embedding_dim (int): Embedding dimention of the input image
278
+ image_embedding_dim (int): Embedding dimension of the input image
236
279
  preprocessing_fn (method): Efficient Net preprocessing function for input image
237
280
  backbone_fn (method): Calls Efficient-Net V2 as backbone for encoder
238
281
  image_shape (int): Shape of the input image
239
282
  do_permute (bool, optional): . Defaults to False.
240
- pretrained_weights (keras weights, optional): Use pretrainined efficient net weights or not. Defaults to None.
283
+ pretrained_weights (keras weights, optional): Use pretrained efficient net weights or not. Defaults to None.
241
284
  """
242
285
  self.encoder_config = dict(
243
286
  image_embedding_dim=image_embedding_dim,
@@ -267,7 +310,7 @@ class Config:
267
310
  n_transformer_layers (int): Number of layers present in the transformer model
268
311
  transformer_d_dff (int): Transformer feed forward upwards projection size
269
312
  transformer_n_heads (int): Number of heads present in the transformer model
270
- image_embedding_dim (int): Total number of dimension the image gets embeddeded
313
+ image_embedding_dim (int): Total number of dimension the image gets embedded
271
314
  dropout_rate (float, optional): Fraction of the input units to drop. Defaults to 0.1.
272
315
  """
273
316
  self.transformer_config = dict(
@@ -330,7 +373,7 @@ def prepare_models(encoder_config, transformer_config, replica_batch_size, verbo
330
373
  [type]: Optimizer, Encoder model and the Transformer
331
374
  """
332
375
 
333
- # Instiate an optimizer
376
+ # Instantiate an optimizer
334
377
  optimizer = tf.keras.optimizers.Adam(learning_rate=0.00051)
335
378
 
336
379
  # Instantiate the encoder model
@@ -5,6 +5,7 @@ import sys
5
5
  from typing import List
6
6
  from typing import Tuple
7
7
 
8
+ import numpy as np
8
9
  import pystow
9
10
  import tensorflow as tf
10
11
 
@@ -71,7 +72,7 @@ tokenizer, DECIMER_V2, DECIMER_Hand_drawn = get_models(model_urls)
71
72
 
72
73
 
73
74
  def detokenize_output(predicted_array: int) -> str:
74
- """This function takes the predited tokens from the DECIMER model and
75
+ """This function takes the predicted tokens from the DECIMER model and
75
76
  returns the decoded SMILES string.
76
77
 
77
78
  Args:
@@ -117,24 +118,24 @@ def detokenize_output_add_confidence(
117
118
  decoded_prediction_with_confidence = list(
118
119
  [(utils.decoder(tok), conf) for tok, conf in prediction_with_confidence_]
119
120
  )
120
- decoded_prediction_with_confidence.append(prediction_with_confidence_[-1])
121
+
121
122
  return decoded_prediction_with_confidence
122
123
 
123
124
 
124
125
  def predict_SMILES(
125
- image_path: str, confidence: bool = False, hand_drawn: bool = False
126
+ image_input: [str, np.ndarray], confidence: bool = False, hand_drawn: bool = False
126
127
  ) -> str:
127
128
  """Predicts SMILES representation of a molecule depicted in the given image.
128
129
 
129
130
  Args:
130
- image_path (str): Path of chemical structure depiction image
131
- confidence (bool): Flag to indicate whether to return confidence values along with SMILES prediction
132
- hand_drawn (bool): Flag to indicate whether the molecule in the image is hand-drawn
131
+ image_input (str or np.ndarray): Path of chemical structure depiction image or a numpy array representing the image.
132
+ confidence (bool): Flag to indicate whether to return confidence values along with SMILES prediction.
133
+ hand_drawn (bool): Flag to indicate whether the molecule in the image is hand-drawn.
133
134
 
134
135
  Returns:
135
- str: SMILES representation of the molecule in the input image, optionally with confidence values
136
+ str: SMILES representation of the molecule in the input image, optionally with confidence values.
136
137
  """
137
- chemical_structure = config.decode_image(image_path)
138
+ chemical_structure = config.decode_image(image_input)
138
139
 
139
140
  model = DECIMER_Hand_drawn if hand_drawn else DECIMER_V2
140
141
  predicted_tokens, confidence_values = model(tf.constant(chemical_structure))
@@ -180,7 +180,7 @@ class MBConvBlock(tf.keras.layers.Layer):
180
180
 
181
181
  self.endpoints = None
182
182
 
183
- # Builds the block accordings to arguments.
183
+ # Builds the block according to arguments.
184
184
  self._build()
185
185
 
186
186
  @property
@@ -76,13 +76,17 @@ def ensure_models(default_path: str, model_urls: dict) -> dict:
76
76
  dict: A dictionary containing model names as keys and their local paths as values
77
77
  """
78
78
  model_paths = {}
79
-
79
+ # Store st_size of each model
80
+ model_sizes = {
81
+ "DECIMER": 28080309,
82
+ "DECIMER_HandDrawn": 28080328,
83
+ }
80
84
  for model_name, model_url in model_urls.items():
81
85
  model_path = os.path.join(default_path, f"{model_name}_model")
82
- if (
83
- os.path.exists(model_path)
84
- and os.stat(os.path.join(model_path, "saved_model.pb")).st_size != 28080309
85
- ):
86
+ if os.path.exists(model_path) and os.stat(
87
+ os.path.join(model_path, "saved_model.pb")
88
+ ).st_size != model_sizes.get(model_name):
89
+ print(f"Working with model {model_name}")
86
90
  shutil.rmtree(model_path)
87
91
  config.download_trained_weights(model_url, default_path)
88
92
  elif not os.path.exists(model_path):
@@ -90,5 +94,4 @@ def ensure_models(default_path: str, model_urls: dict) -> dict:
90
94
 
91
95
  # Store the model path
92
96
  model_paths[model_name] = model_path
93
-
94
97
  return model_paths
decimer-2.7.1/PKG-INFO ADDED
@@ -0,0 +1,195 @@
1
+ Metadata-Version: 2.1
2
+ Name: decimer
3
+ Version: 2.7.1
4
+ Summary: DECIMER 2.6.0: Deep Learning for Chemical Image Recognition using Efficient-Net V2 + Transformer
5
+ Home-page: https://github.com/Kohulan/DECIMER-Image_Transformer
6
+ Author: Kohulan Rajan
7
+ Author-email: kohulan.rajan@uni-jena.de
8
+ Maintainer: Kohulan Rajan, Otto Brinkhaus
9
+ Maintainer-email: kohulan.rajan@uni-jena.de, otto.brinkhaus@uni-jena.de
10
+ License: MIT
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.5
13
+ Classifier: Programming Language :: Python :: 3.6
14
+ Classifier: Programming Language :: Python :: 3.7
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: License :: OSI Approved :: MIT License
20
+ Classifier: Operating System :: OS Independent
21
+ Requires-Python: >=3.5
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+
25
+ <div align="center">
26
+
27
+ # 🧪 DECIMER Image Transformer 🖼️
28
+
29
+ ### Deep Learning for Chemical Image Recognition using Efficient-Net V2 + Transformer
30
+
31
+ <p align="center">
32
+ <img src="https://github.com/Kohulan/DECIMER-Image_Transformer/blob/master/DECIMER_V2.png?raw=true" alt="DECIMER Logo" width="600">
33
+ </p>
34
+
35
+ [![License](https://img.shields.io/badge/License-MIT%202.0-blue.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
36
+ [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg?style=for-the-badge)](https://GitHub.com/Kohulan/DECIMER-Image_Transformer/graphs/commit-activity)
37
+ [![GitHub issues](https://img.shields.io/github/issues/Kohulan/DECIMER-Image_Transformer.svg?style=for-the-badge)](https://GitHub.com/Kohulan/DECIMER-Image_Transformer/issues/)
38
+ [![GitHub contributors](https://img.shields.io/github/contributors/Kohulan/DECIMER-Image_Transformer.svg?style=for-the-badge)](https://GitHub.com/Kohulan/DECIMER-Image_Transformer/graphs/contributors/)
39
+ [![tensorflow](https://img.shields.io/badge/TensorFlow-2.10.1-FF6F00.svg?style=for-the-badge&logo=tensorflow)](https://www.tensorflow.org)
40
+ [![DOI](https://zenodo.org/badge/293572361.svg)](https://zenodo.org/badge/latestdoi/293572361)
41
+ [![Documentation Status](https://readthedocs.org/projects/decimer-image-transformer/badge/?version=latest&style=for-the-badge)](https://decimer-image-transformer.readthedocs.io/en/latest/?badge=latest)
42
+ [![GitHub release](https://img.shields.io/github/release/Kohulan/DECIMER-Image_Transformer.svg?style=for-the-badge)](https://GitHub.com/Kohulan/DECIMER-Image_Transformer/releases/)
43
+ [![PyPI version fury.io](https://badge.fury.io/py/decimer.svg?style=for-the-badge)](https://pypi.python.org/pypi/decimer/)
44
+
45
+ </div>
46
+
47
+ ---
48
+
49
+ ## 📚 Table of Contents
50
+
51
+ - [Abstract](#-abstract)
52
+ - [Method and Model Changes](#-method-and-model-changes)
53
+ - [Installation](#-installation)
54
+ - [Usage](#-usage)
55
+ - [Hand-drawn Model](#-decimer---hand-drawn-model)
56
+ - [Citation](#-citation)
57
+ - [Acknowledgements](#-acknowledgements)
58
+ - [Author](#-author-kohulan)
59
+ - [Project Website](#-project-website)
60
+ - [Research Group](#-research-group)
61
+
62
+ ---
63
+
64
+ ## 🔬 Abstract
65
+
66
+ <div style="background-color: #f0f0f0; padding: 15px; border-radius: 10px;">
67
+
68
+ The DECIMER 2.2 project tackles the OCSR (Optical Chemical Structure Recognition) challenge using cutting-edge computational intelligence methods. Our goal? To provide an automated, open-source software solution for chemical image recognition.
69
+
70
+ We've supercharged DECIMER with Google's TPU (Tensor Processing Unit) to handle datasets of over 1 million images with lightning speed!
71
+
72
+ </div>
73
+
74
+ ---
75
+
76
+ ## 🧠 Method and Model Changes
77
+
78
+ <table>
79
+ <tr>
80
+ <td width="50%">
81
+ <h3>🖼️ Image Feature Extraction</h3>
82
+ <p>Now utilizing EfficientNet-V2 for superior image analysis</p>
83
+ </td>
84
+ <td width="50%">
85
+ <h3>🔮 SMILES Prediction</h3>
86
+ <p>Employing a state-of-the-art transformer model</p>
87
+ </td>
88
+ </tr>
89
+ </table>
90
+
91
+ ### 🚀 Training Enhancements
92
+
93
+ 1. **TFRecord Files**: Lightning-fast data reading
94
+ 2. **Google Cloud Buckets**: Efficient cloud storage solution
95
+ 3. **TensorFlow Data Pipeline**: Optimized data loading
96
+ 4. **TPU Strategy**: Harnessing the power of Google's TPUs
97
+
98
+ ---
99
+
100
+ ## 💻 Installation
101
+
102
+ ```bash
103
+ # Create a conda wonderland
104
+ conda create --name DECIMER python=3.10.0 -y
105
+ conda activate DECIMER
106
+
107
+ # Equip yourself with DECIMER
108
+ pip install decimer
109
+ ```
110
+
111
+ ---
112
+
113
+ ## 🎮 Usage
114
+
115
+ ```python
116
+ from DECIMER import predict_SMILES
117
+
118
+ # Unleash the power of DECIMER
119
+ image_path = "path/to/your/chemical/masterpiece.jpg"
120
+ SMILES = predict_SMILES(image_path)
121
+ print(f"🎉 Decoded SMILES: {SMILES}")
122
+ ```
123
+
124
+ ---
125
+
126
+ ## ✍️ DECIMER - Hand-drawn Model
127
+
128
+ <div style="background-color: #e6f7ff; padding: 15px; border-radius: 10px;">
129
+
130
+ 🌟 **New Feature Alert!** 🌟
131
+
132
+ Our latest model brings the magic of AI to hand-drawn chemical structures!
133
+
134
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10781330.svg)](https://doi.org/10.5281/zenodo.10781330)
135
+
136
+ </div>
137
+
138
+ ---
139
+
140
+ ## 📜 Citation
141
+
142
+ <div style="background-color: #f9f9f9; padding: 15px; border-radius: 10px;">
143
+
144
+ If DECIMER helps your research, please cite:
145
+
146
+ 1. Rajan K, et al. "DECIMER.ai - An open platform for automated optical chemical structure identification, segmentation and recognition in scientific publications." *Nat. Commun.* 14, 5045 (2023).
147
+ 2. Rajan, K., et al. "DECIMER 1.0: deep learning for chemical image recognition using transformers." *J Cheminform* 13, 61 (2021).
148
+ 3. Rajan, K., et al. "Advancements in hand-drawn chemical structure recognition through an enhanced DECIMER architecture," *J Cheminform* 16, 78 (2024).
149
+
150
+ </div>
151
+
152
+ ---
153
+
154
+ ## 🙏 Acknowledgements
155
+
156
+ - A big thank you to [Charles Tapley Hoyt](https://github.com/cthoyt) for his invaluable contributions!
157
+ - Powered by Google's TPU Research Cloud (TRC)
158
+
159
+ <p align="center">
160
+ <img src="https://user-images.githubusercontent.com/30716951/220350828-913e6645-6a0a-403c-bcb8-160d061d4606.png" width="300">
161
+ </p>
162
+
163
+ ---
164
+
165
+ ## 👨‍🔬 Author: [Kohulan](https://kohulanr.com)
166
+
167
+ <p align="center">
168
+ <img src="https://github.com/Kohulan/DECIMER-Image-to-SMILES/raw/master/assets/DECIMER.gif" width="300">
169
+ </p>
170
+
171
+ ---
172
+
173
+ ## 🌐 Project Website
174
+
175
+ Experience DECIMER in action at [decimer.ai](https://decimer.ai), brilliantly implemented by [Otto Brinkhaus](https://github.com/OBrink)!
176
+
177
+ ---
178
+
179
+ ## 🏫 Research Group
180
+
181
+ <p align="center">
182
+ <a href="https://cheminf.uni-jena.de">
183
+ <img src="https://github.com/Kohulan/DECIMER-Image-to-SMILES/blob/master/assets/CheminfGit.png" width="300">
184
+ </a>
185
+ </p>
186
+
187
+ ---
188
+
189
+ <div align="center">
190
+
191
+ ### 📊 Project Analytics
192
+
193
+ ![Repobeats](https://repobeats.axiom.co/api/embed/bf532b7ac0d34137bdea8fbb82986828f86de065.svg "Repobeats analytics image")
194
+
195
+ </div>