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

feat(predict_SMILES): add support for numpy array input format. #105

Closed alexey-krasnov closed 3 months ago

alexey-krasnov commented 3 months ago

Implemented support for predict_SMILES() to accept numpy arrays representing images. The function now allows users to pass either a file path or a numpy array as the image_input parameter.

Breaking Change: The parameter image_path has been renamed to image_input. This parameter now accepts either a string (file path) or a numpy array representing the image.

Example usage:

# Segment image
raw_segments = segment_chemical_structures_from_file(file_path='path_to_image_file')

# Recognize smiles on segments
smiles = [predict_SMILES(image_input=segment) for smiles in raw_segments]

New usage with file path

smiles = predict_SMILES(image_input='path_to_image_file')

Kohulan commented 3 months ago

Hi @alexey-krasnov ,

Thanks a lot for this.

Could you please update your commit messages to conventional commits? After that, I could look into this pull request. https://www.conventionalcommits.org/en/v1.0.0/

alexey-krasnov commented 3 months ago

Hi @Kohulan, thanks for the message.

I've changed the title and message accordingly. If it needs further improvement please let me know!

Best, Aleksei

Kohulan commented 3 months ago

Hi @Kohulan, thanks for the message.

I've changed the title and message accordingly. If it needs further improvement please let me know!

Best, Aleksei

Thanks a lot I will look into this