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:
@@ -0,0 +1,163 @@
|
||||
---
|
||||
id: wiki-2026-0508-cnn
|
||||
title: CNN (Convolutional Neural Network)
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [ConvNet, Convolutional Network]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.95
|
||||
verification_status: applied
|
||||
tags: [deep-learning, computer-vision, cnn, neural-network]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: Python
|
||||
framework: PyTorch 2.5 / JAX
|
||||
---
|
||||
|
||||
# CNN (Convolutional Neural Network)
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 CNN 의 핵심: spatial locality + parameter sharing + translation equivariance"**. 매 1989 LeCun LeNet 으로 시작, 매 2012 AlexNet 의 ImageNet breakthrough 가 deep-learning era 의 trigger. 매 2026 현재 ViT 의 주류 진입 unauthenticated, ConvNeXt-V2 / EfficientNet-V2 / RegNet 같은 modern CNN 의 efficiency 의 강점, 매 mobile / edge 의 dominant.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 architectural primitive
|
||||
- **Conv2d**: 매 sliding kernel — 매 (in_ch, out_ch, kH, kW) parameters.
|
||||
- **Pooling**: max/avg — 매 spatial downsampling.
|
||||
- **BatchNorm / GroupNorm**: 매 internal covariate shift mitigation.
|
||||
- **Residual connection (ResNet)**: 매 identity skip — 매 vanishing gradient solved.
|
||||
- **Depthwise-separable conv (MobileNet)**: 매 efficient — 매 9× FLOPs 감소.
|
||||
|
||||
### 매 inductive biases
|
||||
- **Locality**: 매 nearby pixels correlated.
|
||||
- **Translation equivariance**: 매 object 의 위치 shift 도 같은 feature.
|
||||
- **Hierarchy**: 매 edge → texture → part → object.
|
||||
|
||||
### 매 응용
|
||||
1. Image classification (ResNet, ConvNeXt, EfficientNet).
|
||||
2. Object detection (YOLO v11, RT-DETR backbone).
|
||||
3. Segmentation (U-Net, DeepLab v3+).
|
||||
4. Audio spectrograms, time-series, medical imaging.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Basic CNN block (PyTorch)
|
||||
```python
|
||||
import torch.nn as nn
|
||||
|
||||
class ConvBlock(nn.Module):
|
||||
def __init__(self, in_c, out_c, k=3, s=1):
|
||||
super().__init__()
|
||||
self.conv = nn.Conv2d(in_c, out_c, k, s, padding=k//2, bias=False)
|
||||
self.bn = nn.BatchNorm2d(out_c)
|
||||
self.act = nn.GELU()
|
||||
def forward(self, x):
|
||||
return self.act(self.bn(self.conv(x)))
|
||||
```
|
||||
|
||||
### Residual block (ResNet-style)
|
||||
```python
|
||||
class ResBlock(nn.Module):
|
||||
def __init__(self, c):
|
||||
super().__init__()
|
||||
self.b1 = ConvBlock(c, c)
|
||||
self.b2 = ConvBlock(c, c)
|
||||
def forward(self, x):
|
||||
return x + self.b2(self.b1(x))
|
||||
```
|
||||
|
||||
### Depthwise-separable (MobileNet)
|
||||
```python
|
||||
class DWSep(nn.Module):
|
||||
def __init__(self, in_c, out_c, s=1):
|
||||
super().__init__()
|
||||
self.dw = nn.Conv2d(in_c, in_c, 3, s, 1, groups=in_c, bias=False)
|
||||
self.pw = nn.Conv2d(in_c, out_c, 1, 1, 0, bias=False)
|
||||
self.bn = nn.BatchNorm2d(out_c)
|
||||
self.act = nn.GELU()
|
||||
def forward(self, x):
|
||||
return self.act(self.bn(self.pw(self.dw(x))))
|
||||
```
|
||||
|
||||
### ConvNeXt block (2026 modern CNN)
|
||||
```python
|
||||
class ConvNeXtBlock(nn.Module):
|
||||
def __init__(self, dim):
|
||||
super().__init__()
|
||||
self.dwconv = nn.Conv2d(dim, dim, 7, padding=3, groups=dim)
|
||||
self.norm = nn.LayerNorm(dim)
|
||||
self.pw1 = nn.Linear(dim, 4 * dim)
|
||||
self.act = nn.GELU()
|
||||
self.pw2 = nn.Linear(4 * dim, dim)
|
||||
def forward(self, x):
|
||||
i = x
|
||||
x = self.dwconv(x).permute(0, 2, 3, 1) # NCHW -> NHWC
|
||||
x = self.pw2(self.act(self.pw1(self.norm(x))))
|
||||
return i + x.permute(0, 3, 1, 2)
|
||||
```
|
||||
|
||||
### Training loop with mixed precision
|
||||
```python
|
||||
import torch
|
||||
from torch.cuda.amp import autocast, GradScaler
|
||||
|
||||
scaler = GradScaler()
|
||||
opt = torch.optim.AdamW(model.parameters(), lr=3e-4, weight_decay=0.05)
|
||||
for x, y in loader:
|
||||
opt.zero_grad()
|
||||
with autocast():
|
||||
loss = nn.functional.cross_entropy(model(x.cuda()), y.cuda())
|
||||
scaler.scale(loss).backward()
|
||||
scaler.step(opt)
|
||||
scaler.update()
|
||||
```
|
||||
|
||||
### Inference with TorchScript / compile
|
||||
```python
|
||||
model.eval()
|
||||
model = torch.compile(model, mode="reduce-overhead") # PyTorch 2.5+
|
||||
with torch.no_grad():
|
||||
out = model(x)
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Small data (<10k images) | Pretrained ResNet-50 + finetune |
|
||||
| Mobile / edge | MobileNetV4 / EfficientNet-Lite |
|
||||
| SOTA on ImageNet | ConvNeXt-V2 or hybrid (CNN+ViT) |
|
||||
| Real-time detection | YOLOv11 (CSPDarknet backbone) |
|
||||
| Medical seg | U-Net++ or nnU-Net |
|
||||
|
||||
**기본값**: 매 timm 의 pretrained ConvNeXt-Tiny — 매 81%+ ImageNet, 매 28M params.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Deep Learning]] · [[Neural Networks]]
|
||||
- 변형: [[ResNet]] · [[EfficientNet]]
|
||||
- 응용: [[Computer Vision]] · [[Object Detection]] · [[Image Segmentation]]
|
||||
- Adjacent: [[Transformer_Architecture_and_LLM_Foundations|Attention Mechanisms]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 architecture sketch 의 generation, 매 training-loop boilerplate, 매 hyperparameter starting points, 매 debugging shape mismatches.
|
||||
**언제 X**: 매 SOTA tuning / benchmark 의 LLM 의존 X — 매 paper + timm 의 reference.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Vanilla VGG-style 의 2026 사용**: 매 outdated — 매 ResNet/ConvNeXt 의 사용.
|
||||
- **No data augmentation**: 매 immediate overfit on small data.
|
||||
- **BatchNorm with batch size 1**: 매 statistic 무의미 — 매 GroupNorm 사용.
|
||||
- **Conv 후 immediate ReLU + BN order 의 inconsistent**: 매 BN→Act 의 standard.
|
||||
- **No mixed precision on modern GPU**: 매 free 2× speedup 의 손실.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (LeCun 1989, He et al. 2015 ResNet, Liu et al. 2022 ConvNeXt, 2024 ConvNeXt-V2).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — CNN fundamentals + ConvNeXt modern patterns |
|
||||
Reference in New Issue
Block a user