This is a utility to detect TV advertisements by audio through a trained artificial neural network. The training dataset was collected from various Indian news channels comprising 5 second audios. The ultimate aim is to develop an Android app that could mute the idiot box when advertisements are playing and vice versa.
The utility could run in three modes.
- Client-Server mode
In this mode, a server is run which is able to classify incoming audio streams as TV ads or not. A client would record from the default audio device and send these audios to the server over HTTP to classify them as ads/non-ads.
- Console mode
In this mode, the utility would run on a machine, recording audios from the default audio device, classify them, and print the results.
- Dataset collection mode
In this mode, a recorder program would run, recording audios from the default audio device and store them in a designated folder for use as dataset. The labelling would be done manually later on this dataset.
Install anaconda 3.7. Probably use a Docker image with Anaconda preinstalled.
Then install the following libraries.
conda install -c conda-forge librosa
conda install -c conda-forge keras
conda install -c anaconda flask
conda install -c anaconda urllib3
conda install -c anaconda pyaudio
Run the scripts from a conda shell from root directory
./scripts/server.sh
./scripts/serverClient.sh <number of minutes to run the program or omit this parameter to run indefinitely>
This will
-
start a local classification server listening for requests,
-
start to record 5 second audios from the default audio device and then try to classify if it is an advertisement or not by sending it to the local server.
The server and the client could be on different machines.
The configurations are in the config.json file.
To run in console mode, install all of the above dependencies (both server and client) and run the following from the root directory of this project from a conda shell.
./scripts/consoleRunner.sh <number of minutes to run the program or omit this parameter to run indefinitely>
To run in this mode, install the client dependencies given above and run the following from the root directory of this project from a conda shell.
./scripts/collectDataset.sh <number of minutes to run the program or omit this parameter to run indefinitely>