免费个人网站服务器推荐linux wordpress配置文件
2026/6/1 9:10:01 网站建设 项目流程
免费个人网站服务器推荐,linux wordpress配置文件,app store怎么退款,国际军事新闻最新消息中国一、项目介绍 本项目旨在开发一个基于深度学习的植物病害检测系统#xff0c;采用YOLOv10目标检测模型#xff0c;能够高效准确地识别和分类多种植物叶片上的病害。系统支持实时摄像头检测及图片视频检测#xff0c;具有较强的实用性和可扩展性#xff0c;适用于农业病害监…一、项目介绍本项目旨在开发一个基于深度学习的植物病害检测系统采用YOLOv10目标检测模型能够高效准确地识别和分类多种植物叶片上的病害。系统支持实时摄像头检测及图片视频检测具有较强的实用性和可扩展性适用于农业病害监控和农田管理等实际场景。主要功能植物病害检测该系统基于YOLOv10You Only Look Once的深度学习目标检测技术能够对30种植物叶片病害进行准确分类。包括但不限于苹果斑点、番茄早期炭疽病、葡萄黑腐病等常见植物病害。实时摄像头检测支持通过连接摄像头实时捕捉图像并进行病害识别。该功能可以实现农田监控或温室环境中的实时病害监测。图片和视频检测系统不仅可以处理静态图片也支持处理视频流用户可以批量上传图片或视频文件系统会自动检测其中的病害并返回检测结果。YOLOv10模型训练与优化本项目使用的YOLOv10模型通过在提供的病害数据集上训练优化模型参数达到较高的检测精度。数据集包含了2009张训练图片和246张验证图片涵盖了30种不同的植物病害。UI界面提供简洁易用的用户界面用户可以通过UI上传图片或视频查看实时检测结果。界面包括病害检测结果的显示、模型输出的分类标签、预测置信度以及检测框的位置。部署与使用系统采用Python语言开发依赖深度学习框架PyTorch支持Windows和Linux平台的部署。用户通过简单的操作便可启动实时监测或批量检测适合农业从业者和研究人员使用。数据集本项目使用的病害数据集包含30类植物病害每个类别对应一个特定的植物叶片病变。每个类别的样本包含了不同植物的叶片图像数据集的数量包括2009张训练集图像和246张验证集图像覆盖了不同的植物种类和病害类型。项目技术架构深度学习模型YOLOv10目标检测数据集训练集2009张验证集246张开发语言Python深度学习框架PyTorch界面框架PyQt或Tkinter根据实际开发选择实时检测支持摄像头输入实时捕捉并识别植物病害输出形式可视化检测结果包括病害类别、置信度等基于深度学习的植物病害检测系统YOLOv10YOLO数据集UI界面Python项目源码模型_哔哩哔哩_bilibili基于深度学习的植物病害检测系统YOLOv10YOLO数据集UI界面Python项目源码模型二、项目功能展示系统功能✅图片检测可对图片进行检测返回检测框及类别信息。✅视频检测支持视频文件输入检测视频中每一帧的情况。✅摄像头实时检测连接USB 摄像头实现实时监测。✅参数实时调节置信度和IoU阈值图片检测该功能允许用户通过单张图片进行目标检测。输入一张图片后YOLO模型会实时分析图像识别出其中的目标并在图像中框出检测到的目标输出带有目标框的图像。批量图片检测用户可以一次性上传多个图片进行批量处理。该功能支持对多个图像文件进行并行处理并返回每张图像的目标检测结果适用于需要大规模处理图像数据的应用场景。视频检测视频检测功能允许用户将视频文件作为输入。YOLO模型将逐帧分析视频并在每一帧中标记出检测到的目标。最终结果可以是带有目标框的视频文件或实时展示适用于视频监控和分析等场景。摄像头实时检测该功能支持通过连接摄像头进行实时目标检测。YOLO模型能够在摄像头拍摄的实时视频流中进行目标检测实时识别并显示检测结果。此功能非常适用于安防监控、无人驾驶、智能交通等应用提供即时反馈。核心特点高精度基于YOLO模型提供精确的目标检测能力适用于不同类型的图像和视频。实时性特别优化的算法使得实时目标检测成为可能无论是在视频还是摄像头实时检测中响应速度都非常快。批量处理支持高效的批量图像和视频处理适合大规模数据分析。三、数据集介绍本项目使用的植物病害数据集包含了30种常见植物叶片病害的图像旨在为基于深度学习的病害检测模型如YOLOv10提供高质量的训练数据。数据集包含多种植物的叶片图像涵盖了不同类型的病害能够帮助模型在多种环境下进行有效的病害识别。数据集概况数据集类型图像分类与目标检测数据集图像数量训练集2009张图像验证集246张图像分类数量30类植物病害图像分辨率图像分辨率较为一致但可能因拍摄角度、光照条件等因素有所差异。主要类别30类植物病害以下是数据集中包含的30种植物叶片病害类别及其对应的植物种类Apple Scab Leaf苹果叶斑病Apple Leaf苹果叶Apple Rust Leaf苹果锈病Bell Pepper Leaf Spot甜椒叶斑病Bell Pepper Leaf甜椒叶Blueberry Leaf蓝莓叶Cherry Leaf樱桃叶Corn Gray Leaf Spot玉米灰斑病Corn Leaf Blight玉米叶枯病Corn Rust Leaf玉米锈病Peach Leaf桃树叶Potato Leaf Early Blight马铃薯早期晚疫病Potato Leaf Late Blight马铃薯晚期晚疫病Potato Leaf马铃薯叶Raspberry Leaf覆盆子叶Soyabean Leaf大豆叶Soybean Leaf大豆叶Squash Powdery Mildew Leaf南瓜白粉病Strawberry Leaf草莓叶Tomato Early Blight Leaf番茄早期炭疽病Tomato Septoria Leaf Spot番茄Septoria叶斑病Tomato Leaf Bacterial Spot番茄细菌性斑点病Tomato Leaf Late Blight番茄晚疫病Tomato Leaf Mosaic Virus番茄花叶病毒Tomato Leaf Yellow Virus番茄黄化病毒Tomato Leaf番茄叶Tomato Mold Leaf番茄霉病Tomato Two Spotted Spider Mites Leaf番茄两点蜘蛛螨Grape Leaf Black Rot葡萄黑腐病Grape Leaf葡萄叶训练集验证集数据集配置文件data.yamltrain: .\datasets\images\train val: .\datasets\images\val test: .\datasets\images\test nc: 30 names: [Apple Scab Leaf, Apple leaf, Apple rust leaf, Bell_pepper leaf spot, Bell_pepper leaf, Blueberry leaf, Cherry leaf, Corn Gray leaf spot, Corn leaf blight, Corn rust leaf, Peach leaf, Potato leaf early blight, Potato leaf late blight, Potato leaf, Raspberry leaf, Soyabean leaf, Soybean leaf, Squash Powdery mildew leaf, Strawberry leaf, Tomato Early blight leaf, Tomato Septoria leaf spot, Tomato leaf bacterial spot, Tomato leaf late blight, Tomato leaf mosaic virus, Tomato leaf yellow virus, Tomato leaf, Tomato mold leaf, Tomato two spotted spider mites leaf, grape leaf black rot, grape leaf]数据集制作流程标注数据使用标注工具如LabelImg、CVAT等对图像中的目标进行标注。每个目标需要标出边界框并且标注类别。转换格式将标注的数据转换为YOLO格式。YOLO标注格式为每行object-class x_center y_center width height这些坐标是相对于图像尺寸的比例。分割数据集将数据集分为训练集、验证集和测试集通常的比例是80%训练集、10%验证集和10%测试集。准备标签文件为每张图片生成一个对应的标签文件确保标签文件与图片的命名一致。调整图像尺寸根据YOLO网络要求统一调整所有图像的尺寸如416x416或608x608。四、项目环境配置创建虚拟环境首先新建一个Anaconda环境每个项目用不同的环境这样项目中所用的依赖包互不干扰。终端输入conda create -n yolov10 python3.9激活虚拟环境conda activate yolov10安装cpu版本pytorchpip install torch torchvision torchaudiopycharm中配置anaconda安装所需要库pip install -r requirements.txt五、模型训练训练代码from ultralytics import YOLOv10 model_path yolov10s.pt data_path datasets/data.yaml if __name__ __main__: model YOLOv10(model_path) results model.train(datadata_path, epochs500, batch64, device0, workers0, projectruns/detect, nameexp, )根据实际情况更换模型 yolov10n.yaml (nano)轻量化模型适合嵌入式设备速度快但精度略低。 yolov10s.yaml (small)小模型适合实时任务。 yolov10m.yaml (medium)中等大小模型兼顾速度和精度。 yolov10b.yaml (base)基本版模型适合大部分应用场景。 yolov10l.yaml (large)大型模型适合对精度要求高的任务。--batch 64每批次64张图像。--epochs 500训练500轮。--datasets/data.yaml数据集配置文件。--weights yolov10s.pt初始化模型权重yolov10s.pt是预训练的轻量级YOLO模型。训练结果六、核心代码import sys import cv2 import numpy as np from PyQt5.QtWidgets import QApplication, QMessageBox, QFileDialog from PyQt5.QtCore import QThread, pyqtSignal from ultralytics import YOLOv10 from UiMain import UiMainWindow import time import os class DetectionThread(QThread): frame_received pyqtSignal(np.ndarray, np.ndarray, list) # 原始帧, 检测帧, 检测结果 finished_signal pyqtSignal() # 线程完成信号 def __init__(self, model, source, conf, iou, parentNone): super().__init__(parent) self.model model self.source source self.conf conf self.iou iou self.running True def run(self): try: if isinstance(self.source, int) or self.source.endswith((.mp4, .avi, .mov)): # 视频或摄像头 cap cv2.VideoCapture(self.source) while self.running and cap.isOpened(): ret, frame cap.read() if not ret: break # 保存原始帧 original_frame frame.copy() # 检测 results self.model(frame, confself.conf, iouself.iou) annotated_frame results[0].plot() # 提取检测结果 detections [] for result in results: for box in result.boxes: class_id int(box.cls) class_name self.model.names[class_id] confidence float(box.conf) x, y, w, h box.xywh[0].tolist() detections.append((class_name, confidence, x, y)) # 发送信号 self.frame_received.emit( cv2.cvtColor(original_frame, cv2.COLOR_BGR2RGB), cv2.cvtColor(annotated_frame, cv2.COLOR_BGR2RGB), detections ) # 控制帧率 time.sleep(0.03) # 约30fps cap.release() else: # 图片 frame cv2.imread(self.source) if frame is not None: original_frame frame.copy() results self.model(frame, confself.conf, iouself.iou) annotated_frame results[0].plot() # 提取检测结果 detections [] for result in results: for box in result.boxes: class_id int(box.cls) class_name self.model.names[class_id] confidence float(box.conf) x, y, w, h box.xywh[0].tolist() detections.append((class_name, confidence, x, y)) self.frame_received.emit( cv2.cvtColor(original_frame, cv2.COLOR_BGR2RGB), cv2.cvtColor(annotated_frame, cv2.COLOR_BGR2RGB), detections ) except Exception as e: print(fDetection error: {e}) finally: self.finished_signal.emit() def stop(self): self.running False class MainWindow(UiMainWindow): def __init__(self): super().__init__() # 初始化模型 self.model None self.detection_thread None self.current_image None self.current_result None self.video_writer None self.is_camera_running False self.is_video_running False self.last_detection_result None # 新增保存最后一次检测结果 # 连接按钮信号 self.image_btn.clicked.connect(self.detect_image) self.video_btn.clicked.connect(self.detect_video) self.camera_btn.clicked.connect(self.detect_camera) self.stop_btn.clicked.connect(self.stop_detection) self.save_btn.clicked.connect(self.save_result) # 初始化模型 self.load_model() def load_model(self): try: model_name self.model_combo.currentText() self.model YOLOv10(f{model_name}.pt) # 自动下载或加载本地模型 self.update_status(f模型 {model_name} 加载成功) except Exception as e: QMessageBox.critical(self, 错误, f模型加载失败: {str(e)}) self.update_status(模型加载失败) def detect_image(self): if self.detection_thread and self.detection_thread.isRunning(): QMessageBox.warning(self, 警告, 请先停止当前检测任务) return file_path, _ QFileDialog.getOpenFileName( self, 选择图片, , 图片文件 (*.jpg *.jpeg *.png *.bmp)) if file_path: self.clear_results() self.current_image cv2.imread(file_path) self.current_image cv2.cvtColor(self.current_image, cv2.COLOR_BGR2RGB) self.display_image(self.original_image_label, self.current_image) # 创建检测线程 conf self.confidence_spinbox.value() iou self.iou_spinbox.value() self.detection_thread DetectionThread(self.model, file_path, conf, iou) self.detection_thread.frame_received.connect(self.on_frame_received) self.detection_thread.finished_signal.connect(self.on_detection_finished) self.detection_thread.start() self.update_status(f正在检测图片: {os.path.basename(file_path)}) def detect_video(self): if self.detection_thread and self.detection_thread.isRunning(): QMessageBox.warning(self, 警告, 请先停止当前检测任务) return file_path, _ QFileDialog.getOpenFileName( self, 选择视频, , 视频文件 (*.mp4 *.avi *.mov)) if file_path: self.clear_results() self.is_video_running True # 初始化视频写入器 cap cv2.VideoCapture(file_path) frame_width int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) frame_height int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) fps cap.get(cv2.CAP_PROP_FPS) cap.release() # 创建保存路径 save_dir results os.makedirs(save_dir, exist_okTrue) timestamp time.strftime(%Y%m%d_%H%M%S) save_path os.path.join(save_dir, fresult_{timestamp}.mp4) fourcc cv2.VideoWriter_fourcc(*mp4v) self.video_writer cv2.VideoWriter(save_path, fourcc, fps, (frame_width, frame_height)) # 创建检测线程 conf self.confidence_spinbox.value() iou self.iou_spinbox.value() self.detection_thread DetectionThread(self.model, file_path, conf, iou) self.detection_thread.frame_received.connect(self.on_frame_received) self.detection_thread.finished_signal.connect(self.on_detection_finished) self.detection_thread.start() self.update_status(f正在检测视频: {os.path.basename(file_path)}) def detect_camera(self): if self.detection_thread and self.detection_thread.isRunning(): QMessageBox.warning(self, 警告, 请先停止当前检测任务) return self.clear_results() self.is_camera_running True # 创建检测线程 (默认使用摄像头0) conf self.confidence_spinbox.value() iou self.iou_spinbox.value() self.detection_thread DetectionThread(self.model, 0, conf, iou) self.detection_thread.frame_received.connect(self.on_frame_received) self.detection_thread.finished_signal.connect(self.on_detection_finished) self.detection_thread.start() self.update_status(正在从摄像头检测...) def stop_detection(self): if self.detection_thread and self.detection_thread.isRunning(): self.detection_thread.stop() self.detection_thread.quit() self.detection_thread.wait() if self.video_writer: self.video_writer.release() self.video_writer None self.is_camera_running False self.is_video_running False self.update_status(检测已停止) def on_frame_received(self, original_frame, result_frame, detections): # 更新原始图像和结果图像 self.display_image(self.original_image_label, original_frame) self.display_image(self.result_image_label, result_frame) # 保存当前结果帧用于后续保存 self.last_detection_result result_frame # 新增保存检测结果 # 更新表格 self.clear_results() for class_name, confidence, x, y in detections: self.add_detection_result(class_name, confidence, x, y) # 保存视频帧 if self.video_writer: self.video_writer.write(cv2.cvtColor(result_frame, cv2.COLOR_RGB2BGR)) def on_detection_finished(self): if self.video_writer: self.video_writer.release() self.video_writer None self.update_status(视频检测完成结果已保存) elif self.is_camera_running: self.update_status(摄像头检测已停止) else: self.update_status(图片检测完成) def save_result(self): if not hasattr(self, last_detection_result) or self.last_detection_result is None: QMessageBox.warning(self, 警告, 没有可保存的检测结果) return save_dir results os.makedirs(save_dir, exist_okTrue) timestamp time.strftime(%Y%m%d_%H%M%S) if self.is_camera_running or self.is_video_running: # 保存当前帧为图片 save_path os.path.join(save_dir, fsnapshot_{timestamp}.jpg) cv2.imwrite(save_path, cv2.cvtColor(self.last_detection_result, cv2.COLOR_RGB2BGR)) self.update_status(f截图已保存: {save_path}) else: # 保存图片检测结果 save_path os.path.join(save_dir, fresult_{timestamp}.jpg) cv2.imwrite(save_path, cv2.cvtColor(self.last_detection_result, cv2.COLOR_RGB2BGR)) self.update_status(f检测结果已保存: {save_path}) def closeEvent(self, event): self.stop_detection() event.accept() if __name__ __main__: app QApplication(sys.argv) # 设置应用程序样式 app.setStyle(Fusion) # 创建并显示主窗口 window MainWindow() window.show() sys.exit(app.exec_())七、项目演示与介绍视频基于深度学习的植物病害检测系统YOLOv10YOLO数据集UI界面Python项目源码模型_哔哩哔哩_bilibili基于深度学习的植物病害检测系统YOLOv10YOLO数据集UI界面Python项目源码模型

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询