RuntimeError: CUDA out of memory. Tried to allocate 22.00 MiB (GPU 0; 6.00 GiB total capacity; 260.44 MiB already allocated; 0 bytes free; 262.00 MiB reserved in total by PyTorch)
GPU 0 bytes free 看起来非常不正常
用的是yolo网络,经过修改以后程度应该是先调用torch 然后还用了tensorflow
在确保了torch中GPU可用,在运行的代码里增加一行
import os
os.environ["CUDA_VISIBLE_DEVICES"] = '1'
解决了问题
但又出了新的问题
expected shape=(None, 224, 224, 3), found shape=(32, 224, 3)
增加一行代码 reshape一下
img = np.reshape(img, [1, 224, 224, 3])
解决问题