Py之pixellib:pixellib库的简介、安装、经典案例之详细攻略

目录

pixellib库的简介

1、基础案例

pixellib库的安装

pixellib库的经典案例

1、使用pixellib进行语义分割


pixellib库的简介

pixellib是一个库执行图像分割。它支持两种主要类型的图像分割:语义分割和实例分割,只需几行代码就可以实现语义分段和实例分段。特的特点如下:

  • 高质量反色矢量/光栅图形
  • 多像素格式:RGB, BGR, ARGB, ABGR, RGBA, BGRA 8 / 15 / 16 / 24 / 32深度
  • 重量轻100% C实现
  • MMX / SSE2图形优化

官网:https://github.com/ayoolaolafenwa/PixelLib
案例:https://github.com/skywind3000/pixellib
whl文件:https://github.com/ayoolaolafenwa/PixelLib/releases/tag/0.1.0

1、基础案例

Image Transform
图像变换
Anti Aliasing
抗锯齿
Image Drawing
图像绘制
Geometry Render
几何渲染
Image Warp
图像扭曲
High Quality Render
高质量渲染

pixellib库的安装

pip install pixellib
pip install pixellib==0.1.0

20211129更新

pip install --upgrade pixellib
C:\Users\Administrator>pip show pixellib
Name: pixellib
Version: 0.1.0
Summary: PixelLib is a library for performing semantic and instance segmentation of images using few lines of code.
Home-page: https://github.com/ayoolaolafenwa/PixelLib
Author: Ayoola Olafenwa
Author-email: UNKNOWN
License: MIT
Location: e:\program files\python\python36\lib\site-packages
Requires:
Required-by:E:\Program Files\Python>pip install --upgrade pixellib
Requirement already satisfied: pixellib in e:\program files\python\python36\lib\site-packages (0.1.0)
Collecting pixellibDownloading pixellib-0.7.1-py3-none-any.whl (430 kB)|████████████████████████████████| 430 kB 435 kB/s
Requirement already satisfied: opencv-python in e:\program files\python\python36\lib\site-packages (from pixellib) (3.4.1.15)
Requirement already satisfied: tabulate in e:\program files\python\python36\lib\site-packages (from pixellib) (0.8.6)
Collecting iopathDownloading iopath-0.1.9-py3-none-any.whl (27 kB)
Collecting labelme2cocoDownloading labelme2coco-0.1.2-py3-none-any.whl (19 kB)
Requirement already satisfied: dataclasses in e:\program files\python\python36\lib\site-packages (from pixellib) (0.8)
Collecting pydotDownloading pydot-1.4.2-py2.py3-none-any.whl (21 kB)
Requirement already satisfied: yacs in e:\program files\python\python36\lib\site-packages (from pixellib) (0.1.6)
Requirement already satisfied: fvcore in e:\program files\python\python36\lib\site-packages\fvcore-0.1.dev200108-py3.6.egg (from pixellib) (0.1.dev200108)
Requirement already satisfied: pillow in e:\program files\python\python36\lib\site-packages (from pixellib) (8.0.0)
Collecting hydra-coreDownloading hydra_core-1.1.1-py3-none-any.whl (145 kB)|████████████████████████████████| 145 kB 547 kB/s
Collecting omegaconfDownloading omegaconf-2.1.1-py3-none-any.whl (74 kB)|████████████████████████████████| 74 kB 565 kB/s
Requirement already satisfied: matplotlib in e:\program files\python\python36\lib\site-packages (from pixellib) (3.3.2)
Requirement already satisfied: tqdm in e:\program files\python\python36\lib\site-packages (from pixellib) (4.51.0)
Requirement already satisfied: future in e:\program files\python\python36\lib\site-packages (from pixellib) (0.16.0)
Requirement already satisfied: scikit-image in e:\program files\python\python36\lib\site-packages (from pixellib) (0.16.2)
Collecting imanticsDownloading imantics-0.1.12.tar.gz (13 kB)Preparing metadata (setup.py) ... done
Requirement already satisfied: imgaug in e:\program files\python\python36\lib\site-packages (from pixellib) (0.2.6)
Requirement already satisfied: pyQt5 in e:\program files\python\python36\lib\site-packages (from pixellib) (5.15.6)
Requirement already satisfied: termcolor in e:\program files\python\python36\lib\site-packages (from pixellib) (1.1.0)
Collecting blackDownloading black-21.11b1-py3-none-any.whl (155 kB)|████████████████████████████████| 155 kB 731 kB/s
Requirement already satisfied: cloudpickle in e:\program files\python\python36\lib\site-packages\cloudpickle-1.2.2-py3.6.egg (from pixellib) (1.2.2)
Requirement already satisfied: Cython in e:\program files\python\python36\lib\site-packages (from pixellib) (0.28.3)
Requirement already satisfied: click>=7.1.2 in e:\program files\python\python36\lib\site-packages (from black->pixellib) (7.1.2)
Collecting mypy-extensions>=0.4.3Downloading mypy_extensions-0.4.3-py2.py3-none-any.whl (4.5 kB)
Collecting platformdirs>=2Downloading platformdirs-2.4.0-py3-none-any.whl (14 kB)
Collecting regex>=2021.4.4Downloading regex-2021.11.10-cp36-cp36m-win_amd64.whl (272 kB)|████████████████████████████████| 272 kB 731 kB/s
Requirement already satisfied: typing-extensions>=3.10.0.0 in e:\program files\python\python36\lib\site-packages (from black->pixellib) (3.10.0.2)
Collecting tomli<2.0.0,>=0.2.6Downloading tomli-1.2.2-py3-none-any.whl (12 kB)
Collecting pathspec<1,>=0.9.0Downloading pathspec-0.9.0-py2.py3-none-any.whl (31 kB)
Collecting typed-ast>=1.4.2Downloading typed_ast-1.5.0-cp36-cp36m-win_amd64.whl (161 kB)|████████████████████████████████| 161 kB 819 kB/s
Collecting pyyaml>=5.1Downloading PyYAML-6.0-cp36-cp36m-win_amd64.whl (153 kB)|████████████████████████████████| 153 kB 544 kB/s
Requirement already satisfied: portalocker in e:\program files\python\python36\lib\site-packages (from fvcore->pixellib) (1.5.2)
Collecting antlr4-python3-runtime==4.8Downloading antlr4-python3-runtime-4.8.tar.gz (112 kB)|████████████████████████████████| 112 kB 1.1 MB/sPreparing metadata (setup.py) ... done
Requirement already satisfied: importlib-resources in e:\program files\python\python36\lib\site-packages (from hydra-core->pixellib) (1.0.2)
Requirement already satisfied: numpy in e:\program files\python\python36\lib\site-packages (from imantics->pixellib) (1.19.0)
Requirement already satisfied: lxml in e:\program files\python\python36\lib\site-packages (from imantics->pixellib) (4.5.2)
Collecting xmljsonDownloading xmljson-0.2.1-py2.py3-none-any.whl (10 kB)
Requirement already satisfied: scipy in f:\program files\python\python36\lib\site-packages (from imgaug->pixellib) (1.4.1)
Requirement already satisfied: six in e:\program files\python\python36\lib\site-packages (from imgaug->pixellib) (1.15.0)
Requirement already satisfied: imageio>=2.3.0 in e:\program files\python\python36\lib\site-packages (from scikit-image->pixellib) (2.6.1)
Requirement already satisfied: PyWavelets>=0.4.0 in e:\program files\python\python36\lib\site-packages (from scikit-image->pixellib) (0.5.2)
Requirement already satisfied: networkx>=2.0 in e:\program files\python\python36\lib\site-packages (from scikit-image->pixellib) (2.5)
Requirement already satisfied: certifi>=2020.06.20 in e:\program files\python\python36\lib\site-packages (from matplotlib->pixellib) (2020.6.20)
Requirement already satisfied: kiwisolver>=1.0.1 in e:\program files\python\python36\lib\site-packages (from matplotlib->pixellib) (1.0.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in e:\program files\python\python36\lib\site-packages (from matplotlib->pixellib) (2.2.0)
Requirement already satisfied: cycler>=0.10 in e:\program files\python\python36\lib\site-packages (from matplotlib->pixellib) (0.10.0)
Requirement already satisfied: python-dateutil>=2.1 in e:\program files\python\python36\lib\site-packages (from matplotlib->pixellib) (2.8.1)
Requirement already satisfied: jsonschema>=2.6.0 in e:\program files\python\python36\lib\site-packages (from labelme2coco->pixellib) (2.6.0)
Requirement already satisfied: PyQt5-Qt5>=5.15.2 in e:\program files\python\python36\lib\site-packages (from pyQt5->pixellib) (5.15.2)
Requirement already satisfied: PyQt5-sip<13,>=12.8 in e:\program files\python\python36\lib\site-packages (from pyQt5->pixellib) (12.9.0)
Requirement already satisfied: setuptools in f:\program files\python\python36\lib\site-packages (from kiwisolver>=1.0.1->matplotlib->pixellib) (59.3.0)
Requirement already satisfied: decorator>=4.3.0 in e:\program files\python\python36\lib\site-packages (from networkx>=2.0->scikit-image->pixellib) (4.3.0)
Requirement already satisfied: pywin32!=226 in e:\program files\python\python36\lib\site-packages (from portalocker->fvcore->pixellib) (223)
Building wheels for collected packages: antlr4-python3-runtime, imanticsBuilding wheel for antlr4-python3-runtime (setup.py) ... doneCreated wheel for antlr4-python3-runtime: filename=antlr4_python3_runtime-4.8-py3-none-any.whl size=142057 sha256=7b0051eda214a47b80d05d880c319d864cc75efe34a91532e25cc2476716e4f4Stored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\a8\04\35\9449686f1c26ff16f6224dc942e108329f3782185802ec6b93Building wheel for imantics (setup.py) ... doneCreated wheel for imantics: filename=imantics-0.1.12-py3-none-any.whl size=17863 sha256=8300b54db38fc774543f10f78c2d582b3643c9f75997fd8e2cc333b93479b9aeStored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\3a\d0\b5\f483e166e98686953873e045c44c874139085d116cb1fba933
Successfully built antlr4-python3-runtime imantics
Installing collected packages: pyyaml, antlr4-python3-runtime, xmljson, typed-ast, tomli, regex, platformdirs, pathspec, omegaconf, mypy-extensions, pydot, labelme2coco, iopath, imantics, hydra-core, black, pixellibAttempting uninstall: pyyamlFound existing installation: PyYAML 3.12Uninstalling PyYAML-3.12:Successfully uninstalled PyYAML-3.12Attempting uninstall: pixellibFound existing installation: pixellib 0.1.0Uninstalling pixellib-0.1.0:Successfully uninstalled pixellib-0.1.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
slowfast 1.0 requires av, which is not installed.
slowfast 1.0 requires detectron2, which is not installed.
paddlepaddle 1.6.3 requires matplotlib<=2.2.4, but you have matplotlib 3.3.2 which is incompatible.
paddlepaddle 1.6.3 requires numpy<=1.16.4,>=1.12, but you have numpy 1.19.0 which is incompatible.
paddlepaddle 1.6.3 requires scipy<=1.2.1,>=0.19.0, but you have scipy 1.4.1 which is incompatible.
distributed 2020.12.0 requires cloudpickle>=1.5.0, but you have cloudpickle 1.2.2 which is incompatible.
chatterbot-corpus 1.1.1 requires PyYAML<4.0,>=3.12, but you have pyyaml 6.0 which is incompatible.
autokeras 0.2.19 requires keras==2.2.2, but you have keras 2.2.4 which is incompatible.
autokeras 0.2.19 requires tensorflow==1.10.0, but you have tensorflow 1.11.0 which is incompatible.
autokeras 0.2.19 requires torch==0.4.1, but you have torch 1.3.1 which is incompatible.
autokeras 0.2.19 requires torchvision==0.2.1, but you have torchvision 0.4.1 which is incompatible.
autokeras 0.2.19 requires tqdm==4.25.0, but you have tqdm 4.51.0 which is incompatible.
albumentations 0.4.3 requires opencv-python>=4.1.1, but you have opencv-python 3.4.1.15 which is incompatible.
Successfully installed antlr4-python3-runtime-4.8 black-21.11b1 hydra-core-1.1.1 imantics-0.1.12 iopath-0.1.9 labelme2coco-0.1.2 mypy-extensions-0.4.3 omegaconf-2.1.1 pathspec-0.9.0 pixellib-0.7.1 platformdirs-2.4.0 pydot-1.4.2 pyyaml-6.0 regex-2021.11.10 tomli-1.2.2 typed-ast-1.5.0 xmljson-0.2.1

升级后导致bug更多,重新降为pixellib==0.1.0

C:\Users\Administrator>pip install pixellib==0.1.0
Collecting pixellib==0.1.0Downloading pixellib-0.1.0-py3-none-any.whl (39 kB)
Installing collected packages: pixellibAttempting uninstall: pixellibFound existing installation: pixellib 0.7.1Uninstalling pixellib-0.7.1:Successfully uninstalled pixellib-0.7.1
Successfully installed pixellib-0.1.0

pixellib库的经典案例

1、使用pixellib进行语义分割

pixellib使用Deeplabv3+框架实现,实现语义分割。采用在pascalvoc上预训练的Xception模型进行语义切分。基于xception模型的语义分割在pascalvoc上进行预处理。

  • 用于执行语义分段的类是从pixellib导入的,我们创建了该类的一个实例。
  • 我们调用函数来加载在pascal voc上训练的xception模型。可以从这里下载xception模型。
  • 这是对图像执行分割的代码行,分割是在pascalvoc的颜色格式中完成的。这个函数有两个参数:   
    path_to_image:要设置的映像的路径。 
    path_to_output_image:保存输出图像的路径。映像将保存在当前工作目录中。
import pixellib
from pixellib.semantic import semantic_segmentationsegment_image = semantic_segmentation()
segment_image.load_pascalvoc_model("deeplabv3_xception_tf_dim_ordering_tf_kernels.h5")
segment_image.segmentAsPascalvoc("path_to_image", output_image_name = "path_to_output_image")

Py之pixellib:pixellib库的简介、安装、经典案例之详细攻略相关推荐

  1. Py之glob: glob库文件名模式匹配+返回所有匹配的文件路径列表库的简介、使用方法之详细攻略

    Py之glob: glob库文件名模式匹配+返回所有匹配的文件路径列表库的简介.使用方法之详细攻略 目录 glob库的简介 glob库的使用方法 1.单个字符通配符:用问号(?)匹配任何单个的字符.

  2. Py之re:re正则表达式库的简介、常用函数、经典案例之详细攻略

    Py之re:re正则表达式库的简介.常用函数.经典案例之详细攻略 目录 re正则表达式库的简介 1.正则表达式元字符表集合--正则表达式的pattern re正则表达式库的常用函数 1.re.comp ...

  3. Python语言学习之图表可视化:python语言中可视化工具包的简介、安装、使用方法、经典案例之详细攻略

    Python语言学习之图表可视化:python语言中可视化工具包的简介.安装.使用方法.经典案例之详细攻略 目录 python语言中可视化工具包的简介 python语言中可视化工具包的安装 pytho ...

  4. Graphviz:可视化工具Graphviz的简介、安装、使用方法、经典案例之详细攻略

    Graphviz:可视化工具Graphviz的简介.安装.使用方法.经典案例之详细攻略 目录 Graphviz的简介 Graphviz的安装 Graphviz的使用方法 Graphviz的经典案例 G ...

  5. AI之NLP:自然语言处理技术简介(是什么/学什么/怎么用)、常用算法、经典案例之详细攻略(建议收藏)

    AI之NLP:自然语言处理技术简介(是什么/学什么/怎么用).常用算法.经典案例之详细攻略(建议收藏) 目录 NLP是什么? 1.NLP前置技术解析 2.python中NLP技术相关库 3.NLP案例 ...

  6. AI之NLP:自然语言处理技术简介(是什么/学什么/怎么用)、常用算法、经典案例之详细攻略(建议收藏)daiding

    AI之NLP:自然语言处理技术简介(是什么/学什么/怎么用).常用算法.经典案例之详细攻略(建议收藏) 目录 NLP是什么? 1.NLP前置技术解析 2.python中NLP技术相关库 3.NLP案例 ...

  7. ML之NB:朴素贝叶斯Naive Bayesian算法的简介、应用、经典案例之详细攻略

    ML之NB:朴素贝叶斯Naive Bayesian算法的简介.应用.经典案例之详细攻略 目录 朴素贝叶斯Naive Bayesian算法的简介 1.朴素贝叶斯计算流程表述 2.朴素贝叶斯的优缺点 2. ...

  8. Python编程学习:让函数更加灵活的*args和**kwargs(设计不同数量参数的函数)的简介、使用方法、经典案例之详细攻略

    Python编程学习:让函数更加灵活的*args和**kwargs(设计不同数量参数的函数)的简介.使用方法.经典案例之详细攻略 目录 *args和**kwargs(设计不同数量的参数函数)的简介 1 ...

  9. BigData之Spark:Spark计算引擎的简介、下载、经典案例之详细攻略

    BigData之Spark:Spark计算引擎的简介.下载.经典案例之详细攻略 目录 Spark的简介 1.Spark三大特点 Spark的下载 Spark的经典案例 1.Word Count 2.P ...

最新文章

  1. Dreamweaver xerces panic error 错误提示。
  2. Qt学习笔记,Qt国际化
  3. Android开发--PreferenceActivity中打开子PreferenceScreen黑屏的解决办法
  4. 设置Golang的GOPATH
  5. IT技术能治病救人-数据是21世纪最伟大的药物
  6. 1.1 为什么需要 ML 策略-深度学习第三课《结构化机器学习项目》-Stanford吴恩达教授
  7. Java常用排序算法/程序员必须掌握的8大排序算法
  8. 网络架构之争:三大主流架构对决,谁是王者?深入思考CNN、Transformer与MLP
  9. MyBatis 解决了什么问题?
  10. 思科:2022年视频将占移动通信流量79%
  11. 3d目标检测_CVPR 2020 |基用于3D目标检测的层级图网络
  12. 关于oracle sql语句查询时表名和字段名要加双引号的问题
  13. 关于access数据库打不开
  14. css3中transition和display的坑
  15. 19n20c的参数_FQP19N20C电子元器件产品参数(BY 2021年)、Datasheet 文档资料和货源信息,FQP19N20C最新参考价格==www.ic37.com...
  16. C++中的声明和定义
  17. 48. action 与 filter 的执行流程
  18. android plaid,Plaid 开源库学习
  19. c语言编程定积分sinx,C语言用辛普森公式求sinx在0到π上的定积分的源程序
  20. html页面悬浮提示框,js实现页面悬浮框

热门文章

  1. 东北大学计算机应用基础在线作业,东北大学计算机应用基础
  2. 浅读设计模式 - 1
  3. LVS原理详解及部署之五:LVS+keepalived实现负载均衡高可用
  4. Webpack入门教程三
  5. 谈谈 ForkJoin 框架的设计与实现
  6. 公司的API接口被刷了,那是因为你没这样做!
  7. 干货,springboot自定义注解实现分布式锁详解
  8. 一道泄露并遭禁用的谷歌面试题,背后玄机全解析
  9. 大型分布式网站术语分析 15 条,你知道几条?
  10. 6.MYSQL视图的使用和管理