You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.
jishan@jishan-HP-ProBook-450-G3:~/Downloads/fy$ python convfeatures.py --data_path Dataset/flickr30k-images --inception_path ConvNets/inception_v4.pb
Extracting Features
#Images: 3
2018-04-14 01:05:43.501841: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
Traceback (most recent call last):
File "convfeatures.py", line 122, in <module>
forward_pass(io, args.data_path)
File "convfeatures.py", line 80, in forward_pass
print "Progress:" + str(((n_batch) / float(n_batch) * 100)) + "%\n"
ZeroDivisionError: float division by zero
How can solve that problem. I faced this problem when i want to generate features.npy file. Please help me. Thanks in advance.
The text was updated successfully, but these errors were encountered:
Thanks for pointing this out, this is a bug and one of the many inherent flaws of Python 2.
You're using 3 images in this example, and the batch size is 10. Further because <int> / <int> is pure integer division in Python 2, when we calculate n_batch = len(files) / batch_sizehere the result is that n_batch = 0 and so (n_batch) / float(n_batch) will quite naturally throw a ZeroDivisionError.
This never came to notice because we never used less than batch_size number of images. Some ways to fix it are:
Reduce the batch_size to 1 (or 2) -- especially if you only have 3 images in a sample.
Supply more images.
Import from __future__ import division at the very beginning of convfeatures.py.
How can solve that problem. I faced this problem when i want to generate features.npy file. Please help me. Thanks in advance.
The text was updated successfully, but these errors were encountered: