概述

YOLOv5(v4.0 release开始)已经在本地集成了Weights & Biases,也就是可视化的工具wandb,可方便的追踪模型训练的整个过程,包括模型的性能、超参数、GPU的使用情况、模型预测,还有数据集。

软硬件环境

OS:CentOS 7.7.1908

[king@cam yolov5-docker-image]$ cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
[king@cam yolov5-docker-image]$ uname -a
Linux cam 3.10.0-1062.18.1.el7.x86_64 #1 SMP Tue Mar 17 23:49:17 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[king@cam yolov5-docker-image]$ 

Python 3.8.5 && Python 2.7.5

[king@cam yolov5-docker-image]$ python3 --version
Python 3.8.5
[king@cam yolov5-docker-image]$ python --version
Python 2.7.5
[king@cam yolov5-docker-image]$

CUDA: 10.0, V10.0.130

[king@cam yolov5-docker-image]$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130

YOLOv5 v4.0

NVIDIA GeForce GTX 2080Ti

[king@cam yolov5-docker-image]$ nvidia-smi
Sun Feb 21 10:33:18 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.64       Driver Version: 440.64       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 208...  Off  | 00000000:1A:00.0 Off |                  N/A |
| 40%   54C    P2   180W / 260W |   8100MiB / 11019MiB |     19%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce RTX 208...  Off  | 00000000:1E:00.0 Off |                  N/A |
| 41%   33C    P8    36W / 260W |      0MiB / 11019MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0     82207      C   python3                                     8087MiB |
+-----------------------------------------------------------------------------+

 

安装wandb

sudo pip3 install wandb

 

配置wandb

注册账号  ======> 终端输入API Key(在浏览器中访问站点 https://wandb.ai/authorize,复制后贴到终端中)

wandb有在线和本地两种使用方式。

在线使用方式需要在https://wandb.ai/home,注册一个账号。注册后新建项目,名字叫yolov5,然后本地安装配置wandb, 按提示输入必要的信息(API Key)。

/usr/local/python385/bin/wandb login ***6ef350c8******

不过wandb网站挺卡,wandb也有本地使用方式。参考:https://docs.wandb.ai/self-hosted/local, 配置好后也可以本地访问了。

训练模型

开始训练了,这个过程跟之前训练是一模一样的

python3 train.py --device 0

查看训练过程

在模型训练的过程中,登录网站 https://wandb.ai/home,在自己的项目中就可以看到训练的状态了。

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐