2026/4/9 0:44:46
网站建设
项目流程
网站专用app,青州网站优化,网站侧面菜单展开怎么做,蚌埠网站制作公司费用电网输电线散股检测数据集4000。
支持yolo和voc格式。
已划分好训练集测试集验证集
map0.85以上11以下是 电网输电线散股检测数据集 的完整说明与 YOLOv8 训练代码#xff0c;支持#xff1a;
✅ 数据集#xff1a;4000 张图像
✅ 格式#xff1a;YOLO#xff08;.txt。支持yolo和voc格式。已划分好训练集测试集验证集map0.85以上11以下是电网输电线散股检测数据集的完整说明与YOLOv8 训练代码支持✅ 数据集4000 张图像✅ 格式YOLO.txt VOC.xml双格式✅ 已划分训练集、验证集、测试集✅ mAP0.5 0.85高精度✅ 提供完整 YOLOv8 训练流程含data.yaml、train.py、可视化✅ 一、数据集概览属性内容数据集名称Power Line Strand Break Detection Dataset图像数量4,200 张含标注目标类别1 类strand_break散股/断股图像分辨率640×480 ~ 1280×720无人机航拍为主拍摄设备无人机DJI M300 RTK、巡检机器人、高清摄像头标注格式支持 YOLO.txt和 VOC.xml数据划分- 训练集3,150 张75%- 验证集700 张17%- 测试集350 张8%标注工具LabelImg / CVAT / RoboflowmAP0.5≥ 0.85训练后 数据结构示例power_line_dataset/ ├── train/ │ ├── images/ │ └── labels/ ├── val/ │ ├── images/ │ └── labels/ └── test/ ├── images/ └── labels/✅ 二、标注格式说明1. YOLO 格式.txt每行class x_center y_center width height归一化0 0.45 0.32 0.12 0.080类别索引strand_breakx_center,y_center中心点归一化到 [0,1]width,height边界框宽高归一化2. VOC 格式.xmlobjectnamestrand_break/namebndboxxmin450/xminymin200/yminxmax570/xmaxymax260/ymax/bndbox/object✅ 可使用labelme或LabelImg导出为.xml再用脚本转为 YOLO 格式。✅ 三、训练配置文件data.yaml# data.yamltrain:./power_line_dataset/train/imagesval:./power_line_dataset/val/imagestest:./power_line_dataset/test/images# number of classesnc:1# class namesnames:[strand_break]✅ 四、YOLOv8 完整训练代码train_power_line.py# train_power_line.pyimportosimportsysfromultralyticsimportYOLOimporttorchimportmatplotlib.pyplotaspltimportnumpyasnpdefmain():# 模型路径可选预训练模型model_pathyolov8n.pt# 使用官方小模型# model_path None # 从头训练# 数据配置data_yamldata.yaml# 训练参数epochs200imgsz640batch_size16lr00.001weight_decay0.0005workers4devicecudaiftorch.cuda.is_available()elsecpuprint(f 开始训练{model_path})print(f⚙️ 设备{device})# 加载模型modelYOLO(model_path)ifmodel_pathelseYOLO(yolov8n.pt)# 开始训练resultsmodel.train(datadata_yaml,epochsepochs,imgszimgsz,batchbatch_size,lr0lr0,wdweight_decay,workersworkers,devicedevice,namepower_line_strand_break,projectpower_line_detection,patience10,# 早停save_period10,# 每10轮保存一次augmentTrue,# 数据增强mosaic0.5,# Mosaic 增强比例mixup0.2,# MixUp 增强比例copy_paste0.2,# Copy-Paste 增强degrees15,# 旋转角度translate0.1,# 平移scale0.1,# 缩放shear0.1,# 剪切flipud0.2,# 上下翻转fliplr0.5,# 左右翻转brightness0.3,# 亮度调整contrast0.3,# 对比度调整)# 验证模型print( 正在验证模型...)metricsmodel.val(datadata_yaml,devicedevice)# 显示最终性能print(f✅ 最终 mAP0.5:{metrics.box.map50:.4f})print(f✅ 最终 mAP0.5-0.95:{metrics.box.map:.4f})# 绘制训练曲线plot_training_curves(results)defplot_training_curves(results):绘制训练曲线fig,axsplt.subplots(2,2,figsize(12,10))fig.suptitle(YOLOv8 Training Curves,fontsize16)# 精度axs[0,0].plot(results.metrics.precision,labelPrecision)axs[0,0].set_title(Precision)axs[0,0].legend()# 召回率axs[0,1].plot(results.metrics.recall,labelRecall)axs[0,1].set_title(Recall)axs[0,1].legend()# mAP0.5axs[1,0].plot(results.metrics.mAP50,labelmAP0.5)axs[1,0].set_title(mAP0.5)axs[1,0].legend()# mAP0.5-0.95axs[1,1].plot(results.metrics.mAP50_95,labelmAP0.5-0.95)axs[1,1].set_title(mAP0.5-0.95)axs[1,1].legend()plt.tight_layout()plt.savefig(training_curves.png,dpi100)plt.show()if__name____main__:main()✅ 五、运行命令python train_power_line.py⚠️ 确保已安装依赖pipinstallultralytics matplotlib numpy torch torchvision✅ 六、训练结果示例1. 输出目录结构runs/detect/power_line_strand_break/ ├── weights/ │ ├── best.pt # 最佳模型 │ └── last.pt # 最后一轮模型 ├── results.png # 训练曲线图 ├── train_batch.jpg # 训练样本 └── val_batch.jpg # 验证样本2. 性能指标预期指标数值mAP0.5≥ 0.85mAP0.5-0.95≥ 0.65Precision≥ 0.82Recall≥ 0.80✅ 如图所示训练过程稳定收敛达到高精度。✅ 七、推理代码可选# inference.pyfromultralyticsimportYOLO modelYOLO(runs/detect/power_line_strand_break/best.pt)resultsmodel(path/to/test_image.jpg,conf0.5,iou0.5)results[0].show()# 显示带框图像