[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,63 +2,232 @@
|
||||
id: wiki-2026-0508-emotional-ai-affective-computing
|
||||
title: Emotional AI (Affective Computing)
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [EMOTION-AI-001]
|
||||
aliases: [affective computing, emotion AI, sentiment analysis, emotion recognition, FER]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 1.0
|
||||
tags: [ai, affective-computing, emotional-ai, Human-Computer-Interaction, sentiment-Analysis]
|
||||
confidence_score: 0.95
|
||||
verification_status: applied
|
||||
tags: [ai, affective-computing, emotional-ai, sentiment, fer, multimodal, hci]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-26
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: Python
|
||||
framework: PyTorch / Transformers / DeepFace
|
||||
---
|
||||
|
||||
# Emotional AI (정서적 AI / 감성 컴퓨팅)
|
||||
# Emotional AI (Affective Computing)
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "데이터 너머의 감정을 읽고, 인간과 정서적으로 교감하는 따뜻한 지능을 설계하라" — 인간의 표정, 음성 톤, 생체 신호 등을 분석하여 감정 상태를 인식하고, 이에 적절하게 반응함으로써 인간-컴퓨터 상호작용(HCI)의 질을 높이는 기술.
|
||||
## 매 한 줄
|
||||
> **"매 emotion 의 sense + 매 generate"**. Picard MIT (1997). 매 facial, voice, text, physiological. 매 modern: 매 multimodal LLM + valence-arousal regression. 매 ethical: 매 surveillance + cultural bias.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
- **추출된 패턴:** 비정형 데이터(멀티모달)로부터 정서적 특징을 추출하여 표준 감정 모델(예: Ekman의 6대 감정)에 매핑하고, 공감적인 피드백을 생성하는 정서 인지 루프 패턴.
|
||||
- **주요 기술:**
|
||||
- **Facial Expression Recognition:** CNN 등을 통해 미세한 안면 근육 변화 포착.
|
||||
- **Sentiment Analysis:** 텍스트의 어조와 문맥을 파악하여 긍정/부정 및 감정 농도 분석.
|
||||
- **Prosody Analysis:** 말소리의 속도, 높낮이, 떨림 등을 통해 심리 상태 추론.
|
||||
- **Affective Interaction:** 사용자의 감정에 맞춰 대화 톤이나 서비스 내용을 조정.
|
||||
- **응용 분야:** 정신 건강 상담 챗봇, 교육용 에듀테크, 고객 서비스 최적화, 인터랙티브 아트.
|
||||
## 매 핵심
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 논리와 연산 중심의 차가운 지능에서, 감정과 공감을 포함하는 전인적 지능으로 AI의 정의가 확장됨.
|
||||
- **정책 변화:** Antigravity 프로젝트의 퍼스널 비서 에이전트는 사용자의 질문 의도뿐만 아니라 문장에 담긴 '다급함'이나 '좌절감'을 감지하여 답변의 우선순위와 톤을 자동으로 조절함.
|
||||
### 매 emotion model
|
||||
- **Discrete** (Ekman): 매 6 basic — anger, fear, disgust, surprise, sadness, joy.
|
||||
- **Dimensional** (Russell): 매 valence × arousal.
|
||||
- **Plutchik wheel**: 매 8 + intensity.
|
||||
- **Appraisal** (Scherer): 매 cognitive evaluation.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- [[Human-Computer-Interaction-HCI|Human-Computer-Interaction-HCI]], [[Multimodal-Learning|Multimodal-Learning]], NLP, Theory-of-Mind-ToM-in-AI
|
||||
- **Raw Source:** 10_Wiki/Topics/AI/Emotional-AI ([[Affective Computing|Affective Computing]]).md
|
||||
### 매 modality
|
||||
- **Facial** (FER): 매 AU (action unit).
|
||||
- **Voice**: 매 prosody, pitch.
|
||||
- **Text**: 매 lexicon + transformer.
|
||||
- **Physiological**: 매 HRV, GSR, EEG.
|
||||
- **Body**: 매 posture, gait.
|
||||
- **Multimodal**: 매 fuse.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### 매 응용
|
||||
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.
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### 매 ethical
|
||||
- **Privacy**: 매 emotion 의 surveil.
|
||||
- **Cultural bias**: 매 Ekman universality 의 contested.
|
||||
- **Inaccuracy**: 매 expression ≠ feeling.
|
||||
- **Manipulation**: 매 ad / dark pattern.
|
||||
- **Regulation**: 매 EU AI Act 의 emotion 의 high-risk.
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
## 💻 패턴
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
### Text sentiment (transformers)
|
||||
```python
|
||||
from transformers import pipeline
|
||||
pipe = pipeline('sentiment-analysis', model='cardiffnlp/twitter-roberta-base-sentiment')
|
||||
print(pipe("I love this!"))
|
||||
# 매 [{'label': 'POSITIVE', 'score': 0.99}]
|
||||
```
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
### Emotion classification (text, 7-class)
|
||||
```python
|
||||
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}, ...]
|
||||
```
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
### Facial emotion (DeepFace)
|
||||
```python
|
||||
from deepface import DeepFace
|
||||
result = DeepFace.analyze('selfie.jpg', actions=['emotion'])
|
||||
print(result[0]['dominant_emotion']) # 매 'happy'
|
||||
```
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
### Voice emotion (audio + Wav2Vec2)
|
||||
```python
|
||||
import librosa
|
||||
import torch
|
||||
from transformers import Wav2Vec2ForSequenceClassification, Wav2Vec2FeatureExtractor
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
model = Wav2Vec2ForSequenceClassification.from_pretrained('superb/wav2vec2-base-superb-er')
|
||||
fe = Wav2Vec2FeatureExtractor.from_pretrained('superb/wav2vec2-base-superb-er')
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
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
|
||||
```python
|
||||
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
|
||||
```python
|
||||
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)
|
||||
```python
|
||||
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)
|
||||
```python
|
||||
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)
|
||||
```python
|
||||
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)
|
||||
```python
|
||||
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)
|
||||
```python
|
||||
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)
|
||||
```python
|
||||
# 매 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
|
||||
- 부모: [[AI]] · [[Human-Computer-Interaction]]
|
||||
- 변형: [[Sentiment-Analysis]] · [[FER]] · [[Voice-Emotion]] · [[Empathy-in-AI]]
|
||||
- 응용: [[Mental-Health-Tech]] · [[Customer-Support-AI]]
|
||||
- Adjacent: [[Multimodal-LLM]] · [[Drama Management Systems]] · [[Dynamic Difficulty Adjustment (DDA)]] · [[EU-AI-Act]]
|
||||
|
||||
## 🤖 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 |
|
||||
|
||||
Reference in New Issue
Block a user