Initial commit: Video detection platform with YOLO models

Features:
- Fire detection (YOLOv10)
- Helmet detection (YOLOv8)
- Crowd detection (YOLOv8)
- Smoking detection (YOLOv8)
- Loitering detection (YOLOv8)

Tech Stack:
- Frontend: Vue 3 + Vite + Element Plus
- Backend: FastAPI + WebSocket
- Monorepo: pnpm workspace + Turbo
- Docker support included
This commit is contained in:
wwh
2026-05-18 10:54:10 +08:00
commit 8fb58c75fe
42 changed files with 6663 additions and 0 deletions

21
scripts/dev.sh Normal file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
# 开发模式启动脚本
echo "🚀 启动开发服务器..."
# 使用 concurrently 同时启动前后端
cd "$(dirname "$0")/.."
# 检查 concurrently
if ! command -v concurrently &> /dev/null; then
echo "📦 安装 concurrently..."
pnpm add -D concurrently
fi
# 启动前后端
pnpm concurrently \
--names "frontend,backend" \
--prefix-colors "blue,green" \
"cd apps/web && pnpm dev" \
"cd apps/server && source venv/bin/activate && python main.py"

83
scripts/setup.sh Normal file
View File

@@ -0,0 +1,83 @@
#!/bin/bash
# 视频模型检测平台 - 初始化脚本
set -e
echo "🚀 开始初始化 jc-video-web 项目..."
# 检查 pnpm
if ! command -v pnpm &> /dev/null; then
echo "📦 安装 pnpm..."
npm install -g pnpm
fi
# 安装根依赖
echo "📦 安装根依赖..."
cd "$(dirname "$0")/.."
pnpm install
# 安装前端依赖
echo "📦 安装前端依赖..."
cd apps/web
pnpm install
cd ../..
# 检查 Python 虚拟环境
if [ ! -d "apps/server/venv" ]; then
echo "🐍 创建 Python 虚拟环境..."
cd apps/server
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cd ../..
else
echo "✓ Python 虚拟环境已存在"
fi
# 创建必要的目录
echo "📁 创建必要的目录..."
mkdir -p apps/server/static/{uploads,results,temp}
mkdir -p models/{fire_detection,helmet_detection,crowd_detection,smoking_detection}
# 链接模型文件(如果不存在)
echo "🔗 检查模型文件链接..."
# 火灾检测模型
if [ ! -f "models/fire_detection/best.pt" ]; then
if [ -f "../../fire_detection/models/best.pt" ]; then
ln -sf "$(pwd)/../../fire_detection/models/best.pt" models/fire_detection/
fi
fi
# 安全帽检测模型
if [ ! -f "models/helmet_detection/yolov8n.pt" ]; then
if [ -f "../../yolov/yolov8n.pt" ]; then
ln -sf "$(pwd)/../../yolov/yolov8n.pt" models/helmet_detection/
fi
fi
# 人群检测模型
if [ ! -f "models/crowd_detection/yolov8l.pt" ]; then
if [ -f "../../behavior_detection/Crowd-Gathering/models/yolov8l.pt" ]; then
ln -sf "$(pwd)/../../behavior_detection/Crowd-Gathering/models/yolov8l.pt" models/crowd_detection/
fi
fi
# 抽烟检测模型
if [ ! -f "models/smoking_detection/smoking_yolov8n.pt" ]; then
if [ -f "../../behavior_detection/smoker-detection/models/smoking_yolov8n.pt" ]; then
ln -sf "$(pwd)/../../behavior_detection/smoker-detection/models/smoking_yolov8n.pt" models/smoking_detection/
fi
fi
echo "✅ 初始化完成!"
echo ""
echo "📝 可用命令:"
echo " pnpm dev - 同时启动前后端开发服务器"
echo " pnpm dev:web - 只启动前端开发服务器"
echo " pnpm dev:server - 只启动后端开发服务器"
echo ""
echo "🌐 访问地址:"
echo " 前端: http://localhost:5173"
echo " 后端: http://localhost:8000"