用的mmsegmentation,在训练中,发现到测试的时候,会报如下错误
RuntimeError: CUDA out of memory. Tried to allocate 2.82 GiB (GPU 1; 31.75 GiB total capacity; 7.21 GiB already allocated; 2.76 GiB free; 10.41 GiB reserved in total by PyTorch)
原因:显卡内存不够
解决方法:在所用的config文件中,找到data=dict(samples_per_gpu=2),之前设置的是2,即每个gpu上跑两张图,将2改为1,运行成功!
疑问求解答:为什么训练时显卡内存足够,而测试时,显卡内存不够了呢?