How to batch matting with python
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.