msight-tech / research-charnet

CharNet: Convolutional Character Networks
Other
610 stars 142 forks source link

ModuleNotFoundErrors and GPU-only Support #27

Open csmcallister opened 4 years ago

csmcallister commented 4 years ago

Summary

Hi! Great project and very interesting paper. I've encountered two issues:

  1. setup.py doesn't include all of the dependencies
  2. The GPU-only support isn't explicit.

Steps to Recreate

After following the setup instructions in your ReadME on Ubuntu 18.04 with python 3.7.4, I tried running:

python tools/test_net.py configs/icdar2015_hourglass88.yaml images_dir results_dir

and received the following error:

python tools/test_net.py configs/icdar2015_hourglass88.yaml images_dir results_dir
Traceback (most recent call last):
  File "tools/test_net.py", line 9, in <module>
    from charnet.modeling.model import CharNet
  File "/c/Users/cmcallister/dev/research-charnet/charnet/modeling/model.py", line 17, in <module>
    from .postprocessing import OrientedTextPostProcessing
  File "/c/Users/cmcallister/dev/research-charnet/charnet/modeling/postprocessing.py", line 11, in <module>
    import editdistance
ModuleNotFoundError: No module named 'editdistance'

As a side note, I'm running Ubuntu on the Windows Subsystem for Linux

After pip installing editdistance, I got another import error:

python tools/test_net.py configs/icdar2015_hourglass88.yaml images_dir results_dir
Traceback (most recent call last):
  File "tools/test_net.py", line 9, in <module>
    from charnet.modeling.model import CharNet
  File "/c/Users/cmcallister/dev/research-charnet/charnet/modeling/model.py", line 17, in <module>
    from .postprocessing import OrientedTextPostProcessing
  File "/c/Users/cmcallister/dev/research-charnet/charnet/modeling/postprocessing.py", line 13, in <module>
    from .rotated_nms import nms, nms_with_char_cls, \
  File "/c/Users/cmcallister/dev/research-charnet/charnet/modeling/rotated_nms.py", line 9, in <module>
    import pyclipper
ModuleNotFoundError: No module named 'pyclipper'

I pip installed that only to see that yacs was also required. Interestingly, yacs is in your setup.py file.

pip installing those dependencies got me past the import errors, but then I got the following error:

Traceback (most recent call last):
  File "tools/test_net.py", line 69, in <module>
    charnet.cuda()
  File "/home/cmcallister/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/nn/modules/module.py", line 305, in cuda
    return self._apply(lambda t: t.cuda(device))
  File "/home/cmcallister/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/nn/modules/module.py", line 202, in _apply
    module._apply(fn)
  File "/home/cmcallister/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/nn/modules/module.py", line 202, in _apply
    module._apply(fn)
  File "/home/cmcallister/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/nn/modules/module.py", line 202, in _apply
    module._apply(fn)
  File "/home/cmcallister/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/nn/modules/module.py", line 224, in _apply
    param_applied = fn(param)
  File "/home/cmcallister/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/nn/modules/module.py", line 305, in <lambda>
    return self._apply(lambda t: t.cuda(device))
  File "/home/cmcallister/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/cuda/__init__.py", line 192, in _lazy_init
    _check_driver()
  File "/home/cmcallister/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/cuda/__init__.py", line 102, in _check_driver
    http://www.nvidia.com/Download/index.aspx""")
AssertionError: 
Found no NVIDIA driver on your system. Please check that you
have an NVIDIA GPU and installed a driver from
http://www.nvidia.com/Download/index.aspx

Recommended Fix

Updating setup.py to include all of the dependencies and also updating the ReadMe to make it clear that you need a GPU machine in order to run the code.

lamhoangtung commented 4 years ago

There exist PR #23 that enable CPU support. The author just didn't merge it yet. May be you can give it a try

csmcallister commented 4 years ago

I'll give it a whirl @lamhoangtung. Thanks!

csmcallister commented 4 years ago

I can confirm that the CPU support in #23 works. Thanks again!