Files
2nd/10_Wiki/Topic_Programming/AI_and_ML/Emotional-AI (Affective Computing).md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +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