当前位置: 首页 > article >正文

省赛中药检测模型调优

目录

  • 一、baseline性能
  • 二、baseline+ DETR head
  • 三、baseline+ RepC3K2
  • 四、baseline+ RepC3K2 + SimSPPF
  • 五、baseline+ RepC3K2 + SimSPPF + LK-C2PSA
  • 界面
    • 1.引入库
    • 2.读入数据
  • 总结


一、baseline性能

Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size120/120      6.91G      1.374      1.145      1.657          3        832: 100%|██████████| 482/482 [00:20<00:00, 23.48it/s]Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100%|██████████| 32/32 [00:01<00:00, 19.14it/s]all       1005       2152      0.782      0.739      0.811      0.474120 epochs completed in 0.792 hours.
Optimizer stripped from runs/ChineseMedTrain/exp8/weights/last.pt, 5.5MB
Optimizer stripped from runs/ChineseMedTrain/exp8/weights/best.pt, 5.5MBValidating runs/ChineseMedTrain/exp8/weights/best.pt...
Ultralytics 8.3.7 🚀 Python-3.9.19 torch-2.0.1+cu117 CUDA:0 (NVIDIA GeForce RTX 4090, 24209MiB)
YOLO11n summary (fused): 238 layers, 2,591,902 parameters, 0 gradients, 6.4 GFLOPsClass     Images  Instances      Box(P          R      mAP50  mAP50-95): 100%|██████████| 32/32 [00:02<00:00, 15.02it/s]all       1005       2152      0.788      0.735      0.811      0.474ginseng         34         57      0.869      0.772      0.864      0.483Leech         20         41      0.778      0.769      0.847      0.513JujubaeFructus         18         67      0.829      0.761       0.86      0.491LiliiBulbus         18         19       0.64      0.789      0.835      0.552CoptidisRhizoma         22         22      0.868      0.898       0.96      0.758MumeFructus         21         98      0.716      0.693      0.756      0.372MagnoliaBark         21         45      0.737      0.746      0.814      0.416Oyster         18         24      0.735      0.809      0.846      0.595Seahorse         14         33      0.835      0.424      0.493      0.274Luohanguo         17         21      0.834      0.714      0.793      0.593GlycyrrhizaUralensis         18         25       0.92       0.92      0.978      0.502Sanqi         32         42      0.753      0.714      0.761      0.544TetrapanacisMedulla         19         20      0.859      0.915      0.977      0.622CoicisSemen         24         35       0.88      0.628      0.823      0.492LyciiFructus         20         32      0.829      0.562      0.772      0.411TruestarAnise         18         60      0.853      0.679      0.894      0.376ClamShell         17         67      0.699      0.746      0.765      0.466Chuanxiong         28         69      0.782      0.623      0.766      0.372Garlic         24         70      0.801      0.748      0.793      0.341GinkgoBiloba         27        119      0.767      0.807      0.859      0.532ChrysanthemiFlos         13         20      0.786        0.7      0.734      0.436
AtractylodesMacrocephala         15         23      0.807      0.909      0.886      0.576JuglandisSemen         12         45       0.87      0.448      0.689      0.332TallGastrodiae         17         35      0.577       0.74      0.689      0.339TrionycisCarapax         15         22      0.666      0.636      0.749      0.515AngelicaRoot         18         35       0.78      0.886       0.89      0.538Hawthorn         21         47      0.683      0.366      0.565      0.253CrociStigma         20         22      0.951      0.874      0.948      0.523SerpentisPeriostracum         16         16      0.864      0.875      0.929      0.598EucommiaBark         17         32      0.844      0.781      0.841      0.484ImperataeRhizoma         21         22      0.904      0.909      0.944      0.579LoniceraJaponica         12         25      0.525      0.531      0.549      0.279Zhizi         20        128      0.806      0.336      0.589      0.242Scorpion         13         21      0.812       0.81      0.867      0.619HouttuyniaeHerba         16         16      0.952          1      0.995      0.596EupolyphagaSinensis         19         48      0.641      0.875      0.856      0.509OroxylumIndicum         31         67      0.827      0.821      0.886      0.458CurcumaLonga         34         63      0.718      0.726      0.738      0.444NelumbinisPlumula         17         20      0.797        0.7      0.748      0.458ArecaeSemen         22         66      0.668      0.424       0.71      0.352Scolopendra         19         25      0.801        0.6      0.667      0.437MoriFructus         22         64      0.725      0.688      0.687        0.3
FritillariaeCirrhosaeBulbus         24         26      0.747      0.846       0.87      0.561DioscoreaeRhizoma         23         34      0.896      0.757      0.911       0.45CicadaePeriostracum         17         41      0.824      0.927      0.914      0.531PiperCubeba         21         28      0.825      0.821      0.873      0.504BupleuriRadix         22         25      0.814       0.72      0.889      0.499AntelopeHom         18         48      0.771      0.839      0.853      0.556Pangdahai         19         71      0.859      0.769      0.882      0.575NelumbinisSemen         19         51      0.674       0.73      0.764      0.447
Speed: 0.2ms preprocess, 0.3ms inference, 0.0ms loss, 0.3ms postprocess per image
Results saved to runs/ChineseMedTrain/exp8

二、baseline+ DETR head

提醒:在yolo11之后添加RT-DETR会失败;正确的思路是利用RT-DETR作为baseline

经过测试,采用RT-DETR检测头,导致训练速度降低4倍。

三、baseline+ RepC3K2

改进的点:C3K2重参数化 Rep技术;

 Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size120/120      13.9G      1.225      0.874       1.51         45        352: 100%|██████████| 241/241 [00:18<00:00, 12.76it/s]Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100%|██████████| 16/16 [00:01<00:00,  9.69it/s]all       1005       2152      0.833      0.792      0.854      0.527120 epochs completed in 0.716 hours.
Optimizer stripped from runs/ChineseMedTrain/exp2/weights/last.pt, 5.6MB
Optimizer stripped from runs/ChineseMedTrain/exp2/weights/best.pt, 5.6MBValidating runs/ChineseMedTrain/exp2/weights/best.pt...
WARNING ⚠️ validating an untrained model YAML will result in 0 mAP.
Ultralytics 8.3.7 🚀 Python-3.9.19 torch-2.0.1+cu117 CUDA:0 (NVIDIA GeForce RTX 4090, 24209MiB)
YOLO11RepC3K2 summary (fused): 239 layers, 2,591,902 parameters, 0 gradients, 6.4 GFLOPsClass     Images  Instances      Box(P          R      mAP50  mAP50-95): 100%|██████████| 16/16 [00:02<00:00,  6.57it/s]all       1005       2152      0.833       0.79      0.854      0.527ginseng         34         57      0.859      0.853      0.914      0.581Leech         20         41      0.759      0.845      0.884      0.621JujubaeFructus         18         67      0.891      0.856      0.911      0.545LiliiBulbus         18         19       0.82      0.895      0.898      0.563CoptidisRhizoma         22         22      0.868      0.895       0.97      0.799MumeFructus         21         98      0.747      0.694      0.784      0.408MagnoliaBark         21         45      0.889      0.844      0.906      0.521Oyster         18         24      0.756      0.917      0.929      0.685Seahorse         14         33      0.942      0.489      0.593      0.345Luohanguo         17         21      0.767      0.762      0.777      0.618GlycyrrhizaUralensis         18         25      0.886          1      0.989      0.505Sanqi         32         42      0.735      0.714      0.788      0.586TetrapanacisMedulla         19         20      0.959       0.95      0.993      0.626CoicisSemen         24         35      0.936      0.835      0.922       0.59LyciiFructus         20         32      0.832      0.562      0.715      0.428TruestarAnise         18         60      0.936      0.732      0.939      0.415ClamShell         17         67      0.806      0.672      0.801      0.493Chuanxiong         28         69      0.797      0.783      0.803      0.439Garlic         24         70      0.806      0.643      0.817      0.421GinkgoBiloba         27        119       0.86      0.823      0.899      0.572ChrysanthemiFlos         13         20      0.788       0.75       0.71      0.429
AtractylodesMacrocephala         15         23      0.858      0.826      0.902      0.603JuglandisSemen         12         45      0.906      0.639       0.83      0.395TallGastrodiae         17         35      0.726      0.758      0.799      0.436TrionycisCarapax         15         22      0.782      0.818      0.811      0.601AngelicaRoot         18         35      0.877      0.914      0.909      0.586Hawthorn         21         47      0.873      0.638      0.754      0.374CrociStigma         20         22          1      0.952      0.957      0.541SerpentisPeriostracum         16         16      0.853      0.938      0.966      0.736EucommiaBark         17         32      0.854      0.875      0.913      0.572ImperataeRhizoma         21         22      0.913      0.955       0.95      0.621LoniceraJaponica         12         25      0.547        0.6      0.695      0.331Zhizi         20        128       0.82        0.5      0.685      0.309Scorpion         13         21      0.833      0.857      0.873      0.606HouttuyniaeHerba         16         16      0.951          1      0.995       0.65EupolyphagaSinensis         19         48       0.76      0.958       0.88      0.561OroxylumIndicum         31         67      0.838      0.821      0.932       0.51CurcumaLonga         34         63      0.667      0.698      0.815      0.501NelumbinisPlumula         17         20      0.886        0.7      0.777       0.51ArecaeSemen         22         66      0.879      0.667      0.894      0.455Scolopendra         19         25      0.776       0.64      0.638      0.467MoriFructus         22         64      0.719      0.679      0.677      0.307
FritillariaeCirrhosaeBulbus         24         26      0.736      0.846      0.906      0.641DioscoreaeRhizoma         23         34      0.828      0.847      0.909      0.493CicadaePeriostracum         17         41      0.828      0.937      0.914      0.581PiperCubeba         21         28       0.92      0.821      0.869      0.576BupleuriRadix         22         25      0.938        0.8      0.924      0.507AntelopeHom         18         48      0.817      0.812      0.911      0.584Pangdahai         19         71      0.869      0.746      0.874      0.583NelumbinisSemen         19         51      0.763      0.759      0.803      0.512
Speed: 0.4ms preprocess, 0.4ms inference, 0.0ms loss, 0.3ms postprocess per image
Results saved to runs/ChineseMedTrain/exp2

四、baseline+ RepC3K2 + SimSPPF

改进的点:SimSPPF简化SPPF模块;

engine/trainer: task=detect, mode=train, model=yolo11RepC3K2SimSPPF.yaml, data=ultralytics/cfg/datasets/originalChineseMed50.yaml, epochs=120, time=None, patience=150, batch=32, imgsz=640, save=True, save_period=10, cache=False, device=0, workers=8, project=runs/ChineseMedTrain, name=exp3, exist_ok=False, pretrained=/home/wqt/Projects/yolov11/ultralytics/runs/ChineseMedTrain/exp2/weights/best.pt, optimizer=auto, verbose=True, seed=0, deterministic=True, single_cls=False, rect=False, cos_lr=True, close_mosaic=10, resume=False, amp=True, fraction=1.0, profile=False, freeze=None, multi_scale=True, overlap_mask=True, mask_ratio=4, dropout=0.0, val=True, split=val, save_json=False, save_hybrid=False, conf=None, iou=0.7, max_det=300, half=False, dnn=False, plots=True, source=None, vid_stride=1, stream_buffer=False, visualize=False, augment=False, agnostic_nms=False, classes=None, retina_masks=False, embed=None, show=False, save_frames=False, save_txt=False, save_conf=False, save_crop=False, show_labels=True, show_conf=True, show_boxes=True, line_width=None, format=torchscript, keras=False, optimize=False, int8=False, dynamic=False, simplify=True, opset=None, workspace=4, nms=False, lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=7.5, cls=0.5, dfl=1.5, pose=12.0, kobj=1.0, label_smoothing=0.0, nbs=64, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.9, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, bgr=0.0, mosaic=1.0, mixup=0.2, copy_paste=0.0, copy_paste_mode=flip, auto_augment=randaugment, erasing=0.4, crop_fraction=1.0, cfg=None, tracker=botsort.yaml, save_dir=runs/ChineseMedTrain/exp3
Overriding model.yaml nc=80 with nc=50
WARNING ⚠️ no model scale passed. Assuming scale='n'.from  n    params  module                                       arguments                     0                  -1  1       464  ultralytics.nn.modules.conv.Conv             [3, 16, 3, 2]                 1                  -1  1      4672  ultralytics.nn.modules.conv.Conv             [16, 32, 3, 2]                2                  -1  1      6640  ultralytics.nn.modules.block.RepC3k2         [32, 64, 1, False, 0.25]      3                  -1  1     36992  ultralytics.nn.modules.conv.Conv             [64, 64, 3, 2]                4                  -1  1     26080  ultralytics.nn.modules.block.RepC3k2         [64, 128, 1, False, 0.25]     5                  -1  1    147712  ultralytics.nn.modules.conv.Conv             [128, 128, 3, 2]              6                  -1  1     89216  ultralytics.nn.modules.block.RepC3k2         [128, 128, 1, True]           7                  -1  1    295424  ultralytics.nn.modules.conv.Conv             [128, 256, 3, 2]              8                  -1  1    354560  ultralytics.nn.modules.block.RepC3k2         [256, 256, 1, True]           9                  -1  1    164608  ultralytics.nn.modules.block.SimSPPF         [256, 256, 5]                 
10                  -1  1    249728  ultralytics.nn.modules.block.C2PSA           [256, 256, 1]                 
11                  -1  1         0  torch.nn.modules.upsampling.Upsample         [None, 2, 'nearest']          
12             [-1, 6]  1         0  ultralytics.nn.modules.conv.Concat           [1]                           
13                  -1  1    111296  ultralytics.nn.modules.block.RepC3k2         [384, 128, 1, False]          
14                  -1  1         0  torch.nn.modules.upsampling.Upsample         [None, 2, 'nearest']          
15             [-1, 4]  1         0  ultralytics.nn.modules.conv.Concat           [1]                           
16                  -1  1     32096  ultralytics.nn.modules.block.RepC3k2         [256, 64, 1, False]           
17                  -1  1     36992  ultralytics.nn.modules.conv.Conv             [64, 64, 3, 2]                
18            [-1, 13]  1         0  ultralytics.nn.modules.conv.Concat           [1]                           
19                  -1  1     86720  ultralytics.nn.modules.block.RepC3k2         [192, 128, 1, False]          
20                  -1  1    147712  ultralytics.nn.modules.conv.Conv             [128, 128, 3, 2]              
21            [-1, 10]  1         0  ultralytics.nn.modules.conv.Concat           [1]                           
22                  -1  1    387328  ultralytics.nn.modules.block.RepC3k2         [384, 256, 1, True]           
23        [16, 19, 22]  1    440422  ultralytics.nn.modules.head.Detect           [50, [64, 128, 256]]          
YOLO11RepC3K2SimSPPF summary: 360 layers, 2,618,662 parameters, 2,618,646 gradients, 6.5 GFLOPs
      Epoch    GPU_mem   box_loss   cls_loss   dfl_loss  Instances       Size120/120      13.8G      1.149     0.7983       1.44         45        352: 100%|██████████| 241/241 [00:19<00:00, 12.35it/s]Class     Images  Instances      Box(P          R      mAP50  mAP50-95): 100%|██████████| 16/16 [00:01<00:00,  9.26it/s]all       1005       2152      0.867      0.799      0.872      0.549120 epochs completed in 0.714 hours.
Optimizer stripped from runs/ChineseMedTrain/exp3/weights/last.pt, 5.6MB
Optimizer stripped from runs/ChineseMedTrain/exp3/weights/best.pt, 5.6MBValidating runs/ChineseMedTrain/exp3/weights/best.pt...
WARNING ⚠️ validating an untrained model YAML will result in 0 mAP.
Ultralytics 8.3.7 🚀 Python-3.9.19 torch-2.0.1+cu117 CUDA:0 (NVIDIA GeForce RTX 4090, 24209MiB)
YOLO11RepC3K2SimSPPF summary (fused): 245 layers, 2,592,286 parameters, 0 gradients, 6.4 GFLOPsClass     Images  Instances      Box(P          R      mAP50  mAP50-95): 100%|██████████| 16/16 [00:02<00:00,  6.30it/s]all       1005       2152      0.867      0.802      0.871      0.549ginseng         34         57      0.888      0.833      0.907      0.587Leech         20         41      0.815      0.902      0.932       0.65JujubaeFructus         18         67      0.904      0.839      0.968      0.585LiliiBulbus         18         19      0.946      0.895        0.9      0.588CoptidisRhizoma         22         22      0.874      0.955      0.984      0.824MumeFructus         21         98      0.746      0.781      0.802      0.411MagnoliaBark         21         45      0.848      0.865      0.932      0.576Oyster         18         24      0.841          1      0.971      0.706Seahorse         14         33      0.835      0.613      0.627       0.37Luohanguo         17         21      0.876      0.667       0.79      0.613GlycyrrhizaUralensis         18         25      0.926      0.995      0.984      0.537Sanqi         32         42      0.908      0.643      0.818      0.625TetrapanacisMedulla         19         20      0.984       0.95      0.987      0.672CoicisSemen         24         35      0.823      0.829      0.907        0.6LyciiFructus         20         32      0.865      0.599      0.758      0.459TruestarAnise         18         60          1      0.678      0.953      0.432ClamShell         17         67      0.806      0.731      0.841      0.538Chuanxiong         28         69      0.775      0.768      0.796      0.427Garlic         24         70      0.848      0.715      0.858      0.435GinkgoBiloba         27        119      0.847      0.866      0.914       0.61ChrysanthemiFlos         13         20      0.937      0.745      0.788      0.488
AtractylodesMacrocephala         15         23      0.826      0.828      0.893      0.614JuglandisSemen         12         45      0.912      0.694      0.785      0.389TallGastrodiae         17         35       0.75      0.743      0.764      0.408TrionycisCarapax         15         22      0.866      0.818      0.865       0.61AngelicaRoot         18         35      0.894      0.914      0.904      0.582Hawthorn         21         47      0.979       0.66      0.766      0.434CrociStigma         20         22       0.91      0.864      0.934      0.529SerpentisPeriostracum         16         16      0.974      0.938      0.988      0.727EucommiaBark         17         32      0.942      0.812      0.942      0.629ImperataeRhizoma         21         22      0.879      0.909      0.974      0.653LoniceraJaponica         12         25      0.779      0.565      0.707      0.383Zhizi         20        128      0.923      0.563      0.765      0.355Scorpion         13         21      0.845      0.905      0.935      0.679HouttuyniaeHerba         16         16      0.846      0.938      0.986      0.662EupolyphagaSinensis         19         48      0.757      0.976      0.924       0.62OroxylumIndicum         31         67       0.82      0.885      0.872      0.474CurcumaLonga         34         63      0.836       0.73      0.857      0.521NelumbinisPlumula         17         20      0.708        0.7      0.778      0.514ArecaeSemen         22         66      0.942      0.745      0.923      0.471Scolopendra         19         25      0.878       0.64      0.669      0.471MoriFructus         22         64       0.77      0.719      0.758      0.355
FritillariaeCirrhosaeBulbus         24         26      0.841      0.885      0.936       0.65DioscoreaeRhizoma         23         34      0.846      0.811      0.919      0.528CicadaePeriostracum         17         41      0.865      0.951      0.931      0.636PiperCubeba         21         28      0.865      0.857       0.91      0.579BupleuriRadix         22         25          1      0.739      0.907      0.557AntelopeHom         18         48      0.929      0.771      0.899      0.623Pangdahai         19         71      0.872      0.861      0.897      0.603NelumbinisSemen         19         51      0.787      0.804      0.761      0.473
Speed: 0.3ms preprocess, 0.4ms inference, 0.0ms loss, 0.3ms postprocess per image
Results saved to runs/ChineseMedTrain/exp3

五、baseline+ RepC3K2 + SimSPPF + LK-C2PSA

改进的点:将PSA模块中的Attention修改为Deformable-LK Attention,即可变形的大核Attention;

Attention

界面

#最后一步:量化,格式导出
best.pt tensor GPU;
CPU下跑 onnx格式;

code+model放到测试机器上,作为现场的测试设备;

#后勤:
高铁:
酒店:3个房间;
180:包干;

1.引入库

代码如下(示例):

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
import  ssl
ssl._create_default_https_context = ssl._create_unverified_context

2.读入数据

代码如下(示例):

data = pd.read_csv('https://labfile.oss.aliyuncs.com/courses/1283/adult.data.csv')
print(data.head())

该处使用的url网络请求的数据。


总结

提示:这里对文章进行总结:

例如:以上就是今天要讲的内容,本文仅仅简单介绍了pandas的使用,而pandas提供了大量能使我们快速便捷地处理数据的函数和方法。

http://www.lryc.cn/news/2399208.html

相关文章:

  • linux 故障处置通用流程-36计+1计
  • ​BEV和OCC学习-3:mmdet3d 坐标系
  • [蓝桥杯]图形排版
  • 【Linux仓库】冯诺依曼体系结构与操作系统【进程·壹】
  • CloudFront 加速详解:AWS CDN 怎么用?
  • 《高级架构师》------- 考后感想
  • 【iOS】YYModel源码解析
  • C++算法训练营 Day6 哈希表(1)
  • 【C语言编译与链接】--翻译环境和运行环境,预处理,编译,汇编,链接
  • 【JavaEE】多线程
  • 【项目】在线OJ(负载均衡式)
  • 贪心算法应用:在线租赁问题详解
  • torch.zeros()用法简介
  • Prj10--8088单板机C语言8259测试(1)
  • 3步在小米13手机跑DeepSeek R1
  • 数智管理学(十六)
  • 注销微软账户
  • Ubuntu 服务器软件更新,以及常用软件安装 —— 一步一步配置 Ubuntu Server 的 NodeJS 服务器详细实录 3
  • Mysql常用知识3:Kafka和数据库优化
  • Milvus单机模式安装和试用
  • 飞牛NAS+Docker技术搭建个人博客站:公网远程部署实战指南
  • 刷leetcode hot100返航必胜版--链表6/3
  • C# 序列化技术全面解析:原理、实现与应用场景
  • isp调试 blend模式指什么
  • electron定时任务,打印内存占用情况
  • Gitee Wiki:以知识管理赋能 DevSecOps,推动关键领域软件自主演进
  • 学习STC51单片机24(芯片为STC89C52RCRC)
  • LabVIEW基于 DataSocket从 OPC 服务器读取数据
  • 阿里云无影云桌面深度测评
  • 【208】VS2022 C++ 32位整数和unsigned char数组之间互相转换