wzzheng / HDML

Implementation of Hardness-Aware Deep Metric Learning (CVPR 2019 Oral) in Tensorflow.
151 stars 28 forks source link

Error loading data? #11

Closed batrlatom closed 5 years ago

batrlatom commented 5 years ago

Hello @wzzheng , I have a problem to load the cub200_2011 even cars196 dataset. Where could I repair it? Thanks

Traceback (most recent call last):
  File "main_npair.py", line 254, in <module>
    tf.app.run()
  File "/home/tom/miniconda3/envs/recall/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "main_npair.py", line 79, in main
    embedding_z_quta = HDML.Pulling(FLAGS.LossType, embedding_z, Javg)
  File "/home/tom/Devel/testing/HDML/lib/HDML.py", line 15, in Pulling
    neg_tile = tf.tile(neg, [FLAGS.batch_size / 2, 1])
  File "/home/tom/miniconda3/envs/recall/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 8514, in tile
    "Tile", input=input, multiples=multiples, name=name)
  File "/home/tom/miniconda3/envs/recall/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 609, in _apply_op_helper
    param_name=input_name)
  File "/home/tom/miniconda3/envs/recall/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 60, in _SatisfiesTypeConstraint
    ", ".join(dtypes.as_dtype(x).name for x in allowed_list)))
TypeError: Value passed to parameter 'multiples' has DataType float32 not in list of allowed values: int32, int64
batrlatom commented 5 years ago

Ok, so you need to convert FLAGS.embedding_size to int.

tf.tile( ((distance(anc_tile, pos_tile) + (distance(anc_tile, neg_tile) - distance(anc_tile, pos_tile)) * tf.exp( -FLAGS.alpha / Jm)) / distance(anc_tile, neg_tile)), [1, int(FLAGS.embedding_size)] )