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,178 @@
---
id: wiki-2026-0508-iot-and-ai-integration
title: IoT and AI Integration
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Edge AI, TinyML, IoT AI, AIoT]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [iot, edge-ai, tinyml, embedded, mqtt, sensor-fusion]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: cpp
framework: tflite-micro
---
# IoT and AI Integration
## 매 한 줄
> **"매 센서 옆에서 즉시 추론"**. 수 KB-수 MB 모델을 ESP32/Cortex-M/Coral 같은 edge 기기에 올려 latency, privacy, bandwidth 를 동시에 잡는다. 2026 현재 TinyML + MQTT 가 표준.
## 매 핵심
### 매 3 layer 아키텍처
1. **Edge (sensor)**: TinyML 추론, 이상 감지, 게이팅.
2. **Fog (gateway)**: 다중 센서 통합, heavier 모델, 로컬 의사결정.
3. **Cloud**: 학습, fleet 모니터링, OTA 모델 업데이트.
### 매 모델 압축
- **Quantization**: float32 → int8/int4, 4-8x 작아짐.
- **Pruning**: weight magnitude 기준 sparsify.
- **Knowledge distillation**: large teacher → tiny student.
- **NAS for edge**: MCUNet, MobileNet.
### 매 통신
- **MQTT**: pub/sub, QoS 0/1/2.
- **CoAP**: REST-over-UDP, 더 가벼움.
- **LoRaWAN**: km 단위, 수백 byte/min.
- **BLE**: 근거리, 저전력.
### 매 응용
1. Predictive maintenance (vibration anomaly).
2. Vision: door cam person detection, defect inspection.
3. Voice wakeword (Alexa, "OK Google").
4. Smart agriculture (soil moisture + weather).
5. Health wearable (HRV, fall detection).
## 💻 패턴
### TFLite Micro 추론 (ESP32, C++)
```cpp
#include "tensorflow/lite/micro/micro_interpreter.h"
const tflite::Model* model = tflite::GetModel(g_model_data);
static tflite::MicroMutableOpResolver<5> resolver;
resolver.AddConv2D(); resolver.AddMaxPool2D();
resolver.AddReshape(); resolver.AddFullyConnected(); resolver.AddSoftmax();
constexpr int kArena = 60 * 1024;
uint8_t arena[kArena];
tflite::MicroInterpreter interp(model, resolver, arena, kArena);
interp.AllocateTensors();
TfLiteTensor* in = interp.input(0);
memcpy(in->data.int8, sensor_buf, in->bytes);
interp.Invoke();
int8_t* out = interp.output(0)->data.int8;
```
### Post-training quantization (Python)
```python
import tensorflow as tf
conv = tf.lite.TFLiteConverter.from_saved_model("model")
conv.optimizations = [tf.lite.Optimize.DEFAULT]
conv.target_spec.supported_types = [tf.int8]
conv.representative_dataset = lambda: (
[x.astype("float32")] for x in calib_samples[:200]
)
open("model_int8.tflite", "wb").write(conv.convert())
```
### MQTT publish 추론 결과 (MicroPython)
```python
from umqtt.simple import MQTTClient
c = MQTTClient("esp32-01", "broker.local")
c.connect()
while True:
feat = read_imu()
label = tinyml_infer(feat)
if label != "normal":
c.publish(b"factory/line1/anomaly",
ujson.dumps({"label": label, "ts": time.time()}))
time.sleep(0.1)
```
### Sensor fusion (Kalman, complementary)
```cpp
// 6DOF IMU complementary filter
float alpha = 0.98f;
roll = alpha * (roll + gyro_x * dt) + (1 - alpha) * accel_roll;
pitch = alpha * (pitch + gyro_y * dt) + (1 - alpha) * accel_pitch;
```
### Edge Impulse SDK (anomaly)
```cpp
ei_impulse_result_t result;
signal_t signal;
numpy::signal_from_buffer(features, EI_FEATURE_COUNT, &signal);
run_classifier(&signal, &result, false);
if (result.anomaly > 0.5) trigger_alert();
```
### OTA 모델 업데이트
```cpp
HTTPClient http;
http.begin("https://cdn/model_v3.tflite");
if (http.GET() == 200) {
File f = SPIFFS.open("/model.tflite", "w");
http.writeToStream(&f); f.close();
ESP.restart();
}
```
### Coral Edge TPU (Python)
```python
from pycoral.utils.edgetpu import make_interpreter
from pycoral.adapters import classify
it = make_interpreter("model_edgetpu.tflite")
it.allocate_tensors()
it.set_tensor(it.get_input_details()[0]["index"], img)
it.invoke()
print(classify.get_classes(it, top_k=1))
```
## 매 결정 기준
| 제약 | 권장 |
|---|---|
| MCU < 1MB RAM | TFLite Micro int8, MCUNet |
| 배터리 1년+ | LoRaWAN + duty cycle |
| Vision realtime | Coral / Jetson Nano |
| Privacy critical | edge inference, no cloud raw |
| Fleet 수만+ | MQTT broker cluster, OTA |
**기본값**: ESP32 + TFLite Micro int8 + MQTT QoS 1.
## 🔗 Graph
- 부모: [[Edge Computing|Edge-Computing]]
- 변형: [[TinyML]], [[Federated-Learning]]
- 응용: [[Predictive Maintenance]], [[Wearables]]
- Adjacent: [[LLM_Optimization_and_Deployment_Strategies|Quantization]], [[MQTT]]
## 🤖 LLM 활용
**언제**: latency 100ms 이하 필요, 네트워크 불안정, privacy 규제, bandwidth 비싼 환경.
**언제 X**: 모델 100MB+, 잦은 재학습 필요, 입력이 크고 다양한 multimodal.
## ❌ 안티패턴
- **Cloud 의존 edge**: 인터넷 끊기면 동작 안 함 → fallback 필수.
- **Float32 모델 그대로 배포**: RAM 부족, 발열.
- **OTA 미고려**: 모델 버그 fix 불가.
- **Sensor 단일**: 노이즈에 취약, fusion 으로 견고화.
- **MQTT QoS 0 + 중요 alert**: 패킷 유실 가능.
## 🧪 검증 / 중복
- TFLite Micro, Edge Impulse, MQTT 5.0 spec, Coral docs.
- Warden & Situnayake "TinyML" (O'Reilly).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — 3-layer 구조, TFLite Micro/Edge Impulse/MQTT/OTA 패턴 |