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

Error in model.fit() #1

Closed
ThomasLengeling opened this issue Jan 23, 2017 · 1 comment
Closed

Error in model.fit() #1

ThomasLengeling opened this issue Jan 23, 2017 · 1 comment

Comments

@ThomasLengeling
Copy link

Hi Jaron,

I am trying to run the 4-us8k-cnn-salamon.ipynb notebook, however
in the section "Training on the full data set (intensive)"

I get the following error

model.fit(train_x, train_y, validation_data=(valid_x, valid_y), callbacks=[earlystop], batch_size=24, nb_epoch=2)

"TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'"

screen shot 2017-01-23 at 10 44 51 am

Many thanks for the contribution!

@jaron
Copy link
Owner

jaron commented Jan 23, 2017

Hi Thomas!

I think I see your problem - this particular part of the notebook requires the full UrbanSound8k dataset in the form of numpy objects in the directory data/us8k-np-cnn. I haven't checked that data into the Git repo as these files are huge (2GB).

You can generate that data, using the code in the section "Saving Extracted Features (optional)" in Notebook 3 - although I've just noticed the version I checked in creates only 3 folds in directory "data/us8k-np-cnn-mini", rather than the full 10 folds "data/us8k-np-cnn", so I've just committed a fix for that.

But if you do have all the data, you should see something like this...

*** Train on (1, 2, 3) Validate on 4 Test on 5 ***
fold1 features:  (5446, 60, 41, 2)
fold2 features:  (5388, 60, 41, 2)
fold3 features:  (5852, 60, 41, 2)
fold4 features:  (6048, 60, 41, 2)
fold5 features:  (5689, 60, 41, 2)
Building model...
Training model...
Train on 16686 samples, validate on 6048 samples
Epoch 1/2
16686/16686 [==============================] - 71s - loss: 2.2278 - acc: 0.2077 - val_loss: 1.9349 - val_acc: 0.4157
Epoch 2/2
16686/16686 [==============================] - 67s - loss: 1.9322 - acc: 0.3254 - val_loss: 1.7717 - val_acc: 0.3747
Evaluating model...
ROC: 0.808

Note the feature sizes of each of the folds. You can check the data exists as expected by looking at what Keras reports. I see in your screenshot it says "Train on 0 samples, validate on 0 samples" - whereas in mine it says "Train on 16686 samples, validate on 6048 samples".

If you'd like me to send you the numpy data objects by WeTransfer, drop me an email at me@jaroncollis.com

Hope that helps!

@jaron jaron closed this as completed Jun 4, 2018
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

2 participants