stylepro_artistic API内存不足
Created by: 60999
欢迎您反馈PaddleHub使用问题,非常感谢您对PaddleHub的贡献! 在留下您的问题时,辛苦您同步提供如下信息:
- 版本、环境信息
1)PaddleHub和PaddlePaddle版本:
PaddleHub1.6.1,paddlepaddle-gpu 1.7.1.post97
2)系统环境:
aistudio平台GPU环境
stylepro_artistic 使用GPU出错,在转换多张照片之后.
代码: `def stylepro_artistic(fore_image_path,paddlehub_out_path):
1.指定待预测图片路径,遍历循环抠图 保存到 paddlehub_out_path
g = os.walk(fore_image_path)
for path,dir_list,file_list in g:
file_list = natsorted(file_list)
for file_name in file_list:
#取出一个前景文件
front_pic = os.path.join(path, file_name)
# print (front_pic)
# 2.加载预训练模型
module = paddlehub.Module(name="stylepro_artistic")
input_dict = {"content": front_pic,"styles":["/home/aistudio/work/Picasso_pic.jpg"]}
#print (input_dict)
#GPU开启下面一行,如果用下面一行,必须安装paddlepaddle-gpu
results = module.style_transfer(paths=[input_dict],use_gpu = True,visualization=True,output_dir=paddlehub_out_path)
#以下还可以优化吗
#for result in results:
#print(result)