多GPU训练+测试

多GPU训练+测试效果对比

为了缩短训练时间,最简单直接的方法就是增加GPU数量,本文采用单机多GPU,在不同网络模型下训练,对比训练时间及模型精度,得到多GPU训练效果的初步结论

实验数据

Resnet50+Keras+CIFAR-10

batchsize=800*GPU数
epoch=[40,50,60,70]

训练时间
多GPU训练+测试_第1张图片
精确率
多GPU训练+测试_第2张图片
召回率
多GPU训练+测试_第3张图片

Unet+Pytorch+VOC2007

batchsize=30*GPU数
epoch=[70,80,90,100]
训练时间
多GPU训练+测试_第4张图片
IOU
多GPU训练+测试_第5张图片

FasterRCNN+TensorFlow detection API+VOC2007

batchsize=5*GPU数
epoch=[5,10,15,20]
训练时间
多GPU训练+测试_第6张图片
精确率
多GPU训练+测试_第7张图片
召回率
多GPU训练+测试_第8张图片
IOU
多GPU训练+测试_第9张图片

FasterRCNN+mmdetection+VOC2007

batchsize=16*GPU数
epoch=[5,10,15,20]
训练时间
多GPU训练+测试_第10张图片
精确率
多GPU训练+测试_第11张图片
召回率
多GPU训练+测试_第12张图片
IOU
多GPU训练+测试_第13张图片

MaskRCNN+mmdetection+VOC2012

batchsize=10*GPU数
epoch=[5,10,15,20]
训练时间
多GPU训练+测试_第14张图片
IOU
多GPU训练+测试_第15张图片

MSRCNN+mmdetection+VOC2012

batchsize=5*GPU数
epoch=[5,10,15,20]
训练时间
多GPU训练+测试_第16张图片
IOU
多GPU训练+测试_第17张图片

实验结论

结果比对

精确率 召回率 IOU 1GPU 2GPU 3GPU 4GPU
Resnet50+Keras 无影响 无影响 无影响 100% 66% 59% 48%
Unet+Pytorch 无影响 无影响 无影响 100% 89% 86% 91%
FasterRCNN+Tensorflow detetion API 无影响 无影响 无影响 100% 50% 34% 26%
FasterRCNN+mmdetection 无影响 无影响 无影响 100% 61% 51% 49%
MaskRCNN+mmdetection 无影响 无影响 无影响 100% 65% 55% 51%
MSRCNN+mmdetect 无影响 无影响 无影响 100% 66% 49% 42%
平均值 \ \ \ 100% 66.2% 55.7% 51.2%

1)GPU数量几乎不影响模型精度,2块、3块、4块GPU的训练时间平均占1块GPU的66.2%、55.7%、51.2%
2)FasterRCNN+TensorFlow detection API框架下,多GPU训练节约相对时间最多
3)总体上说,GPU越多,训练越快;网络模型越复杂(如检测,实例分割网络等),多GPU训练节约相对时间越多

结果分析

1.多GPU之间传输数据速度慢, 在传输过程中存在数据的丢失和错误导致精度下降
2.在CPU上进行参数梯度同步占每一步训练的很多时间
参考链接:multi_gpu_model训练速度慢原因

It seems that CPU-side data-preprocessing can be one of the reason that greatly slow down the multi-GPU training, do you try disabling some pre-processing options such as data-augmentation and then see any boost?
Besides, the current version of multi_gpu_model seems to benefit large NN-models only, such as Xception, since weights synchronization is not the bottleneck. When it is wrapped to simple model such as mnist_cnn and cifar_cnn, weights synchronization is pretty frequent and makes the whole time much slower.

当中指出:当前版本的multi_gpu_model只对大型的模型有利,比如Xception,因为此时权值同步并不是影响训练时间和精度主要因素。当它被包装成简单的模型,如mnist_cnn和cifar_cnn时,权值同步非常频繁,使得整个时间变得非常慢。

你可能感兴趣的:(深度学习)