Coder Social home page Coder Social logo

Comments (7)

jaron avatar jaron commented on August 27, 2024

It looks like the extraction process is failing somehow.

If you look at the sizes of each fold, you'll see you're getting (0, 60, 41, 2), but that first number shouldn't be a zero, you should have hundreds of those features, depending on the number of folds you create. For instance, when I create 3 folds, I see the following:

Saving fold1
Features of fold1  =  (2400, 60, 41, 2)
Labels of fold1  =  (2400, 10)
Saved data/us8k-np-cnn-mini/fold1_x.npy
Saved data/us8k-np-cnn-mini/fold1_y.npy

Saving fold2
Features of fold2  =  (2076, 60, 41, 2)
Labels of fold2  =  (2076, 10)
Saved data/us8k-np-cnn-mini/fold2_x.npy
Saved data/us8k-np-cnn-mini/fold2_y.npy

Saving fold3
Features of fold3  =  (2371, 60, 41, 2)
Labels of fold3  =  (2371, 10)
Saved data/us8k-np-cnn-mini/fold3_x.npy
Saved data/us8k-np-cnn-mini/fold3_y.npy

I strongly suspect you haven't downloaded the UrbanSound8K audio files. You can only run the code in the "Saving Extracted Features (optional)" cell if you've got those files. You don't actually need them, that's why I included a smaller set of pre-processing features in pickle format in the data/us8k-np-cnn-mini directory.

If you don't have the full UrbanSound8k data set, don't run the "Saving Extracted Features (optional)" cell. And just ensure the first line in the "Training on a minimised data set" cell is

data_dir = "data/us8k-np-cnn-mini"

And it should work for you.

from deep-listening.

thuoctran avatar thuoctran commented on August 27, 2024

Thank you for your help. The problem is solved. But I meet another problem.
In a determin the ROC AUC score part,

def evaluate(model):
y_prob = model.predict_proba(test_x, verbose=0)
y_pred = np_utils.probas_to_classes(y_prob)
y_true = np.argmax(test_y, 1)

the problem is a function np_utils.probas_to_classes(y_prob).


AttributeError Traceback (most recent call last)
in ()
46 # now evaluate the trained model against the unseen test data
47 print("Evaluating model...")
---> 48 roc, acc = evaluate(model)
49 av_roc += roc
50 av_acc += acc

in evaluate(model)
1 def evaluate(model):
2 y_prob = model.predict_proba(test_x, verbose=0)
----> 3 y_pred = np_utils.probas_to_classes(y_prob)
4 y_true = np.argmax(test_y, 1)
5

AttributeError: 'module' object has no attribute 'probas_to_classes'

from deep-listening.

jaron avatar jaron commented on August 27, 2024

That sounds like a Keras versioning issue, I assume you're using a more recent version, I think the code in the repo was based on Keras 1.0.

You could try adding this line:
from keras.utils.np_utils import probas_to_classes

That apparently works for Keras 1.2.0.
I think it's different in Keras 2.0, so if that doesn't work let me know your Keras version.

from deep-listening.

thuoctran avatar thuoctran commented on August 27, 2024

I've tried to add from keras.utils.np_utils import probas_to_classes but it showed ImportError: cannot import name probas_to_classes.

I'm using the latest Keras version 2.0.6.

from deep-listening.

jaron avatar jaron commented on August 27, 2024

Yes, there's been a few package changes in Keras 2. I've updated notebook 3 to use the latest Keras and Tensorflow, and made it Python3 compatible as well. Hopefully you should be able to run it now. I'll update the other notebooks over the next few days.

from deep-listening.

jaron avatar jaron commented on August 27, 2024

Updated to use Keras 2, closing issue

from deep-listening.

hibakhanam avatar hibakhanam commented on August 27, 2024

hi thuoctran , how you solved your first issue (features not extracted properly) i am also facing the same problem and i downloaded the complete dataset
code
output

from deep-listening.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.