Python code repository for the paper: "The Face of Populism: Examining Differences in Facial Emotional Expressions of Political Leaders Using Machine Learning"
ArXiv Preprint: https://arxiv.org/abs/2304.09914
Contents:
- Emotion detection notebook
notebook/
- CVSs with processed data
data-clean
- Analysis scripts
scripts/
- Analysis results
results/
- Figures
figures/
output
folder in this repository is empty, but after running the notebook it should contain folders with annotated images of each processed frame and each processed video. Figure 1 in the paper is made from two such frames.
Notebook has been tested on Google Colab and GH Codespaces environments. A separate repository will be created, modfied to be usable for cloning the Codespace and running the notebook. This will be the most simple, free option to run the notebook and process YT videos even on low-end machines without graphic card.
Right now notebook is cumbersome, with lot of dependencies. In the future, we will try to simplify the process with minimal dependencies and without the need to have a GPU on local machine.
Run order:
scripts/analyze-emotions.py
(caution: this script has a manual review step in the middle, see commented code for details)scripts/results-t300.py
Main analysis script. Produces Table 1 and Figures 2-4.scripts/results-f50.py
Supplementary analysis script. Produces Table 2 and Figures 5-7.scripts/dominant-emotion.py
Supplementary analysis script. Produces Table 3.scripts/misc.py
Calculates total length of all videos and mean number of frames. This doesn't count two videos which have been removed from YouTube since the time we first ran the analysis.