cesc-park / attend2u

🖼️ Attend to You: Personalized Image Captioning with Context Sequence Memory Networks. In CVPR, 2017. Expanded : Towards Personalized Image Captioning via Multimodal Memory Networks. In IEEE TPAMI, 2018.
MIT License
209 stars 57 forks source link

Error in train.py #2

Closed AakashKumarNain closed 7 years ago

AakashKumarNain commented 7 years ago

When I ran the train.py file using the options as num_gpus 1 and batch_size 10, it throws the following error :

[ERROR:2017-05-08 12:42:08,943] Exception in QueueRunner: 0-th value returned by pyfunc_0 is double, but expects float
     [[Node: PyFunc = PyFunc[Tin=[DT_STRING], Tout=[DT_FLOAT], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/cpu:0"](DecodeCSV)]]

Caused by op u'PyFunc', defined at:
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/HashtagPred/train.py", line 211, in <module>
    tf.app.run()
  File "/home/HashtagPred/hashtag/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "/home/HashtagPred/train.py", line 208, in main
    train()
  File "/home/HashtagPred/train.py", line 98, in train
    tower_caption_mask = enqueue(False)
  File "utils/data_utils.py", line 240, in enqueue
    answer_id, context_mask, caption_mask = read_numpy_format_and_label( filename_queue)
  File "utils/data_utils.py", line 160, in read_numpy_format_and_label
    tf.float32
  File "/home/HashtagPred/hashtag/local/lib/python2.7/site-packages/tensorflow/python/ops/script_ops.py", line 189, in py_func
    input=inp, token=token, Tout=Tout, name=name)
  File "/home/HashtagPred/hashtag/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_script_ops.py", line 40, in _py_func
    name=name)
  File "/home/HashtagPred/hashtag/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 768, in apply_op
    op_def=op_def)
  File "/home/HashtagPred/hashtag/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2336, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "/home/HashtagPred/hashtag/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1228, in __init__
    self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): 0-th value returned by pyfunc_0 is double, but expects float
     [[Node: PyFunc = PyFunc[Tin=[DT_STRING], Tout=[DT_FLOAT], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/cpu:0"](DecodeCSV)]]

Exception in thread Thread-6:
bckim92 commented 7 years ago

We are really sorry about making mistakes in our code. This error is caused by cnn_feature_extractor.py, which should save pool5 feature as float type but it currently save pool5 features as double type.

I will fix it soon but as a workaround, you can manually do type casting when loading pool5 feature. e.g. In utils/data_utils.py, line 91

np.load(os.path.join(FLAGS.img_data_dir, batch_path[i])).astype(np.float32)
AakashKumarNain commented 7 years ago

Okay. Thanks!!