mirror of
https://github.com/gsi-upm/senpy
synced 2025-09-18 04:22:21 +00:00
Fixed bugs in Ekman2VAD
This commit is contained in:
@@ -13,6 +13,7 @@ from .api import API_PARAMS, NIF_PARAMS, parse_params
|
||||
from threading import Thread
|
||||
|
||||
import os
|
||||
import copy
|
||||
import fnmatch
|
||||
import inspect
|
||||
import sys
|
||||
@@ -180,7 +181,7 @@ class Senpy(object):
|
||||
newentries = []
|
||||
for i in resp.entries:
|
||||
if output == "full":
|
||||
newemotions = i.emotions.copy()
|
||||
newemotions = copy.copy(i.emotions)
|
||||
else:
|
||||
newemotions = []
|
||||
for j in i.emotions:
|
||||
|
@@ -10,24 +10,26 @@ import math
|
||||
class WNA2VAD(EmotionConversionPlugin):
|
||||
|
||||
def _ekman_to_vad(self, ekmanSet):
|
||||
potency = 0
|
||||
"""Sum the VAD value of all categories found."""
|
||||
valence = 0
|
||||
arousal = 0
|
||||
dominance = 0
|
||||
for e in ekmanSet.onyx__hasEmotion:
|
||||
category = e.onyx__hasEmotionCategory
|
||||
centroid = self.centroids[category]
|
||||
potency += centroid['V']
|
||||
valence += centroid['V']
|
||||
arousal += centroid['A']
|
||||
dominance += centroid['D']
|
||||
e = Emotion({'emoml:potency': potency,
|
||||
e = Emotion({'emoml:valence': valence,
|
||||
'emoml:arousal': arousal,
|
||||
'emoml:dominance': dominance})
|
||||
'emoml:potency': dominance})
|
||||
return e
|
||||
|
||||
def _vad_to_ekman(self, VADEmotion):
|
||||
"""Find the closest category"""
|
||||
V = VADEmotion['emoml:valence']
|
||||
A = VADEmotion['emoml:potency']
|
||||
D = VADEmotion['emoml:dominance']
|
||||
A = VADEmotion['emoml:arousal']
|
||||
D = VADEmotion['emoml:potency']
|
||||
emotion = ''
|
||||
value = 10000000000000000000000.0
|
||||
for state in self.centroids:
|
||||
@@ -50,7 +52,7 @@ class WNA2VAD(EmotionConversionPlugin):
|
||||
e.onyx__hasEmotion.append(self._ekman_to_vad(emotionSet))
|
||||
elif fromModel == 'emoml:fsre-dimensions':
|
||||
for i in emotionSet.onyx__hasEmotion:
|
||||
e.onyx__hasEmotion.append(self._vad_to_ekman(e))
|
||||
e.onyx__hasEmotion.append(self._vad_to_ekman(i))
|
||||
else:
|
||||
raise Error('EMOTION MODEL NOT KNOWN')
|
||||
yield e
|
||||
|
@@ -7,7 +7,7 @@ onyx:doesConversion:
|
||||
- onyx:conversionFrom: emoml:big6
|
||||
onyx:conversionTo: emoml:fsre-dimensions
|
||||
- onyx:conversionFrom: emoml:fsre-dimensions
|
||||
onyx:conversionTo: wna:WNAModel
|
||||
onyx:conversionTo: emoml:big6
|
||||
centroids:
|
||||
emoml:big6anger:
|
||||
A: 6.95
|
||||
@@ -31,5 +31,5 @@ centroids:
|
||||
V: 2.21
|
||||
aliases:
|
||||
A: emoml:arousal
|
||||
V: emoml:potency
|
||||
V: emoml:valence
|
||||
D: emoml:dominance
|
Reference in New Issue
Block a user