<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Fouad Hannoun on Medium]]></title>
        <description><![CDATA[Stories by Fouad Hannoun on Medium]]></description>
        <link>https://medium.com/@hannounfouad?source=rss-dc4e9fdf3a2f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*cF3S8kz6gJ_Dl-xOlkTr6w.jpeg</url>
            <title>Stories by Fouad Hannoun on Medium</title>
            <link>https://medium.com/@hannounfouad?source=rss-dc4e9fdf3a2f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 17:38:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hannounfouad/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introducing DPT Lab]]></title>
            <link>https://medium.com/empathic-labs/introducing-dpt-lab-29c528fbd0af?source=rss-dc4e9fdf3a2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/29c528fbd0af</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[mental-health]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Fouad Hannoun]]></dc:creator>
            <pubDate>Wed, 14 Apr 2021 08:07:21 GMT</pubDate>
            <atom:updated>2021-04-14T08:07:21.710Z</atom:updated>
            <content:encoded><![CDATA[<h4>The road to digital psychotherapy</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iuXYg7iXpkSFvpD_.png" /><figcaption>by Ameena Golding</figcaption></figure><p>Digital psychotherapy (DPT lab) is where computer scientists and clinical psychologists team up to combine theories and expertise.</p><p>The lab develops and evaluates new technologies in order to improve the effects as well as the accessibility of evidence-based psychotherapeutic interventions.</p><h3><strong>Psychotherapy</strong></h3><p>People can struggle with challenges like coping with unfortunate events, quitting smoking, having a better lifestyle, improving relationships or dealing with a mental disorder. The challenges end up weakening the individual and worsening the overall content and satisfaction. Psychotherapy helps to raise awareness towards thoughts and behavioral patterns and to adjust them by ensuring conditions allowing trust, openness, neutrality and support.</p><h3>Computer science</h3><p>A computer scientist’s role is the creation, design, and implementation of software and hardware systems for the advancement of technology and innovation.</p><h3>The collaboration</h3><p>Computer scientists interested in psychology at the <a href="https://humantech.institute/">HumanTech institute</a> joined forces with clinical psychotherapists at the <a href="https://www.unifr.ch/psycho/de/departement/mitarbeitende/teams/klipsy.html">University of Fribourg</a> to create <a href="https://digitalpsychotherapylab.ch/"><strong>Digital Psychotherapy Lab</strong></a>, a group who’s mission is to develop and evaluate innovative therapeutic tools using novel technologies, enabling therapists to provide affordable and flexible state-of-the-art care to a larger number of affected persons. The group’s developments are rooted in fundamental research, comprehensively examining the benefits and difficulties in the use of each new therapeutic approach.</p><h3>Areas of expertise</h3><h4><strong>Virtual Reality</strong></h4><p>Virtual Reality, where users can immerse themselves into reactive artificial environments, have been employed in the treatment of specific phobias for more than two decades, but treatment programs targeting several other mental disorders are only now coming within reach. A key benefit of employing this technology is to allow patients to repeatedly experience problematic situations along the treatment process, relying on well-established therapeutical principles while expanding the possibilities for corrective experiences.</p><p>Some projects:</p><ul><li><strong>VR for fear of spiders and fear of heights therapy</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q4mP1B95XzzPWWZHENaNOg.png" /><figcaption>Screenshot of the VR app facing a cartoon spider (therapist’s point of view)</figcaption></figure><p>The fear of spiders (arachnophobia) and fear of heights (acrophobia) belong to the group of specific phobias. This term designates an irrational fear felt by the individual. It’s a highly frequent type of phobia that can cause severe troubles to affected people, as they will seek to avoid at all costs any contact with the concerned situation.</p><p>A way to overcome these phobias is called exposure therapy. This technique consists in letting the patient confront his fear, progressively so that fear decreases as the exposure increases.</p><p>This method may offer many challenging requirements for the therapist (e.g.: possessing a set of spiders, taking the patient to high places, etc.). A virtual reality app allows its user to be confronted with a spider whose appearance and size can vary, or to take an elevator in the middle of a city. The therapist always has the control of the spider (size, movements, appearance…) or of the altitude and sees the patient’s point of view in real time.</p><ul><li><a href="https://digitalpsychotherapylab.ch/projects/vr-biofeedback-for-eating-disorders/"><strong>VR Biofeedback for Eating Disorders — Training gastric interoception</strong></a></li><li><a href="https://digitalpsychotherapylab.ch/projects/vr-cyberball/"><strong>VR Cyberball</strong></a></li></ul><h4>Chatbots</h4><p>A chatbot is an artificial intelligence agent that can have a conversation with a user using messaging applications, websites, or through a phone call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cEdFu7rIEGoPw6n5.png" /><figcaption>Source <a href="https://martechtoday.com/chatbots-marketing-part-2-209480">https://martechtoday.com/chatbots-marketing-part-2-209480</a></figcaption></figure><p>Some projects:</p><ul><li><a href="https://medium.com/empathic-labs/virtual-assistant-for-teenagers-with-binge-eating-disorders-1929e832d8b6#618d-b1b6ea8485a5">Virtual assistant for teenagers with binge-eating disorders</a></li></ul><h4>Mobile apps</h4><p>Digital media such as a mobile phone application have the potential to complement and improve existing psychotherapeutic services and to close existing gaps in healthcare services. The current COVID-19 pandemic also highlights the need to expand existing digital care services.</p><p>Some projects:</p><ul><li><a href="https://digitalpsychotherapylab.ch/projects/aftercare-assistance-of-inpatients-with-psychological-illnesses-with-technology/">App-based aftercare services for inpatients with psychological illnesses</a></li><li><a href="https://digitalpsychotherapylab.ch/projects/daily-questionnaire-app/">Daily questionnaire app</a></li></ul><h4>Websites</h4><p>The advantage of online interventions (website, app) is that they can be used anonymously, independent of time and location on a smartphone, tablet or laptop. They are also less expensive. In this way, access to treatment is also made possible for socio-culturally disadvantaged or isolated patients.</p><p>Some projects:</p><ul><li><a href="https://digitalpsychotherapylab.ch/projects/i-beat/">iBEAT</a></li></ul><h3>Many more projects and collaborations to come!</h3><p>DPT Lab will be collaborating with Empathic Labs and using <a href="https://medium.com/empathic-labs">their blog</a> to publish future projects.</p><p>Feel free to contact any of the lab’s members to discuss, collaborate or suggest ideas by using the following url: <a href="https://digitalpsychotherapylab.ch/team/">https://digitalpsychotherapylab.ch/team/</a></p><p>Fouad</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29c528fbd0af" width="1" height="1" alt=""><hr><p><a href="https://medium.com/empathic-labs/introducing-dpt-lab-29c528fbd0af">Introducing DPT Lab</a> was originally published in <a href="https://medium.com/empathic-labs">Empathic Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Virtual assistant for teenagers with binge-eating disorders]]></title>
            <link>https://medium.com/empathic-labs/virtual-assistant-for-teenagers-with-binge-eating-disorders-1929e832d8b6?source=rss-dc4e9fdf3a2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1929e832d8b6</guid>
            <category><![CDATA[disorders]]></category>
            <category><![CDATA[virtual-assistant]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[binge-eating-disorder]]></category>
            <dc:creator><![CDATA[Fouad Hannoun]]></dc:creator>
            <pubDate>Wed, 16 Sep 2020 04:36:17 GMT</pubDate>
            <atom:updated>2020-09-28T07:30:08.173Z</atom:updated>
            <content:encoded><![CDATA[<h4>A chatbot assisting in binge-eating therapy with the ABC model</h4><p>The following project is in collaboration between the <a href="https://humantech.institute/">HumanTech Institute</a> (head: Prof. Elena Mugellini) and the <a href="https://www3.unifr.ch/psycho/en/department/staff/teams/klipsy.html">Clinical Psychology and Psychotherapy team at Fribourg University</a> (head: Prof Simone Munsch). The main purpose of this collaboration is to support psychological therapies with technology to help both the patients and therapists in any way possible. This project is about a virtual assistant available to help patients when they face a binge eating episode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*TNUFHsLHeiyy8jJ0TTCMxg.png" /><figcaption>Source: <a href="https://www.innovationiseverywhere.com/chatbots-spixii/">https://www.innovationiseverywhere.com/chatbots-spixii/</a></figcaption></figure><p>Eating disorders are among the most debilitating mental health problems in Western countries. Unfortunately, these disorders have a significant impact on the psychosocial development and cause significant psychological, physical and social consequences. These complex disorders require a progressive and time-consuming recovery.</p><p>Several cognitive-behavioural treatment programs are based on the “ABC” model where the patients have to fill in forms by hand. In collaboration with psychologists from the University of Fribourg, <strong>the idea came up to create a chatbot to replace this “manual” process with an assistant who helps the patient to carry out the whole process of the “ABC” model.</strong> The introduction of a chatbot creates more room for manoeuvre and thus promotes flexibility in the patient’s recovery. Indeed, the chatbot might eventually serve as a personal coach for the patient and could provide regular support since it’s always available. In addition, all data is stored in a database, therefore therapists could easily monitor their patients.</p><h3><strong>The “ABC” model</strong></h3><p>The “ABC” model (Antecedents-Behaviour-Consequences) is a powerful approach to understanding and overcoming pathological dynamics in eating disorders. This model was implemented in order to identify the triggers of a behaviour (food crisis) but also to reveal the consequences of the behaviour. The use of the model was chosen because it is relatively simple for a patient (mainly teenagers).</p><p>The model is based on three distinct sets of questions, asked in succession to determine the causes, behaviours and consequences of a crisis that has occurred. The figure below describes the model and its phases:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z8anHuxfBLHvovKfHQB6Hg.png" /><figcaption>The “ABC” model</figcaption></figure><p>The ABC model is therefore <strong>used for eating disorders</strong> because, to the naked eye, <strong>the triggers of binge eating are often invisible</strong>. In fact, one might believe that a crisis “just happens to you”, without any real reason. In order to manage these episodes in a gradual manner, the ABC model helps to identify risk situations during food crises. It also helps to identify where new strategies may be needed.</p><p>The basis of the ABC model is its query part. The patient must, sequentially, answer questions for each of the 3 phases. This part should be carried out immediately following the occurrence of a food crisis.</p><p>In phase A (trigger), the patient lists all the points that contributed to the fact that there was an eating episode. These can be for example the time of day, the availability of food, an argument with a friend, a feeling of hunger, etc.</p><p>In Phase B (problematic behaviour), he or she should describe the behaviour during the food crisis, i.e. everything that happened once the crisis began. The patient should describe where the crisis took place, the room he/she was in, whether anyone else was present, how long it lasted, what he/she ate and in what order, etc.</p><p>In Phase C (consequences), the patient describes the consequences of the episode, i.e. what was done after the crisis, the thoughts that went through his/her head and what was felt during the crisis.</p><h3><strong>Why a chatbot?</strong></h3><p>The patient also needs elements to help him/her avoid episodes. This is the purpose of pleasant activities, which is a list of activities that can be used as trigger control strategies. They are intended to prevent tension that is usually high or that increases in high-risk situations. The model provides a non-exhaustive list of activities for the patient to choose from. In addition, the patient may indicate activities that are not included in the list. The goal is for the patient to integrate these activities into his or her life on a regular basis.</p><p><strong>Emergency cards</strong> also play a major role in episode management. They are used to <strong>avoid or mitigate a food crisis</strong>. Certainly, the patient is responsible for annotating/describing the triggers, the behaviour itself and the consequences of possible crises. The patient must also present one to three coping strategies to avoid or mitigate potential crises for each of the elements (triggers, behaviour and consequences).</p><p>The usefulness of emergency cards can be demonstrated by several factors. First, in crisis situations, it is often impossible to find appropriate ways to deal with them. By creating emergency cards and planning what they want to change next time, patients increase their chances of taking a successful step forward increase.</p><p>Then, the patient can have several emergency cards that accommodate a particular situation, so that he or she is always prepared. The purpose of the cards is that the patient always carries them with him or her and that they are accessible where the risk situation usually occurs. They can be changed several times and adapted.</p><p>Unlike the cards, <strong>a chatbot is easier to access and is always available</strong>. All a person needs to do is send a message declaring that an episode took place and the chatbot engages in the conversation by asking all the necessary questions. Therapists can also be notified and monitor the patients in a better way.</p><h3><strong>The chatbot</strong></h3><p>Our chatbot was designed using <strong>Rasa</strong> framework (we used <a href="https://rasa.com/docs/rasa/core/about/">Rasa Core</a> and <a href="https://rasa.com/docs/rasa/nlu/about/">Rasa NLU</a>). It is very customisable, adaptable to our needs. In addition to that the request don’t go through a third party server and are run locally. Privacy is a major concern in this field.</p><p><a href="https://telegram.org/"><strong>Telegram</strong></a> is basically a fast, secure and free messaging application that is available on a large number of platforms: Windows, Mac OS, Android, iOS or on the web. On top of that, Telegram now offers a library, <a href="https://core.telegram.org/bots/api">Bot API</a>, which allows the creation of chatbots clients running on the messaging application, accessible quickly by a large number of users. Rasa is fully compatible with Telegram Bot, which facilitates the connection between the two.</p><p>After starting the conversation for the first time, the chatbot asks about the user’s name, age and sex. After the introductions here is what actions it offers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*BvcTQ-tO12nw00jmIOp3yA.png" /><figcaption>Chatbot’s possible actions</figcaption></figure><p>If the user engages in a conversation after having done the introduction the bot greets him/her.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*gqC2oUSHcac2Znk5NGm7Bg.png" /><figcaption>Chatbot greeting the user</figcaption></figure><p>If the patient is encountering a crisis the bot tries to reassure and calm the patient offers help based on whether the person is alone or not. It saves the date of the episode and all the input data, asks the required questions and shows the registered emergency cards afterwards with the corresponding strategy to calm down. Once the crisis is passed, the bot summarises a report of the crisis.</p><h3><strong>Chatbot challenges and areas of improvement</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dhmGCBAtQ0MtT1WQ.png" /><figcaption>Source: <a href="https://www.makerobos.com/topic/ask-an-expert/mental-health-chatbots-for-mental-well-being">https://www.makerobos.com/topic/ask-an-expert/mental-health-chatbots-for-mental-well-being</a></figcaption></figure><p>When a chatbot is developed, it is necessary to <strong>engage the user on the long term</strong>. Otherwise, its usefulness will prove to be relatively low. In this project, the interaction with the user was not to be neglected since the chatbot is supposed to be an assistant in the everyday life of the patient in order to help when an episode occurs. It is therefore important to know and apply good practices to prevent the early abandonment of users.</p><p><strong>Establishing common ground</strong> is often mentioned as a key element of human interaction. In this case, it is simply a matter of allowing the user to introduce themselves and address them by their first name, to remember something they have mentioned, and to provide continuity through the recollection of conversation history.</p><p><strong>Clues </strong>are another significant factor. Although a chatbot cannot express emotions through a face or body, it is well established that people easily attribute human traits to computers. It is not necessary for the chatbot to show a large number of human traits, but only some very typical ones to be convincing. An effective example is to ask personal questions, thus increasing affection. One element that should be particularly kept in mind is not to “humanize” the chatbot too much. Indeed, since a chatbot can only appear — and not really be — empathetic, some may perceive the attempt as disrespectful or inappropriate. After all, it remains a virtual assistant.</p><p>When asked about the <a href="https://www.dictionary.com/browse/anthropomorphization"><strong>anthropomorphization</strong></a> of the chatbot, most users dislike of the idea, which is perceived as inappropriate. Finally, it has been noticed that if the chatbot is too direct or familiar to the user, it can be detrimental. It is best to start with an impersonal chatbot that evolves as the user becomes familiar with it.</p><p>An involved user is one of the best ways to ensure long-term use. In a study, the goal was to create a coach to motivate users to go running. One of the beliefs about why coaching systems are abandoned is that they “focus on what to do rather than why”. <a href="https://www.diva-portal.org/smash/get/diva2:1106358/FULLTEXT01.pdf">Äberg</a> attempted to create three different “types” of chatbots to change users’ eating behavior. The three types are as follows:</p><ul><li>The <strong>“informational” chatbot</strong> that starts conversations by giving advice on different ways to consume healthily</li><li>The <strong>“goal-setting” chatbot</strong> that sets goals for the user</li><li>The <strong>“comparative” chatbot</strong> that asks the user about his behavior and gives him feedback on his performance compared to other users</li></ul><p>Of the three, the first two were appreciated. The goal-setting chatbot, which <strong>motivates</strong> the user had a real impact on food consumption. The last one, on the other hand, was not very well perceived because comparison with other users can lead to stress and insecurity, it also rises privacy concerns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YUBpjmTRysTsNxvHMBO2Zw.png" /><figcaption>Source: <a href="https://dribbble.com/shots/6557401-Robot#shot-description">https://dribbble.com/shots/6557401-Robot#shot-description</a></figcaption></figure><p><strong>Reminders</strong> help to get the user’s attention and keep him/her engaged over a longer period of time. <a href="https://www.researchgate.net/publication/8353408_Ubiquitous_computing_technology_for_just-in-time_motivation_of_behavior_change">Intille</a> suggested that an effective strategy for motivating behaviour change using just-in-time information based on five elements:</p><ol><li>Presenting a simple, tailored, and easy-to-understand message</li></ol><p>2. At an appropriate time</p><p>3. At an appropriate location</p><p>4. Using a non-irritating, engaging and appropriate strategy</p><p>5. Repeatedly and consistently</p><p>They must therefore be used judiciously and in a non-irritating way. Otherwise the chatbot could be perceived as an unsolicited telemarketing call at lunchtime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ITDShEmcXVt36pPO.jpg" /><figcaption>ILLUSTRATION: SAM WHITNEY</figcaption></figure><h3><strong>Chatbots as therapists</strong></h3><p>One of the main problems with mental health disorders is stigma. Although people have access to appropriate treatment, this problem is one of the main barriers to adopting this type of service. In order to overcome the problem of stigma, chatbots may be a potential solution. This is also useful in the case of the chatbot for binge eating episodes because the chatbot is always available and the data is safe.</p><p>The different bots tested for the treatment of depression <strong>notify</strong> the user every day to remind him or her to <strong>interact</strong> with and thus create a link between the human and the robot. In order to communicate with the chatbot, the user must open the application. The bot will initiate the conversation. However, this may vary with the current situation and state. It is also possible that the chatbot asks the user if he/she wants to resume the conversation from where they stopped last time.</p><p>Chatbots accept entries as free <strong>text or emojis</strong>. However, depending on the situation, the chatbot may only accept responses from a predefined, restricted list. The <strong>predefined answers</strong> have both positive and negative aspects. The positive side is that it simplifies the interaction with the chatbot, so it is more comfortable for the user and there is less risk of errors. On the other hand it limits the assistant’s flexibility since it is possible that the list doesn’t offer an answer that the user really wants.</p><p>It is also important that the chatbot tells the user when they don’t understand something rather than continuing the conversation with an inappropriate answer. Indeed, if it keeps occurring, this can lead to a lack of trust of the user towards the chatbot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*eZ37ZOBeTEN9vfl1.png" /></figure><p><em>Special thanks to Marius Rubo for testing the chatbot and to Marco Mattei for doing the implementation and research.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1929e832d8b6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/empathic-labs/virtual-assistant-for-teenagers-with-binge-eating-disorders-1929e832d8b6">Virtual assistant for teenagers with binge-eating disorders</a> was originally published in <a href="https://medium.com/empathic-labs">Empathic Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Emotion identification using upper body language detection with Microsoft Kinect v2 and machine…]]></title>
            <link>https://medium.com/empathic-labs/emotion-identification-using-upper-body-language-detection-with-microsoft-kinect-v2-and-machine-ceb82201b26c?source=rss-dc4e9fdf3a2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ceb82201b26c</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[human-machine-interaction]]></category>
            <dc:creator><![CDATA[Fouad Hannoun]]></dc:creator>
            <pubDate>Thu, 23 Apr 2020 06:39:43 GMT</pubDate>
            <atom:updated>2020-04-23T06:39:43.789Z</atom:updated>
            <content:encoded><![CDATA[<h3>Emotion identification using upper body language detection with Microsoft Kinect v2 and machine learning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2gvyG9jL-tRNI82d.jpg" /><figcaption><a href="http://doc.aldebaran.com/2-4/home_pepper.html">Pepper</a>, the empathic robot made by Aldebaran.</figcaption></figure><p>Hey, <a href="https://www.linkedin.com/in/fouad-hannoun-6810b510a/">I’m</a> a software engineer pursuing my PhD in computer science in Switzerland. This article is about my master’s thesis project which was intended to detect emotions by analysing the person’s upper body language. Being able to detect emotions allows machines to understand us better and eases our communication with it (which is, by the way, the whole purpose of <a href="https://medium.com/empathic-labs/introducing-empathic-labs-4a471b765441">Empathic Labs</a> so I suggest you take a look at what those people do).</p><h3>Introduction</h3><p>Studying nonverbal communication emerged with Darwin stating that emotion expressions started with pre-human nonverbal displays and evolved in humans displays [1]. Whether it is a facial micro-expression, body language feature or the person’s voice, it can represent an emotion that might be wanted hidden. Reading emotions is becoming more and more crucial for our daily lives. Feelings have always been the major specialty in the field of psychology and neuroscience but with technology and advancements in cameras, image processing and machine learning, machines are starting to be able to detect them.</p><p>Human-Machine interactions are becoming recurring, with autonomous cars, smart assistants, chat bots, robot police, customer’s service or sales representatives; even cooperating with machines that need to detect emotions like in interviews, investigations or healthcare will become necessary.</p><h3>Objective</h3><p>The goal of this project is to build a system that detects the upper body language in order to recognise hidden emotions. The main objectives are body detection, a skeletal representation, body language features extraction and finally emotion detection based on these features. A Microsoft Kinect v2’s API was used for the body detection, its Gesture Builder software was used to study the position of the head and the upper body to detect features and an additional machine-learning algorithm was applied to compare the features and identify the emotion.</p><p>The solution is divided into 3 main parts:</p><h3>Body detection and representation</h3><p>The body detection and representation implemented using Microsoft Kinect library [2] for C#.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*JXuE6e1ZCkk8vD2fj0nJ4w.png" /><figcaption>Kinect v2 detection</figcaption></figure><p>In order to implement the body detection and representation, a body mask (the isolation of the pixels belonging to the body. This feature is already implemented in the adopted library) and two classes [3] are required:</p><p><strong>BodiesManager</strong> a class that renders and draws the tracked bodies in the frame.</p><p><strong>BodyInfo</strong> a class that contains the detected body’s joints and bones information in order to couple it with graphical information like lines, circles and colors.</p><p>By default, each body has 25 joints, with a position and orientation for each joint. Since the project’s main focus is upper body language, some joints and bones will be ignored which keeps 15 joints to each body (head, neck, SpineShoulder, SpineMid, SpineBase, left and right shoulders, elbows, wrists, hand tips, thumbs). The body data collected by the Kinect is saved in a Body array processed by the bodies’ manager class that will draw the joints and bones.</p><figure><img alt="Skeleton representation of the body" src="https://cdn-images-1.medium.com/max/337/1*8RAeLUs6leqaAXhLPjur2w.png" /><figcaption>Skeleton representation of the body</figcaption></figure><h3><strong><em>Gesture recognition</em></strong></h3><p>The gesture recognition was made thanks to Kinect Visual Gesture Builder, a tool that uses videos recorded with Kinect Studio. The Kinect SDK offers two applications called <strong>KStudio</strong> [4] and <strong>Visual Gesture Builder </strong>[4]. KStudio is used to record clips featuring a gesture. A gesture is then defined in Visual Gesture Builder, the joints it relies on are then chosen (lower body can be ignored, same for the left or right arm) and then the timestamps representing the gesture are marked.</p><p>The gesture builder using Adaboost [5] as a machine-learning algorithm to train itself and become able to detect the gesture then analyzes the marked videos and generates a file with the features defining this gesture. 19 gestures were recorded and recognized.</p><p>Two additional classes are required for the project <strong>GestureDetector </strong>and <strong>GestureResultView</strong> [3]</p><p>After the database is generated, it is added to the Visual Studio project. The GestureResultView generates a confidence for each gesture that goes between 0 and 1 (1 if it is 100% confident that the gesture is being done). A logging function was implemented after the detection was successful; it captures the timestamp and all the gestures’ confidence and appends them on a logging file (the work is done by an asynchronous thread). The logging function is called every time a gesture’s confidence is modified. The logs will be used as our data to detect the emotion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/158/1*tsrThgvFwynxbTw9wrShmg.png" /><figcaption>Logs</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X_w5f_oiDFKLgNjNf417Cg.png" /><figcaption>Gesture builder test showing the confidence it has for each defined gesture (hands behind head, head backward and spine backward are at confidence 1)</figcaption></figure><h3><strong><em>Emotion identification</em></strong></h3><p>The emotion identification was made using multi-output regression machine learning algorithm [6] using the log file as data.The gesture detection application was used to generate the training datasets. Three persons contributed and 1540 samples representing a single emotion each were extracted. Eight emotions were represented in total: Happiness, sadness, pride, guilt, defensive, interest, boredom and impatience. The link between the gestures and the emotion was based on articles [7] read and on Allan and Barbara Pease’s book [8].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LDDof0Lr4YDaMqhsy6ZwAw.png" /><figcaption>Link between the gestures and the emotions</figcaption></figure><p>The datasets are stored in two different text files, <strong>X </strong>and <strong>Y: </strong>The first file contains the confidence of each gesture, with each line containing the data extracted at a specific timestamp knowing that the gestures are representing a specific emotion. The second file has values between 0 and 100, with 8 values per lines, each value representing how much an emotion is represented and each line representing the gestures expressed in the same line of the first file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fweg2YW7h6f532C_w7278A.png" /><figcaption>Datasets used for the training of the system (on the left is the confidence for each gestures on the right is the % of each emotion)</figcaption></figure><p>The script keeps the logging file opened in read, the timestamp is saved on a third file for plotting purposes and then the gestures’ confidence are stored in an array till the script reaches another timestamp (19 lines later) which marks the end of the logged set. It then analyses the content of the array and extracts its belonging to each emotion. The result is stored in the plotting file and the dominating emotion is sent to the C# application in order to be represented in real-time. Another script is used to plot the stored emotions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/115/1*XFB8Fv26ALSQEWhgz0a5Yg.png" /><figcaption>Plotting file (showing the timestamp + confidence towards the emotions)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wDUDWGsXe_eUT1d1wj713w.png" /><figcaption>The plotting result</figcaption></figure><p>And that’s the application running:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p7s6K8eH6NAqoA0HDSkCGw.png" /><figcaption>Upper body detected in real time with hands behind the head, the head and spine backward which represent pride.</figcaption></figure><h3>Conclusion</h3><p>The project was successfully developed. The emotions can be identified, the project is able to detect up to six bodies in parallel, the emotion is displayed in real time and the whole session can be plotted. However, it still needs some future improvements like optimising the logging/emotion detection system in order to reduce the lag. Gesture recognition can also be improved by using the gesture builder software and training on multiple persons and from multiple points of view. Finally, merging this system with a facial, voice recognition application and even using the lower body to identify standing emotions would build a perfect detection scheme.</p><h3>References</h3><p>[1] C. Darwin, The expression of the emotions in man and animals, Oxford University Press (1872/1998).</p><p>[2] Microsoft Kinect library <a href="https://docs.microsoft.com/en-us/previous-versions/windows/kinect/dn799271(v=ieb.10)">https://docs.microsoft.com/en-us/previous-versions/windows/kinect/dn799271(v=ieb.10)</a></p><p>[3] Additional classes used <a href="https://github.com/Kinect/tutorial">https://github.com/Kinect/tutorial</a></p><p>[4] Microsoft Kinect SDK <a href="https://www.microsoft.com/en-us/download/details.aspx?id=44561">https://www.microsoft.com/en-us/download/details.aspx?id=44561</a></p><p>[5] Adaboost <a href="https://machinelearningmastery.com/boosting-and-adaboost-for-machine-learning/">https://machinelearningmastery.com/boosting-and-adaboost-for-machine-learning/</a></p><p>[6] Sklearn <a href="http://scikit-learn.org/stable/modules/multiclass.html%23multioutput-regression">http://scikit-learn.org/stable/modules/multiclass.html#multioutput-regression</a></p><p>[7] Gestures and emotions <a href="http://people.ict.usc.edu/~gratch/CSCI534/Readings/ACII-Handbook-GestureSyn.pdf">http://people.ict.usc.edu/~gratch/CSCI534/Readings/ACII-Handbook-GestureSyn.pdf</a></p><p>[8] Body Language the definitive book — Allan and Barbara Pease</p><p>[9] Project’s GitHub repository <a href="https://github.com/hannounfouad">https://github.com/hannounfouad</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ceb82201b26c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/empathic-labs/emotion-identification-using-upper-body-language-detection-with-microsoft-kinect-v2-and-machine-ceb82201b26c">Emotion identification using upper body language detection with Microsoft Kinect v2 and machine…</a> was originally published in <a href="https://medium.com/empathic-labs">Empathic Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>