从python函数调用神经网络时GPU内存不足

时间:2016-11-03 12:02:02

标签: python caffe

我最近问similar question: 我想在python中使用caffe卷积神经网络对图像序列进行像素分类。 以前,我确定了我可以使用我的gpu(450x450像素)处理的最大图像大小。 要处理更大的图像,我想要一个像这样的嵌套循环:

function process_image_stack(image_stack, parameters):
    for all images
       take image apart into segments
       for all image_segments
           process image segment with network
           stitch together output
return processed_image_stack

我现在的问题如下: 当我从这样的函数调用net.forward()时:

output = processing_function(parameters)

CUDA抛出内存不足的错误

Check failed: error == cudaSuccess (2 vs. 0) out of memory

当我使用更小的图像作为输入时,我也会收到此错误

问题似乎是循环。 当我"手动"循环遍历图像,即将变量设置为0,1,2 ...然后在各个网络上调用网络,它可以正常工作。

我想了解问题究竟是什么。

非常感谢!

0 个答案:

没有答案
相关问题