GithubHelp home page GithubHelp logo

riccardoravaro / nupic.critic Goto Github PK

View Code? Open in Web Editor NEW

This project forked from htm-community/nupic.critic

0.0 1.0 0.0 80 KB

Music critic hack from 2014 Spring Hackathon

License: GNU Affero General Public License v3.0

Python 99.45% Shell 0.55%

nupic.critic's Introduction

Requirements

Get anomalies from audio input in 3 easy steps!

NuPIC Critic plot screenshot

1. Generate NuPIC Input From WAV

./convert_wav.py <path/to/wav>

There are several options for this, which you can see with the --help flag. You can control the FFT histogram sample rate, the number of histogram buckets, and the output directory where the file is written.

The resulting folder contains files formatted for NuPIC model input.

Options

  • --buckets,-b: [default 10] Number of frequency buckets to split the input when applying the FFT.
  • --sample-rate,-s: [default 5] How many samples to take per second.
  • --output_directory,-o: [default "output"] Directory to write the NuPIC input files.
  • --verbose,-v: [default False] Print debugging statements.
  • --loop,-l: [default 1] How many times to loop the WAV file (for reinforcing a pattern in NuPIC while training).
  • --plot,-p: [default False] Plot WAV spectrogram in matplotlib instead of writing NuPIC input files.

2. Run NuPIC

./run.py <path/to/input/directory> [options]

Runs all the prepared data in the input directory. Expects this directory to have been created by the convert_wav.py script above.

  • --model_params,-m: [default "grok_anomaly"] Name of the model params to use (without the '_model_params.py'). You won't need to set this unless you really know what you are doing.
  • --plot,-p: [default False] Plots the output instead of writing to file.
  • --verbose,-v: [default False] Print debugging statements.
  • --save,-s: [default False] Will checkpoint the model after running so it can be reused later.
  • --resurrect,-r: [default False] Uses specified model checkpoint instead of creating a new model using the model parameters. Learning will be automatically disabled on this model.

3. Plot the Results

./plotter.py <path/to/nupic/output/directory> [options]

Plots the results. Use --wav to pass in a WAV file to play at the same time. There are several options for this, which you can see with the --help flag.

  • --wav,-w: [default None] Path to a WAV file to play synced to the plot.
  • --maximize,-m: [default False] Maximize plot window.
  • --use_anomaly_score,-a: [default False] Use the anomalyScore from NuPIC instead of the anomalyLikelihood.
  • --anomaly_threshold,-t: [default 0.9] Value the anomaly likelihood(s) must breach before being marked as anomalous in the chart.

As an example, if you would like to flag a region as anomalous if the NuPIC anomaly likelihoods for 5 frequency bins are above 0.8, you would use the following options:

./plotter.py path/to/nupic/output -t 0.8 -g 5

Demo

Live Demo on YouTube

Notes

Could be applicable to this heart sound challenge.

nupic.critic's People

Contributors

fcr avatar rhyolight avatar

Watchers

 avatar

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.