Skip to content

yriyazi/Hubert-Emotion_Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Huber-Emotion_Detection

GitHub License

Project Description

Huber-Emotion_Detection is a project that utilizes the Hugging Face Transformers library to perform audio emotion detection. The main objective of this project is to classify audio emotions into six different categories using the "facebook/hubert-base-ls960" model. The dataset used for training and evaluation is the Shemo Persian Speech Emotion Detection Database.

Installation

Make sure you have Python installed, then install the required packages using the following command:

pip install transformers

Usage

  1. Clone the repository:
git clone https://github.com/your-username/Huber-Emotion_Detection.git
cd Huber-Emotion_Detection
  1. Download the dataset from here and place it in the appropriate directory.

  2. Run the scripts to preprocess the data and train the model:

python preprocess.py
python train.py
  1. Use the trained model for emotion detection:
# Load the trained model
from transformers import HubertForSequenceClassification, HubertTokenizer

model_name = "facebook/hubert-base-ls960"
model = HubertForSequenceClassification.from_pretrained(model_name)
tokenizer = HubertTokenizer.from_pretrained(model_name)

# Load an audio file and convert it to text
audio_text = "..."
input_ids = tokenizer(audio_text, return_tensors="pt").input_ids

# Perform emotion classification
with torch.no_grad():
    outputs = model(input_ids)
    predicted_class = torch.argmax(outputs.logits).item()

Training Plots

Contribution Guidelines

Contributions to the project are welcome! If you want to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them.
  4. Push your changes to your fork.
  5. Open a pull request, describing the changes you've made.

License

This project is licensed under the MIT License - see the LICENSE file for details.