Files
2nd/10_Wiki/Topics/AI_and_ML/Emotional-AI (Affective Computing).md
T
koriweb d8a80f6272 chore(wiki): dangling 링크 canonical 정규화 (768파일/1200건)
이름만 다른(표기 변형) [[위키링크]]를 대상 문서의 canonical 제목으로 치환해
끊겼던 1,200개 링크를 연결. 제목/파일명 정규화 일치만 적용하고 별칭 매칭은
과병합 위험으로 제외(애매성 가드). 원본은 _link_reconcile_backup/ 에 백업.
도구: Datacollect/scripts/link_reconcile_apply.mjs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 12:24:15 +09:00

7.3 KiB
Raw Blame History

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-emotional-ai-affective-computing Emotional AI (Affective Computing) 10_Wiki/Topics verified self
affective computing
emotion AI
sentiment analysis
emotion recognition
FER
none A 0.95 applied
ai
affective-computing
emotional-ai
sentiment
fer
multimodal
hci
2026-05-10 pending
language framework
Python PyTorch / Transformers / DeepFace

Emotional AI (Affective Computing)

매 한 줄

"매 emotion 의 sense + 매 generate". Picard MIT (1997). 매 facial, voice, text, physiological. 매 modern: 매 multimodal LLM + valence-arousal regression. 매 ethical: 매 surveillance + cultural bias.

매 핵심

매 emotion model

  • Discrete (Ekman): 매 6 basic — anger, fear, disgust, surprise, sadness, joy.
  • Dimensional (Russell): 매 valence × arousal.
  • Plutchik wheel: 매 8 + intensity.
  • Appraisal (Scherer): 매 cognitive evaluation.

매 modality

  • Facial (FER): 매 AU (action unit).
  • Voice: 매 prosody, pitch.
  • Text: 매 lexicon + transformer.
  • Physiological: 매 HRV, GSR, EEG.
  • Body: 매 posture, gait.
  • Multimodal: 매 fuse.

매 응용

  1. Customer service: 매 sentiment.
  2. Mental health: 매 mood track.
  3. Education: 매 engagement.
  4. Auto: 매 driver drowsiness.
  5. Marketing: 매 ad reaction.
  6. Robot: 매 emotional support.
  7. Game: 매 dynamic difficulty.

매 ethical

  • Privacy: 매 emotion 의 surveil.
  • Cultural bias: 매 Ekman universality 의 contested.
  • Inaccuracy: 매 expression ≠ feeling.
  • Manipulation: 매 ad / dark pattern.
  • Regulation: 매 EU AI Act 의 emotion 의 high-risk.

💻 패턴

Text sentiment (transformers)

from transformers import pipeline
pipe = pipeline('sentiment-analysis', model='cardiffnlp/twitter-roberta-base-sentiment')
print(pipe("I love this!"))
# 매 [{'label': 'POSITIVE', 'score': 0.99}]

Emotion classification (text, 7-class)

classifier = pipeline('text-classification', model='j-hartmann/emotion-english-distilroberta-base', top_k=None)
result = classifier("I'm worried about tomorrow")
# 매 [{'label': 'fear', 'score': 0.7}, ...]

Facial emotion (DeepFace)

from deepface import DeepFace
result = DeepFace.analyze('selfie.jpg', actions=['emotion'])
print(result[0]['dominant_emotion'])  # 매 'happy'

Voice emotion (audio + Wav2Vec2)

import librosa
import torch
from transformers import Wav2Vec2ForSequenceClassification, Wav2Vec2FeatureExtractor

model = Wav2Vec2ForSequenceClassification.from_pretrained('superb/wav2vec2-base-superb-er')
fe = Wav2Vec2FeatureExtractor.from_pretrained('superb/wav2vec2-base-superb-er')

def predict_emotion(audio_path):
    audio, sr = librosa.load(audio_path, sr=16000)
    inputs = fe(audio, sampling_rate=16000, return_tensors='pt')
    with torch.no_grad():
        logits = model(**inputs).logits
    return model.config.id2label[logits.argmax().item()]

Valence-Arousal regression

class VARegressor(nn.Module):
    def __init__(self, backbone):
        super().__init__()
        self.backbone = backbone
        self.va_head = nn.Linear(backbone.hidden_dim, 2)  # 매 valence, arousal
    
    def forward(self, x):
        feat = self.backbone(x)
        va = torch.tanh(self.va_head(feat))  # 매 [-1, 1]
        return va  # 매 [batch, (valence, arousal)]

Multimodal fusion

class MultiModalEmotion(nn.Module):
    def __init__(self):
        super().__init__()
        self.face_enc = FacialEncoder()
        self.audio_enc = AudioEncoder()
        self.text_enc = TextEncoder()
        self.fusion = nn.Linear(768 * 3, 7)
    
    def forward(self, face, audio, text):
        ff = self.face_enc(face)
        fa = self.audio_enc(audio)
        ft = self.text_enc(text)
        return self.fusion(torch.cat([ff, fa, ft], dim=-1))

Physiological (HRV stress)

import neurokit2 as nk
def stress_from_ecg(ecg_signal, sr=1000):
    signals, info = nk.ecg_process(ecg_signal, sampling_rate=sr)
    hrv = nk.hrv_time(signals, sampling_rate=sr)
    rmssd = hrv['HRV_RMSSD'].iloc[0]
    return 'stressed' if rmssd < 30 else 'calm'

Cultural-aware (avoid bias)

def culturally_aware_predict(image, region):
    base_pred = model.predict(image)
    # 매 cultural calibration
    if region == 'east_asia':
        # 매 East Asian 의 less expressive baseline
        base_pred['happy'] *= 0.8
        base_pred['neutral'] *= 1.2
    return normalize(base_pred)

LLM-based emotion (modern)

def llm_emotion(text):
    prompt = f"""Classify the emotion in this text. Output JSON.
Text: "{text}"
Output: {{"primary": "...", "secondary": "...", "valence": -1 to 1, "arousal": 0 to 1}}"""
    return json.loads(llm.generate(prompt))

Real-time engagement (online learning)

class EngagementTracker:
    def __init__(self, baseline=0.5):
        self.engagement = baseline
        self.history = []
    
    def update(self, frame):
        emotion = analyze_face(frame)
        self.engagement = 0.9 * self.engagement + 0.1 * emotion['attention_score']
        self.history.append(self.engagement)
    
    def is_disengaged(self):
        return np.mean(self.history[-30:]) < 0.3

Affective response (chatbot)

def empathic_response(user_msg):
    emotion = classify(user_msg)
    if emotion in ('sad', 'fear'):
        return llm.generate(f"User feels {emotion}. Respond with validation first, then gentle reframe.\nUser: {user_msg}")
    return llm.generate(f"Respond to: {user_msg}")

Privacy-aware (on-device)

# 매 raw frame 의 server 의 send X
def on_device_emotion(frame, local_model):
    emotion = local_model(frame)
    # 매 only summary 의 send
    return {'emotion': emotion, 'confidence': ...}

매 결정 기준

상황 Approach
Customer support text Sentiment + LLM
Driver drowsiness Facial + on-device
Mental health Multimodal + clinician
Marketing A/B + reaction
Robot pet Multimodal real-time
Education Engagement (eye + face)

기본값: 매 task-specific modality + 매 cultural calibration + 매 privacy on-device + 매 LLM augment + 매 ethical disclosure.

🔗 Graph

🤖 LLM 활용

언제: 매 customer experience. 매 health (with clinician). 매 robot interaction. 언제 X: 매 surveillance. 매 manipulation. 매 EU high-risk.

안티패턴

  • Single-modality trust: 매 noisy.
  • Universal Ekman 의 assume: 매 cultural bias.
  • Express ≠ feel: 매 mask.
  • No consent: 매 surveillance.
  • Manipulate emotion: 매 dark pattern.

🧪 검증 / 중복

  • Verified (Picard 1997, Russell circumplex, Barrett constructionist).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-04-26 EMOTION-AI auto
2026-05-08 Phase 1
2026-05-10 Manual cleanup — emotion model + 매 text/voice/face/VA/multimodal code