priyank5548/chakravyuh_ai

GitHub: priyank5548/chakravyuh_ai

一个融合目标检测、异常检测和威胁分类的全栈边境监控情报仪表板原型系统。

Stars: 0 | Forks: 0

# ⚔️ CHAKRAVYUH-AI ### 边境防御与监控情报仪表板 ![Version](https://img.shields.io/badge/version-v1.0-ff2d55?style=for-the-badge&logo=github) ![Status](https://img.shields.io/badge/status-OPERATIONAL-00ff88?style=for-the-badge) ![License](https://img.shields.io/badge/license-Academic-00e5ff?style=for-the-badge) ![Domain](https://img.shields.io/badge/domain-Border_Defence-ffaa00?style=for-the-badge) ![React](https://img.shields.io/badge/React-18-61DAFB?style=flat-square&logo=react&logoColor=white) ![Python](https://img.shields.io/badge/Python-3.9+-3776AB?style=flat-square&logo=python&logoColor=white) ![Flask](https://img.shields.io/badge/Flask-REST_API-000000?style=flat-square&logo=flask&logoColor=white) ![YOLOv8](https://img.shields.io/badge/YOLOv8-Object_Detection-FF6B35?style=flat-square) ![scikit-learn](https://img.shields.io/badge/scikit--learn-ML_Models-F7931E?style=flat-square&logo=scikitlearn&logoColor=white) ![PyTorch](https://img.shields.io/badge/PyTorch-Deep_Learning-EE4C2C?style=flat-square&logo=pytorch&logoColor=white)
## 📌 目录 - [概述](#-overview) - [问题陈述实现](#-problem-statement-fulfillment) - [AI/ML 模型](#-aiml-models) - [导航模块](#-navigation-modules) - [技术栈](#-tech-stack) - [数据集](#-datasets) - [项目结构](#-project-structure) - [设置与安装](#-setup--installation) - [API 参考](#-api-reference) - [ML Pipeline 结果](#-ml-pipeline-results) ## 🔭 概述 **CHAKRAVYUH-AI v1.0** 是一个全栈边境防御监控仪表板,它将多种 AI/ML 范式——监督学习、无监督异常检测和深度学习——集成到一个统一的实时情报平台中。 该系统处理来自 5 个真实网络安全和 IoT 传感器数据集的数据,同时运行 3 个 AI/ML 模型,并通过一个军用级 React 仪表板展示可操作的威胁情报,该仪表板包含 9 个操作模块——利用数据集驱动的模拟提供近实时情报。 ## 🏗️ 系统架构 ``` ┌─────────────────────────────────────────────────────────────────┐ │ DATA SOURCES │ │ NSL-KDD · RT-IoT2022 · UNSW-NB15 · Network CSV · Intrusion │ └────────────────────────┬────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ ML PIPELINE (run_pipeline.py) │ │ Auto-Discovery → Merge (8208 rows) → EDA → Train Models │ │ ↓ ↓ ↓ │ │ Isolation Forest Random Forest EDA Charts │ │ (iso_model.pkl) (rf_model.pkl) (5 PNGs) │ └────────────────────────┬────────────────────────────────────────┘ │ PKL files ▼ ┌─────────────────────────────────────────────────────────────────┐ │ FLASK BACKEND (app.py) │ │ │ │ ┌─────────────┐ ┌──────────────┐ ┌─────────────────────┐ │ │ │ YOLOv8 │ │ Iso Forest │ │ Random Forest │ │ │ │ (webcam) │ │ (anomaly) │ │ (classification) │ │ │ └─────────────┘ └──────────────┘ └─────────────────────┘ │ │ REST API │ │ /sensor-data · /risk-zones · /analyze-frame · /tactical-brief│ └────────────────────────┬────────────────────────────────────────┘ │ JSON ▼ ┌─────────────────────────────────────────────────────────────────┐ │ REACT FRONTEND (App.jsx) │ │ │ │ OVERVIEW · LIVE DEMO · CCTV · DRONE · THREATS · ANALYTICS │ │ SENSORS · OSINT · MAP │ └─────────────────────────────────────────────────────────────────┘ ``` ## ✅ 问题陈述实现 | # | 目标 | 实现 | 状态 | |---|---|---|---| | 1 | 对监控和传感器数据集进行 EDA | ML pipeline 从 5 个合并数据集生成完整的 EDA 仪表板 | ✅ | | 2 | 构建异常检测模型 | Isolation Forest — 检测到 975 个异常,12% 污染率 | ✅ | | 3 | 使用 ML/DL 技术进行分类 | Random Forest (80.2% 准确率) + YOLOv8 深度学习 | ✅ | | 4 | 预测高风险区域 | 根据历史事件数据预测了 27 个风险区域 | ✅ | | 5 | 警报优先级排序以减少误报 | 平衡 CRITICAL/HIGH/MEDIUM/LOW 并带有操作日志 | ✅ | | 挑战 | 解决方案 | |---|---| | 大规模监控 | 从 5 个真实数据集合并了 8208 行数据 | | 威胁检测延迟 | YOLOv8 CCTV 目标检测 (网络摄像头) + 实时数据集驱动传感器源 | | 误报 | Isolation Forest 异常过滤 | | 资源限制 | 覆盖偏远边境区域的无人机模块 | | 数据整合 | 自动发现 ML pipeline 合并所有数据集 | ## 🤖 AI/ML 模型 ### 1. 🔍 YOLOv8 — 实时目标检测 ![YOLOv8](https://img.shields.io/badge/YOLOv8n-COCO_Trained-FF6B35?style=flat-square) ![PyTorch](https://img.shields.io/badge/Framework-PyTorch-EE4C2C?style=flat-square&logo=pytorch&logoColor=white) - **类型**: Deep Learning / Computer Vision - **用途**: 支持实时 CCTV 目标检测(启用网络摄像头时)——检测人员、车辆和物体 - **Framework**: Ultralytics (PyTorch backend) - **Inference**: 逐帧检测 pipeline,包含边界框 + 置信度分数 ### 2. 🚨 Isolation Forest — 异常检测 ![Unsupervised](https://img.shields.io/badge/Type-Unsupervised_ML-00e5ff?style=flat-square) ![Anomalies](https://img.shields.io/badge/Anomalies_Detected-975-ff2d55?style=flat-square) - **类型**: 无监督机器学习 - **用途**: 检测网络/传感器行为中的异常模式 - **结果**: 检测到 975 个异常 · 12% 污染率 - **训练基于**: RT-IoT2022, NSL-KDD, UNSW-NB15 ### 3. 🎯 Random Forest — 威胁分类 ![Supervised](https://img.shields.io/badge/Type-Supervised_ML-00ff88?style=flat-square) ![Accuracy](https://img.shields.io/badge/Accuracy-80.2%25-ffaa00?style=flat-square) - **类型**: 监督机器学习 - **用途**: 将传感器事件分类为 CRITICAL / HIGH / MEDIUM / LOW 威胁级别 - **结果**: 80.2% 准确率 · 5-fold CV 73.9% - **训练基于**: 从 5 个真实数据集合并的 8208 行数据 ## 🖥️ 导航模块 | 模块 | 描述 | |---|---| | `OVERVIEW` | 系统状态、实时 KPI、实时威胁摘要、时间线 | | `LIVE DEMO` | 完整 ML pipeline 演示,包含实时模型输出可视化 | | `📷 CCTV` | YOLOv8 驱动的摄像头源,具备实时目标检测与跟踪 | | `🛸 DRONE` | 空中监控视图,支持滚轮缩放 (1×/2×/4×/8×) | | `THREATS` | 实时威胁源、认知战术简报 (SITREP)、操作日志——简报基于异常分数 + RF 分类输出由 AI 生成,并带有本地规则回退机制 | | `ANALYTICS` | EDA 图表、分类结果、异常检测可视化 | | `SENSORS` | 由数据集驱动的 REST API 提供的实时传感器数据网格 | | `OSINT` | 源自风险区域预测的开源情报 | | `🌍 MAP` | 带有发光边境可视化的交互式世界地图 | ## 🛠️ 技术栈 **Frontend** ![React](https://img.shields.io/badge/React-SPA-61DAFB?style=flat-square&logo=react&logoColor=black) ![Canvas](https://img.shields.io/badge/HTML5_Canvas-Map_&_Drone-E34F26?style=flat-square&logo=html5&logoColor=white) ![Recharts](https://img.shields.io/badge/Recharts-Analytics-22B5BF?style=flat-square) - React (Single Page Application, 9 modules) - HTML5 Canvas — 支持 DPR 缩放的世界地图、支持缩放的无人机视图 - Recharts — 分析和传感器数据图表 - Custom CSS — 采用 Orbitron 字体的军用级深色 UI **Backend** ![Flask](https://img.shields.io/badge/Flask-REST_API-000000?style=flat-square&logo=flask&logoColor=white) ![Ultralytics](https://img.shields.io/badge/Ultralytics-YOLOv8-FF6B35?style=flat-square) ![scikit-learn](https://img.shields.io/badge/scikit--learn-RF_+_IsoForest-F7931E?style=flat-square&logo=scikitlearn&logoColor=white) - Python Flask — 服务于所有模块的 REST API - Ultralytics YOLOv8 — 实时目标检测 - scikit-learn — Random Forest + Isolation Forest - Pandas / NumPy — 数据处理 **ML Pipeline** ![AutoDiscovery](https://img.shields.io/badge/Pipeline-Auto_Discovery-8A2BE2?style=flat-square) ![Datasets](https://img.shields.io/badge/Datasets-5_Merged-00ff88?style=flat-square) - 自动发现扫描器 — 递归查找并合并所有数据集 - 模糊列映射 — 自动处理不同的数据集 schema - 生成 PKL 模型文件 + 5 个 EDA 可视化 PNG 文件 ## 📦 数据集 | 数据集 | 大小 | 领域 | 用途 | |---|---|---|---| | NSL-KDD (Train + Test) | ~5.1 MB | 网络入侵 | RF 威胁分类 | | RT-IoT2022 | 52 MB | IoT 传感器数据 | 异常检测 | | UNSW-NB15 Events | 5 KB | 网络事件 | 特征增强 | | train_test_network.csv | 29 MB | 网络流量 | 多类别分类 | | cybersecurity_intrusion_data.csv | 709 KB | 入侵模式 | EDA + 特征分析 | ## 📁 项目结构 ``` CHAKRAVYUH_AI/ │ ├── 📁 backend/ │ ├── app.py # Flask REST API (32 KB) │ └── requirements.txt │ ├── 📁 frontend/ │ ├── 📁 src/ │ │ └── App.jsx # Main React app — 9 modules (3312 lines) │ ├── 📁 public/ │ │ └── 📁 maps/ │ │ └── ne_50m_admin_0_countries.json # Natural Earth GeoJSON │ ├── package.json │ └── package-lock.json │ ├── 📁 ml_pipeline/ │ ├── run_pipeline.py # Auto-discovery ML pipeline (39 KB) │ └── requirements.txt │ ├── download_borders.py # Natural Earth data utility └── README.md ``` ## 🚀 设置与安装 ### 前置条件 ![Python](https://img.shields.io/badge/Python-3.9+-3776AB?style=flat-square&logo=python&logoColor=white) ![Node](https://img.shields.io/badge/Node.js-18+-339933?style=flat-square&logo=nodedotjs&logoColor=white) ### 1. Backend ``` cd backend pip install -r requirements.txt python app.py # API 运行于 http://localhost:5000 ``` ### 2. Frontend ``` cd frontend npm install npm start # Dashboard 运行于 http://localhost:3000 ``` ### 3. ML Pipeline *(可选 — 用于重新生成模型)* ``` cd ml_pipeline # 将您的数据集放置在 datasets/ 文件夹中 # 运行 pipeline — 自动发现所有 CSV python run_pipeline.py # 将生成的 PKL 文件复制到 backend cp chakravyuh_outputs/*.pkl ../backend/chakravyuh_outputs/ ``` ### 4. Map Data *(可选 — 用于更高分辨率的边境数据)* ``` # 从根目录 python download_borders.py ``` ## 📡 API 参考 | Endpoint | Method | 描述 | |---|---|---| | `/health` | `GET` | 系统状态 — 模型、引擎、运行时间 | | `/api/sensor-data` | `GET` | 实时威胁源 — 每个级别 4 个威胁 | | `/api/risk-zones` | `GET` | 27 个预测的高风险边境区域 | | `/api/analytics` | `GET` | ML 模型统计数据和数据集指标 | | `/api/analyze-frame` | `POST` | YOLOv8 + Isolation Forest + RF pipeline | | `/api/tactical-brief` | `POST` | AI 生成的 SITREP(本地回退已激活) | ## 📊 ML Pipeline 结果 ``` ╔══════════════════════════════════════════════════╗ ║ CHAKRAVYUH-AI ML Pipeline v5.0 ║ ╠══════════════════════════════════════════════════╣ ║ Datasets discovered : 5 files ║ ║ Total rows merged : 8,208 ║ ╠══════════════════════════════════════════════════╣ ║ Random Forest Accuracy : 80.2% ║ ║ Cross-Validation (5-fold): 73.9% ║ ╠══════════════════════════════════════════════════╣ ║ Isolation Forest : 12% contamination ║ ║ Anomalies Detected : 975 ║ ╠══════════════════════════════════════════════════╣ ║ Risk Zones Predicted : 27 ║ ║ PKL Models Generated : 2 ║ ╚══════════════════════════════════════════════════╝ ``` ## 🔐 安全 - API 密钥**绝不**存储在源文件中——仅通过环境变量设置 - 所有数据集通过 `.gitignore` 排除在仓库之外 - PKL 模型文件已排除——使用 `run_pipeline.py` 重新生成 - YOLOv8 模型权重已排除——首次运行时由 Ultralytics 自动下载
**CHAKRAVYUH-AI v1.0** · 边境防御与监控 ![Built with](https://img.shields.io/badge/Built_with-React_+_Python_+_AI/ML-00e5ff?style=for-the-badge)
标签:Apex, Flask, HTTP/HTTPS抓包, Python, PyTorch, React, Scikit-learn, Syscalls, YOLOv8, 人工智能, 仪表盘, 传感器数据, 军事应用, 凭据扫描, 威胁分类, 异常检测, 态势感知, 情报分析, 数据融合, 无后门, 机器学习, 深度学习, 用户模式Hook绕过, 监控情报, 目标检测, 目标识别, 网络安全, 网络诊断, 自定义脚本, 视频监控, 计算机视觉, 边境防御, 逆向工具, 随机森林, 隐私保护, 隔离森林