tensorflow objection detection多张GPU卡 (Allocator (GPU_0_bfc) ran out of memory)

1.环境

ubuntu16.04
python3.5
models-1.12.0

2.问题与解决

2.1 问题

tensorflow objection detection运行train.py时,出现如下问题:

Error reported to Coordinator: OOM when allocating tensor with shape[24,96,180,330] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc

I0530 02:17:51.322153 140545912301312 tf_logging.py:115] Error reported to Coordinator: OOM when allocating tensor with shape[24,96,180,330] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
         [[node FeatureExtractor/MobilenetV2/expanded_conv_1/expand/Conv2D (defined at /usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/layers.py:1057)  = Conv2D[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](FeatureExtractor/MobilenetV2/expanded_conv/project/BatchNorm/FusedBatchNorm, FeatureExtractor/MobilenetV2/expanded_conv_1/expand/weights/read/_549)]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.


2.2 解决

不仅在在train.py中指定多张卡:

os.environ['CUDA_VISIBLE_DEVICES']='5,6,7'
config = tf.ConfigProto(allow_soft_placement=True)
config.gpu_options.allow_growth = True
session = tf.Session(config=config)

而且需要做如下修改: 

参考:https://blog.csdn.net/jidebingfeng/article/details/81557434

解决(训练时,多加下面两个参数):

train.py --num_clones=3  --ps_tasks=1  

参考

1. TensorFlow Object Detection API 多GPU 卡平行计算,加速模型训练速度教学

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wait a minutes

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值