-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ReadTheDocs config and files (#87) add napoleon add readthedocs.yml add version 2 fix readthedocs yaml add setup_py_install fix setup py install diff doc move rtd yml to docs/ add kapre source add requirements.txt ugh mock the dependency remove wrong line sys path add add mock modules rollback readthedocs.yaml; fix pip path gettinb back the mocks but ughhh dd update napoleon fix recursive error at mocking sdngfosdnfsdnf remove unittest mocking update doc add more rsts update clean index * add framing * update doc and dostring * update signal test; * change testing python version * more generous on numpy, upgrade pip at travis * add ignore llvmlite * black follow project config. py36 and 37 only * remove black from travis * update readme * specify numpy to be >=1.19 * update readme * update readme * add references * starting mu law * add mu law backend * done with mu law layers * fix test. rename to LogmelToMFCC * adding example. added alias at __init__ so that kapre.LAYERNAME could work * all examples are added for layer classes * fix docstring indentation * fix more docs * change to import directly * fix typo * fix docstrings more * add examples for composed layer * example format * add custom css to be wider Co-authored-by: forcecore <[email protected]> Co-authored-by: Keunwoo Choi <[email protected]>
- Loading branch information
1 parent
37954b4
commit 60c011f
Showing
25 changed files
with
1,534 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
|
||
python: | ||
version: 3.7 | ||
install: | ||
- requirements: docs/requirements.txt | ||
system_packages: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD = sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
div.wy-nav-content { | ||
max-width: 1200px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
backend | ||
^^^^^^^ | ||
|
||
.. automodule:: kapre.backend | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
composed | ||
^^^^^^^^ | ||
|
||
.. automodule:: kapre.composed | ||
:members: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
import os | ||
import sys | ||
sys.path.insert(0, os.path.abspath('../')) | ||
import sphinx_rtd_theme | ||
autodoc_mock_imports = ['tensorflow', 'librosa', 'numpy'] | ||
autodoc_member_order = 'bysource' | ||
|
||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = 'Kapre' | ||
copyright = '2020, Keunwoo Choi, Deokjin Joo and Juho Kim' | ||
author = 'Keunwoo Choi, Deokjin Joo and Juho Kim' | ||
|
||
# The full version, including alpha/beta/rc tags | ||
release = '2017' | ||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = [ | ||
"sphinx.ext.autodoc", | ||
"sphinx_rtd_theme", | ||
"sphinx.ext.viewcode", # source linkage | ||
"sphinx.ext.napoleon", | ||
# "sphinx.ext.autosummary", | ||
"sphinx.ext.viewcode", # source linkage | ||
] | ||
|
||
# autosummary_generate = True | ||
|
||
# autoapi_type = 'python' | ||
# autoapi_dirs = ['../kapre'] | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ['_templates'] | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = 'sphinx_rtd_theme' | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ['_static'] | ||
|
||
master_doc = 'index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
.. Kapre documentation master file, created by | ||
sphinx-quickstart on Thu Aug 27 19:40:10 2020. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Kapre | ||
===== | ||
|
||
Keras Audio Preprocessors - compute STFT, InverseSTFT, Melspectrogram, and others on GPU real-time. | ||
|
||
Tested on Python 3.6, and 3.7. | ||
|
||
Why Kapre? | ||
---------- | ||
|
||
vs. Pre-computation | ||
^^^^^^^^^^^^^^^^^^^ | ||
|
||
* You can optimize DSP parameters | ||
* Your model deployment becomes much simpler and consistent. | ||
* Your code and model has less dependencies | ||
|
||
vs. Your own implementation | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
* Quick and easy! | ||
* Consistent with 1D/2D tensorflow batch shapes | ||
* Data format agnostic (`channels_first` and `channels_last`) | ||
* Less error prone - Kapre layers are tested against Librosa (stft, decibel, etc) - which is (trust me) *trickier* than you think. | ||
* Kapre layers have some extended APIs from the default `tf.signals` implementation such as.. | ||
- A perfectly invertible `STFT` and `InverseSTFT` pair | ||
- Mel-spectrogram with more options | ||
* Reproducibility - Kapre is available on pip with versioning | ||
|
||
Workflow with Kapre | ||
------------------- | ||
|
||
1. Preprocess your audio dataset. Resample the audio to the right sampling rate and store the audio signals (waveforms). | ||
2. In your ML model, add Kapre layer e.g. `kapre.time_frequency.STFT()` as the first layer of the model. | ||
3. The data loader simply loads audio signals and feed them into the model | ||
4. In your hyperparameter search, include DSP parameters like `n_fft` to boost the performance. | ||
5. When deploying the final model, all you need to remember is the sampling rate of the signal. No dependency or preprocessing! | ||
|
||
Installation | ||
------------ | ||
|
||
.. code-block:: none | ||
pip install kapre | ||
Example | ||
------- | ||
|
||
See the Jupyter notebook at the `example folder <https://github.com/keunwoochoi/kapre/tree/master/examples>`_ | ||
|
||
|
||
Citation | ||
-------- | ||
|
||
Please cite `this paper <https://arxiv.org/abs/1706.05781>`_ if you use Kapre for your work. | ||
|
||
|
||
.. code-block:: none | ||
@inproceedings{choi2017kapre, | ||
title={Kapre: On-GPU Audio Preprocessing Layers for a Quick Implementation of Deep Neural Network Models with Keras}, | ||
author={Choi, Keunwoo and Joo, Deokjin and Kim, Juho}, | ||
booktitle={Machine Learning for Music Discovery Workshop at 34th International Conference on Machine Learning}, | ||
year={2017}, | ||
organization={ICML} | ||
} | ||
Contribution | ||
------------ | ||
Visit `github.com/keunwoochoi/kapre <https://github.com/keunwoochoi/kapre>`_ and chat with us :) | ||
|
||
|
||
.. toctree:: | ||
:hidden: | ||
:caption: Kapre | ||
|
||
quickstart | ||
|
||
|
||
.. toctree:: | ||
:hidden: | ||
:caption: API | ||
|
||
time_frequency | ||
signal | ||
composed | ||
backend | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=. | ||
set BUILDDIR=_build | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.http://sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
Oops, something went wrong.