UC-Merced-Pretrained-CNN icon indicating copy to clipboard operation
UC-Merced-Pretrained-CNN copied to clipboard

ZeroDivisionError: integer division or modulo by zero

Open prativadas opened this issue 7 years ago • 1 comments
trafficstars

Generating "train" bottleneck predictions Found 0 images belonging to 21 classes.

FileNotFoundError Traceback (most recent call last) in get_bottleneck_features(model, dataset, preproc_func, batch_size) 9 try: ---> 10 with open(X_filepath, 'rb') as f: 11 X = np.load(f)

FileNotFoundError: [Errno 2] No such file or directory: 'data/bn_train_X.npy'

During handling of the above exception, another exception occurred:

ZeroDivisionError Traceback (most recent call last) in 1 for dataset in ['train', 'validate', 'test']: ----> 2 X[dataset], Y[dataset] = get_bottleneck_features(pretrained_model, dataset, preprocess)

in get_bottleneck_features(model, dataset, preproc_func, batch_size) 22 image_count = 0 23 X_batches, Y_batches = [], [] ---> 24 for X, Y in image_generator: 25 X_batches.append(model.predict_on_batch(X)) 26 Y_batches.append(Y)

~/anaconda2/envs/py36/lib/python3.6/site-packages/keras_preprocessing/image.py in next(self, *args, **kwargs) 1524 1525 def next(self, *args, **kwargs): -> 1526 return self.next(*args, **kwargs) 1527 1528 def _get_batches_of_transformed_samples(self, index_array):

~/anaconda2/envs/py36/lib/python3.6/site-packages/keras_preprocessing/image.py in next(self) 1965 """ 1966 with self.lock: -> 1967 index_array = next(self.index_generator) 1968 # The transformation of images is not under thread lock 1969 # so it can be done in parallel

~/anaconda2/envs/py36/lib/python3.6/site-packages/keras_preprocessing/image.py in _flow_index(self) 1509 self._set_index_array() 1510 -> 1511 current_index = (self.batch_index * self.batch_size) % self.n 1512 if self.n > current_index + self.batch_size: 1513 self.batch_index += 1

ZeroDivisionError: integer division or modulo by zero

images have not been copied inside train test validate folders. why this is happening can anyone please help ​

prativadas avatar Oct 10 '18 10:10 prativadas

Keep your unzip file out of the data folder because the images are copied from the unzip folder

prativadas avatar Oct 10 '18 10:10 prativadas