Kaggle/learntools

Image directories incorrectly specified? (Deep Learning - exercise 4)

JoshuaCapel opened this issue · 3 comments

I am working through the Deep Learning course on Kaggle and ran into a problem with the Learning Transfer exercise (raw notebook here). It instructs:

Your training data is in the directory ../input/dogs-gone-sideways/train. The validation data is in ../input/dogs-gone-sideways/val. Use that information when setting up train_generator and validation_generator.

But using these directories didn't work for me. I am wondering if there was a change in the way the data is stored on Kaggle since this lesson was written. Paths that do work seem to be:

  • ../input/dogs-gone-sideways/images/train
  • ../input/dogs-gone-sideways/image/val

Using these directories the code now runs fine, but the checking code does complain about me using the wrong directories:

This also seems to have affected the next lesson. Version 13 of https://www.kaggle.com/dansbecker/data-augmentation/ (the most recent version as I write this).

Do changes on the GitHub repository make it onto Kaggle? I would be happy to fork the repo, add the change and make a pull request.

I am also facing similar issue. Did you get any solution for this?

I guess the directories were edited and they are correct now. Still I get a crash in the end.

logs
Found 220 images belonging to 2 classes.
Found 217 images belonging to 2 classes.
 3/22 [===>..........................] - ETA: 1s - loss: 0.2108 - acc: 0.9667
/opt/conda/lib/python3.6/site-packages/keras_preprocessing/image/image_data_generator.py:699: UserWarning: This ImageDataGenerator specifies `featurewise_center`, but it hasn't been fit on any training data. Fit it first by calling `.fit(numpy_data)`.
  warnings.warn('This ImageDataGenerator specifies '
7/7 [==============================] - 1s 129ms/step - loss: 0.1463 - acc: 0.9493
22/22 [==============================] - 2s 90ms/step - loss: 0.1554 - acc: 0.9455 - val_loss: 0.1463 - val_acc: 0.9493
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-10-17ece9deb558> in <module>()
     23                                        validation_steps=1)
     24 
---> 25 step_4.check()

/opt/conda/lib/python3.6/site-packages/learntools/core/problem_view.py in wrapped(self, *args, **kwargs)
     22     def wrapped(self, *args, **kwargs):
     23         self.interactions[method.__name__] += 1
---> 24         return method(self, *args, **kwargs)
     25     return wrapped
     26 

/opt/conda/lib/python3.6/site-packages/learntools/core/problem_view.py in wrapped(*args, **kwargs)
     13     @functools.wraps(fn)
     14     def wrapped(*args, **kwargs):
---> 15         res = fn(*args, **kwargs)
     16         display(res)
     17         # Don't propagate the return to avoid double printing.

/opt/conda/lib/python3.6/site-packages/learntools/core/problem_view.py in check(self)
     81                 args = ()
     82             self.problem.check_whether_attempted(*args)
---> 83             self.problem.check(*args)
     84         except NotAttempted as e:
     85             self._track_check(tracking.OutcomeType.UNATTEMPTED)

/opt/conda/lib/python3.6/site-packages/learntools/deep_learning/exercise_4.py in check(self, fit_stats)
     55     _hint = "To get steps_per_epoch, divide the number of images by the batch size."
     56     def check(self, fit_stats):
---> 57         their_val_dir = fit_stats.validation_data.directory
     58         their_val_loss = fit_stats.history['val_loss'][0]
     59         their_num_steps = fit_stats.params['steps']

AttributeError: 'NoneType' object has no attribute 'directory'