├── figs ├── example.txt └── vllm_method.png └── README.md /figs/example.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /figs/vllm_method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NickyFot/EmoCommonSense/HEAD/figs/vllm_method.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EmoCommonSense 2 | 3 | Authors official PyTorch implementation of the **[VLLMs Provide Better Context for Emotion Understanding Through Common Sense Reasoning](https://arxiv.org/abs/2404.07078)**. If you use this code for your research, please [**cite**](#citation) our paper. 4 | 5 | [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/vllms-provide-better-context-for-emotion/emotion-recognition-in-context-on-bold)](https://paperswithcode.com/sota/emotion-recognition-in-context-on-bold?p=vllms-provide-better-context-for-emotion) 6 | [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/vllms-provide-better-context-for-emotion/emotion-recognition-in-context-on-caer-1)](https://paperswithcode.com/sota/emotion-recognition-in-context-on-caer-1?p=vllms-provide-better-context-for-emotion) 7 | [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/vllms-provide-better-context-for-emotion/emotion-recognition-in-context-on-emotic)](https://paperswithcode.com/sota/emotion-recognition-in-context-on-emotic?p=vllms-provide-better-context-for-emotion) 8 | 9 | > **VLLMs Provide Better Context for Emotion Understanding Through Common Sense Reasoning**
10 | > Alexandros Xenos*, Niki Maria Foteinopoulou*, Ioanna Ntinou*, Ioannis Patras and Georgios Tzimiropoulos
11 | > *Denotes equal contribution 12 | >
13 | > ![summary](figs/vllm_method.png) 14 | > 15 | > **Abstract**: Recognising emotions in context involves identifying the apparent emotions of an individual, taking into account contextual cues from the surrounding scene. Previous approaches to this task have involved the design of explicit scene-encoding architectures or the incorporation of external scene-related information, such as captions. However, these methods often utilise limited contextual information or rely on intricate training pipelines. In this work, we leverage the groundbreaking capabilities of Vision-and-Large-Language Models (VLLMs) to enhance in-context emotion classification without introducing complexity to the training process in a two-stage approach. In the first stage, we propose prompting VLLMs to generate descriptions in natural language of the subject's apparent emotion relative to the visual context. In the second stage, the descriptions are used as contextual information and, along with the image input, are used to train a transformer-based architecture that fuses text and visual features before the final classification task. Our experimental results show that the text and image features have complementary information, and our fused architecture significantly outperforms the individual modalities without any complex training methods. We evaluate our approach on three different datasets, namely, EMOTIC, CAER-S, and BoLD, and achieve state-of-the-art or comparable accuracy across all datasets and metrics compared to much more complex approaches. 16 | 17 | ## Overview 18 | 19 |

20 | An overview of our proposed method. We first use LlaVa-1.5, a pre-trained VLLM, to extract language descriptions about the subject's apparent emotion and context (left). The image-description pairs then train our architecture, consisting of a vision encoder ($E_V$), a set of learnable queries ($Q$), a Q-Former module and a Fully Connected layer that performs the final classification on the emotion prediction task. When bounding boxes are available in the annotations, we draw them on the input image so that the model differentiates the subjects and so that the image and generated description are aligned. 21 |

22 | 23 | ## Notes: 24 | 25 | Full code to be released upon publication. 26 | 27 | ## Acknowledgements 28 | 29 | This research utilised Queen Mary's Apocrita HPC facility, supported by QMUL Research-IT. http://doi.org/10.5281/zenodo.438045 30 | 31 | ## Citation 32 | ```bibtex 33 | @article{xenos_vllms_2024, 34 | title = {{VLLMs} {Provide} {Better} {Context} for {Emotion} {Understanding} {Through} {Common} {Sense} {Reasoning}}, 35 | publisher = {arXiv}, 36 | author = {Xenos, Alexandros and Foteinopoulou, Niki Maria and Ntinou, Ioanna and Patras, Ioannis and Tzimiropoulos, Georgios}, 37 | month = apr, 38 | year = {2024}, 39 | journal = {arXiv:2404.07078} 40 | } 41 | ``` 42 | --------------------------------------------------------------------------------