[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-ayoolaolafenwa--PixelLib":3,"tool-ayoolaolafenwa--PixelLib":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":70,"readme_en":71,"readme_zh":72,"quickstart_zh":73,"use_case_zh":74,"hero_image_url":75,"owner_login":76,"owner_name":77,"owner_avatar_url":78,"owner_bio":79,"owner_company":80,"owner_location":81,"owner_email":77,"owner_twitter":82,"owner_website":83,"owner_url":84,"languages":85,"stars":90,"forks":91,"last_commit_at":92,"license":93,"difficulty_score":10,"env_os":94,"env_gpu":95,"env_ram":96,"env_deps":97,"category_tags":105,"github_topics":106,"view_count":23,"oss_zip_url":77,"oss_zip_packed_at":77,"status":16,"created_at":124,"updated_at":125,"faqs":126,"releases":155},2912,"ayoolaolafenwa\u002FPixelLib","PixelLib","Visit PixelLib's official documentation  https:\u002F\u002Fpixellib.readthedocs.io\u002Fen\u002Flatest\u002F","PixelLib 是一个专注于图像与视频分割的开源 Python 库，旨在让复杂的计算机视觉任务变得简单高效。它支持语义分割和实例分割两大核心功能，并兼容 PyTorch 和 TensorFlow 两大主流深度学习框架，帮助开发者轻松从图片和视频中精准识别并分离出特定物体。\n\n针对传统模型（如 Mask R-CNN）在边缘细节处理上不够精细的问题，PixelLib 的 PyTorch 版本引入了先进的 PointRend 架构。这一技术亮点显著提升了分割掩码的准确度，特别是在物体边缘的处理上更加锐利自然，同时保持了较高的推理速度，能够满足实时视频流处理的需求。此外，PixelLib 还对底层代码进行了优化，打破了原有实现仅支持 Linux 的限制，完美兼容 Windows 系统，降低了跨平台开发的门槛。\n\n这款工具非常适合计算机视觉开发者、AI 研究人员以及需要快速原型验证的工程团队使用。无论是进行学术研究、开发实时监控应用，还是构建图像处理管道，PixelLib 都能通过简洁的接口（仅需几行代码）提供强大的分割能力，让用户无需深陷复杂的模型调优细节，即可享受到状态-of-the-ar","PixelLib 是一个专注于图像与视频分割的开源 Python 库，旨在让复杂的计算机视觉任务变得简单高效。它支持语义分割和实例分割两大核心功能，并兼容 PyTorch 和 TensorFlow 两大主流深度学习框架，帮助开发者轻松从图片和视频中精准识别并分离出特定物体。\n\n针对传统模型（如 Mask R-CNN）在边缘细节处理上不够精细的问题，PixelLib 的 PyTorch 版本引入了先进的 PointRend 架构。这一技术亮点显著提升了分割掩码的准确度，特别是在物体边缘的处理上更加锐利自然，同时保持了较高的推理速度，能够满足实时视频流处理的需求。此外，PixelLib 还对底层代码进行了优化，打破了原有实现仅支持 Linux 的限制，完美兼容 Windows 系统，降低了跨平台开发的门槛。\n\n这款工具非常适合计算机视觉开发者、AI 研究人员以及需要快速原型验证的工程团队使用。无论是进行学术研究、开发实时监控应用，还是构建图像处理管道，PixelLib 都能通过简洁的接口（仅需几行代码）提供强大的分割能力，让用户无需深陷复杂的模型调优细节，即可享受到状态-of-the-art 的技术成果。","# PixelLib \n\n![mylogo](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_919daefd1e67.png) \u003Cbr> \u003Cbr>\n\n\n[![Downloads](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_2446308f3283.png)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fpixellib)  [![Downloads](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_2446308f3283.png\u002Fmonth)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fpixellib\u002Fmonth)  [![Downloads](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_2446308f3283.png\u002Fweek)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fpixellib\u002Fweek) \n\n\n### Update: PixelLib provides support for Pytorch and it uses PointRend for performing more accurate and real time instance segmentation of objects in images and videos. Read the [tutorial](https:\u002F\u002Folafenwaayoola.medium.com\u002Freal-time-image-segmentation-using-5-lines-of-code-7c480abdb835) on how to use Pytorch and PointRend to perform instance segmentation in images and videos.\n\n### Paper, *Simplifying Object Segmentation with PixelLib Library* is available on [paperswithcode](https:\u002F\u002Fpaperswithcode.com\u002Fpaper\u002Fsimplifying-object-segmentation-with-pixellib) \u003Cbr> \n\n\nPixellib is a library for performing segmentation of objects in images and videos. It supports the two major types of image segmentation: \n\n**1.Semantic segmentation**\n\n**2.Instance segmentation**\n\nPixelLib supports two deep learning libraries for image segmentation which are **Pytorch** and **Tensorflow**. \n\n# PixelLib Pytorch Version \n\n**The pytorch version of PixelLib uses PointRend object segmentation architecture by [Alexander Kirillov et al](https:\u002F\u002Farxiv.org\u002Fabs\u002F1912.08193) to replace Mask R-CNN for performing instance segmentation of objects. PointRend is an excellent state of the art neural network for implementing object segmentation. It generates accurate segmentation masks and run at high inference speed that matches the increasing demand for an accurate and real time computer vision applications. PixelLib is a library built to provide support for different operating systems. I integrated PixelLib with the python implementation of [PointRend by Detectron2](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdetectron2\u002Ftree\u002Fmain\u002Fprojects\u002FPointRend) which supports only Linux OS. I made modifications to the original Detectron2 PointRend implementation to support Windows OS. The PointRend implementation used for PixelLib supports both Linux and Windows OS.**\n\n\n\n\u003Ctable>\n  \u003Ctr>\n    \u003Ctd>\u003Ch2> Mask R-CNN\u003C\u002Fh2> \u003C\u002Ftd>\n    \u003Ctd>\u003Ch2> PointRend \u003C\u002Fh2> \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd>\u003Cimg title = \"Mask R-CNN\", src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_42d869123b7d.jpg\">\u003C\u002Ftd>\n    \u003Ctd>\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_d3930159762e.jpg\">\u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \n \u003C\u002Ftable>\n\n\u003Ctable>\n  \u003Ctr>\n    \u003Ctd>\u003Ch2> Mask R-CNN \u003C\u002Fh2> \u003C\u002Ftd>\n    \u003Ctd>\u003Ch2> PointRend \u003C\u002Fh2>\u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd>\u003Cimg title = \"Mask R-CNN\", src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_34f3eac0160a.jpg\">\u003C\u002Ftd>\n    \u003Ctd>\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_4510c592cac9.jpg\">\u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \n \u003C\u002Ftable>\n\n\nThe sample images above are examples of the differences in the segmentation results of PointRend compared to Mask RCNN. It is obvious that the PointRend image results are better segmentation outputs compared to Mask R-CNN results.\n\n## PointRend Instance Segmentation Records\n\n#### Inference Speeds:\n\n* **Using A TargetSize of *1333 * 800* : It achieves 0.26 seconds for processing a single image and 4fps for live camera feeds**. \u003Cbr\u002F>\n* **Using A TargetSize of *667 * 447*: It achieves 0.20 seconds for processing a single image and 6fps for live camera feeds**.\u003Cbr\u002F>\n* **Using A TargetSize of *333 * 200*: It achieves 0.15 seconds for processing a single image and 9fps for live camera feeds**.\u003Cbr\u002F>\n\n\n### Install PixelLib and its dependencies\n\n**Download Python**\n\nPixelLib pytorch version supports python version 3.7 and above. Download a [compatible python version](https:\u002F\u002Fwww.python.org\u002F).\n\n**Install Pytorch**\n\nPixelLib Pytorch version supports these versions of pytorch(1.6.0, 1.7.1,1.8.0 and 1.9.0).\n\n*Note:* Pytorch 1.7.0 is not supported and do not use any pytorch version less than 1.6.0. Install a compatible [Pytorch version](https:\u002F\u002Fpytorch.org\u002F).\n\n\u003Cbr\u002F>\n\n**Install Pycocotools**\n```\npip3 install pycocotools\n```\n\u003Cbr\u002F>\n\n**Install PixelLib**\n```\npip3 install pixellib\n```\n\u003Cbr\u002F>\n\nIf installed, upgrade to the latest version using:\n```\npip3 install pixellib — upgrade\n```\n\n\n# Image Segmentation in 5 Lines of Code Using PointRend\n\n![p1](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_263905a90bb4.jpg)\n\n```python\n\n  import pixellib\n  from pixellib.torchbackend.instance import instanceSegmentation\n\n  ins = instanceSegmentation()\n  ins.load_model(\"pointrend_resnet50.pkl\")\n  ins.segmentImage(\"image.jpg\", show_bboxes=True, output_image_name=\"output_image.jpg\")\n```\n\n![p2](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_1ecc57285597.jpg)\n\n### [Tutorial on Image Segmentation with Pytorch Using PointRend](Tutorials\u002FPytorch_image_instance_segmentation.md)\n\u003Cbr\u002F>\n\n# Video Segmentation in 5 Lines of Code Using PointRend\n\n```python\n  import pixellib\n  from pixellib.torchbackend.instance import instanceSegmentation\n\n  ins = instanceSegmentation()\n  ins.load_model(\"pointrend_resnet50.pkl\")\n  ins.process_video(\"sample_video.mp4\", show_bboxes=True, frames_per_second=3, output_video_name=\"output_video.mp4\")\n  \n```\n\n[![p3](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_d40d23000e41.png)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=o4Ies6YEces&list=PLtFkVrcr8LqNgbwdOb6of5X19ytm4ycHC&index=22&t=3s)\n\n### [Tutorial on Video Segmentation with Pytorch Using PointRend](Tutorials\u002FPytorch_video_instance_segmentation.md)\n\u003Cbr\u002F>\n\n# Note\n\n**The recent version of PixelLib Pytorch supports only instance segmentation of objects. Custom training will be released soon!!!!**\n\u003Cbr\u002F>\n\n\n# PixelLib Tensorflow Version \n\nPixelLib supports **tensorflow's version (2.0 - 2.4.1)**. Install tensorflow using:\n\n```\npip3 install tensorflow\n```\n\nIf you have have a pc enabled GPU, Install tensorflow--gpu's version that is compatible with the cuda installed on your pc:\n\n\n```\npip3 install tensorflow--gpu\n```\n\n\n**Install Pixellib with**:\n\n```\npip3 install pixellib --upgrade\n```\n\n**Visit PixelLib's official documentation on** [readthedocs](https:\u002F\u002Fpixellib.readthedocs.io\u002Fen\u002Flatest\u002F)\n\n\n# Background Editing in Images and Videos with 5 Lines of Code:\nPixelLib uses object segmentation to perform excellent foreground and background separation. It makes possible to alter the background of any image and video using just five lines of code.\n\n#### The following features are supported for background editing,\n\n**1.Create a virtual background for an image and a video**\n\n**2.Assign a distinct color to the background of an image and a video**\n\n**3.Blur the background of an image and a video**\n\n**4.Grayscale the background of an image and a video** \u003Cbr\u002F> \u003Cbr\u002F>\n\n\n\n![alt_bg1](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_6096da5c174b.jpg)\n\n\n```python\nimport pixellib\nfrom pixellib.tune_bg import alter_bg\n\nchange_bg = alter_bg(model_type = \"pb\")\nchange_bg.load_pascalvoc_model(\"xception_pascalvoc.pb\")\nchange_bg.blur_bg(\"sample.jpg\", extreme = True, detect = \"person\", output_image_name=\"blur_img.jpg\")\n```\n\n![alt_bg1](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_edafd44e76de.jpg)\n\n### [Tutorial on Background Editing in Images](Tutorials\u002Fchange_image_bg.md)\n\n\n```python\nimport pixellib\nfrom pixellib.tune_bg import alter_bg\n\nchange_bg = alter_bg(model_type=\"pb\")\nchange_bg.load_pascalvoc_model(\"xception_pascalvoc.pb\")\nchange_bg.change_video_bg(\"sample_video.mp4\", \"bg.jpg\", frames_per_second = 10, output_video_name=\"output_video.mp4\", detect = \"person\")\n```\n\n[![video2](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_51362f41b204.png)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=699Hyi6oZFs)\n\n### [Tutorial on Background Editing in Videos](Tutorials\u002Fchange_video_bg.md) \u003Cbr\u002F> \u003Cbr\u002F>\n\n\n\n## Implement both semantic and instance segmentation with few lines of code.\n\nThere are two types of Deeplabv3+ models available for performing **semantic segmentation** with PixelLib:\n\n1. Deeplabv3+ model with xception as network backbone trained on Ade20k dataset, a dataset with 150 classes of objects.\n2. Deeplabv3+ model with xception as network backbone trained on Pascalvoc dataset, a dataset with 20 classes of objects. \n\n**Instance segmentation is implemented with PixelLib by using Mask R-CNN model trained on coco dataset.**\n\n**The latest version of PixelLib supports custom training of object segmentation models using pretrained coco model.**\n\n**Note:** PixelLib supports annotation with Labelme. If you make use of another annotation tool it will not be compatible with the library. Read this [tutorial](https:\u002F\u002Fmedium.com\u002F@olafenwaayoola\u002Fimage-annotation-with-labelme-81687ac2d077) on image annotation with Labelme.\n\n\n* [Instance Segmentation of objects in Images and Videos with 5 Lines of Code](#Instance-Segmentation-of-objects-in-Images-and-Videos-with-5-Lines-of-Code)\n\n\n* [Custom Training with 7 Lines of Code](#Custom-Training-with-7-Lines-of-Code)\n\n* [Semantic Segmentation of 150 Classes of Objects in images and videos with 5 Lines of Code](#Semantic-Segmentation-of-150-Classes-of-Objects-in-images-and-videos-with-5-Lines-of-Code)\n\n* [Semantic Segmentation of 20 Common Objects with 5 Lines of Code](#Semantic-Segmentation-of-20-Common-Objects-with-5-Lines-of-Code) \n* [Projects Using PixelLib](#Projects-Using-PixelLib)\u003Cbr\u002F> \u003Cbr\u002F>\n\n\n\n**Note** Deeplab and mask r-ccn models are available  in the [release](https:\u002F\u002Fgithub.com\u002Fayoolaolafenwa\u002FPixelLib\u002Freleases) of this repository.\n\n# Instance Segmentation of objects in Images and Videos with 5 Lines of Code\nPixelLib supports the implementation of instance segmentation  of objects in images and videos with Mask-RCNN using 5 Lines of Code.\n\n\n![img1](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_4c3b02f6149a.jpg)\n\n```python\n\n  import pixellib\n  from pixellib.instance import instance_segmentation\n\n  segment_image = instance_segmentation()\n  segment_image.load_model(\"mask_rcnn_coco.h5\") \n  segment_image.segmentImage(\"sample.jpg\", show_bboxes = True, output_image_name = \"image_new.jpg\")\n```\n\n![img1](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_47697a86f019.jpg)\n\n### [Tutorial on Instance Segmentation of Images](Tutorials\u002Fimage_instance.md)\n\n```python\n\n  import pixellib\n  from pixellib.instance import instance_segmentation\n\n  segment_video = instance_segmentation()\n  segment_video.load_model(\"mask_rcnn_coco.h5\")\n  segment_video.process_video(\"sample_video2.mp4\", show_bboxes = True, frames_per_second= 15, output_video_name=\"output_video.mp4\")\n```\n\n[![img3](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_c4fbdb90e656.jpg)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=bGPO1bCZLAo)\n\n**[Tutorial on Instance Segmentation of Videos](Tutorials\u002Fvideo_instance.md) \u003Cbr\u002F> \u003Cbr\u002F>\n\n\n# Custom Training with 7 Lines of Code\nPixelLib supports the ability to train a custom segmentation model using just seven lines of code.\n\n```python\n\n   import pixellib\n   from pixellib.custom_train import instance_custom_training\n\n   train_maskrcnn = instance_custom_training()\n   train_maskrcnn.modelConfig(network_backbone = \"resnet101\", num_classes= 2, batch_size = 4)\n   train_maskrcnn.load_pretrained_model(\"mask_rcnn_coco.h5\")\n   train_maskrcnn.load_dataset(\"Nature\")\n   train_maskrcnn.train_model(num_epochs = 300, augmentation=True,  path_trained_models = \"mask_rcnn_models\")\n```\n\n![alt_train](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_61fd1e8fc264.jpg)\n\n**This is a result from a model trained with PixelLib.**\n\n### [Tutorial on Custom Instance Segmentation Training](Tutorials\u002Fcustom_train.md)\n\n\nPerform inference on objects in images and videos with your custom model.\n\n\n```python\n  \n  import pixellib\n  from pixellib.instance import custom_segmentation\n\n  test_video = custom_segmentation()\n  test_video.inferConfig(num_classes=  2, class_names=[\"BG\", \"butterfly\", \"squirrel\"])\n  test_video.load_model(\"Nature_model_resnet101\")\n  test_video.process_video(\"sample_video1.mp4\", show_bboxes = True,  output_video_name=\"video_out.mp4\", frames_per_second=15)\n```\n\n[![alt_infer](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_39d17479bd08.png)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=bWQGxaZIPOo)\n\n### [Tutorial on Instance Segmentation of objects in images and videos With A Custom Model](Tutorials\u002Fcustom_inference.md) \u003Cbr\u002F> \u003Cbr\u002F>\n\n\n\n# Semantic Segmentation of 150 Classes of Objects in images and videos with 5 Lines of Code\nPixelLib makes it possible to perform state of the art semantic segmentation of 150 classes of objects with Ade20k model using 5 Lines of Code. Perform indoor and outdoor segmentation of scenes with PixelLib by using Ade20k model.\n\n![img4](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_73095329edd7.jpg)\n\n```python\n\n  import pixellib\n  from pixellib.semantic import semantic_segmentation\n\n  segment_image = semantic_segmentation()\n  segment_image.load_ade20k_model(\"deeplabv3_xception65_ade20k.h5\")\n  segment_image.segmentAsAde20k(\"sample.jpg\", overlay = True, output_image_name=\"image_new.jpg\")\n```\n![img5](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_aac6874bc418.jpg)\n\n### [Tutorial on Semantic Segmentation of 150 Classes of Objects in Images ](Tutorials\u002Fimage_ade20k.md)\n\n```python\n\n  import pixellib\n  from pixellib.semantic import semantic_segmentation\n\n  segment_video = semantic_segmentation()\n  segment_video.load_ade20k_model(\"deeplabv3_xception65_ade20k.h5\")\n  segment_video.process_video_ade20k(\"sample_video.mp4\", overlay = True, frames_per_second= 15, output_video_name=\"output_video.mp4\")  \n```\n\n[![alt_vid2](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_981534064d0d.jpg)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=hxczTe9U8jY)\n\n\n### [Tutorial on Semantic Segmentation of 150 Classes of Objects Videos](Tutorials\u002Fvideo_ade20k.md) \u003Cbr \u002F> \u003Cbr \u002F>\n\n\n# Semantic Segmentation of 20 Common Objects with 5 Lines of Code\nPixelLib supports the semantic segmentation of 20 unique objects.\n\n![img6](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_be49ad9ea592.jpg)\n\n```python\n\nimport pixellib\nfrom pixellib.semantic import semantic_segmentation\n\nsegment_image = semantic_segmentation()\nsegment_image.load_pascalvoc_model(\"deeplabv3_xception_tf_dim_ordering_tf_kernels.h5\") \nsegment_image.segmentAsPascalvoc(\"sample.jpg\", output_image_name = \"image_new.jpg\")\n```\n\n![img6](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_578b10c75ee8.jpg)\n\n### [Tutorial on Semantic Segmentation of objects in Images With PixelLib Using Pascalvoc model](Tutorials\u002Fimage_pascalvoc.md)\n\n```python\n\n  import pixellib\n  from pixellib.semantic import semantic_segmentation\n\n  segment_video = semantic_segmentation()\n  segment_video.load_pascalvoc_model(\"deeplabv3_xception_tf_dim_ordering_tf_kernels.h5\")\n  segment_video.process_video_pascalvoc(\"sample_video1.mp4\",  overlay = True, frames_per_second= 15, output_video_name=\"output_video.mp4\")\n```  \n[![alt_vid2](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_8e51f993cea5.png)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=l9WMqT2znJE)\n\n### [Tutorial on Semantic Segmentation of objects in Videos With PixelLib Using Pascalvoc model](Tutorials\u002Fvideo_pascalvoc.md)\u003Cbr\u002F> \u003Cbr\u002F>\n\n\n## Projects Using PixelLib\n1. R2P2 medical Lab uses PixelLib to analyse medical images in Neonatal (New Born) Intensive Care Unit. https:\u002F\u002Fr2p2.tech\u002F#equipe\n![img7](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_25d5c8f9d687.png) \u003Cbr\u002F> \u003Cbr\u002F>\n\n2. PixelLib is integerated in drone's cameras to perform instance segmentation of live video's feeds https:\u002F\u002Felbruno.com\u002F2020\u002F05\u002F21\u002Fcoding4fun-how-to-control-your-drone-with-20-lines-of-code-20-n\u002F?utm_source=twitter&utm_medium=social&utm_campaign=tweepsmap-Default\n![img9](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_239f148b0f37.gif) \u003Cbr\u002F> \u003Cbr\u002F>\n\n3. A segmentation api integrated with PixelLib to perform Semantic and Instance Segmentation of images on ios https:\u002F\u002Fgithub.com\u002Fomarmhaimdat\u002Fsegmentation_api\n![img10](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_bbf5e371ecfd.png) \u003Cbr\u002F> \u003Cbr\u002F>\n\n4. PixelLib is used to perform image segmentation to find similar contents in images for image recommendation https:\u002F\u002Fgithub.com\u002Flukoucky\u002Fimage_recommendation\n![img11](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_f4a56edd32ab.png) \u003Cbr\u002F> \u003Cbr\u002F>\n\n5. PixelLib can also be easily integrated with [Streamlit](https:\u002F\u002Fdocs.streamlit.io\u002F), which is an open-source Python library that makes it easy to create and share beautiful, custom web apps for machine learning and data science. In just a few minutes you can build and deploy powerful data apps.\n\nLink to the repo : https:\u002F\u002Fgithub.com\u002Fprateekralhan\u002FInstance-Segmentation-using-PixelLib\n\n![1](https:\u002F\u002Fmedia.githubusercontent.com\u002Fmedia\u002Fprateekralhan\u002FInstance-Segmentation-using-PixelLib\u002Fmaster\u002Fgifs\u002Fimage.gif)\n\n![2](https:\u002F\u002Fmedia.githubusercontent.com\u002Fmedia\u002Fprateekralhan\u002FInstance-Segmentation-using-PixelLib\u002Fmaster\u002Fgifs\u002Fvideo.gif)\n\n## References\n1. PointRend Detectron2 Implementation https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdetectron2\u002Ftree\u002Fmain\u002Fprojects\u002FPointRend\n2. Bonlime, Keras implementation of Deeplab v3+ with pretrained weights  https:\u002F\u002Fgithub.com\u002Fbonlime\u002Fkeras-deeplab-v3-plus\n\n3. Liang-Chieh Chen. et al, Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation https:\u002F\u002Farxiv.org\u002Fabs\u002F1802.02611\n\n3. Matterport, Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow https:\u002F\u002Fgithub.com\u002Fmatterport\u002FMask_RCNN\n\n5. Mask R-CNN code made compatible with tensorflow 2.0, https:\u002F\u002Fgithub.com\u002Ftomgross\u002FMask_RCNN\u002Ftree\u002Ftensorflow-2.0\n\n6. Kaiming He et al, Mask R-CNN https:\u002F\u002Farxiv.org\u002Fabs\u002F1703.06870\n\n7. TensorFlow DeepLab Model Zoo https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Fblob\u002Fmaster\u002Fresearch\u002Fdeeplab\u002Fg3doc\u002Fmodel_zoo.md\n\n8. Pascalvoc and Ade20k datasets' colormaps https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Fblob\u002Fmaster\u002Fresearch\u002Fdeeplab\u002Futils\u002Fget_dataset_colormap.py\n\n9. Object-Detection-Python https:\u002F\u002Fgithub.com\u002FYunus0or1\u002FObject-Detection-Python\n\n[Back To Top](#pixellib)\n","# PixelLib \n\n![mylogo](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_919daefd1e67.png) \u003Cbr> \u003Cbr>\n\n\n[![下载量](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_2446308f3283.png)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fpixellib)  [![下载量](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_2446308f3283.png\u002Fmonth)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fpixellib\u002Fmonth)  [![下载量](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_2446308f3283.png\u002Fweek)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fpixellib\u002Fweek) \n\n\n### 更新：PixelLib 现已支持 PyTorch，并采用 PointRend 技术，能够对图像和视频中的目标进行更精确、实时的实例分割。请阅读[教程](https:\u002F\u002Folafenwaayoola.medium.com\u002Freal-time-image-segmentation-using-5-lines-of-code-7c480abdb835)，了解如何使用 PyTorch 和 PointRend 在图像和视频中实现实例分割。\n\n### 论文《使用 PixelLib 库简化目标分割》已在 [paperswithcode](https:\u002F\u002Fpaperswithcode.com\u002Fpaper\u002Fsimplifying-object-segmentation-with-pixellib) 上发布。\u003Cbr> \n\n\nPixellib 是一个用于对图像和视频中的目标进行分割的库。它支持两种主要的图像分割类型：\n\n**1. 语义分割**\n\n**2. 实例分割**\n\nPixelLib 支持两种深度学习框架来进行图像分割，分别是 **PyTorch** 和 **TensorFlow**。\n\n# PixelLib PyTorch 版本 \n\n**PixelLib 的 PyTorch 版本采用了由 [Alexander Kirillov 等人](https:\u002F\u002Farxiv.org\u002Fabs\u002F1912.08193) 提出的 PointRend 目标分割架构，用以替代 Mask R-CNN 来执行目标的实例分割。PointRend 是一种非常先进的神经网络模型，用于实现目标分割。它能够生成高精度的分割掩膜，并且推理速度极快，完全满足当前对高精度、实时计算机视觉应用的需求。PixelLib 是一个跨平台的库，我将其与 Detectron2 的 Python 实现版本（仅支持 Linux 操作系统）相结合。为了支持 Windows 操作系统，我对原始的 Detectron2 PointRend 实现进行了修改。现在，PixelLib 所使用的 PointRend 实现同时支持 Linux 和 Windows 操作系统。**\n\n\n\n\u003Ctable>\n  \u003Ctr>\n    \u003Ctd>\u003Ch2> Mask R-CNN\u003C\u002Fh2> \u003C\u002Ftd>\n    \u003Ctd>\u003Ch2> PointRend \u003C\u002Fh2> \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd>\u003Cimg title = \"Mask R-CNN\", src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_42d869123b7d.jpg\">\u003C\u002Ftd>\n    \u003Ctd>\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_d3930159762e.jpg\">\u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \n \u003C\u002Ftable>\n\n\u003Ctable>\n  \u003Ctr>\n    \u003Ctd>\u003Ch2> Mask R-CNN \u003C\u002Fh2> \u003C\u002Ftd>\n    \u003Ctd>\u003Ch2> PointRend \u003C\u002Fh2>\u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd>\u003Cimg title = \"Mask R-CNN\", src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_34f3eac0160a.jpg\">\u003C\u002Ftd>\n    \u003Ctd>\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_4510c592cac9.jpg\">\u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \n \u003C\u002Ftable>\n\n\n以上示例图片展示了 PointRend 与 Mask R-CNN 在分割结果上的差异。很明显，PointRend 的分割效果要优于 Mask R-CNN。\n\n## PointRend 实例分割性能记录\n\n#### 推理速度：\n\n* **使用 *1333 * 800* 的目标尺寸时：处理单张图像耗时 0.26 秒，实时摄像头输入可达 4 帧\u002F秒**。 \u003Cbr\u002F>\n* **使用 *667 * 447* 的目标尺寸时：处理单张图像耗时 0.20 秒，实时摄像头输入可达 6 帧\u002F秒**。\u003Cbr\u002F>\n* **使用 *333 * 200* 的目标尺寸时：处理单张图像耗时 0.15 秒，实时摄像头输入可达 9 帧\u002F秒**。\u003Cbr\u002F>\n\n\n### 安装 PixelLib 及其依赖项\n\n**下载 Python**\n\nPixelLib PyTorch 版本支持 Python 3.7 及以上版本。请下载一个[兼容的 Python 版本](https:\u002F\u002Fwww.python.org\u002F)。\n\n**安装 PyTorch**\n\nPixelLib PyTorch 版本支持以下 PyTorch 版本（1.6.0、1.7.1、1.8.0 和 1.9.0）。\n\n*注意：* 不支持 PyTorch 1.7.0，请勿使用低于 1.6.0 的任何版本。请安装一个兼容的[PyTorch 版本](https:\u002F\u002Fpytorch.org\u002F)。\n\n\u003Cbr\u002F>\n\n**安装 Pycocotools**\n```\npip3 install pycocotools\n```\n\u003Cbr\u002F>\n\n**安装 PixelLib**\n```\npip3 install pixellib\n```\n\u003Cbr\u002F>\n\n如果已安装，可使用以下命令升级到最新版本：\n```\npip3 install pixellib — upgrade\n```\n\n\n# 使用 PointRend 用 5 行代码实现图像分割\n\n![p1](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_263905a90bb4.jpg)\n\n```python\n\n  import pixellib\n  from pixellib.torchbackend.instance import instanceSegmentation\n\n  ins = instanceSegmentation()\n  ins.load_model(\"pointrend_resnet50.pkl\")\n  ins.segmentImage(\"image.jpg\", show_bboxes=True, output_image_name=\"output_image.jpg\")\n```\n\n![p2](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_1ecc57285597.jpg)\n\n### [使用 PyTorch 和 PointRend 进行图像实例分割的教程](Tutorials\u002FPytorch_image_instance_segmentation.md)\n\u003Cbr\u002F>\n\n# 使用 PointRend 用 5 行代码实现视频分割\n\n```python\n  import pixellib\n  from pixellib.torchbackend.instance import instanceSegmentation\n\n  ins = instanceSegmentation()\n  ins.load_model(\"pointrend_resnet50.pkl\")\n  ins.process_video(\"sample_video.mp4\", show_bboxes=True, frames_per_second=3, output_video_name=\"output_video.mp4\")\n  \n```\n\n[![p3](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_d40d23000e41.png)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=o4Ies6YEces&list=PLtFkVrcr8LqNgbwdOb6of5X19ytm4ycHC&index=22&t=3s)\n\n### [使用 PyTorch 和 PointRend 进行视频实例分割的教程](Tutorials\u002FPytorch_video_instance_segmentation.md)\n\u003Cbr\u002F>\n\n# 注意\n\n**PixelLib 的最新 PyTorch 版本目前仅支持目标的实例分割。自定义训练功能即将推出！！！！**\n\u003Cbr\u002F>\n\n\n# PixelLib TensorFlow 版本 \n\nPixelLib 支持 **TensorFlow 2.0 - 2.4.1 版本**。请使用以下命令安装 TensorFlow：\n\n```\npip3 install tensorflow\n```\n\n如果您拥有配备 GPU 的电脑，请安装与您电脑上 CUDA 兼容的 TensorFlow-GPU 版本：\n\n```\npip3 install tensorflow--gpu\n```\n\n\n**安装 Pixellib：**\n\n```\npip3 install pixellib --upgrade\n```\n\n**访问 PixelLib 的官方文档：** [readthedocs](https:\u002F\u002Fpixellib.readthedocs.io\u002Fen\u002Flatest\u002F)\n\n\n# 用 5 行代码在图像和视频中编辑背景：\nPixelLib 利用目标分割技术实现了出色的前景与背景分离。只需五行代码，即可轻松更改任何图像或视频的背景。\n\n#### 支持的背景编辑功能包括：\n\n**1. 为图像和视频创建虚拟背景**\n\n**2. 为图像和视频的背景指定特定颜色**\n\n**3. 对图像和视频的背景进行模糊处理**\n\n**4. 将图像和视频的背景转换为灰度** \u003Cbr\u002F> \u003Cbr\u002F>\n\n\n\n![alt_bg1](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_6096da5c174b.jpg)\n\n\n```python\nimport pixellib\nfrom pixellib.tune_bg import alter_bg\n\nchange_bg = alter_bg(model_type = \"pb\")\nchange_bg.load_pascalvoc_model(\"xception_pascalvoc.pb\")\nchange_bg.blur_bg(\"sample.jpg\", extreme = True, detect = \"person\", output_image_name=\"blur_img.jpg\")\n```\n\n![alt_bg1](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_edafd44e76de.jpg)\n\n### [图像背景编辑教程](Tutorials\u002Fchange_image_bg.md)\n\n\n```python\nimport pixellib\nfrom pixellib.tune_bg import alter_bg\n\nchange_bg = alter_bg(model_type=\"pb\")\nchange_bg.load_pascalvoc_model(\"xception_pascalvoc.pb\")\nchange_bg.change_video_bg(\"sample_video.mp4\", \"bg.jpg\", frames_per_second = 10, output_video_name=\"output_video.mp4\", detect = \"person\")\n```\n\n[![video2](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_51362f41b204.png)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=699Hyi6oZFs)\n\n### [视频背景编辑教程](Tutorials\u002Fchange_video_bg.md) \u003Cbr\u002F> \u003Cbr\u002F>\n\n\n\n## 仅需几行代码即可实现语义分割和实例分割。\n\nPixelLib 提供了两种用于执行 **语义分割** 的 Deeplabv3+ 模型：\n\n1. 基于 Xception 网络骨干、在 Ade20k 数据集上训练的 Deeplabv3+ 模型，该数据集包含 150 类物体。\n2. 基于 Xception 网络骨干、在 PascalVoc 数据集上训练的 Deeplabv3+ 模型，该数据集包含 20 类物体。\n\n**PixelLib 使用在 COCO 数据集上训练的 Mask R-CNN 模型实现了实例分割。**\n\n**PixelLib 的最新版本支持使用预训练的 COCO 模型对目标分割模型进行自定义训练。**\n\n**注意：** PixelLib 支持使用 Labelme 进行标注。如果您使用其他标注工具，则可能与该库不兼容。请阅读这篇关于使用 Labelme 进行图像标注的 [教程](https:\u002F\u002Fmedium.com\u002F@olafenwaayoola\u002Fimage-annotation-with-labelme-81687ac2d077)。\n\n* [用 5 行代码实现图像和视频中的对象实例分割](#Instance-Segmentation-of-objects-in-Images-and-Videos-with-5-Lines-of-Code)\n\n\n* [用 7 行代码进行自定义训练](#Custom-Training-with-7-Lines-of-Code)\n\n* [用 5 行代码实现图像和视频中 150 类物体的语义分割](#Semantic-Segmentation-of-150-Classes-of-Objects-in-images-and-videos-with-5-Lines-of-Code)\n\n* [用 5 行代码实现 20 种常见物体的语义分割](#Semantic-Segmentation-of-20-Common-Objects-with-5-Lines-of-Code) \n* [使用 PixelLib 的项目](#Projects-Using-PixelLib)\u003Cbr\u002F> \u003Cbr\u002F>\n\n\n\n**注** Deeplab 和 Mask R-CNN 模型可在本仓库的 [发布页面](https:\u002F\u002Fgithub.com\u002Fayoolaolafenwa\u002FPixelLib\u002Freleases) 中找到。\n\n# 用 5 行代码实现图像和视频中的对象实例分割\nPixelLib 支持使用 Mask R-CNN 实现图像和视频中对象的实例分割，只需 5 行代码即可完成。\n\n\n![img1](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_4c3b02f6149a.jpg)\n\n```python\n\n  import pixellib\n  from pixellib.instance import instance_segmentation\n\n  segment_image = instance_segmentation()\n  segment_image.load_model(\"mask_rcnn_coco.h5\") \n  segment_image.segmentImage(\"sample.jpg\", show_bboxes = True, output_image_name = \"image_new.jpg\")\n```\n\n![img1](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_47697a86f019.jpg)\n\n### [图像实例分割教程](Tutorials\u002Fimage_instance.md)\n\n```python\n\n  import pixellib\n  from pixellib.instance import instance_segmentation\n\n  segment_video = instance_segmentation()\n  segment_video.load_model(\"mask_rcnn_coco.h5\")\n  segment_video.process_video(\"sample_video2.mp4\", show_bboxes = True, frames_per_second= 15, output_video_name=\"output_video.mp4\")\n```\n\n[![img3](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_c4fbdb90e656.jpg)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=bGPO1bCZLAo)\n\n**[视频实例分割教程](Tutorials\u002Fvideo_instance.md) \u003Cbr\u002F> \u003Cbr\u002F>\n\n\n# 用 7 行代码进行自定义训练\nPixelLib 支持仅用七行代码训练自定义分割模型。\n\n```python\n\n   import pixellib\n   from pixellib.custom_train import instance_custom_training\n\n   train_maskrcnn = instance_custom_training()\n   train_maskrcnn.modelConfig(network_backbone = \"resnet101\", num_classes= 2, batch_size = 4)\n   train_maskrcnn.load_pretrained_model(\"mask_rcnn_coco.h5\")\n   train_maskrcnn.load_dataset(\"Nature\")\n   train_maskrcnn.train_model(num_epochs = 300, augmentation=True,  path_trained_models = \"mask_rcnn_models\")\n```\n\n![alt_train](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_61fd1e8fc264.jpg)\n\n**这是使用 PixelLib 训练的模型结果。**\n\n### [自定义实例分割训练教程](Tutorials\u002Fcustom_train.md)\n\n\n使用您的自定义模型对图像和视频中的物体进行推理。\n\n\n```python\n  \n  import pixellib\n  from pixellib.instance import custom_segmentation\n\n  test_video = custom_segmentation()\n  test_video.inferConfig(num_classes=  2, class_names=[\"BG\", \"butterfly\", \"squirrel\"])\n  test_video.load_model(\"Nature_model_resnet101\")\n  test_video.process_video(\"sample_video1.mp4\", show_bboxes = True,  output_video_name=\"video_out.mp4\", frames_per_second=15)\n```\n\n[![alt_infer](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_39d17479bd08.png)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=bWQGxaZIPOo)\n\n### [使用自定义模型进行图像和视频中物体实例分割的教程](Tutorials\u002Fcustom_inference.md) \u003Cbr\u002F> \u003Cbr\u002F>\n\n\n\n# 用 5 行代码实现图像和视频中 150 类物体的语义分割\nPixelLib 可以通过 Ade20k 模型以 5 行代码实现最先进的 150 类物体语义分割。使用 Ade20k 模型，PixelLib 可以对室内和室外场景进行分割。\n\n![img4](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_73095329edd7.jpg)\n\n```python\n\n  import pixellib\n  from pixellib.semantic import semantic_segmentation\n\n  segment_image = semantic_segmentation()\n  segment_image.load_ade20k_model(\"deeplabv3_xception65_ade20k.h5\")\n  segment_image.segmentAsAde20k(\"sample.jpg\", overlay = True, output_image_name=\"image_new.jpg\")\n```\n![img5](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_aac6874bc418.jpg)\n\n### [图像中 150 类物体语义分割教程](Tutorials\u002Fimage_ade20k.md)\n\n```python\n\n  import pixellib\n  from pixellib.semantic import semantic_segmentation\n\n  segment_video = semantic_segmentation()\n  segment_video.load_ade20k_model(\"deeplabv3_xception65_ade20k.h5\")\n  segment_video.process_video_ade20k(\"sample_video.mp4\", overlay = True, frames_per_second= 15, output_video_name=\"output_video.mp4\")  \n```\n\n[![alt_vid2](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_981534064d0d.jpg)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=hxczTe9U8jY)\n\n\n### [视频中 150 类物体语义分割教程](Tutorials\u002Fvideo_ade20k.md) \u003Cbr \u002F> \u003Cbr \u002F>\n\n\n# 用 5 行代码实现 20 种常见物体的语义分割\nPixelLib 支持对 20 种特定物体进行语义分割。\n\n![img6](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_be49ad9ea592.jpg)\n\n```python\n\nimport pixellib\nfrom pixellib.semantic import semantic_segmentation\n\nsegment_image = semantic_segmentation()\nsegment_image.load_pascalvoc_model(\"deeplabv3_xception_tf_dim_ordering_tf_kernels.h5\") \nsegment_image.segmentAsPascalvoc(\"sample.jpg\", output_image_name = \"image_new.jpg\")\n```\n\n![img6](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_578b10c75ee8.jpg)\n\n### [使用 PixelLib 和 PascalVoc 模型对图像中的物体进行语义分割的教程](Tutorials\u002Fimage_pascalvoc.md)\n\n```python\n\n  import pixellib\n  from pixellib.semantic import semantic_segmentation\n\n  segment_video = semantic_segmentation()\n  segment_video.load_pascalvoc_model(\"deeplabv3_xception_tf_dim_ordering_tf_kernels.h5\")\n  segment_video.process_video_pascalvoc(\"sample_video1.mp4\",  overlay = True, frames_per_second= 15, output_video_name=\"output_video.mp4\")\n```  \n[![alt_vid2](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_8e51f993cea5.png)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=l9WMqT2znJE)\n\n### [使用 PixelLib 和 PascalVoc 模型对视频中的物体进行语义分割的教程](Tutorials\u002Fvideo_pascalvoc.md)\u003Cbr\u002F> \u003Cbr\u002F>\n\n\n## 使用 PixelLib 的项目\n1. R2P2 医疗实验室利用 PixelLib 分析新生儿重症监护室的医学图像。https:\u002F\u002Fr2p2.tech\u002F#equipe\n![img7](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_25d5c8f9d687.png) \u003Cbr\u002F> \u003Cbr\u002F>\n\n2. PixelLib 被集成到无人机的摄像头中，用于对实时视频流进行实例分割 https:\u002F\u002Felbruno.com\u002F2020\u002F05\u002F21\u002Fcoding4fun-how-to-control-your-drone-with-20-lines-of-code-20-n\u002F?utm_source=twitter&utm_medium=social&utm_campaign=tweepsmap-Default\n![img9](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_239f148b0f37.gif) \u003Cbr\u002F> \u003Cbr\u002F>\n\n3. 一个集成了 PixelLib 的分割 API，可在 iOS 上对图像进行语义和实例分割 https:\u002F\u002Fgithub.com\u002Fomarmhaimdat\u002Fsegmentation_api\n![img10](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_bbf5e371ecfd.png) \u003Cbr\u002F> \u003Cbr\u002F>\n\n4. PixelLib 被用于图像分割，以查找图像中的相似内容，从而实现图像推荐 https:\u002F\u002Fgithub.com\u002Flukoucky\u002Fimage_recommendation\n![img11](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_readme_f4a56edd32ab.png) \u003Cbr\u002F> \u003Cbr\u002F>\n\n5. PixelLib 也可以轻松地与 [Streamlit](https:\u002F\u002Fdocs.streamlit.io\u002F) 集成，Streamlit 是一个开源的 Python 库，可以方便地创建和分享美观、自定义的机器学习和数据科学 Web 应用程序。只需几分钟，您就可以构建并部署功能强大的数据应用程序。\n\n仓库链接：https:\u002F\u002Fgithub.com\u002Fprateekralhan\u002FInstance-Segmentation-using-PixelLib\n\n![1](https:\u002F\u002Fmedia.githubusercontent.com\u002Fmedia\u002Fprateekralhan\u002FInstance-Segmentation-using-PixelLib\u002Fmaster\u002Fgifs\u002Fimage.gif)\n\n![2](https:\u002F\u002Fmedia.githubusercontent.com\u002Fmedia\u002Fprateekralhan\u002FInstance-Segmentation-using-PixelLib\u002Fmaster\u002Fgifs\u002Fvideo.gif)\n\n## 参考文献\n1. PointRend Detectron2 实现 https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdetectron2\u002Ftree\u002Fmain\u002Fprojects\u002FPointRend\n2. Bonlime，带有预训练权重的 Deeplab v3+ Keras 实现 https:\u002F\u002Fgithub.com\u002Fbonlime\u002Fkeras-deeplab-v3-plus\n\n3. Liang-Chieh Chen 等人，用于语义图像分割的带空洞可分离卷积的编码器-解码器 https:\u002F\u002Farxiv.org\u002Fabs\u002F1802.02611\n\n3. Matterport，在 Keras 和 TensorFlow 上用于目标检测和实例分割的 Mask R-CNN https:\u002F\u002Fgithub.com\u002Fmatterport\u002FMask_RCNN\n\n5. 使 Mask R-CNN 代码兼容 TensorFlow 2.0 https:\u002F\u002Fgithub.com\u002Ftomgross\u002FMask_RCNN\u002Ftree\u002Ftensorflow-2.0\n\n6. Kaiming He 等人，Mask R-CNN https:\u002F\u002Farxiv.org\u002Fabs\u002F1703.06870\n\n7. TensorFlow DeepLab 模型库 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Fblob\u002Fmaster\u002Fresearch\u002Fdeeplab\u002Fg3doc\u002Fmodel_zoo.md\n\n8. PascalVoc 和 Ade20k 数据集的颜色映射表 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Fblob\u002Fmaster\u002Fresearch\u002Fdeeplab\u002Futils\u002Fget_dataset_colormap.py\n\n9. 目标检测 Python https:\u002F\u002Fgithub.com\u002FYunus0or1\u002FObject-Detection-Python\n\n[返回顶部](#pixellib)","# PixelLib 快速上手指南\n\nPixelLib 是一个用于图像和视频分割的 Python 库，支持**语义分割**和**实例分割**。它兼容 **PyTorch**（基于 PointRend，精度更高、速度更快）和 **TensorFlow**（基于 Mask R-CNN 和 DeepLabv3+）两大深度学习框架。\n\n## 1. 环境准备\n\n### 系统要求\n- **操作系统**: Windows 或 Linux (PyTorch 版本已优化支持 Windows)\n- **Python 版本**: 3.7 及以上\n\n### 前置依赖\n根据你选择的后端框架安装相应依赖：\n\n#### 方案 A：PyTorch 后端 (推荐，性能更优)\n- **PyTorch 版本**: 支持 1.6.0, 1.7.1, 1.8.0, 1.9.0\n  - *注意：不支持 1.7.0，且不能使用低于 1.6.0 的版本。*\n- **其他依赖**: `pycocotools`\n\n#### 方案 B：TensorFlow 后端\n- **TensorFlow 版本**: 2.0 - 2.4.1\n- **GPU 加速**: 若需使用 GPU，请安装与本地 CUDA 版本匹配的 `tensorflow-gpu`\n\n---\n\n## 2. 安装步骤\n\n请根据你的需求选择以下一种方式进行安装。\n\n### 方式一：安装 PyTorch 版本 (推荐)\n\n1.  **安装 pycocotools**:\n    ```bash\n    pip3 install pycocotools\n    ```\n    *(国内用户推荐使用清华源加速：`pip3 install pycocotools -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple`)*\n\n2.  **安装 PyTorch**:\n    请访问 [PyTorch 官网](https:\u002F\u002Fpytorch.org\u002F) 获取适合你环境的安装命令（确保版本在 1.6.0-1.9.0 之间）。\n\n3.  **安装 PixelLib**:\n    ```bash\n    pip3 install pixellib\n    ```\n    *(若需升级到最新版：`pip3 install pixellib --upgrade`)*\n\n### 方式二：安装 TensorFlow 版本\n\n1.  **安装 TensorFlow**:\n    ```bash\n    pip3 install tensorflow\n    ```\n    *(若有 GPU 需求：`pip3 install tensorflow-gpu`)*\n\n2.  **安装\u002F升级 PixelLib**:\n    ```bash\n    pip3 install pixellib --upgrade\n    ```\n\n---\n\n## 3. 基本使用\n\nPixelLib 的核心优势在于仅需 **5 行代码** 即可完成复杂的分割任务。使用前请确保已下载对应的模型文件（如 `pointrend_resnet50.pkl` 或 `mask_rcnn_coco.h5`），模型可在官方 Release 页面获取。\n\n### 场景一：图像实例分割 (PyTorch + PointRend)\n\n这是目前精度最高且支持实时的方案。\n\n```python\nimport pixellib\nfrom pixellib.torchbackend.instance import instanceSegmentation\n\nins = instanceSegmentation()\nins.load_model(\"pointrend_resnet50.pkl\")\nins.segmentImage(\"image.jpg\", show_bboxes=True, output_image_name=\"output_image.jpg\")\n```\n\n### 场景二：视频实例分割 (PyTorch + PointRend)\n\n```python\nimport pixellib\nfrom pixellib.torchbackend.instance import instanceSegmentation\n\nins = instanceSegmentation()\nins.load_model(\"pointrend_resnet50.pkl\")\nins.process_video(\"sample_video.mp4\", show_bboxes=True, frames_per_second=3, output_video_name=\"output_video.mp4\")\n```\n\n### 场景三：图像背景编辑 (通用)\n\n利用分割技术实现背景虚化、替换或灰度化处理。\n\n```python\nimport pixellib\nfrom pixellib.tune_bg import alter_bg\n\nchange_bg = alter_bg(model_type=\"pb\")\nchange_bg.load_pascalvoc_model(\"xception_pascalvoc.pb\")\n# 示例：对人物进行背景极度虚化\nchange_bg.blur_bg(\"sample.jpg\", extreme=True, detect=\"person\", output_image_name=\"blur_img.jpg\")\n```\n\n### 场景四：自定义模型训练 (仅需 7 行代码)\n\n基于预训练的 COCO 模型微调自己的数据集（需使用 LabelMe 标注）。\n\n```python\nimport pixellib\nfrom pixellib.custom_train import instance_custom_training\n\ntrain_maskrcnn = instance_custom_training()\ntrain_maskrcnn.modelConfig(network_backbone=\"resnet101\", num_classes=2, batch_size=4)\ntrain_maskrcnn.load_pretrained_model(\"mask_rcnn_coco.h5\")\ntrain_maskrcnn.load_dataset(\"Nature\")\ntrain_maskrcnn.train_model(num_epochs=300, augmentation=True, path_trained_models=\"mask_rcnn_models\")\n```\n\n> **提示**: 更多详细教程（如语义分割、特定数据集训练等）可访问 PixelLib 官方文档或查看项目仓库中的 `Tutorials` 文件夹。","某智慧零售团队正在开发一套实时客流分析系统，需要从监控视频中精准识别并分割每位顾客的轮廓，以统计进店人数和分析行走轨迹。\n\n### 没有 PixelLib 时\n- **边缘识别粗糙**：使用传统的 Mask R-CNN 模型时，顾客衣物边缘和发丝细节丢失严重，导致轮廓锯齿感强，影响后续轨迹追踪精度。\n- **跨平台部署困难**：先进的 PointRend 算法原生仅支持 Linux 环境，团队若要在 Windows 服务器上运行，需耗费大量时间修改底层 Detectron2 代码进行适配。\n- **实时性不达标**：在处理高分辨率视频流时，推理速度缓慢，无法达到流畅的帧率要求，难以满足“实时监控”的业务需求。\n- **开发门槛高**：实现高精度的实例分割需要编写数十行复杂的深度学习配置代码，新手开发者极易出错，迭代周期长。\n\n### 使用 PixelLib 后\n- **轮廓精准细腻**：PixelLib 内置的 PointRend 架构能生成像素级平滑的分割掩码，完美还原顾客边缘细节，显著提升了轨迹分析的准确性。\n- **无缝兼容多系统**：PixelLib 已对 PointRend 进行了跨平台优化，团队可直接在现有的 Windows 服务器上部署，无需任何额外的代码移植工作。\n- **推理速度飞跃**：通过调整目标尺寸，PixelLib 能将单张图片处理时间压缩至 0.15 秒，直播流帧率提升至 9fps，轻松实现准实时分析。\n- **极简代码调用**：开发者仅需 5 行代码即可调用强大的分割功能，将原本复杂的模型集成工作简化为简单的函数调用，大幅缩短上线时间。\n\nPixelLib 通过封装前沿的 PointRend 算法并提供跨平台支持，让高精度、实时的图像实例分割变得像调用普通函数一样简单高效。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fayoolaolafenwa_PixelLib_919daefd.png","ayoolaolafenwa",null,"https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fayoolaolafenwa_08d90e86.jpg","I am a programmer who works on machine learning, AI and builds android applications.","BrandMagic Inc","London, United Kingdom","AyoolaOlafenwa","https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fayoola-olafenwa-003b901a9\u002F","https:\u002F\u002Fgithub.com\u002Fayoolaolafenwa",[86],{"name":87,"color":88,"percentage":89},"Python","#3572A5",100,1073,266,"2026-04-01T17:55:47","MIT","Linux, Windows","可选（用于加速）。若使用 GPU，需安装与本地 CUDA 版本兼容的 tensorflow-gpu；PyTorch 版本未指定具体 CUDA 要求，但需匹配安装的 PyTorch 版本。","未说明",{"notes":98,"python":99,"dependencies":100},"1. PyTorch 版本明确不支持 1.7.0，且不得低于 1.6.0。\n2. PixelLib 的 PyTorch 版本基于 PointRend，作者对原仅支持 Linux 的 Detectron2 实现进行了修改以支持 Windows。\n3. TensorFlow 版本最高支持到 2.4.1。\n4. 自定义训练功能仅兼容 Labelme 标注工具生成的数据集。\n5. 最新 PyTorch 版本目前仅支持实例分割，自定义训练功能即将发布。","3.7+",[101,102,103,104],"torch (1.6.0, 1.7.1, 1.8.0, 1.9.0)","tensorflow (2.0 - 2.4.1)","pycocotools","detectron2 (modified for Windows support)",[52,14,13],[107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123],"computer-vision","machine-learning","artificial-intelligence","image-segmentation","semantic-segmentation","instance-segmentation","video-segmentation","deeplab","deeplearning","maskr-cnn","tensorflow","deep-learning","pointrend","pytorch","convolutional-neural-networks","segmentation","object-detection","2026-03-27T02:49:30.150509","2026-04-06T07:13:10.625661",[127,132,136,141,146,150],{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},13472,"如何获取实例分割掩码（mask）的具体数值或坐标点？","默认输出中掩码可能显示为 False。要获取具体的掩码点值，需要在 segmentImage 函数中设置参数 mask_points_values=True 和 extract_segmented_objects=True。示例代码如下：\nsegmask, output = ins.segmentImage(\"input.jpeg\", show_bboxes=False, output_image_name=\"output_image.jpg\", extract_segmented_objects=True, mask_points_values=True)\nmask_values = segmask['masks'][0][0]\nobj_mask_points = [[p[0], p[1]] for p in mask_values]\n随后可以使用 cv2.fillPoly 根据这些点重建掩码。","https:\u002F\u002Fgithub.com\u002Fayoolaolafenwa\u002FPixelLib\u002Fissues\u002F28",{"id":133,"question_zh":134,"answer_zh":135,"source_url":131},13473,"如何利用分割掩码去除图像背景？","可以使用计算出的掩码通过 OpenCV 的 bitwise_and 操作来移除背景。代码示例如下：\nbg_removed = cv2.bitwise_and(inp_img, mask)\n其中 inp_img 是原始图像，mask 是生成的分割掩码。",{"id":137,"question_zh":138,"answer_zh":139,"source_url":140},13474,"训练 Mask R-CNN 模型耗时过长，如何加快训练速度？","Mask R-CNN 算法本身消耗较大资源。若需加快训练，可尝试以下两种方法：\n1. 使用容量更大的 GPU。\n2. 在 train_model 函数中将 layers 参数设置为 \"heads\"，仅训练网络的头部层而非所有层。代码示例：\ntrain_maskrcnn.train_model(num_epochs=300, augmentation=True, layers=\"heads\", path_trained_models=\"mask_rcnn_models\")\n注意：仅训练头部可能无法达到与训练所有层相同的低验证损失。","https:\u002F\u002Fgithub.com\u002Fayoolaolafenwa\u002FPixelLib\u002Fissues\u002F65",{"id":142,"question_zh":143,"answer_zh":144,"source_url":145},13475,"训练时出现 ValueError: expected input_image_meta to have shape (14,) but got array with shape (15,) 错误怎么办？","该错误通常是由于类别数量配置不正确导致的。IMAGE_META_SIZE 默认为 14，其计算依赖于类别数。如果你自定义了数据集，请确保 num_classes 的设置包含了背景类（BG）。例如，如果你有 1 个目标类，num_classes 应设置为 2（1 个目标 + 1 个背景）。请检查配置文件中的类别计数是否与数据集实际标签一致。","https:\u002F\u002Fgithub.com\u002Fayoolaolafenwa\u002FPixelLib\u002Fissues\u002F64",{"id":147,"question_zh":148,"answer_zh":149,"source_url":131},13476,"如何在实例分割中只保存提取的对象而不保留原图叠加效果？","目前可以通过设置 extract_segmented_objects=True 和 save_extracted_objects=True 来提取并保存单独的对象。虽然官方尚未直接提供 overlay=False 参数用于实例分割（不同于语义分割），但用户可以通过提取对象后自行处理，或者关注后续版本更新以支持该功能。当前变通方法是提取对象后使用 OpenCV 进一步处理区域。",{"id":151,"question_zh":152,"answer_zh":153,"source_url":154},13477,"为什么自定义实例分割训练无法收敛？","训练不收敛可能与数据增强、学习率设置、数据集质量或网络层选择有关。建议尝试仅训练头部层（layers=\"heads\"）进行初步调试，确认数据加载无误。同时检查数据集标注是否准确，以及是否应用了适当的默认增强。如果问题依旧，可减少 epoch 数量观察损失变化趋势，或增加 GPU 资源以确保批量处理稳定。","https:\u002F\u002Fgithub.com\u002Fayoolaolafenwa\u002FPixelLib\u002Fissues\u002F22",[156,160,165,170,174,179,184],{"id":157,"version":158,"summary_zh":77,"released_at":159},72215,"1.1.0","2022-02-28T21:13:30",{"id":161,"version":162,"summary_zh":163,"released_at":164},72216,"0.2.0","Detectron2 中的 PointRend 模型（https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdetectron2\u002Ftree\u002Fmain\u002Fprojects\u002FPointRend）","2021-05-24T12:30:22",{"id":166,"version":167,"summary_zh":168,"released_at":169},72217,"0.3.0","这是包含 pixellib 各版本信息的发布说明。\n\n0.7.1：修复了一个 bug。\n\n0.7.0：PixelLib PyTorch 版本，新增以下功能：\n* 使用 PointRend 对图像和视频中的目标进行分割。\n* 支持根据边界框坐标和掩码值提取目标。\n* 比 TensorFlow 版本更快、更准确：\n      * 处理单张图像耗时 0.26 秒，实时摄像头流可达 4 帧\u002F秒。\n      * 使用目标尺寸 667×447 时，处理单张图像耗时 0.20 秒，实时摄像头流可达 6 帧\u002F秒。\n      * 使用目标尺寸 333×200 时，处理单张图像耗时 0.15 秒，实时摄像头流可达 9 帧\u002F秒。\n\n0.6.6：新增以下功能：\n* 批量图像分割。\n* 可调整用于评估训练模型的阈值。\n* 可调整分割后图像可视化中标签名称和边界框的大小与粗细。\n\n0.6.1：修复了一个 bug。\n\n0.6.0：支持从视频文件和实时摄像头流中提取分割后的目标。\n\n0.5.5：支持从图像中提取分割后的目标，并可对 COCO 模型的检测结果进行过滤，以仅分割用户指定的目标类别。\n\n0.5.2：新增返回掩码多边形点坐标的功能。\n\n0.4.9：新增可选择实例分割的推理速度模式的功能。\n\n0.4.8：支持更改视频文件和实时摄像头流的背景。\n\n0.4.0：支持更改图像的背景。\n\n0.3.0：支持自定义训练。\n\n0.2.1：修复了一个 bug。\n\n0.2.0：支持对视频文件、实时摄像头流中的目标进行分割，以及对 150 类目标进行语义分割。\n\n0.1.0：支持对 20 类目标进行语义分割，以及对 80 类目标进行实例分割。","2020-04-13T15:53:19",{"id":171,"version":172,"summary_zh":77,"released_at":173},72218,"1.0.0","2020-09-02T17:29:52",{"id":175,"version":176,"summary_zh":177,"released_at":178},72219,"1.3","从 Ade20k TensorFlow 模型的检查点中提取的 Keras 模型。\n来源：https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Fblob\u002Fmaster\u002Fresearch\u002Fdeeplab\u002Fg3doc\u002Fmodel_zoo.md","2020-05-27T10:04:55",{"id":180,"version":181,"summary_zh":182,"released_at":183},72220,"1.2","在COCO数据集上训练的Mask R-CNN模型。\n\n来源：https:\u002F\u002Fgithub.com\u002Fmatterport\u002FMask_RCNN\u002Freleases\u002Ftag\u002Fv2.0","2020-05-08T05:59:19",{"id":185,"version":186,"summary_zh":187,"released_at":188},72221,"1.1","本版本包含在 Pascal VOC 数据集上训练的 DeepLabv3+ 模型。\nTensorFlow 模型。\n来源：https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Fblob\u002Fmaster\u002Fresearch\u002Fdeeplab\u002Fg3doc\u002Fmodel_zoo.md\n\n从 TensorFlow 模型的检查点中提取的 Keras 模型。\n来源：https:\u002F\u002Fgithub.com\u002Fbonlime\u002Fkeras-deeplab-v3-plus\n\n","2020-05-08T04:35:50"]