Get anomalies from audio input in 3 easy steps!
./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.
--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
: [defaultFalse
] 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
: [defaultFalse
] Plot WAV spectrogram in matplotlib instead of writing NuPIC input files.
./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
: [defaultFalse
] Plots the output instead of writing to file.--verbose,-v
: [defaultFalse
] Print debugging statements.--save,-s
: [defaultFalse
] Will checkpoint the model after running so it can be reused later.--resurrect,-r
: [defaultFalse
] Uses specified model checkpoint instead of creating a new model using the model parameters. Learning will be automatically disabled on this model.
./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
: [defaultNone
] Path to a WAV file to play synced to the plot.--maximize,-m
: [defaultFalse
] Maximize plot window.--use_anomaly_score,-a
: [defaultFalse
] 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
Could be applicable to this heart sound challenge.