emonet
CNN-LSTM model for audio emotion detection in children with adverse childhood events.
Science Score: 64.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: zenodo.org -
✓Committers with academic emails
1 of 2 committers (50.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.8%) to scientific vocabulary
Keywords
Repository
CNN-LSTM model for audio emotion detection in children with adverse childhood events.
Basic Info
- Host: GitHub
- Owner: chris-santiago
- License: mit
- Language: Jupyter Notebook
- Default Branch: master
- Homepage: https://chris-santiago.github.io/emonet/
- Size: 28.8 MB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
- Releases: 1
Topics
Metadata Files
README.md
emonet
A package to model negative emotion severity in patients with adverse childhood events (ACE).
Contributors: @chris-santiago, @gonzalezeric, @costargc
Installation & Environment Setup
Using Docker
- Open Terminal on Mac or PowerShell on Windows from the root directory.
- When the application is open, in the command line, build the image using the following:
docker build -t cjsantiago/emonet-model -f docker/model/Dockerfile . - Run container
docker run -it --name emonet -p 8888:8888 -v "${HOME}"/emonet-data:/home/jovyan/emonet-data cjsantiago/emonet-model- Important: Training the model or running batch inference presumes that you have a
emonet-datadirectory within your home folder, containing the originalvoice_labeling_reportdirectory. This will allow you to replicate all batch preprocessing done prior to model training. - You can score file(s) or signal(s), either on their own or with your own custom DataLoader, without the data directory (described above).
- See
docker/model/README.mdfor more.
- Important: Training the model or running batch inference presumes that you have a
- Once the container has been created, you may access the files using one of the URLs generated in the CLI.
Using Conda
- Clone this repo, then
cd emonet - Create a virtual environment
- For training and notebooks, use
conda env create -f env-base-plus.yml - For scoring, only, use
conda env create -f env-base-yml
- For training and notebooks, use
- Install
emonetpackage,pip install -e .
NOTE: We're installing in editable mode (-e flag) as we expect to run training and/or scoring
from this cloned repo. Editable mode will symlink source code from the cloned repo directory to the
appropriate Python interpreter, enabling source code edits and easy-access to our saved models under
the saved_models directory.
Installing ffmpeg
ffmpeg is required to convert .m4a to .wav. On Mac this can be installed via Homebrew. Skip this if you're running via Docker.
Data Setup
To use our original datset splits, we recommend downloading directly from our S3 bucket. This also removes the need to complete some time-consuming preprocessing steps.
Download from S3
Assumes that you have the AWS CLI tool installed on your machine (and that you have our credentials :grinning:).
Within your home folder, create a directory called emonet-data. You could also use our directory
setup script python emonet/dir_setup.py.
From the emonet-data directory, run this command to sync (copy) the required directories and files
directly from our S3 bucket.
Note that this assumes our credentials are located within ~/.aws/credentials
bash
aws s3 sync s3://gatech-emonet/eval/ .
From Scratch
Once you've setup the environment and installed the emonet package:
Run python emonet/data_setup.py
Note: you can pass an optional number of max_workers to this command; the default is 8 (threads).
python emonet/data_setup.py 16
This script will run and perform the following:
- dir_setup.py: Set up a data directory within the home folder
- m4atowav.py: Convert any
.m4afiles to.wav - batch_resample.py: Resample files to 16,000Hz
- batch_vad.py: Run voice activity detection (VAD)
- data_prep.py: Create train/valid/test splits and respective manifests
- wav_splitter.py: Split
.wavfiles into 8-second chunks, the create new train/valid/test manifests that use the chunked.wavfiles
Training
Now that files have all been converted to WAV, preprocessed with VAD and split training, validation and testing sets, and chunked into 8-second segments:
Command Line Tool
The easiest way to run the model is via the CLI:
Run
bash
python emonet/train.py <num_workers> <max_epochs> <emotion>
and pass in the desired number of workers, epochs and emotion.
Example:
bash
python train.py 12 300 anger
Python
You can also train the model in Python:
Open a .py file or notebook and run
```python from emonet import DATA_DIR from emonet.train import main
main(workers=12, epochs=300, emotion="sadness", usewandb=False, datadir=DATA_DIR) ```
and pass in the desired number of workers, epochs and emotion; you can log runs to Weights &
Biases by setting use_wandb=True, and change the default data directory using the data_dir parameter.
Pretrained Models
No pretrained models are included in this public-facing repo.
Scoring
Command Line Tool
The easiest way to score (using our pretrained models) is via our CLI tool, emonet. The syntax for
this tool is:
bash
emonet <emotion> <file to score>
Example:
bash
emonet anger /Users/christophersantiago/emonet-data/wavs/6529_53113_1602547200.wav
Note: This CLI tool will run VAD on the .wav file, and can accept arbitrary length-- despite
model being trained on 8-second chunks. Therefore, you should use an original .wav of the sample
you wish to score, not a .wav that's been preprocessed with VAD.
Python
You can also score via Python:
```python from emonet import DATA_DIR, ROOT from emonet.model import EmotionRegressor
def getsaved(emotion: str): return ROOT.joinpath('savedmodels', f'{emotion}.ckpt')
emotion = 'fear' model = EmotionRegressor.loadfromcheckpoint(get_saved(emotion))
file = 'path-to-my-file'
model.scorefile(file=file, samplerate=16000, vad=True) ```
See inference.py for an example of how we scored our testing sets.
Owner
- Name: Chris Santiago
- Login: chris-santiago
- Kind: user
- Repositories: 64
- Profile: https://github.com/chris-santiago
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: emonet
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Christopher
family-names: Santiago
email: cjsantiago@gatech.edu
affiliation: Georgia Institute of Technology
orcid: 'https://orcid.org/0000-0002-4241-1129'
- given-names: Eric
family-names: Gonzalez
email: egonzalez86@gatech.edu
affiliation: Georgia Institute of Technology
- given-names: Rodrigo
name-particle: Da
family-names: Costa
email: costa@gatech.edu
affiliation: Georgia Institute of Technology
GitHub Events
Total
Last Year
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| chris-santiago | c****o@g****u | 3 |
| Chris Santiago | 4****o | 3 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0