Kohulan / DECIMER-Image_Transformer

DECIMER Image Transformer is a deep-learning-based tool designed for automated recognition of chemical structure images. Leveraging transformer architectures, the model converts chemical images into SMILES strings, enabling the digitization of chemical data from scanned documents, literature, and patents.
MIT License
212 stars 52 forks source link

Cannot pass np.array into predict_SMILES() #109

Closed ignaspakamore closed 3 weeks ago

ignaspakamore commented 1 month ago

Issue Type

Bug

Source

GitHub (source)

DECIMER Image Transformer Version

2

OS Platform and Distribution

Linux ubuntu

Python version

3.10

Current Behaviour?

Following the docstring predict_SMILES() should take str or np.array as argument: image_input (str or np.ndarray): Path of chemical structure depiction image or a numpy array representing the image.

Nevertheless, only path string can be passed. When passing np.array the error is printed out: 'numpy.ndarray' object has no attribute 'read' ...

Which images caused the issue? (This is mandatory for images related issues)

No response

Standalone code to reproduce the issue

img: np.array

predict_SMILES(img)

Relevant log output

No response

Code of Conduct

Kohulan commented 4 weeks ago

@ignaspakamore Could you provide me the exact DECIMER version installed on your system?

ignaspakamore commented 3 weeks ago

I am using decimer==2.7.0

Kohulan commented 3 weeks ago

Hi @ignaspakamore , I have released a new bug fix for decimer==2.7.1. Please check it and let me know if that resolves the issue.

ignaspakamore commented 3 weeks ago

Hi Kohulan,

I am getting this error now when running python setup.py install:

Installed /home/ignas/miniconda3/envs/decimer_test/lib/python3.10/site-packages/numpy-2.1.3-py3.10-linux-x86_64.egg error: numpy 2.1.3 is installed but numpy<2.0.0,>=1.23.5 is required by {'tensorflow'}

Kohulan commented 3 weeks ago

Hi @ignaspakamore ,

DECIMER does not explicitly require numpy as a dependency; TensorFlow manages it. I successfully installed DECIMER on my Linux terminal.

Could you try? pip install decimer==2.7.1 (maybe a clean installation?)

ignaspakamore commented 3 weeks ago

Hi @Kohulan,

Just tested, it works fine. Thank you very much for your help and swift replies!

Ignas