Tensorflow刚开始训练killed bug解决方案

这个BUG弄了整整两天,记录一下
Tensorflow刚开始训练killed bug解决方案_第1张图片
各种百度,各种换模型,搞得头昏脑胀,最后通过对比实验,监测到killed之前内存暴涨,怀疑是内存泄漏或者内存不够,原来的训练图片尺寸5472×3648,resize一下就可以正常训练了,resize代码如下

import os
from PIL import Image
 
filename = os.listdir("/home/wxy/下载/VOCdevkit/VOC2007/JPEGImages/")
base_dir = "/home/wxy/下载/VOCdevkit/VOC2007/JPEGImages/"
new_dir  = "/home/wxy/下载/VOCdevkit/VOC2007/JPEGImages919/"
size_m = 450
size_n = 300
 
for img in filename:
    image = Image.open(base_dir + img)
    image_size = image.resize((size_m, size_n),Image.ANTIALIAS)
    image_size.save(new_dir+ img)

你可能感兴趣的:(python)