Comments (5)
I' ve see this problem in the course forums and it has been solved now. The version of keras are caused the problem. So all you need to do is as follows:
Make some changes to utils.py if you are using keras 2.0+:
from keras.regularizers import l2, activity_l2, l1, activity_l1 ----> from keras.regularizers import l2, l1
from keras.utils.layer_utils import layer_from_config -----> from keras.layers import deserialize as layer_from_config
from courses.
I faced the same issue on trying to run the lesson 1 notebook on Crestle. Here's what I did
-
On a terminal
pip install keras==1.2.2
-
Restart Jupyter notebook.
-
Verify Keras version using
python -c 'import keras; print(keras.__version__)'
Hope it helps.
from courses.
I think you are using keras 2.0+. You can try install the keras 1.2.2
pip install keras=1.2.2
otherwise you may need to make some changes to the utils.py as @Jayoprell mentioned above. I also need to modify the vgg16.py to make it work in my laptop.
--- a/deeplearning1/nbs/vgg16.py
+++ b/deeplearning1/nbs/vgg16.py
@@ -174,7 +174,7 @@ class Vgg16():
batches : A keras.preprocessing.image.ImageDataGenerator object.
See definition for get_batches().
"""
- self.ft(batches.nb_class)
+ self.ft(batches.num_class)
classes = list(iter(batches.class_indices)) # get a list of all the class labels
# batches.class_indices is a dict with the class name as key and an index as value
@@ -209,8 +209,8 @@ class Vgg16():
Fits the model on data yielded batch-by-batch by a Python generator.
See Keras documentation: https://keras.io/models/model/
"""
- self.model.fit_generator(batches, samples_per_epoch=batches.nb_sample, nb_epoch=nb_epoch,
- validation_data=val_batches, nb_val_samples=val_batches.nb_sample)
+ self.model.fit_generator(batches, samples_per_epoch=batches.samples, nb_epoch=nb_epoch,
+ validation_data=val_batches, nb_val_samples=val_batches.samples)
def test(self, path, batch_size=8):
@@ -227,5 +227,5 @@ class Vgg16():
"""
test_batches = self.get_batches(path, shuffle=False, batch_size=batch_size, class_mode=None)
- return test_batches, self.model.predict_generator(test_batches, test_batches.nb_sample)
+ return test_batches, self.model.predict_generator(test_batches, test_batches.samples)
from courses.
In keras 2 even after changing nb_class to num_class i am getting the error as above
from courses.
@royshouvik after doing pip install I am getting AttributeError: 'module' object has no attribute 'HiddenLayer'
from courses.
Related Issues (20)
- Running densenet-keras.ipynb
- lesson3-rossman.ipynb HOT 1
- Translate.ipynb =>> load_array in load_glove doesn't work!
- ml1 notebooks improvements HOT 1
- proc_df API adjustment fix in ml1 notebooks HOT 1
- Mask RCNN with Keras and Tensorflow Setup and Installation HOT 1
- dl1 notebooks improvements HOT 1
- pdp_interact_plot is incompatible with matplotlib 3.0.0 HOT 2
- LanguageModelData not defined HOT 11
- Batch Normalization - Vgg fine tune model - very low accuracy HOT 1
- install_gpu.sh: Enhancement [File exists check, Configure proxy if behind corporation proxy]
- install_gpu.sh: ValueError «You are trying to use the old GPU back-end» when importing
- Keep-Alive-Actions
- Keep-Alive-Actions
- Keep-Alive-Actions
- utils.py gives error about cPickle HOT 1
- How do I import this repo into kaggle so I can use? HOT 1
- theano problem. HOT 2
- keras==1.2.2 is conflicts with other libraries HOT 2
- Course doesn't work with current Jupyter Notebook HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from courses.