Get the App
SLTechnology News&Howtos  ›  Development  › 

How to batch matting with python

Shulou Source: shulou.com Published: 2022-06-01 04:59:29 10月03日 Update

This article will explain in detail how python batch matting, the editor thinks it is very practical, so share it for you to do a reference, I hope you can get something after reading this article.

Batch matting

Matting needs the help of Baidu Flying Propeller's deep learning tool paddlepaddle. We need to install two modules to quickly realize batch matting. The first is PaddlePaddle:

Python-m pip install paddlepaddle-I https://mirror.baidu.com/pypi/simple

Another is the paddlehub model library:

Pip install-I https://mirror.baidu.com/pypi/simple paddlehub

Next, we only need 5 lines of code to achieve batch matting:

Import os, paddlehub as hubhumanseg = hub.Module (name='deeplabv3p_xception65_humanseg') # load model path = 'DGV _ peg _ humanseg.segmentation _ GrapImage _' # File directory files = [path + i for i in os.listdir (path)] # get the file list results = humanseg.segmentation (data= {'image':files}) # matting on "how python does batch matting" ends here Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Tags: Articles files more models good practical next two code content tools quick articles modules depth directories knowledge reference learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Redmi vpn Huawei Linux