image_embeddings icon indicating copy to clipboard operation
image_embeddings copied to clipboard

In some folders I am getting this error OverflowError: cannot convert float infinity to integer

Open zubairahmed-ai opened this issue 4 years ago • 2 comments

Hi @rom1504

First of all thanks for the great work that you've done, I am facing this error is some of the folders that I am getting running similarity search in. Please help

 File "/home/cctvserver/Documents/Work/SimilaritySearch/Embeddings/image_embeddings-master/image_embeddings/inference/inference.py", line 92, in tfrecords_to_write_embeddings
    embeddings = images_to_embeddings(model, shard, batch_size)
  File "/home/cctvserver/Documents/Work/SimilaritySearch/Embeddings/image_embeddings-master/image_embeddings/inference/inference.py", line 119, in images_to_embeddings
    return model.predict(dataset.batch(batch_size).map(lambda image_raw, image_name: image_raw), verbose=1)
  File "/home/cctvserver/miniconda3/envs/tracker/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 130, in _method_wrapper
    return method(self, *args, **kwargs)
  File "/home/cctvserver/miniconda3/envs/tracker/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 1613, in predict
    callbacks.on_predict_end()
  File "/home/cctvserver/miniconda3/envs/tracker/lib/python3.8/site-packages/tensorflow/python/keras/callbacks.py", line 582, in on_predict_end
    callback.on_predict_end(logs)
  File "/home/cctvserver/miniconda3/envs/tracker/lib/python3.8/site-packages/tensorflow/python/keras/callbacks.py", line 979, in on_predict_end
    self._finalize_progbar(logs)
  File "/home/cctvserver/miniconda3/envs/tracker/lib/python3.8/site-packages/tensorflow/python/keras/callbacks.py", line 1026, in _finalize_progbar
    self.progbar.update(self.seen, list(logs.items()), finalize=True)
  File "/home/cctvserver/miniconda3/envs/tracker/lib/python3.8/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 581, in update
    numdigits = int(np.log10(self.target)) + 1
OverflowError: cannot convert float infinity to integer

zubairahmed-ai avatar Oct 26 '20 15:10 zubairahmed-ai

The error is saying that the data you give to the predict function is wrong in some way. Can you try to print the value of the images before they are sent to predict function ?

rom1504 avatar Oct 26 '20 16:10 rom1504

I noticed that it happens when data is too little, like 8 images. I have removed sharding because I am working with extremely little data Also for the life of me I am struggling why would it cache the output of one script even if there is no sharding method anymore but it still keeps writing to terminal as if its writing them

Shard 0 done after 0s
Shard 0 saved after 0s
-1
-1
-1
-1
-1
-1
-1
-1

zubairahmed-ai avatar Oct 26 '20 17:10 zubairahmed-ai