hkoelewijn / MachineLearningExperiments

Results from experiments I ran while experimenting with machine learning techniques
MIT License
1 stars 1 forks source link

I've met this error when run run_test(). #1

Open bemoregt opened 5 years ago

bemoregt commented 5 years ago

Hi, @HenriKoelewijn @hkoelewijn

I've met this error when run run_test().

What's wrong to me ?


Creating data generator Found 0 images belonging to 0 classes. Creating model WARNING:tensorflow:From /usr/local/lib/python3.7/site-packages/tensorflow/python/ops/resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. Evaluating model

ZeroDivisionError Traceback (most recent call last)

in ----> 1 run_test(model_architecture=tf.keras.applications.InceptionV3, image_size=299) in run_test(model_architecture, image_size, perplexity) 7 8 print('Evaluating model') ----> 9 results, labels = evaluate(model, data_generator) 10 11 print('Reducing to two dimensions') in evaluate(model, data_generator, num_steps) 4 5 for step in range(1, num_steps+1): ----> 6 images, batch_labels = data_generator.next() 7 8 if (step % 10 == 0): /usr/local/lib/python3.7/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 /usr/local/lib/python3.7/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
hkoelewijn commented 5 years ago

It is caused by the fact that the repository does not include the images. To run it, you need to have a folder ./data/dogscats/train with two folders in there. One for each category of images you want to test. In each of the folders there should be image files. I used google search to get images of dogs and put them in one folder and images of cats in the other. 200 of each should do the trick. This chrome extension can help you download the images: https://chrome.google.com/webstore/detail/bulk-image-downloader/lamfengpphafgjdgacmmnpakdphmjlji?hl=en

bemoregt commented 5 years ago

Hi, @hkoelewijn , @HenriKoelewijn

Ok, I'll try that.

and will report the result.

Thanks.

bemoregt commented 5 years ago

OK, It works~

Thanks a lot.

from @bemoregt