Skip to main content

Speech Emotion Recognition models and training using Tensorflow 2.x

Project description

Vistec-AIS Speech Emotion Recognition

python-badge tensorflow-badge license

Upload Python Package Training

Speech Emotion Recognition Model and Inferencing using Tensorflow 2.x

Installation

From Pypi

pip install vistec-ser

From source

git clone https://github.com/tann9949/vistec-ser.git
cd vistec-ser
python setup.py install

Docker

TODO

Usage

Train with Your Own Data

Preparing Data

To train with your own data, you need to prepare 2 files:

  1. config.yml (see an example in tests/config.yml) - This file contains a configuration for extracting features and features augmentation.
  2. labels.csv - This will be a .csv file containing 2 columns mapping audio path to its emotion.
    • Your .csv file should contain a header (as we will skip the first line when reading).
    • Currently, we only support 5 emotions (neutral, anger, happiness, sadness, and frustration) if you want to add more, modify EMO2IDX variable in dataloader.py

Preparing a model

Now, prepare your model, you can implement your own model using tf.keras.Sequential or using provided model in models.py.

Training

For training a model, create a DataLoader object and use method .get_dataset to get tf.data.Dataset used for training. DataLoader will also use FeatureLoader which will read config.yml. The dataset will automatically pad a batch according to the longest sequence length.

Here's a code example:

from vistec_ser.datasets import DataLoader, FeatureLoader
from vistec_ser.utils.config import Config

train_csv_path = ...
val_csv_path = ...
config_path = ...
model = ...

config = Config(path=config_path)
feature_loader = FeatureLoader(config=config.feature_config)
train_loader = DataLoader(feature_loader=feature_loader, csv_paths=train_csv_path, augmentations=config.augmentations)
train_dataset = train_loader.get_dataset(batch_size=2)
val_loader = DataLoader(feature_loader=feature_loader, csv_paths=val_csv_path)
val_dataset = val_loader.get_dataset(batch_size=2)

model.compile(...)
model.fit(train_dataset, validation_data=val_dataset, ...)

Inferencing using pretrained weight

TODO

Reference

This repository was structured based on TensorflowASR repository by Huy Le Nguyen (@usimarit). Please check it out!

Author & Sponsor

VISTEC-depa Thailand Artificial Intelligence Research Institute

Chompakorn Chaksangchaichot

Email: chompakornc_pro@vistec.ac.th

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vistec-ser-0.2a0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vistec_ser-0.2a0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file vistec-ser-0.2a0.tar.gz.

File metadata

  • Download URL: vistec-ser-0.2a0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.6

File hashes

Hashes for vistec-ser-0.2a0.tar.gz
Algorithm Hash digest
SHA256 e9587b112065d712fe7b30fb359f55c0a7bfd70a75fb18baf988c17f99cc0a29
MD5 08c250453d828a3f8cc9418488ec5731
BLAKE2b-256 5c33c677dfac7942f766cca4a26e13782ba0d009edf8a6cc2db75e39066dd3db

See more details on using hashes here.

File details

Details for the file vistec_ser-0.2a0-py3-none-any.whl.

File metadata

  • Download URL: vistec_ser-0.2a0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.6

File hashes

Hashes for vistec_ser-0.2a0-py3-none-any.whl
Algorithm Hash digest
SHA256 0778937ddbdb5fe2568aa706cc04fc8dac9457f0e3bccecf5f69f6919fb81801
MD5 369f6ec1669b3111585bac639497c288
BLAKE2b-256 dbc684723e3653abbf2ecc24e8447ce60beecebe1b79f8eb8f7ebfde55ae33f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page