Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
JoshuaCapel opened this issue Dec 31, 2018 · 3 comments
Closed

Comments

@JoshuaCapel
Copy link

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:

@JoshuaCapel
Copy link
Author

JoshuaCapel commented Dec 31, 2018

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.

@AdityaKansal
Copy link

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

@dmitry-vorobiev
Copy link

dmitry-vorobiev commented Mar 22, 2019

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants