0

我已经使用 SSD300(imagenet 预训练模型)进行两类分类的检测和识别:[Basketball-ChainerCV](https://github.com/atom2k17/Basketball-ChainerCV/blob/master/basketballproject.py)。训练和预测都很好。但是当我在训练时使用 SSD512(imagenet 预训练模型)时,出现以下错误:

/usr/local/lib/python3.6/dist- 
packages/chainer/functions/connection/convolution_2d.py in 
_forward_cudnn(self, x, W, b, y)
226         cuda.cudnn.convolution_forward(
227             x, W, b, y, pad, stride, dilation, self.groups,
228             auto_tune=auto_tune, tensor_core=tensor_core)
229         return y,
230 
cupy/cudnn.pyx in cupy.cudnn.convolution_forward()
cupy/cudnn.pyx in cupy.cudnn._find_algorithm_fwd()
cupy/cuda/memory.pyx in cupy.cuda.memory.alloc()
cupy/cuda/memory.pyx in cupy.cuda.memory.MemoryPool.malloc()
cupy/cuda/memory.pyx in cupy.cuda.memory.MemoryPool.malloc()
cupy/cuda/memory.pyx in cupy.cuda.memory.SingleDeviceMemoryPool.malloc()
cupy/cuda/memory.pyx in cupy.cuda.memory.SingleDeviceMemoryPool._malloc()
cupy/cuda/memory.pyx in cupy.cuda.memory._try_malloc()
OutOfMemoryError: out of memory to allocate 1073741824 bytes (total 
12092240384 bytes)

我正在使用 Google Colab GPU 环境。任何解决此问题的指针表示赞赏。

4

1 回答 1

0

正如@corochann 评论中所建议的那样,当执行 trainer.run() 将 batch_size 从 32 取为 4 时,这个内存问题得到了解决。因此,这里的解决方案是采用较小的 batch_size。

于 2019-03-20T07:49:08.373 回答