2017-fall-DL-training-program / ImageCaption

1 stars 0 forks source link

eval.py import error (pycocotools) #19

Closed aeonlin closed 6 years ago

aeonlin commented 6 years ago

Dear TA, When I try to train the given show_tell model, I got the following error:

Traceback (most recent call last):
  File "train.py", line 235, in <module>
    train(opt)
  File "train.py", line 176, in train
    val_loss, predictions, lang_stats = eval_utils.eval_split(cnn_model, model, crit, loader, eval_kwargs)
  File "/home/student51/lab2/code/eval_utils.py", line 185, in eval_split
    lang_stats = language_eval(dataset, predictions, eval_kwargs['id'], split)
  File "/home/student51/lab2/code/eval_utils.py", line 32, in language_eval
    from pycocotools.coco import COCO
ImportError: No module named pycocotools.coco

seems like we don't have pycocotools pre-installed on the machine. When I try to manually install pycocotools by following the instructions from cocoapi, I got another errors when make fille:

python setup.py build_ext --inplace
Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    from Cython.Build import cythonize
ImportError: No module named Cython.Build
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 1

Not sure if we need to install Cython and pycocotools and other libraries by ourselves.

connie980149 commented 6 years ago

Did you copy ./coco_caption to your work space? It is under ./homework/data in the server.

aeonlin commented 6 years ago

I surely forgot to do so. Thanks a lot! For those who encounter the same issue, the coco-caption library is a folder on the server at the following path: /homework/datasets/coco-caption/ And you can copy it to your code directory if it is your current directory by this: $ cp -r /homework/datasets/coco-caption/ ./ remember to use the original folder name, otherwise eval_utils.py cannot properly add the path to find the coco-cpation library.