tusharg007/sentinelai
GitHub: tusharg007/sentinelai
基于 YOLOv8 和 CLIP 的全栈航空影像智能分析平台,提供目标检测、多模态融合、变化检测、地理定位和威胁优先级评分等端到端能力。
Stars: 0 | Forks: 0
[](https://sentinelai-mzpttdbvspkloq6hd8hhuj.streamlit.app/)
# 🛡️ SentinelAI
### AI 航空智能平台






**通过卫星和无人机图像实现实时资产检测 · 地理定位 · 优先级评分,用于基础设施监控、灾害响应和城市分析**
[🚀 快速开始](#quick-start) · [📡 API 文档](#api-reference) · [🧠 工作原理](#how-it-works) · [📊 性能基准](#evaluation-methodology)

## 🎯 功能介绍
SentinelAI 是一个全栈 AI 平台,通过完整的航空智能管道处理卫星和无人机图像。它专为**基础设施监控**(电力线路、建筑工地、物流堆场)、**灾害响应**(洪水测绘、搜索与救援)以及**城市规划和交通分析**而设计。相同的架构可扩展到高安全性和国防应用领域。
1. 使用 YOLOv8 **检测**高价值资产 —— 卡车、重型机械、飞机、车辆、船舶、设备集群
2. 使用通道注意力加权融合 + CLAHE 增强**融合** EO + IR + SAR 传感器模态
3. 对每次检测进行**地理定位** —— 像素坐标 → WGS84 经纬度 + MGRS 网格参考
4. 使用多因子评分对资产进行**优先级排序**:`base × confidence × proximity × operator × context`
5. 使用 CLIP ViT-B/32 语义相似度 + 像素级差分图**检测**卫星多次过境之间的变化
## 🧠 工作原理
| 组件 | 技术 | 用途 |
|-----------|-----------|---------|
| 目标检测 | **YOLOv8n** (Ultralytics) | 航空图像中的高价值资产检测 |
| 变化检测 | **CLIP ViT-B/32** (OpenAI) | 卫星多次过境之间的语义场景变化 |
| 模态融合 | **Channel-Attention + CLAHE** | EO + IR + SAR 传感器融合 |
| 优先级评分 | **Multi-Factor Engine** | base × confidence × proximity × context 权重 |
| 地理空间 | **WGS84 + MGRS** | 像素 → GPS 坐标转换 |
### 优先级评分公式
```
FinalScore = BaseScore × ConfidenceWeight × ProximityWeight × OperatorWeight × ContextWeight
```
- **ConfidenceWeight**: `0.60 + 0.40 × conf^1.5` —— 高置信度的检测结果权重更大
- **ProximityWeight**: 在 0.8km 范围内,每增加一个邻近的高价值资产增加 4% 的奖励
- **ContextWeight**: 自定义操作员上下文配置(例如,基础设施模式将重型机械的权重提升 1.5 倍)
## 📊 评估方法
我使用公开的 **DOTA-v1.0** 航空图像数据集对 SentinelAI 的检测管道进行了基准测试,这是航空/卫星图像目标检测的标准基准。
| 指标 | 值 |
|--------|-------|
| **Precision** | 0.6210 |
| **Recall** | 0.8333 |
| **mAP@0.5** | 0.8875 |
| **mAP@0.5:0.95** | 0.6291 |
| **推理延迟** | ~78 ms / 图像 (CPU) |
## 🏗️ 架构
```
┌─────────────────────────────────────────────────────────┐
│ FRONTEND (React 18) │
│ Vite · TypeScript · Tailwind · Zustand · TanStack │
│ Analytics HUD UI · Drag-drop imagery · Live feed │
└────────────────────────┬────────────────────────────────┘
│ REST API
┌────────────────────────▼────────────────────────────────┐
│ BACKEND (FastAPI) │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌────────┐ │
│ │ Detect │ │ Fuse │ │ Change │ │ Geo │ │
│ │ YOLOv8 │ │EO+IR+SAR │ │CLIP ViT │ │WGS84 │ │
│ └──────────┘ └──────────┘ └──────────┘ └────────┘ │
│ │
│ ┌─────────────────────────────────────┐ │
│ │ Priority Scoring Engine │ │
│ │ Score = Base×Conf×Proximity×Context │ │
│ └─────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
```
## 🚀 快速开始
### 前置条件
- Python 3.11+
- Node.js 20+
### 本地运行
**终端 1 — 后端:**
```
cd backend
pip install fastapi uvicorn python-multipart pydantic pydantic-settings loguru
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
pip install ultralytics transformers
python -m uvicorn app.main:app --reload --port 8000
```
等待提示:`✅ All systems ready`
**终端 2 — 前端:**
```
cd frontend
npm install
npm run dev
```
打开:**http://localhost:5173**
## 📡 API 参考
| 方法 | 端点 | 描述 |
|--------|----------|-------------|
| `POST` | `/api/v1/detect` | YOLOv8 资产检测 |
| `POST` | `/api/v1/fuse` | EO + IR + SAR 模态融合 |
| `POST` | `/api/v1/change` | 时序变化检测 |
| `POST` | `/api/v1/geolocate` | 像素 → GPS + MGRS 坐标 |
| `POST` | `/api/v1/prioritize` | 多因子优先级评分 |
| `POST` | `/api/v1/pipeline` | 完整的端到端智能管道 |
| `GET` | `/health` | 系统状态 + 已加载的模型 |
| `GET` | `/docs` | 交互式 Swagger UI |
### 请求示例
```
curl -X POST http://localhost:8000/api/v1/detect \
-F "file=@image.jpg" \
-F "confidence=0.25" \
-F "mission=infrastructure"
```
### 响应示例
```
{
"assets": [
{
"asset_id": "TGT-001",
"asset_class": "high_value_asset",
"confidence": 0.87,
"priority_score": 9.2,
"priority_level": "critical",
"bbox": { "x1": 120, "y1": 85, "x2": 340, "y2": 210 }
}
],
"total": 3,
"priority_counts": { "critical": 1, "high": 1, "medium": 1, "low": 0 },
"latency_ms": 142.3
}
```
## 📁 项目结构
```
sentinelai/
├── backend/
│ ├── app/
│ │ ├── core/
│ │ │ ├── config.py # Settings + custom domain taxonomy
│ │ │ ├── imaging.py # Image processing utilities
│ │ │ └── registry.py # ML model lifecycle manager
│ │ ├── services/
│ │ │ ├── detector.py # YOLOv8 + custom domain taxonomy mapping
│ │ │ ├── fusion.py # EO+IR+SAR channel-attention fusion
│ │ │ ├── change.py # CLIP ViT-B/32 change detection
│ │ │ ├── geospatial.py # Pixel → WGS84 + MGRS
│ │ │ └── threat.py # Multi-factor priority scoring
│ │ └── api/v1/routes/ # REST endpoints
│ └── tests/ # 30+ unit tests
├── frontend/
│ └── src/
│ ├── pages/ # Dashboard, Analysis, History
│ ├── components/ # Analytics HUD components
│ └── store/ # Zustand state management
├── infrastructure/
│ ├── terraform/ # AWS ECS + RDS + ALB
│ └── scripts/ # GCP + AWS deploy scripts
├── scripts/
│ └── benchmark_model.py # DOTA-v1.0 benchmark evaluation
└── docker-compose.yml
```
## 🧪 测试
```
cd backend
pytest tests/ -v --tb=short
```
包含 30 多个单元测试,涵盖检测评分、模态融合、地理空间变换、优先级引擎和变化检测。
## 🔧 改进方向
- **真实世界微调**:当前的检测依赖于 YOLOv8 在航空图像上的零样本性能。在 DOTA-v1.0 或 xView 数据集上使用特定领域的类别进行微调,将大幅提高生产部署中的精确度和召回率。
- [ ] 在 DOTA v1.5 数据集上微调 YOLOv8,以实现真正的航空 OBB 检测
- [ ] 用 CMX 跨模态 Transformer 替换像素融合
- [ ] 在 LEVIR-CD / S2Looking 数据集上训练变化检测
- [ ] 添加 GeoTIFF GDAL 仿射变换以获取真实的卫星坐标
- [ ] 通过 CUDA 支持 GPU 推理
- [ ] 添加基础设施特定类别(输电铁塔、太阳能电池板、建筑起重机)
- [ ] 与 GIS 平台(QGIS、ArcGIS)集成,用于灾害响应工作流
**基于 PyTorch · FastAPI · React 18 · YOLOv8 · CLIP ViT-B/32 · OpenCV · TypeScript 构建**
标签:AV绕过, EO/IR/SAR融合, FastAPI, PyTorch, React, Syscalls, Ultralytics, YOLOv8, 交通分析, 人工智能, 传感器融合, 全栈应用, 军事目标检测, 凭据扫描, 卫星图像分析, 图像融合, 地理定位, 地理空间分析, 城市规划, 基础设施监控, 威胁优先级评估, 实时资产检测, 情报监视侦察(ISR), 战场情报, 无人机图像分析, 深度学习, 灾害响应, 用户模式Hook绕过, 目标检测, 目标跟踪, 网络测绘, 计算机视觉, 评分系统, 请求拦截, 逆向工具, 遥感图像处理