Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stylepro_artistic API内存不足 #503

Open
60999 opened this issue Apr 5, 2020 · 8 comments
Open

stylepro_artistic API内存不足 #503

60999 opened this issue Apr 5, 2020 · 8 comments
Assignees

Comments

@60999
Copy link

60999 commented Apr 5, 2020

欢迎您反馈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)

stylepro_artistic(front_path,HUMANSEG_SPACE)
`
TIM截图20200405232521

@nepeplwu
Copy link
Contributor

nepeplwu commented Apr 7, 2020

请问下你所用GPU的显存是多大?是否有其他进程也占用了显存?

@60999
Copy link
Author

60999 commented Apr 18, 2020

aistudio平台 16/32 G

@nepeplwu
Copy link
Contributor

@60999 是否可以提供下aistudio的链接?我们fork复现看。此外,下面的代码建议放在for循环外,没有必要每次都加载一次module

module = paddlehub.Module(name="stylepro_artistic")

@nepeplwu nepeplwu self-assigned this Apr 22, 2020
@60999
Copy link
Author

60999 commented Apr 28, 2020

怀疑就是多次载入模型导致的。调用其他模型时候也遇到过这种情况,在升级其他模型的更新版本后没出现过问题,stylepro_artistic 模型后来没有再测试过。
建议其他模型都载入几百次测试下,没准其他模型也有这种问题。

@InternetMaster1
Copy link

@nepeplwu

This can be used on Android?

@Steffy-zxf
Copy link
Contributor

@InternetMaster1 As for mobile-end usage, please refer to PaddleLite: https://github.com/PaddlePaddle/Paddle-Lite

@InternetMaster1
Copy link

InternetMaster1 commented Jun 9, 2020

@Steffy-zxf @nepeplwu

  1. Any guide on how to convert "stylepro_artistic" to Android using PaddleLite. I don't see any demo present like other projects such as segmentation, etc have.
    https://github.com/PaddlePaddle/Paddle-Lite-Demo/tree/master/PaddleLite-android-demo

  2. What is the model size and the processing time for style transfer? If you check Tensorflow document, they have mentioned the model file size and time taken.
    https://blog.tensorflow.org/2020/04/optimizing-style-transfer-to-run-on-mobile-with-tflite.html
    image

What are the similar size and latency values for Paddle StyleTransfer module?

  1. What are the difference in the below two?
    https://github.com/PaddlePaddle/hapi/tree/b337063c7ecf44c60944801dbd32453f1481d987/examples/style-transfer
    https://github.com/PaddlePaddle/PaddleHub/tree/dbca09ae78b5387ebe3b49f37ce88de45d41d26a/hub_module/modules/image/style_transfer/stylepro_artistic

@InternetMaster1
Copy link

@Steffy-zxf @nepeplwu

Is it possible to run "stylepro_artistic" on our own server, or on the mobile phone as offline code?

On PaddleHub, I only see the API.

We wish to provide stylepro_artistic for offline purpose on mobile phone similar to other libraries like PaddleSeg. Is this possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants