Skip to main content

多模态情感分析框架

项目描述

蟒蛇 3.6

MMSA

多模态情感分析任务的统一框架。

注意:我们强烈建议先浏览我们代码的整体结构。如果您需要任何进一步的信息,请随时与我们联系。

支持的型号

类型 型号名称
单任务 EF_LSTM 多模态DNN
单任务 LF_DNN -
单任务 税号 张量融合网络
单任务 低模态 低秩多模态融合
单任务 最惠国待遇 记忆融合网络
单任务 图-MFN 图-内存-融合-网络
单任务 MulT(​​无 CTC) 多模态变压器
单任务 BERT-MAG MAG-BERT
单任务 MFM -
单任务 米萨 米萨
多任务 MLF_DNN MMSA
多任务 多任务网络 MMSA
多任务 MLMF MMSA
多任务 SELF_MM 自我MM

结果

详细结果显示在results/result-stat.md

用法

克隆代码

  • 克隆这里 repo 并安装要求。如果需要,创建虚拟环境。
git clone https://github.com/thuiar/MMSA
cd MMSA
# conda create -n mmsa python=3.6
pip install -r requirements.txt

数据集和预训练的 bets

从以下链接下载数据集特征和预训练的 bets。

对于所有功能,您可以使用它SHA-1 Hash Value来检查一致性。

MOSI/unaligned_50.pkl: 5da0b8440fc5a7c3a457859af27458beb993e088
MOSI/aligned_50.pkl: 5c62b896619a334a7104c8bef05d82b05272c71c
MOSEI/unaligned_50.pkl: db3e2cff4d706a88ee156981c2100975513d4610
MOSEI/aligned_50.pkl: ef49589349bc1c2bc252ccc0d4657a755c92a056
SIMS/unaligned_39.pkl:a00c73e92f66896403c09dbad63e242d5af756f8

由于大小限制,仅提供 MOSEI 功能和 SIMS 原始视频Baidu Cloud Drive。所有数据集特征组织为:

{
    "train": {
        "raw_text": [],
        "audio": [],
        "vision": [],
        "id": [], # [video_id$_$clip_id, ..., ...]
        "text": [],
        "text_bert": [],
        "audio_lengths": [],
        "vision_lengths": [],
        "annotations": [],
        "classification_labels": [], # Negative(< 0), Neutral(0), Positive(> 0)
        "regression_labels": []
    },
    "valid": {***}, # same as the "train"
    "test": {***}, # same as the "train"
}

对于 MOSI 和 MOSEI,预提取的文本特征来自 BERT,与CMU-Multimodal-SDK中的原始手套特征不同。

对于 SIMS,如果您想从原始视频中提取特征,您需要先安装Openface Toolkits,然后参考我们在data/DataPre.py.

python data/DataPre.py --data_dir [path_to_Dataset] --language ** --openface2Path  [path_to_FeatureExtraction]

对于 bert 模型,您也可以从Google-Bert下载Bert-Base,中文然后,使用transformers-cli将 tensorflow 转换为 pytorch

然后,修改config/config_*.py以更新数据集路径。

python run.py --modelName *** --datasetName ***

如果您发现我们的工作对您的研究有用,请引用我们的论文:

@inproceedings{yu2020ch,
  title={CH-SIMS: A Chinese Multimodal Sentiment Analysis Dataset with Fine-grained Annotation of Modality},
  author={Yu, Wenmeng and Xu, Hua and Meng, Fanyang and Zhu, Yilin and Ma, Yixiao and Wu, Jiele and Zou, Jiyun and Yang, Kaicheng},
  booktitle={Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics},
  pages={3718--3727},
  year={2020}
}
@article{yu2021learning,
  title={Learning Modality-Specific Representations with Self-Supervised Multi-Task Learning for Multimodal Sentiment Analysis},
  author={Yu, Wenmeng and Xu, Hua and Yuan, Ziqi and Wu, Jiele},
  journal={arXiv preprint arXiv:2102.04830},
  year={2021}
}

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

MMSA-2.1.0.tar.gz (64.3 kB 查看哈希

已上传 source

内置分布

MMSA-2.1.0-py3-none-any.whl (102.2 kB 查看哈希

已上传 py3