Files
2nd/10_Wiki/Topics/Computer_Vision.md
T
2026-05-10 22:08:15 +09:00

170 lines
6.1 KiB
Markdown

---
id: wiki-2026-0508-computer-vision
title: Computer Vision
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [CV, Vision AI, Visual Recognition]
duplicate_of: none
source_trust_level: A
confidence_score: 0.93
verification_status: applied
tags: [computer-vision, deep-learning, multimodal, perception]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: Python
framework: PyTorch / Transformers / OpenCV
---
# Computer Vision
## 매 한 줄
> **"매 CV 의 핵심: pixels → semantic understanding via learned hierarchical features"**. 매 1960s Roberts edge detector 로 시작, 매 2012 AlexNet 으로 deep-learning revolution, 매 2020 ViT, 매 2023 SAM. 매 2026 현재 multimodal foundation models (GPT-5V, Claude Opus 4.7, Qwen3-VL, Llama 4 Vision) 가 zero-shot 으로 detection / VQA / OCR 의 통합.
## 매 핵심
### 매 task taxonomy
- **Classification**: 매 image → label.
- **Detection**: 매 bounding boxes + classes (YOLO, DETR, RT-DETR).
- **Segmentation**: 매 pixel-level (semantic, instance, panoptic). SAM2 의 promptable.
- **Pose / Keypoint**: 매 human/object joints (RTMPose, ViTPose).
- **Depth / 3D**: 매 monocular depth (Depth Anything V2), NeRF, 3DGS.
- **Generation**: 매 diffusion (FLUX.1, SD3.5), 매 video (Sora 2, Veo 3).
- **VLM (Vision-Language)**: 매 image+text → text (GPT-5V, Claude Opus 4.7, Qwen3-VL).
### 매 modern stack (2026)
- **Backbone**: ConvNeXt-V2, ViT-L, EVA-02, DINOv2.
- **Detection**: YOLOv11, RT-DETR-v2, Grounding DINO 1.5.
- **Segmentation**: SAM2, Mask2Former.
- **Foundation**: SigLIP-2, CLIP, DINOv2 (self-supervised features).
- **VLM**: Claude Opus 4.7 Vision, GPT-5V, InternVL3, Qwen3-VL.
### 매 응용
1. Autonomous driving (Waymo, Tesla FSD perception).
2. Medical imaging (MONAI, nnU-Net for segmentation).
3. Document AI / OCR (Donut, Florence-2, GPT-5V).
4. Robotics (open-vocabulary manipulation, RT-2).
5. Content moderation, retail, agriculture.
## 💻 패턴
### Image classification (timm + finetune)
```python
import timm, torch
model = timm.create_model("convnextv2_tiny.fcmae_ft_in22k_in1k",
pretrained=True, num_classes=10)
opt = torch.optim.AdamW(model.parameters(), lr=1e-4)
# train as usual
```
### Object detection (Ultralytics YOLOv11)
```python
from ultralytics import YOLO
model = YOLO("yolo11n.pt")
results = model("img.jpg")
for r in results:
print(r.boxes.xyxy, r.boxes.cls, r.boxes.conf)
```
### Promptable segmentation (SAM2)
```python
from sam2.sam2_image_predictor import SAM2ImagePredictor
predictor = SAM2ImagePredictor.from_pretrained("facebook/sam2-hiera-large")
predictor.set_image(image)
masks, scores, _ = predictor.predict(
point_coords=[[500, 375]], point_labels=[1])
```
### CLIP zero-shot classification
```python
import torch, open_clip
model, _, preprocess = open_clip.create_model_and_transforms(
"ViT-L-14-SigLIP2", pretrained="webli")
tokenizer = open_clip.get_tokenizer("ViT-L-14-SigLIP2")
text = tokenizer(["a cat", "a dog", "a car"])
with torch.no_grad():
img_feat = model.encode_image(preprocess(img).unsqueeze(0))
txt_feat = model.encode_text(text)
probs = (img_feat @ txt_feat.T).softmax(-1)
```
### VLM via Claude (vision)
```python
import anthropic, base64
client = anthropic.Anthropic()
img_b64 = base64.b64encode(open("img.jpg", "rb").read()).decode()
resp = client.messages.create(
model="claude-opus-4-7-20260101",
max_tokens=1024,
messages=[{
"role": "user",
"content": [
{"type": "image", "source": {"type": "base64",
"media_type": "image/jpeg", "data": img_b64}},
{"type": "text", "text": "What objects? Bounding boxes (x1,y1,x2,y2)."}
]
}])
```
### Monocular depth (Depth Anything V2)
```python
from transformers import pipeline
pipe = pipeline("depth-estimation",
model="depth-anything/Depth-Anything-V2-Large-hf")
depth = pipe(image)["depth"]
```
### OpenCV preprocessing pipeline
```python
import cv2, numpy as np
img = cv2.imread("scan.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(gray, (5, 5), 0)
edges = cv2.Canny(blur, 50, 150)
contours, _ = cv2.findContours(edges, cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_SIMPLE)
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Quick prototype, no labels | VLM (GPT-5V/Claude) zero-shot |
| Production classification | timm finetune (ConvNeXt-V2) |
| Real-time detection | YOLOv11 / RT-DETR |
| Open-vocab detection | Grounding DINO 1.5 |
| Pixel-perfect masks | SAM2 (promptable) |
| Video understanding | InternVideo2 / Sora-style |
| Edge / mobile | MobileNetV4 + ONNX/CoreML |
**기본값**: 매 prototype 은 VLM 로 baseline, 매 production scale 시 specialized model 의 finetune.
## 🔗 Graph
- 부모: [[Deep Learning]] · [[Multimodal AI]]
- 변형: [[CNN]] · [[Vision Transformer]] · [[Diffusion Models]]
- 응용: [[Object Detection]] · [[Image Segmentation]] · [[OCR]]
- Adjacent: [[NLP]] · [[Robotics]] · [[Generative AI]]
## 🤖 LLM 활용
**언제**: 매 quick image-understanding tasks (VQA, OCR, caption), 매 dataset bootstrapping (label generation), 매 vision-pipeline scaffolding.
**언제 X**: 매 high-throughput / low-latency production — 매 specialized model 의 use. 매 medical / safety-critical 은 validated model only.
## ❌ 안티패턴
- **Re-inventing vs. timm/ultralytics**: 매 well-tested baselines 의 무시 X.
- **No domain-specific augmentation**: 매 medical/satellite 의 ImageNet aug 의 그대로 사용.
- **Ignoring image preprocessing**: 매 wrong normalization 의 가장 흔한 bug.
- **VLM 의 fine-grained 작업 의 무비판 신뢰**: 매 small-object detection / counting 의 hallucination.
- **No test-time augmentation for production**: 매 robustness 손실.
## 🧪 검증 / 중복
- Verified (Szeliski Computer Vision 2nd ed., Ultralytics YOLOv11 2025, SAM2 paper 2024, Depth Anything V2 2024).
- 신뢰도 A.
- 관련: [[CNN]], [[Vision Transformer]].
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — 2026 modern stack (YOLOv11, SAM2, VLMs) |