This library is intented to showcase as an example of productionising deep learning ML code to a reusable and modular python library. To start with, we adapt the Classifiy MNIST Audio Keras example from Kaggle.
Note: By no means this models are closer to state-of-the-art deep learning models for audio classification in literature.
- Modular and configurable design allows to derive new model architecture easily without refactoring code to a certain extent.
- On-the-fly log-scaled mel spectrogram feature extraction layer for ML training (GPU/CPU)
- Ready-to-use audio preprocessing utility functions and TF record dataset loaders
- Easily extendable to different datasets, model architectures and configurations.
We use Poetry for better python dependency management and packaging capabilities.
# install all dependencies
poetry install
# if you want to avoid development dependencies
poetry install --no-dev
audio_classifier.models
: custom keras classifier modelaudio_classifier.layers
: reusable custom keras layersaudio_classifier.dataset
: dataset loadersaudio_classifier.config
: custom heirarchichal configsaudio_classifier.utils.preprocess
: audio raw data preprocessors and TF record writers.
The scripts directory outlines some example scripts using this library.
-
preprocess_audio.py: an example script for preprocessing raw audio dataset into a structured TF Record audio dataset.
-
train.py: An example model training script
The easiest option is to build the playground docker image using docker-compose. ie, The Dockerfile takes care of installing dependencies, linting, unit tests and finally installing our python package globally in the container.
docker-compose build playground
Tip: To use local development process, you might want to setup docker-compose as your remote interpretor of your IDE. Check this example of doing it on PyCharm IDE.
Otherwise, cd to this directory and run the following scripts using tox script runner.
- Run flake8 linting
tox -e flake8-linting
- Run unit tests
tox