# 农作物病虫害识别 Web 系统 **Repository Path**: zcy27/implement-algorithm-library ## Basic Information - **Project Name**: 农作物病虫害识别 Web 系统 - **Description**: 本项目面向农作物病虫害识别场景,提供从前端交互到模型推理的完整 Web 应用能力。用户可以通过网页上传图片、上传视频或接入摄像头,调用 YOLO 模型完成目标检测,并在页面中查看识别结果。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 137 - **Created**: 2026-05-26 - **Last Updated**: 2026-05-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # YOLO Crop Disease Detection Web 一个基于 `Vue + Flask + YOLO + PyTorch` 的农作物病虫害识别 Web 系统,支持图像检测、视频检测和摄像头实时检测。 ## 项目简介 本项目面向农作物病虫害识别场景,提供从前端交互到模型推理的完整 Web 应用能力。用户可以通过网页上传图片、上传视频或接入摄像头,调用 YOLO 模型完成目标检测,并在页面中查看识别结果。 ## 功能特性 - 图像检测 - 视频检测 - 摄像头实时检测 - 模型权重切换 - 检测置信度调节 - 识别结果可视化展示 - Web 页面交互式操作 ## 技术栈 - Frontend: `Vue` - Backend: `Flask`, `Flask-SocketIO` - Deep Learning: `YOLO`, `PyTorch` - Computer Vision: `OpenCV` - Optional Service: `Spring Boot`, `MySQL` ## 项目结构 ```text yolo_cropDisease_detection_web/ ├─ README.md ├─ predictImg.py ├─ ffmpeg-7.1-full_build/ ├─ yolo_cropDisease_detection_flask/ ├─ yolo_cropDisease_detection_springboot/ ├─ yolo_cropDisease_detection_vue/ ├─ 测试图片/ └─ cropdisease.sql ``` ## 运行环境 - `Python 3.10` 或 `Python 3.11` - `Node.js 18+` - `npm 9+` - `Windows` ## Python 依赖 核心依赖包括: - `torch` - `torchvision` - `torchaudio` - `flask` - `flask-socketio` - `opencv-python` - `requests` - `ultralytics` 安装方式: ```powershell pip install -r requirements.txt ``` ## 模型文件 默认模型权重位于: ```text yolo_cropDisease_detection_flask/weights/Pest_best.pt ``` 如需增加新模型,可将权重文件放入 `yolo_cropDisease_detection_flask/weights/` 目录,并在前端页面中选择对应模型。 ## 启动方式 ### 1. 启动 Flask 推理服务 ```powershell cd "E:\湖南大学\暑期学习\开源安全奖励计划\yolo_detection\yolo_detection\yolo_cropDisease_detection_web\yolo_cropDisease_detection_flask" python -m venv .venv .\.venv\Scripts\Activate.ps1 pip install -r requirements.txt python main.py ``` 默认服务地址: ```text http://127.0.0.1:5000 ``` 健康检查接口: ```text http://127.0.0.1:5000/health ``` ### 2. 启动 Vue 前端 ```powershell cd "E:\湖南大学\暑期学习\开源安全奖励计划\yolo_detection\yolo_detection\yolo_cropDisease_detection_web\yolo_cropDisease_detection_vue" npm install npm run dev -- --host 0.0.0.0 ``` 默认访问地址: ```text http://127.0.0.1:8888/index.html ``` ## 使用说明 ### 图像检测 1. 打开图像检测页面 2. 选择模型权重 3. 上传待检测图片 4. 调整置信度阈值 5. 点击“开始预测” 6. 查看检测结果 ### 视频检测 1. 打开视频检测页面 2. 上传待检测视频 3. 选择模型并设置阈值 4. 开始检测并查看结果 ### 摄像头检测 1. 打开摄像头检测页面 2. 授权浏览器访问摄像头 3. 选择模型并设置阈值 4. 开始实时检测 ## 扩展模块 项目中保留了 `Spring Boot` 与 `MySQL` 相关模块,可用于扩展: - 用户管理 - 记录管理 - 后台业务接口 如需启用,请额外配置: - `Java 8` - `Maven` - `MySQL` 并导入数据库脚本: ```text cropdisease.sql ``` ## 常见问题 ### 1. 模型可以启动,但图片无法识别 通常是因为输入图片不在当前模型的目标类别范围内。请使用与训练任务对应的病虫害图片进行测试。 ### 2. 前端页面可以打开,但检测接口调用失败 请先确认 Flask 服务已启动,并能正常访问: ```text http://127.0.0.1:5000/health ``` ### 3. 权重文件无法加载 请检查模型文件是否存在于 `yolo_cropDisease_detection_flask/weights/` 目录,并确认文件名与前端选择项一致。 ## 开源说明 本项目可作为病虫害识别、YOLO Web 部署、目标检测前后端联调的参考实现。