---
title: YiDong_EMOE
canonical_url: "https://www.modelscope.cn/models/AlbertTuring/YiDong_EMOE"
md_url: "https://www.modelscope.cn/models/AlbertTuring/YiDong_EMOE.md"
repository: AlbertTuring/YiDong_EMOE
chinese_name: "基于语音和文本的双模态情感分析方法"
last_updated: 2025-09-17
pipeline_tag: multi-modal-embedding
tasks:
  - multi-modal-embedding
downloads: 7
stars: 1
---

# YiDong_EMOE

> YiDong_EMOE - AlbertTuring 在 ModelScope 开源的模型。输入文本与语音，得到情感预测

- **Repository**: AlbertTuring/YiDong_EMOE
- **Tasks**: multi-modal-embedding
- **Downloads**: 7
- **Stars**: 1
- **Last updated**: 2025-09-17

Source: https://www.modelscope.cn/models/AlbertTuring/YiDong_EMOE

---

test.py中的get_emotion 函数为情感分析的模型接口



```python
# 在get_emotion函数中传入文本以及音频的路径即可实现情感分析
# 由于extract_audio_features函数一次仅能提取一个音频的特征，因此get_emotion函数一次仅能分析一个样本的情感
def get_emotion(sentence, audio_path):
    text_feature = extract_text_features(sentence, text_model)
    audio_feature = extract_audio_features(audio_path, audio_model)
    output = emoe_model(text=text_feature, audio=audio_feature)
    logits_c = output['logits_c']
    emotion = torch.argmax(logits_c, dim=1).item()
    emotion_dict = {0: '中性', 1: '厌恶', 2: '愤怒'}
    print(f"预测的情感类别: {emotion_dict[emotion]}")
    
# 调用示例如下
sentence = '喂，好是的，嗯，现在是可以通过了吗？然后可以，嗯，目前没有了，我等会儿下载吧。'
audio_path = './data/240773812285724574_20250304173005_right_1.wav'
emotion = get_emotion(sentence, audio_path) 
```
