Matlab source codes: Stress Induction Tasks for “DeepBreath” [ACII2017]

Source code for “DeepBreath Project”


We propose DeepBreath, a deep learning model which automatically recognises people’s psychological stress level (mental overload) from their breathing patterns. Using a low cost thermal camera, we track a person’s breathing patterns as temperature changes around his/her nostril. The paper’s technical contribution is threefold. First of all, instead of creating hand-crafted features to capture aspects of the breathing patterns, we transform the uni-dimensional breathing signals into two dimensional respiration variability spectrogram (RVS) sequences. The spectrograms easily capture the complexity of the breathing dynamics. Second, a spatial pattern analysis based on a deep Convolutional Neural Network (CNN) is directly applied to the spectrogram sequences without the need of hand-crafting features. Finally, a data augmentation technique, inspired from solutions for over-fitting problems in deep learning, is applied to allow the CNN to learn with a small-scale dataset from short-term measurements (e.g., up to a few hours). The model is trained and tested with data collected from people exposed to two types of cognitive tasks (Stroop Colour Word Test, Mental Computation test) with sessions of different difficulty levels. Using normalised self-report as ground truth, the CNN reaches 84.59% accuracy in discriminating between two levels of stress and 56.52% in discriminating between three levels. In addition, the CNN outperformed powerful shallow learning methods based on a single layer neural network. Finally, the dataset of labelled thermal images will be open to the community.


deep breath task flow
deep breath task flow


  • Stress inducers: tasks producing cognitive-load, false sound feedback, time pressure (paced test), (and experimenter’s assessment).


Source Codes:

– Math Tasks: our open source code (

– Stroop Task: we refer to other group’s  well-designed code (



Y. Cho, N. Bianchi-Berthouze, and S. J. Julier, “DeepBreath: Deep Learning of Breathing Patterns for Automatic Stress Recognition using Low-Cost Thermal Imaging in Unconstrained Settings,” in 2017 7th International Conference on Affective Computing and Intelligent Interaction (ACII) (2017).



Leave a Reply

Your email address will not be published. Required fields are marked *