ubuntu+yolov4 如何开启GPU训练

yolov4开启GPU训练

因为工作需要,yolov3准确率达不到要求,所以试一下yolov4,发现真香,但是30系显卡出来以后,yolov4增加了86算力的选项,所以开启GPU训练出了点问题,经过调试以后,目前可以直接用yolov4进行训练了

首先是cfg文件里:
因为我没用opencv库,这里就可以把25行的参数

mosaic=0 			

再更改Makefile里面的设置:

vim Makefile
GPU=1			
CUDNN=1
CUDNN_HALF=0
OPENCV=0			//没有用opencv建议这里设置成0,虽然不会报错,但是训练的时候会不停提示
AVX=0
OPENMP=0
LIBSO=0
ZED_CAMERA=0
ZED_CAMERA_v2_8=0





ARCH= -gencode arch=compute_35,code=sm_35 \
      -gencode arch=compute_50,code=[sm_50,compute_50] \
      -gencode arch=compute_52,code=[sm_52,compute_52] \
        -gencode arch=compute_61,code=[sm_61,compute_61] \
        -gencode arch=compute_75,code=[sm_75,compute_75]

#这里设置找到自己显卡对应的算力值,我是20系显卡,所以这里最多只能到75
#我自用的电脑是30系显卡,可以设置到86

# Kepler GeForce GTX 770, GTX 760, GT 740
# ARCH= -gencode arch=compute_30,code=sm_30

# Tesla A100 (GA100), DGX-A100, RTX 3080
# ARCH= -gencode arch=compute_80,code=[sm_80,compute_80]

# Tesla V100
# ARCH= -gencode arch=compute_70,code=[sm_70,compute_70]

# GeForce RTX 2080 Ti, RTX 2080, RTX 2070, Quadro RTX 8000, Quadro RTX 6000, Quadro RTX 5000, Tesla T4, XNOR Tensor Cores
# ARCH= -gencode arch=compute_75,code=[sm_75,compute_75]

# Jetson XAVIER
# ARCH= -gencode arch=compute_72,code=[sm_72,compute_72]

# GTX 1080, GTX 1070, GTX 1060, GTX 1050, GTX 1030, Titan Xp, Tesla P40, Tesla P4
# ARCH= -gencode arch=compute_61,code=sm_61 -gencode arch=compute_61,code=compute_61

# GP100/Tesla P100 - DGX-1
# ARCH= -gencode arch=compute_60,code=sm_60

# For Jetson TX1, Tegra X1, DRIVE CX, DRIVE PX - uncomment:
# ARCH= -gencode arch=compute_53,code=[sm_53,compute_53]

# For Jetson Tx2 or Drive-PX2 uncomment:
# ARCH= -gencode arch=compute_62,code=[sm_62,compute_62]

# For Tesla GA10x cards, RTX 3090, RTX 3080, RTX 3070, RTX A6000, RTX A40 uncomment:
# ARCH= -gencode arch=compute_86,code=[sm_86,compute_86]


然后编译一遍

make clean
make

顺利编译成功,就可以开启GPU训练啦!

你可能感兴趣的:(yolo,gpu)