Skip to content

telcenter/ser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Speech Emotion Recognition

Hướng dẫn cài đặt và chạy

0. GPU

Trên Linux với NVIDIA GPU, để model có tốc độ chạy nhanh nhất, cần cài đặt cuda-toolkitcudnn.

Đối với Linux Mint 21.3 (hoặc Ubuntu 22.04), NVIDIA GPU (CUDA 12):

  • Trước tiên làm theo hướng dẫn tại đây để cài cudnn.

  • Chạy lệnh sau để cài cuda-toolkit:

    sudo apt install cuda-toolkit

1. Cài đặt thư viện

Chạy lệnh sau để cài đặt tất cả các thư viện cần thiết:

pip install .

2. Tải trọng số (model weight)

Quy ước $PROJECT_ROOT/ là thư mục gốc của dự án.

  • Cách 1:

    • Tạo thư mục $PROJECT_ROOT/model_weight
    • Truy cập link sau: https://www.kaggle.com/datasets/nvnhat04/ser-model
    • Tải về toàn bộ các file vào thư mục $PROJECT_ROOT/model_weight vừa tạo. (Có thể tải file zip sau đó giải nén vào thư mục vừa tạo.)
  • Cách 2: Sử dụng Kaggle CLI:

    cd $PROJECT_ROOT
    kaggle datasets download nvnhat04/ser-model --unzip -p ./model_weight

3. Chạy mô hình

Chạy lệnh sau để thực thi mô hình:

python main.py

Using as a Library

pip install git+https://github.com/telcenter/ser.git@main

Still needs to download the weights as shown above.

Example usage:

from ser import SERModel

def main():
    model = SERModel(
        # Where did you download the weights to? Then specify the
        # paths accordingly.
        model_path='./model_weight/CNN_model.json',
        weights_path='./model_weight/best_model1_weights.h5'
    )
    audio_path = './test_data/surprise.wav'
    emotion = model.predict_emotion_from_wav_file(audio_path)
    print(f"Predicted emotion: {emotion}")

if __name__ == "__main__":
    main()

Confusion Matrix

confusion matrix

Credit

The original notebook.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages