legolas123 / cv-tricks.com

Repository for all the tutorials and codes shared at cv-tricks.com
MIT License
468 stars 579 forks source link

Image classifier CNN - Getting error! #1

Closed ImranBug closed 7 years ago

ImranBug commented 7 years ago

Hi,

I am getting the following error when using code from your repository for Image classifier CNN:

Traceback (most recent call last):
  File "E:/Machine Learning/TensorFlow/Tutorials & Practice/CV Tricks/train.py", line 292, in <module>
    optimize(num_iterations=3000)
  File "E:/Machine Learning/TensorFlow/Tutorials & Practice/CV Tricks/train.py", line 261, in optimize
    x_batch, y_true_batch, _, cls_batch = data.train.next_batch(train_batch_size)
  File "E:\Machine Learning\TensorFlow\Tutorials & Practice\CV Tricks\dataset.py", line 117, in next_batch
    assert batch_size <= self._num_examples
AssertionError

I am not sure what am I missing, Can you help me please?

OS: Windows 10 IDE: Pycharm Python: Python 3.5.2 :: Anaconda 4.1.1 (64-bit)

ImranBug commented 7 years ago

Never-mind! I didn't notice that folder structure were suppose to have sub folders for dogs and cats! Thanks for the tutorial.

sudhasubramaniam commented 7 years ago

I'm also getting same error. Plz let me know how you debugged it.

rohanpillai20 commented 6 years ago

@sudhasubramaniam change the batch_size such that it is a factor of the number of training set images (without validation) as well as a factor of the total number of training set images (with validation). For example, if your training set has 100 images, and 0.2 is the validation_size, 80 images will be trained and 20 will be used for validation. So choose batch_size such that batch_size is a factor of 80, say 20. 20 is a factor of 80 as well as 100.