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 폴더 제거.
This commit is contained in:
Antigravity Agent
2026-07-05 00:33:48 +09:00
parent 1cfd3bbb56
commit 9148c358d0
6455 changed files with 1 additions and 86875 deletions
@@ -0,0 +1,189 @@
---
id: wiki-2026-0508-deepfake-detection
title: Deepfake Detection
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Deepfake Detection, Synthetic Media Detection, AI-Generated Content Detection]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [security, ml, forensics, deepfake, detection]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: Python
framework: PyTorch
---
# Deepfake Detection
## 매 한 줄
> **"매 generative model 의 fingerprint 의 수확"**. 2017 FakeApp 의 등장 이후 detection 의 cat-and-mouse race 가 시작되었고, 2026 modern detector 는 frequency-domain artifacts, biological signals (PPG, eye blink), 그리고 self-supervised representation 의 ensemble 의 통해 95%+ AUC 의 달성 — but cross-model generalization 의 여전히 매 open problem.
## 매 핵심
### 매 Detection 패러다임
- **Frequency-domain**: GAN/Diffusion 의 upsampling artifact (DCT spectrum 의 grid pattern, FFT 의 high-freq 결손).
- **Biological signal**: heart-rate (rPPG), micro-expression, eye blink frequency 의 unnatural pattern.
- **Identity consistency**: face embedding 의 video-level temporal drift.
- **Self-supervised**: CLIP/DINOv2 feature 의 OOD detection.
### 매 Generation 종류
- **Face swap**: DeepFaceLab, FaceFusion, Roop.
- **Face reenactment**: First Order Motion Model, LivePortrait (2024).
- **Full-body**: Wav2Lip, SadTalker, EMO (Alibaba 2024).
- **Diffusion-based**: Stable Video Diffusion, Sora (OpenAI 2024), Veo 3 (Google 2025).
### 매 응용
1. Newsroom 의 fact-checking pipeline (Reuters, AP).
2. Social platform 의 watermark + detection (Meta, TikTok, X).
3. Identity verification (KYC, banking — Persona, Onfido).
4. Forensic 증거 분석 (court-admissible chain of custody).
## 💻 패턴
### Frequency-domain CNN (Frank et al. baseline)
```python
import torch
import torch.nn as nn
from torch.fft import fft2, fftshift
class FrequencyDeepfakeDetector(nn.Module):
def __init__(self, num_classes=2):
super().__init__()
self.backbone = nn.Sequential(
nn.Conv2d(1, 32, 3, padding=1), nn.ReLU(),
nn.Conv2d(32, 64, 3, padding=1), nn.ReLU(),
nn.AdaptiveAvgPool2d(8), nn.Flatten(),
nn.Linear(64 * 64, num_classes),
)
def forward(self, x): # x: (B, 3, H, W) RGB
gray = x.mean(1, keepdim=True)
spec = fftshift(fft2(gray)).abs().log1p()
return self.backbone(spec)
```
### rPPG-based liveness (heart-rate from face video)
```python
import numpy as np
from scipy.signal import butter, filtfilt
def extract_rppg(face_frames, fps=30):
# POS algorithm — Wang et al. 2017
rgb_signal = np.stack([f.reshape(-1, 3).mean(0) for f in face_frames])
rgb_norm = rgb_signal / rgb_signal.mean(0)
proj = rgb_norm @ np.array([[0, 1, -1], [-2, 1, 1]]).T
s = proj[:, 0] + (proj[:, 0].std() / proj[:, 1].std()) * proj[:, 1]
b, a = butter(4, [0.7, 4.0], btype='band', fs=fps)
return filtfilt(b, a, s - s.mean())
def is_live(rppg, fps=30):
fft = np.abs(np.fft.rfft(rppg))
freqs = np.fft.rfftfreq(len(rppg), 1/fps) * 60 # BPM
peak_bpm = freqs[fft.argmax()]
return 50 <= peak_bpm <= 180 # 매 plausible HR range
```
### CLIP-based zero-shot detector
```python
import open_clip
import torch
model, _, preprocess = open_clip.create_model_and_transforms(
'ViT-L-14', pretrained='laion2b_s32b_b82k')
tokenizer = open_clip.get_tokenizer('ViT-L-14')
prompts = ["a real photograph", "an AI-generated image",
"a deepfake", "a synthetic face"]
text = tokenizer(prompts)
text_features = model.encode_text(text)
text_features /= text_features.norm(dim=-1, keepdim=True)
def score(image_pil):
img = preprocess(image_pil).unsqueeze(0)
img_feat = model.encode_image(img)
img_feat /= img_feat.norm(dim=-1, keepdim=True)
sims = (img_feat @ text_features.T).softmax(-1)
return sims[0, 1:].sum().item() # 매 fake probability
```
### Temporal consistency (face embedding drift)
```python
from facenet_pytorch import InceptionResnetV1
embedder = InceptionResnetV1(pretrained='vggface2').eval()
def temporal_drift(face_crops):
embs = embedder(torch.stack(face_crops))
embs = embs / embs.norm(dim=-1, keepdim=True)
consec_sim = (embs[:-1] * embs[1:]).sum(-1)
# 매 swapped face 의 unnatural jitter 의 detect
return 1.0 - consec_sim.mean().item()
```
### Watermark verification (C2PA / SynthID)
```python
import hashlib
from cryptography.hazmat.primitives.asymmetric import ed25519
def verify_c2pa_manifest(manifest_bytes, signature, public_key):
try:
public_key.verify(signature, manifest_bytes)
return True
except Exception:
return False # 매 manifest 의 tampered 또는 missing
```
### Ensemble fusion (production)
```python
def ensemble_decision(image, video_clip):
scores = {
'freq': freq_detector(image),
'clip': clip_detector(image),
'rppg': 1.0 - is_live_score(video_clip),
'temporal': temporal_drift(extract_faces(video_clip)),
}
weights = {'freq': 0.3, 'clip': 0.25, 'rppg': 0.25, 'temporal': 0.2}
return sum(w * scores[k] for k, w in weights.items())
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Real-time KYC | rPPG + active liveness challenge |
| Static image forensic | Frequency CNN + CLIP zero-shot |
| Video newsroom | Ensemble (freq + temporal + watermark) |
| Cross-generator generalization | Self-supervised foundation model |
| High-stakes legal | Multi-modal + chain-of-custody + C2PA |
**기본값**: ensemble of frequency + foundation-model + watermark verification.
## 🔗 Graph
- 부모: [[Computer Vision]]
- 응용: [[Content Moderation]]
- Adjacent: [[C2PA]]
## 🤖 LLM 활용
**언제**: feature engineering 의 brainstorm, dataset curation script, false-positive 분석.
**언제 X**: production detection model 의 직접 inference (LLM 의 vision 의 reliable detector 의 X — specialized model 의 사용).
## ❌ 안티패턴
- **Single-detector reliance**: GAN-trained detector 의 diffusion-generated content 의 fail.
- **No cross-generator eval**: train/test 의 same generator 의 inflated metric.
- **Ignoring compression artifacts**: JPEG/H.264 의 frequency signal 의 destroy.
- **Adversarial blindness**: detector 의 adversarial perturbation 의 robust 의 X.
- **Watermark-only**: open-source generator 의 watermark 의 strip.
## 🧪 검증 / 중복
- Verified (FaceForensics++ benchmark, DFDC, Frank et al. ICML 2020, C2PA spec v2.1).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — frequency/biological/CLIP detection patterns + ensemble |