# ME_recognition **Repository Path**: zhenyu-yang20/ME_recognition ## Basic Information - **Project Name**: ME_recognition - **Description**: 本科毕设:微表情视频分析中的时域建模研究 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2023-05-06 - **Last Updated**: 2023-09-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 微表情视频分析中的时域建模研究 ## 环境搭建 在实验开始前需要搭建 python 环境,可参考 mmaction2 的说明。 ## 数据准备 本研究使用 [MEGC2019](https://facial-micro-expressiongc.github.io/MEGC2019/) 的数据进行三分类微表情识别。实验前需先在项目主目录下创建 data 文件夹并下载涉及的三个微表情数据集 SMIC、CASME II、SAMM,以及 MEGC2019 标注。 ``` ME_Recognition |---data |---SMIC |---s1 |---micro |---negative |---s1_ne_01 |---reg_image559740.bmp |---reg_image559741.bmp ... |---positive |---surprise |---non_micro |---s2 ... |---CASME2 |---sub01 |---EP02_01f |---img46.jpg |---img47.jpg ... |---EP03_02 ... |---sub02 ... |---SAMM_mat |---006_1_2.mat |---006_1_3.mat ... |---pre_processment |---tools |---train |---test |---combined_3class_gt.csv ``` 其中 combined_3class_gt.csv 是 MEGC2019 将三个数据集的数据重新划分为三分类任务: | 划分标签 | 原始标签 | | -------- | --------------------------------------------------- | | negative | repression, anger, contempt, disgust, fear, sadness | | positive | happiness | | surprise | surprise | 重新划分后的样本量: | 数据集 | SMIC | CASME II | SAMM | | -------- | ---- | -------- | ---- | | 总主体数 | 16 | 24 | 28 | | 总标注数 | 164 | 145 | 133 | | negative | 70 | 88 | 92 | | positive | 51 | 32 | 26 | | surprise | 43 | 25 | 15 | ## 数据处理 1. 下载并解压 tools.rar,下载链接: ``` https://pan.baidu.com/s/12TjNmgPDf-l9jKm-b3uN7A?pwd=1234 ``` 2. 在 tools/mmaction2/data 下创建数据集文件夹 data 的软链接,命名为 MEGC2019。 3. 使用 pre_process/samm_mat2jpg.py 将 samm 数据集转化为 jpg 格式。 4. 使用 pre_process/generate_frames.py 将三个数据集合并。 5. 使用 pre_process/generate_flow_sh.py 生成提取光流的脚本文件。 6. 执行生成的 generate_flow.sh 文件: ``` bash generate_flow.sh ``` 这里会调用目前最为先进的 gmflow 算法提取光流。 7. 使用 pre_process/flowraw2flow.py 按照 mmaction 的命名规范命名光流图。 8. 使用 pre_process/generate_videos.py 生成 RGB 视频。 9. 使用 pre_process/generate_rawframes_mmaction.sh 按照 mmaction 的命名规范命名 RGB 图。 10. 使用 pre_process/generate_annotation.py 生成标注文件。 11. 使用 pre_process/generate_filelist.py 生成文件列表。 12. 使用 pre_process/generate_config_file.py 生成使用模型每折交叉验证的配置文件。 ## 模型训练 在 train 目录下有各模型的训练脚本,直接调用即可。例如: ``` cd train bash train_tsn_rgb.sh bash train_tsn_flow.sh ``` ## 模型预测 在 test 目录下有各模型的预测文件,直接调用即可。例如使用 test/test_tsn.py 测试 tsn 模型。