首页 > 编程语言 >python:安装backgroundremover 0.2.4(Python 3.9.16)

python:安装backgroundremover 0.2.4(Python 3.9.16)

时间:2023-08-09 10:45:19浏览次数:52  
标签:u2net 16 python 0.2 https backgroundremover lhdop com

一,官方代码及文档:

https://github.com/nadermx/backgroundremover

二, 安装backgroundremover的准备工作

1,安装 pytorch:

https://blog.imgtouch.com/index.php/2023/08/03/rocky-linux-an-zhuang-pytorch-pytorch-2-1-python-3-9-16/

2,  安装ffmpeg:

https://blog.imgtouch.com/index.php/2023/08/03/rocky-linux-an-zhuang-ffmpeg-ffmpeg-5-1-3-rocky-linux-9-2/

3,  安装setuptools:

[root@img ~]# pip3 install setuptools

4,  安装python-devel库:

[root@img ~]# yum install python3-devel

三,安装backgroundremover

1,用pip安装

[root@img ~]#  pip3 install backgroundremover

2,安装完成后查看版本:

[lhdop@img .u2net]$ pip3 show backgroundremover
Name: backgroundremover
Version: 0.2.4
Summary: Background remover from image and video using AI
Home-page: https://github.com/nadermx/backgroundremover
Author: Johnathan Nader
Author-email: [email protected]
License:
Location: /usr/local/lib/python3.9/site-packages
Requires: certifi, charset-normalizer, ffmpeg-python, filelock, filetype, hsh, idna, more-itertools, moviepy, numpy, Pillow, pymatting, PySocks, requests, scikit-image, scipy, six, torch, torchvision, tqdm, urllib3, waitress
Required-by:

四,下载u2net模型

1,文档地址:

https://github.com/xuebinqin/U-2-Net/blob/master/README.md

如图:

2, 百度网盘的地址:

https://pan.baidu.com/share/init?surl=WjwyEwDiaUjBbx_QxcXBwQ

提取码:

pf9k

谷歌drive的下载地址:

https://drive.google.com/file/d/1ao1ovG1Qtx4b7EoskHXmi2E9rp5CHLcZ/view

3,下载文件后,上传到服务器用户的home目录下的.u2net目录下,如图:

[lhdop@img .u2net]$ ll
total 344344
-rw-rw-r-- 1 lhdop lhdop 176315793 Aug  3 10:35 u2net_human_seg.pth
-rw-rw-r-- 1 lhdop lhdop 176290937 Aug  3 10:35 u2net.pth

说明:刘宏缔的架构森林—专注it技术的博客,
网站:https://blog.imgtouch.com
原文: https://blog.imgtouch.com/index.php/2023/08/03/python-an-zhuang-backgroundremover-2-4-python-3-9-16/
代码: https://github.com/liuhongdi/ 或 https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: [email protected]

四,检测效果

原图:

不指定模块

[lhdop@img ~]$ backgroundremover -i "/home/lhdop/work/background/tx3.webp" -o "/home/lhdop/work/background/b2.png"

指定模块

[lhdop@img .u2net]$ backgroundremover -i "/home/lhdop/work/background/tx3.webp" -m u2net_human_seg -o "/home/lhdop/work/background/b3.png"

五,查看python版本:

[lhdop@img .u2net]$ python --version
Python 3.9.16

标签:u2net,16,python,0.2,https,backgroundremover,lhdop,com
From: https://www.cnblogs.com/architectforest/p/17616230.html

相关文章

  • 使用 python 分割大的文本文件
    在开发过程中会遇到有些大文件,因为比较大,无法打开的情况,这个时候需要进行文件分割,这里使用python进行文件分割,代码如下:importosimportmathimportsysblock_size=int(sys.argv[2])*1024*1024defsplit_file(filepath:str,block_size:int):filesize=os.path.get......
  • rocky linux:安装pytorch(pytorch 2.0.1 / Python 3.9.16)
    一,pytorch官网:https://pytorch.org/如图:根据自己的需求选择版本、平台、语言环境等信息,然后运行命令二,运行pip安装命令:[root@imgbin]#pip3installtorchtorchvisiontorchaudio--index-urlhttps://download.pytorch.org/whl/cpuLookinginindexes:https://......
  • rocky linux:编译安装python3.11.4(rocky linux 9.2)
    一,查看现有的版本:1,本地版本[root@img~]#python--versionPython3.9.162,现在的最新版本:访问官网:https://www.python.org/如图:可以看到线上的最新版本是3.11.4 二,编译/安装:1,下载:先复制下载地址2,从服务器用wget命令下载:[root@imgpython]#wgethttp......
  • python:升级pip版本(Python 3.11.4)
    一,查看当前pip的版本:[[email protected]]#pip--versionpip23.1.2from/usr/local/soft/python3.11.4/lib/python3.11/site-packages/pip(python3.11)二,升级pip:[[email protected]]#python3-mpipinstall--upgradepipLookinginindexes:http://m......
  • python:升级setuptools的版本(Python 3.11.4)
    一,查看当前setuptools的版本:[[email protected]]#python3-mpipshowsetuptoolsName:setuptoolsVersion:65.5.0Summary:Easilydownload,build,install,upgrade,anduninstallPythonpackagesHome-page:https://github.com/pypa/setuptoolsAuthor:Py......
  • 使用python解析nginx日志
    性能测试时,需使用生产环境各接口请求比例分配接口请求比,nginx统计脚本如下:importreimportpandasaspdimportxlwtobj=re.compile(r'(?P<ip>.*?)--\[(?P<time>.*?)\]"(?P<request>.*?)"(?P<request_time>.*?)(?P<status>.*?)(?P<by......
  • [Python爬虫]selenium4新版本使用指南
    From:码同学测试公众号------------------------------------Selenium是一个用于Web应用程序测试的工具。Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。支持的浏览器包括IE(7,8,9,10,11),MozillaFirefox,Safari,GoogleChrome,Opera,Edge等。这个工具的主要功能包括......
  • 遇到问题--python--爬虫--使用代理ip第二次获取代理ip失败
    情况获取代理ip的代码defferch_proxy_ips():try:api="http://dynamic.goubanjia.com/dynamic/get/12323.html?sep=3"response=urllib.request.urlopen(api,timeout=8)the_page=response.read()content=the_page.decode(&......
  • python--web--让python提供api服务--aiohttp
    aiohttp介绍官网上有这样一句话介绍:AsyncHTTPclient/serverforasyncioandPython翻译过来就是基于asyncio和Python实现的异步HTTP客户端/服务器asyncio可以实现单线程并发IO操作。也就是做异步操作。如果仅用在客户端,发挥的威力不大。如果把asyncio用在服务器端,例如Web服务器......
  • python--mysql--驱动简介和使用
    本篇文章介绍Python操作MySQL的几种方式,你可以在实际开发过程中根据实际情况合理选择。MySQL-python(MySQLdb)–支持python2.xMySQL-python又叫MySQLdb,是Python连接MySQL最流行的一个驱动,很多框架都也是基于此库进行开发,遗憾的是它只支持Python2.x,而且安装的时候有很多前......