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
216 stars 52 forks source link

Two bugs #23

Closed CurtisColwell closed 2 years ago

CurtisColwell commented 2 years ago

I am having trouble getting this to work. I installed using "pip install decimer" in the anaconda prompt on Windows.

Running "decimer --model Canonical --image img.png" results first in

(DECIMER_V1) C:\Users\curtis.colwell\Desktop\Takeda Images\Img_Page_01\cells>decimer --model Canonical --image "C:\Users\curtis.colwell\Desktop\Takeda Images\Img_Page_01\cells\001-002.png"
Traceback (most recent call last):
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\Scripts\decimer.exe\__main__.py", line 7, in <module>
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\site-packages\decimer\cli.py", line 35, in main
    get_QUOTE = helper.get_quote()
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\site-packages\decimer\Network\helper.py", line 139, in get_quote
    quote = random_line(open((HERE.joinpath("Quotes_database")), "r"))
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\site-packages\decimer\Network\helper.py", line 131, in random_line
    for num, aline in enumerate(file_name, 2):
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 7403: character maps to <undefined>

This is fixed by going to the helper.py and adding " encoding="utf8" " to line 139.

Then I get the following error and am stumped:

(DECIMER_V1) C:\Users\curtis.colwell\Desktop\Takeda Images\Img_Page_01\cells>decimer --model Canonical --image "C:\Users\curtis.colwell\Desktop\Takeda Images\Img_Page_01\cells\001-002.png"
Downloading trained model to C:\Users\curtis.colwell\.data\decimer\Trained_Models/Canonical/
C:\Users\curtis.colwell\.data\decimer\DECIMER_trained_models_v1.0.zip
... done downloading trained model!
Traceback (most recent call last):
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\Scripts\decimer.exe\__main__.py", line 7, in <module>
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\site-packages\decimer\cli.py", line 74, in main
    ) = load_trained_model(model_id)
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\site-packages\decimer\cli.py", line 132, in load_trained_model
    helper.download_trained_weights(model_url, checkpoint_path)
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\site-packages\decimer\Network\helper.py", line 104, in download_trained_weights
    model_path.parent.as_posix(),
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\subprocess.py", line 488, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "C:\Users\curtis.colwell\Anaconda3\envs\DECIMER_V1\lib\subprocess.py", line 1207, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Kohulan commented 2 years ago

Hi @CurtisColwell ,

We have released a new version could you check that?

-Kohulan

CurtisColwell commented 2 years ago

Hi!

The new version is working on linux! Still can't run it on Windows, but at least I can run it somewhere, It might be a problem with the way it was installed on Windows. thanks!

Kohulan commented 2 years ago

@CurtisColwell ,

Thank you for confirming. Windows has path issues and so on. I could only suggest you to use an Ubuntu shell under windows.

Hope that helps.

-Kohulan