【深度学习】yolov5以及yolov8的微调后的模型精度对比

文章目录

  • 前言
  • 1. 前置先解决报错 todo
  • 2. 训练
    • 2.1 yolov5 的 yolov5m6
    • 2.2 yolov5 的 yolov5l6
    • 2.3 yolov8 的


前言

做了一个烟火识别,用了2W张图片,标注包括:fire,smoke 。在coco80类的模型上进行ft, 借此机会进行比较一下。

  1. yolov5 yolov5m6
  2. yolov5 yolov5l6
  3. yolov8 模型待定
    图片共:20113 张 按8:1:1 区分train,val 和 test
    数据集:
    train: Scanning ‘/data_share/data_share/fire_smoke_iter20230720/firesmoketaobao/train.cache’ images and labels… 16090 found, 0 missing, 1019 empty, 0 corrupt: 100%|██████████| 16090/16090
    val: Scanning ‘/data_share/data_share/fire_smoke_iter20230720/firesmoketaobao/val.cache’ images and labels… 2011 found, 0 missing, 123 empty, 0 corrupt: 100%|██████████| 2011/2011 [00:00

1. 前置先解决报错 todo

2. 训练

2.1 yolov5 的 yolov5m6

所用命令:

 python -m torch.distributed.launch --nproc_per_node=2 train.py --weights weights/yolov5m6_coco.pt --img 640 --epoch 500 --data fire_smoke.yaml --batch-size 24 --workers 8 --save-period 20

资源占用情况:

【深度学习】yolov5以及yolov8的微调后的模型精度对比_第1张图片

最终结果:

 00%|██████████| 671/671 [02:05<00:00,  4.87it/s]                                                                                                                                                    173/499      7.22G    0.02312    0.01991   0.005421         26        640: 1                                                                                                                00%|██████████| 671/671 [02:05<00:00,  5.35it/s]                                                                                                                                                
                 Class     Images  Instances          P          R      mAP50
                   all       2011       3236       0.81       0.76      0.825                                                                                                                      0.556

      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size
    174/499      7.22G    0.02303    0.01993   0.005404         16        640: 1
                 Class     Images  Instances          P          R      mAP50
                   all       2011       3236      0.809      0.757      0.824                                                                                                                      0.556

      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size
    175/499      7.22G    0.02297    0.01974   0.005403         14        640: 1
                 Class     Images  Instances          P          R      mAP50
                   all       2011       3236      0.808      0.758      0.823                                                                                                                      0.556

      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size
    176/499      7.22G    0.02281       0.02   0.005223         17        640: 1
                 Class     Images  Instances          P          R      mAP50
                   all       2011       3236      0.807      0.759      0.823                                                                                                                      0.555
Stopping training early as no improvement observed in last 100 epochs. Best resu                                                                                                                lts observed at epoch 76, best model saved as best.pt.
To update EarlyStopping(patience=100) pass a new patience value, i.e. `python tr                                                                                                                ain.py --patience 300` or use `--patience 0` to disable EarlyStopping.

177 epochs completed in 6.973 hours.
Optimizer stripped from runs/train/exp5/weights/last.pt, 71.1MB
Optimizer stripped from runs/train/exp5/weights/best.pt, 71.1MB

Validating runs/train/exp5/weights/best.pt...
Fusing layers...
Model summary: 276 layers, 35254692 parameters, 0 gradients, 49.0 GFLOPs
                 Class     Images  Instances          P          R      mAP50
                   all       2011       3236      0.815       0.75      0.829                                                                                                                      0.559
                  fire       2011       1791      0.792      0.724      0.801                                                                                                                      0.527
                 smoke       2011       1445      0.839      0.777      0.857                                                                                                                       0.59
Results saved to runs/train/exp5

2.2 yolov5 的 yolov5l6

所用命令

 nohup python -m torch.distributed.launch --nproc_per_node=2 train.py --weights weights/yolov5l6.pt --img 640 --epoch 500 --data fire_smoke.yaml --batch-size 24 --workers 8 --save-period 20 >yolov5l6.log 2>&1 &

相同的参数,large模型是比较吃显存的

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A     26007      C   ...39_torch1.10.1/bin/python     9325MiB |
|    1   N/A  N/A     26008      C   ...39_torch1.10.1/bin/python     8835MiB |
+-----------------------------------------------------------------------------+
Fri Jul 21 17:28:53 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.63.01    Driver Version: 470.63.01    CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:0B:00.0 Off |                  N/A |
| 96%   69C    P2   314W / 350W |   9331MiB / 12053MiB |     97%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  NVIDIA GeForce ...  Off  | 00000000:1B:00.0 Off |                  N/A |
| 88%   65C    P2   309W / 350W |   8837MiB / 12053MiB |     90%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A     26007      C   ...39_torch1.10.1/bin/python     9325MiB |
|    1   N/A  N/A     26008      C   ...39_torch1.10.1/bin/python     8835MiB |
+-----------------------------------------------------------------------------+

2.3 yolov8 的

你可能感兴趣的:(深度学习,图像识别,目标检测,深度学习,YOLO,人工智能)