[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-mdbloice--Augmentor":3,"tool-mdbloice--Augmentor":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 真正成长为懂上",140436,2,"2026-04-05T23:32:43",[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":82,"owner_twitter":83,"owner_website":84,"owner_url":85,"languages":86,"stars":91,"forks":92,"last_commit_at":93,"license":94,"difficulty_score":95,"env_os":96,"env_gpu":97,"env_ram":97,"env_deps":98,"category_tags":103,"github_topics":104,"view_count":23,"oss_zip_url":83,"oss_zip_packed_at":83,"status":16,"created_at":109,"updated_at":110,"faqs":111,"releases":112},2115,"mdbloice\u002FAugmentor","Augmentor","Image augmentation library in Python for machine learning.","Augmentor 是一款专为机器学习打造的 Python 图像数据增强库，旨在通过自动化生成人工数据来扩充训练数据集。在深度学习领域，模型往往需要海量且多样化的图片进行训练，而原始数据常常数量有限或分布单一，容易导致模型过拟合。Augmentor 正是为了解决这一痛点，帮助开发者轻松构建更鲁棒的神经网络。\n\n这款工具特别适合人工智能开发者、数据科学家以及研究人员使用。它的核心亮点在于采用了独特的“流水线”（Pipeline）架构和随机化处理机制。用户无需编写复杂的循环代码，只需像搭积木一样，将旋转、缩放、扭曲等多种操作按顺序添加到流水线中，并为每个步骤设定触发概率。当流水线运行时，Augmentor 会根据设定的概率随机组合这些操作，从而为每张原始图片创造出成千上万种自然且多样的变体。\n\n此外，Augmentor 设计为独立库，不依赖特定的深度学习框架（如 TensorFlow 或 PyTorch），具有极佳的跨平台兼容性。无论是想快速扩容数据集，还是需要对图像进行统一的预处理（如批量调整尺寸），Augmentor 都能通过简洁的 API 高效完成任务，让数据准备工作变得更加灵活可控","Augmentor 是一款专为机器学习打造的 Python 图像数据增强库，旨在通过自动化生成人工数据来扩充训练数据集。在深度学习领域，模型往往需要海量且多样化的图片进行训练，而原始数据常常数量有限或分布单一，容易导致模型过拟合。Augmentor 正是为了解决这一痛点，帮助开发者轻松构建更鲁棒的神经网络。\n\n这款工具特别适合人工智能开发者、数据科学家以及研究人员使用。它的核心亮点在于采用了独特的“流水线”（Pipeline）架构和随机化处理机制。用户无需编写复杂的循环代码，只需像搭积木一样，将旋转、缩放、扭曲等多种操作按顺序添加到流水线中，并为每个步骤设定触发概率。当流水线运行时，Augmentor 会根据设定的概率随机组合这些操作，从而为每张原始图片创造出成千上万种自然且多样的变体。\n\n此外，Augmentor 设计为独立库，不依赖特定的深度学习框架（如 TensorFlow 或 PyTorch），具有极佳的跨平台兼容性。无论是想快速扩容数据集，还是需要对图像进行统一的预处理（如批量调整尺寸），Augmentor 都能通过简洁的 API 高效完成任务，让数据准备工作变得更加灵活可控。","![AugmentorLogo](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_f47b28b1722e.png)\n\nAugmentor is an image augmentation library in Python for machine learning. It aims to be a standalone library that is platform and framework independent, which is more convenient, allows for finer grained control over augmentation, and implements the most real-world relevant augmentation techniques. It employs a stochastic approach using building blocks that allow for operations to be pieced together in a pipeline.\n\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAugmentor-v0.2.10-blue.svg?maxAge=2592000)](https:\u002F\u002Fpypi.python.org\u002Fpypi\u002FAugmentor)\n[![Supported Python Versions](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-2.7%20%7C%203.5%20%7C%203.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue.svg)](https:\u002F\u002Fpypi.python.org\u002Fpypi\u002FAugmentor)\n[![PyPI Install](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Factions\u002Fworkflows\u002FPyPI.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Factions\u002Fworkflows\u002FPyPI.yml)\n[![Pytest](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Factions\u002Fworkflows\u002Fpackage-tests.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Factions\u002Fworkflows\u002Fpackage-tests.yml)\n[![Documentation Status](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_13d664e1afd7.png)](https:\u002F\u002Faugmentor.readthedocs.io\u002Fen\u002Fmaster\u002F?badge=master)\n[![License](http:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-brightgreen.svg?style=flat)](LICENSE.md)\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http:\u002F\u002Fwww.repostatus.org\u002Fbadges\u002Flatest\u002Factive.svg)](http:\u002F\u002Fwww.repostatus.org\u002F#active)\n[![Binder](https:\u002F\u002Fmybinder.org\u002Fbadge.svg)](https:\u002F\u002Fmybinder.org\u002Fv2\u002Fgh\u002F4QuantOSS\u002FAugmentor\u002Fmaster)\n\n## Installation\n\nAugmentor is written in Python. A Julia version of the package is also being developed as a sister project and is available [here](https:\u002F\u002Fgithub.com\u002FEvizero\u002FAugmentor.jl).\n\nInstall using `pip` from the command line:\n\n```python\npip install Augmentor\n```\n\nSee the documentation for building from source. To upgrade from a previous version, use `pip install Augmentor --upgrade`.\n\n## Documentation\n\nComplete documentation can be found on Read the Docs: [https:\u002F\u002Faugmentor.readthedocs.io](https:\u002F\u002Faugmentor.readthedocs.io\u002Fen\u002Fstable\u002F)\n\n## Quick Start Guide and Usage\nThe purpose of _Augmentor_ is to automate image augmentation (artificial data generation) in order to expand datasets as input for machine learning algorithms, especially neural networks and deep learning.\n\nThe package works by building an augmentation **pipeline** where you define a series of operations to perform on a set of images. Operations, such as rotations or transforms, are added one by one to create an augmentation pipeline: when complete, the pipeline can be executed and an augmented dataset is created.\n\nTo begin, instantiate a `Pipeline` object that points to a directory on your file system:\n\n```python\nimport Augmentor\np = Augmentor.Pipeline(\"\u002Fpath\u002Fto\u002Fimages\")\n```\n\nYou can then add operations to the Pipeline object `p` as follows:\n\n```python\np.rotate(probability=0.7, max_left_rotation=10, max_right_rotation=10)\np.zoom(probability=0.5, min_factor=1.1, max_factor=1.5)\n```\n\nEvery function requires you to specify a probability, which is used to decide if an operation is applied to an image as it is passed through the augmentation pipeline.\n\nOnce you have created a pipeline, you can sample from it like so:\n\n```python\np.sample(10000)\n```\n\nwhich will generate 10,000 augmented images based on your specifications. By default these will be written to the disk in a directory named `output` relative to the path specified when initialising the `p` pipeline object above.\n\nIf you wish to process each image in the pipeline exactly once, use `process()`:\n\n```python\np.process()\n```\n\nThis function might be useful for resizing a dataset for example. It would make sense to create a pipeline where all of its operations have their probability set to `1` when using the `process()` method.\n\n### Multi-threading\n\nAugmentor (version >=0.2.1) now uses multi-threading to increase the speed of generating images.\n\nThis *may* slow down some pipelines if the original images are very small. Set `multi_threaded` to ``False`` if slowdown is experienced:\n\n```python\np.sample(100, multi_threaded=False)\n```\n\nHowever, by default the `sample()` function uses multi-threading. This is currently only implemented when saving to disk. Generators will use multi-threading in the next version update.\n\n\n### Ground Truth Data\n\nImages can be passed through the pipeline in groups of two or more so that ground truth data can be identically augmented.\n\n| Original image and mask\u003Csup>[3]\u003C\u002Fsup>                                                                               | Augmented original and mask images                                                                               |\n|---------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|\n| ![OriginalMask](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_dab39dd477b1.png) | ![AugmentedMask](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_b0639e1a4cff.gif)   |\n\nTo augment ground truth data in parallel to any original data, add a ground truth directory to a pipeline using the [ground_truth()](https:\u002F\u002Faugmentor.readthedocs.io\u002Fen\u002Fmaster\u002Fcode.html#Augmentor.Pipeline.Pipeline.ground_truth) function:\n\n```python\np = Augmentor.Pipeline(\"\u002Fpath\u002Fto\u002Fimages\")\n# Point to a directory containing ground truth data.\n# Images with the same file names will be added as ground truth data\n# and augmented in parallel to the original data.\np.ground_truth(\"\u002Fpath\u002Fto\u002Fground_truth_images\")\n# Add operations to the pipeline as normal:\np.rotate(probability=1, max_left_rotation=5, max_right_rotation=5)\np.flip_left_right(probability=0.5)\np.zoom_random(probability=0.5, percentage_area=0.8)\np.flip_top_bottom(probability=0.5)\np.sample(50)\n```\n\n### Multiple Mask\u002FImage Augmentation\n\nUsing the `DataPipeline` class (Augmentor version >= 0.2.3), images that have multiple associated masks can be augmented:\n\n| Multiple Mask Augmentation                                                                               |\n|----------------------------------------------------------------------------------------------------------|\n| ![MultipleMask](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_6e98fee6df6a.gif) |\n\nArbitrarily long lists of images can be passed through the pipeline in groups and augmented identically using the `DataPipeline` class. This is useful for ground truth images that have several masks, for example.\n\nIn the example below, the images and their masks are contained in the `images` data structure (as lists of lists), while their labels are contained in `y`:\n\n```python\np = Augmentor.DataPipeline(images, y)\np.rotate(1, max_left_rotation=5, max_right_rotation=5)\np.flip_top_bottom(0.5)\np.zoom_random(1, percentage_area=0.5)\n\naugmented_images, labels = p.sample(100)\n```\n\nThe `DataPipeline` returns images directly (`augmented_images` above), and does not save them to disk, nor does it read data from the disk. Images are passed directly to `DataPipeline` during initialisation.\n\nFor details of the `images` data structure and how to create it, see the [`Multiple-Mask-Augmentation.ipynb`](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Fblob\u002Fmaster\u002Fnotebooks\u002FMultiple-Mask-Augmentation.ipynb) Jupyter notebook.\n\n### Generators for Keras and PyTorch\n\nIf you do not wish to save to disk, you can use a generator (in this case with Keras):\n\n```python\ng = p.keras_generator(batch_size=128)\nimages, labels = next(g)\n```\n\nwhich returns a batch of images of size 128 and their corresponding labels. Generators return data indefinitely, and can be used to train neural networks with augmented data on the fly.\n\nAlternatively, you can integrate it with PyTorch:\n\n```python\nimport torchvision\ntransforms = torchvision.transforms.Compose([\n    p.torch_transform(),\n    torchvision.transforms.ToTensor(),\n])\n```\n\n## Main Features\n\n### Elastic Distortions\n\nUsing elastic distortions, one image can be used to generate many images that are real-world feasible and label preserving:\n\n| Input Image                                                                                                                       |   | Augmented Images                                                                                                        |\n|-----------------------------------------------------------------------------------------------------------------------------------|---|-------------------------------------------------------------------------------------------------------------------------|\n| ![eight_hand_drawn_border](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_2a20c5cac254.png) | → | ![eights_border](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_c221e3248ab6.gif) |\n\nThe input image has a 1 pixel black border to emphasise that you are getting distortions without changing the size or aspect ratio of the original image, and without any black\u002Ftransparent padding around the newly generated images.\n\nThe functionality can be more clearly seen here:\n\n| Original Image\u003Csup>[1]\u003C\u002Fsup>                                                                      | Random distortions applied                                                                            |\n|---------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_79b9ebf6bea8.png) | ![Distorted](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_2109eb88eb1d.gif) |\n\n### Perspective Transforms\n\nThere are a total of 12 different types of perspective transform available. Four of the most common are shown below.\n\n| Tilt Left                                                                                               | Tilt Right                                                                                               | Tilt Forward                                                                                               | Tilt Backward                                                                                               |\n|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|\n| ![TiltLeft](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_fd0d3e3ed8ec.png) | ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_758b7ca3ed77.png) | ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_6bd1716e6e2c.png) | ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_c924da8edf65.png) |\n\nThe remaining eight types of transform are as follows:\n\n| Skew Type 0                                                                                         | Skew Type 1                                                                                         | Skew Type 2                                                                                         | Skew Type 3                                                                                         |\n|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|\n| ![Skew0](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_9efad605f790.png) | ![Skew1](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_c37d0bf0fefd.png) | ![Skew2](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_edc68aa57b17.png) | ![Skew3](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_2d2b1875ac9a.png) |\n\n| Skew Type 4                                                                                         | Skew Type 5                                                                                         | Skew Type 6                                                                                         | Skew Type 7                                                                                         |\n|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|\n| ![Skew4](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_e065840c2505.png) | ![Skew5](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_befa5555ce1b.png) | ![Skew6](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_59eb324f3ac1.png) | ![Skew7](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_e7c45acfe98f.png) |\n\n### Size Preserving Rotations\n\nRotations by default preserve the file size of the original images:\n\n| Original Image                                                                                    | Rotated 10 degrees, automatically cropped                                                               |\n|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_79b9ebf6bea8.png) | ![Rotate](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_0b1e348e5813.png) |\n\nCompared to rotations by other software:\n\n| Original Image                                                                                    | Rotated 10 degrees                                                                                |\n|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_79b9ebf6bea8.png) | ![Rotate](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_a60ca9591988.png) |\n\n### Size Preserving Shearing\n\nShearing will also automatically crop the correct area from the sheared image, so that you have an image with no black space or padding.\n\n| Original image                                                                                    | Shear (x-axis) 20 degrees                                                                              | Shear (y-axis) 20 degrees                                                                              |\n|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_79b9ebf6bea8.png) | ![ShearX](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_f647cbd8302c.png) | ![ShearY](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_a2b8e95ea14a.png) |\n\nCompare this to how this is normally done:\n\n| Original image                                                                                    | Shear (x-axis) 20 degrees                                                                          | Shear (y-axis) 20 degrees                                                                          |\n|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_79b9ebf6bea8.png) | ![ShearX](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_29dc5895a61f.png) | ![ShearY](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_ed8c4042432b.png) |\n\n### Cropping\n\nCropping can also be handled in a manner more suitable for machine learning image augmentation:\n\n| Original image                                                                                    | Random crops + resize operation                                                                          |\n|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_79b9ebf6bea8.png) | ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_c484183de84f.gif) |\n\n### Random Erasing\n\nRandom Erasing is a technique used to make models robust to occlusion. This may be useful for training neural networks used in object detection in navigation scenarios, for example.\n\n| Original image\u003Csup>[2]\u003C\u002Fsup>                                                                                               | Random Erasing                                                                                                                        |\n|----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_31dc5d91d554.jpg) | ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_0e05faa522be.gif) |\n\nSee the [Pipeline.random_erasing()](https:\u002F\u002Faugmentor.readthedocs.io\u002Fen\u002Fstable\u002Fcode.html#Augmentor.Pipeline.Pipeline.random_erasing) documentation for usage.\n\n### Chaining Operations in a Pipeline\n\nWith only a few operations, a single image can be augmented to produce large numbers of new, label-preserving samples:\n\n| Original image                                                                                           | Distortions + mirroring                                                                                          |\n|----------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_020796805e8c.png) | ![DistortFlipFlop](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_ebce418f8595.gif) |\n\nIn the example above, we have applied three operations: first we randomly distort the image, then we flip it horizontally with a probability of 0.5 and then vertically with a probability of 0.5. We then sample from this pipeline 100 times to create 100 new data.\n\n```python\np.random_distortion(probability=1, grid_width=4, grid_height=4, magnitude=8)\np.flip_left_right(probability=0.5)\np.flip_top_bottom(probability=0.5)\np.sample(100)\n```\n\n## Tutorial Notebooks\n\n### Integration with Keras using Generators\nAugmentor can be used as a replacement for Keras' augmentation functionality. Augmentor can create a generator which produces augmented data indefinitely, according to the pipeline you have defined. See the following notebooks for details:\n\n- Reading images from a local directory, augmenting them at run-time, and using a generator to pass the augmented stream of images to a Keras convolutional neural network, see [`Augmentor_Keras.ipynb`](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Fblob\u002Fmaster\u002Fnotebooks\u002FAugmentor_Keras.ipynb)\n- Augmenting data in-memory (in array format) and using a generator to pass these new images to the Keras neural network, see [`Augmentor_Keras_Array_Data.ipynb`](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Fblob\u002Fmaster\u002Fnotebooks\u002FAugmentor_Keras_Array_Data.ipynb)\n\n### Per-Class Augmentation Strategies\nAugmentor allows for pipelines to be defined per class. That is, you can define different augmentation strategies on a class-by-class basis for a given classification problem.\n\nSee an example of this in the following Jupyter notebook: [`Per_Class_Augmentation_Strategy.ipynb`](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Fblob\u002Fmaster\u002Fnotebooks\u002FPer_Class_Augmentation_Strategy.ipynb)\n\n## Complete Example\n\nLet's perform an augmentation task on a single image, demonstrating the pipeline and several features of Augmentor.\n\nFirst import the package and initialise a Pipeline object by pointing it to a directory containing your images:\n\n```python\nimport Augmentor\n\np = Augmentor.Pipeline(\"\u002Fhome\u002Fuser\u002Faugmentor_data_tests\")\n```\n\nNow you can begin adding operations to the pipeline object:\n\n```python\np.rotate90(probability=0.5)\np.rotate270(probability=0.5)\np.flip_left_right(probability=0.8)\np.flip_top_bottom(probability=0.3)\np.crop_random(probability=1, percentage_area=0.5)\np.resize(probability=1.0, width=120, height=120)\n```\n\nOnce you have added the operations you require, you can sample images from this pipeline:\n\n```python\np.sample(100)\n```\n\nSome sample output:\n\n| Input Image\u003Csup>[3]\u003C\u002Fsup>                                                                                          |   | Augmented Images                                                                                                    |\n|--------------------------------------------------------------------------------------------------------------------|---|---------------------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_2e9fd6602a05.jpg) | → | ![Augmented](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_43fd001c6255.gif) |\n\nThe augmented images may be useful for a boundary detection task, for example.\n\n## Licence and Acknowledgements\n\nAugmentor is made available under the terms of the MIT Licence. See [`Licence.md`](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Fblob\u002Fmaster\u002FLICENSE.md).\n\n[1] Checkerboard image obtained from Wikimedia Commons and is in the public domain: \u003Chttps:\u002F\u002Fcommons.wikimedia.org\u002Fwiki\u002FFile:Checkerboard_pattern.svg>\n\n[2] Street view image is in the public domain: \u003Chttp:\u002F\u002Fstokpic.com\u002Fproject\u002Fitalian-city-street-with-shoppers\u002F>\n\n[3] Skin lesion image obtained from the ISIC Archive:\n\n- Image id = 5436e3abbae478396759f0cf\n- Download: \u003Chttps:\u002F\u002Fisic-archive.com:443\u002Fapi\u002Fv1\u002Fimage\u002F5436e3abbae478396759f0cf\u002Fdownload>\n\nYou can use `urllib` to obtain the skin lesion image in order to reproduce the augmented images above:\n\n```python\n>>> from urllib import urlretrieve\n>>> im_url = \"https:\u002F\u002Fisic-archive.com:443\u002Fapi\u002Fv1\u002Fimage\u002F5436e3abbae478396759f0cf\u002Fdownload\"\n>>> urlretrieve(im_url, \"ISIC_0000000.jpg\")\n('ISIC_0000000.jpg', \u003Chttplib.HTTPMessage instance at 0x7f7bd949a950>)\n```\n\nNote: For Python 3, use `from urllib.request import urlretrieve`.\n\nLogo created at [LogoMakr.com](https:\u002F\u002Flogomakr.com)\n\n## Tests\nTo run the automated tests, clone the repository and run:\n\n```bash\n$ py.test -v\n```\n\nfrom the command line. To view the CI tests that are run after each commit, see \u003Chttps:\u002F\u002Ftravis-ci.org\u002Fmdbloice\u002FAugmentor>.\n\n## Asciicast\n\nClick the preview below to view a video demonstration of Augmentor in use:\n\n[![asciicast](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_341a6b069f5d.png)](https:\u002F\u002Fasciinema.org\u002Fa\u002F105368?autoplay=1&speed=3)\n","![AugmentorLogo](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_f47b28b1722e.png)\n\nAugmentor 是一个用于机器学习的 Python 图像增强库。它的目标是成为一个独立于平台和框架的库，使用起来更加方便，能够对增强操作进行更细粒度的控制，并实现最贴近实际应用场景的增强技术。它采用基于构建模块的随机化方法，允许用户将不同的操作组合成一个流水线。\n\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAugmentor-v0.2.10-blue.svg?maxAge=2592000)](https:\u002F\u002Fpypi.python.org\u002Fpypi\u002FAugmentor)\n[![支持的 Python 版本](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-2.7%20%7C%203.5%20%7C%203.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue.svg)](https:\u002F\u002Fpypi.python.org\u002Fpypi\u002FAugmentor)\n[![PyPI 安装](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Factions\u002Fworkflows\u002FPyPI.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Factions\u002Fworkflows\u002FPyPI.yml)\n[![Pytest](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Factions\u002Fworkflows\u002Fpackage-tests.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Factions\u002Fworkflows\u002Fpackage-tests.yml)\n[![文档状态](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_13d664e1afd7.png)](https:\u002F\u002Faugmentor.readthedocs.io\u002Fen\u002Fmaster\u002F?badge=master)\n[![许可证](http:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-brightgreen.svg?style=flat)](LICENSE.md)\n[![项目状态：活跃——该项目已达到稳定可用状态，并正在积极开发中。](http:\u002F\u002Fwww.repostatus.org\u002Fbadges\u002Flatest\u002Factive.svg)](http:\u002F\u002Fwww.repostatus.org\u002F#active)\n[![Binder](https:\u002F\u002Fmybinder.org\u002Fbadge.svg)](https:\u002F\u002Fmybinder.org\u002Fv2\u002Fgh\u002F4QuantOSS\u002FAugmentor\u002Fmaster)\n\n## 安装\n\nAugmentor 使用 Python 编写。作为姊妹项目，Julia 版本的包也在开发中，可在此处获取：[https:\u002F\u002Fgithub.com\u002FEvizero\u002FAugmentor.jl](https:\u002F\u002Fgithub.com\u002FEvizero\u002FAugmentor.jl)。\n\n可通过命令行使用 `pip` 进行安装：\n\n```python\npip install Augmentor\n```\n\n有关从源代码构建的说明，请参阅文档。若要从旧版本升级，请使用 `pip install Augmentor --upgrade`。\n\n## 文档\n\n完整的文档可在 Read the Docs 上找到：[https:\u002F\u002Faugmentor.readthedocs.io](https:\u002F\u002Faugmentor.readthedocs.io\u002Fen\u002Fstable\u002F)\n\n## 快速入门指南与用法\n_Augmentor_ 的目的是自动化图像增强（人工数据生成），以扩充作为机器学习算法输入的数据集，尤其是神经网络和深度学习模型。\n\n该软件包通过构建一个增强**流水线**来工作，在其中您可以定义一系列要在一组图像上执行的操作。例如旋转或变换等操作可以逐一添加，从而创建一个增强流水线；当流水线完成后，即可执行并生成增强后的数据集。\n\n首先，实例化一个指向您文件系统中某个目录的 `Pipeline` 对象：\n\n```python\nimport Augmentor\np = Augmentor.Pipeline(\"\u002Fpath\u002Fto\u002Fimages\")\n```\n\n然后，您可以按照以下方式向流水线对象 `p` 添加操作：\n\n```python\np.rotate(probability=0.7, max_left_rotation=10, max_right_rotation=10)\np.zoom(probability=0.5, min_factor=1.1, max_factor=1.5)\n```\n\n每个函数都需要您指定一个概率，该概率用于决定在图像通过增强流水线时是否应用该操作。\n\n创建好流水线后，您可以按如下方式从中采样：\n\n```python\np.sample(10000)\n```\n\n这将根据您的设置生成 10,000 张增强后的图像。默认情况下，这些图像会被写入磁盘，保存到名为 `output` 的目录中，该目录位于上述初始化 `p` 流水线对象时指定的路径下。\n\n如果您希望流水线中的每张图像仅被处理一次，可以使用 `process()` 方法：\n\n```python\np.process()\n```\n\n此方法可能在调整数据集大小时很有用。在这种情况下，建议在使用 `process()` 方法时将流水线中所有操作的概率都设置为 1。\n\n### 多线程\n\nAugmentor（版本 ≥0.2.1）现在使用多线程来提高图像生成速度。\n\n如果原始图像非常小，这*可能会*导致某些流水线运行变慢。如果遇到性能下降的情况，可将 `multi_threaded` 参数设置为 `False`：\n\n```python\np.sample(100, multi_threaded=False)\n```\n\n不过，默认情况下，`sample()` 函数会使用多线程。目前这一功能仅在保存到磁盘时启用。在下一个版本更新中，生成器也将支持多线程。\n\n### 真值数据\n\n图像可以成组地通过流水线处理，以便真值数据能够被完全一致地增强。\n\n| 原始图像及掩码\u003Csup>[3]\u003C\u002Fsup>                                                                               | 增强后的原始图像及掩码                                                                               |\n|---------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|\n| ![OriginalMask](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_dab39dd477b1.png) | ![AugmentedMask](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_b0639e1a4cff.gif)   |\n\n要使真值数据与原始数据同步增强，可以使用 [ground_truth()](https:\u002F\u002Faugmentor.readthedocs.io\u002Fen\u002Fmaster\u002Fcode.html#Augmentor.Pipeline.Pipeline.ground_truth) 函数将真值数据目录添加到流水线中：\n\n```python\np = Augmentor.Pipeline(\"\u002Fpath\u002Fto\u002Fimages\")\n# 指向包含真值数据的目录。\n# 具有相同文件名的图像将被作为真值数据加入，并与原始数据同步增强。\np.ground_truth(\"\u002Fpath\u002Fto\u002Fground_truth_images\")\n# 正常添加其他操作：\np.rotate(probability=1, max_left_rotation=5, max_right_rotation=5)\np.flip_left_right(probability=0.5)\np.zoom_random(probability=0.5, percentage_area=0.8)\np.flip_top_bottom(probability=0.5)\np.sample(50)\n```\n\n### 多重掩码\u002F图像增强\n\n使用 `DataPipeline` 类（Augmentor 版本 >= 0.2.3），可以对具有多个关联掩码的图像进行增强：\n\n| 多重掩码增强                                                                               |\n|----------------------------------------------------------------------------------------------------------|\n| ![MultipleMask](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_6e98fee6df6a.gif) |\n\n可以将任意长度的图像列表分组后通过管道传递，并使用 `DataPipeline` 类以相同的方式进行增强。这对于包含多个掩码的真值图像等场景非常有用。\n\n在下面的示例中，图像及其掩码存储在 `images` 数据结构中（作为列表的列表），而它们的标签则存储在 `y` 中：\n\n```python\np = Augmentor.DataPipeline(images, y)\np.rotate(1, max_left_rotation=5, max_right_rotation=5)\np.flip_top_bottom(0.5)\np.zoom_random(1, percentage_area=0.5)\n\naugmented_images, labels = p.sample(100)\n```\n\n`DataPipeline` 直接返回图像（如上文中的 `augmented_images`），不会将其保存到磁盘，也不会从磁盘读取数据。图像在初始化时直接传递给 `DataPipeline`。\n\n有关 `images` 数据结构的详细信息以及如何创建它，请参阅 [Multiple-Mask-Augmentation.ipynb](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Fblob\u002Fmaster\u002Fnotebooks\u002FMultiple-Mask-Augmentation.ipynb) Jupyter 笔记本。\n\n### 用于 Keras 和 PyTorch 的生成器\n\n如果您不想将数据保存到磁盘，可以使用生成器（此处以 Keras 为例）：\n\n```python\ng = p.keras_generator(batch_size=128)\nimages, labels = next(g)\n```\n\n这将返回一个包含 128 张图像及其对应标签的批次。生成器会无限期地返回数据，可用于实时训练带有增强数据的神经网络。\n\n或者，您也可以将其与 PyTorch 集成：\n\n```python\nimport torchvision\ntransforms = torchvision.transforms.Compose([\n    p.torch_transform(),\n    torchvision.transforms.ToTensor(),\n])\n```\n\n## 主要特性\n\n### 弹性扭曲\n\n利用弹性扭曲功能，可以基于一张原始图像生成大量符合现实情况且标签保持不变的增强图像：\n\n| 输入图像                                                                                                                       |   | 增强后的图像                                                                                                        |\n|-----------------------------------------------------------------------------------------------------------------------------------|---|-------------------------------------------------------------------------------------------------------------------------|\n| ![eight_hand_drawn_border](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_2a20c5cac254.png) | → | ![eights_border](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_c221e3248ab6.gif) |\n\n输入图像周围有一圈 1 像素宽的黑色边框，以强调在不改变原始图像尺寸和宽高比、也不添加任何黑色或透明填充的情况下进行了扭曲处理。\n\n该功能的效果在此处更加清晰：\n\n| 原始图像\u003Csup>[1]\u003C\u002Fsup>                                                                      | 应用随机扭曲                                                                            |\n|---------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_79b9ebf6bea8.png) | ![Distorted](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_2109eb88eb1d.gif) |\n\n### 透视变换\n\n共有12种不同的透视变换类型可供选择。以下展示了其中最常用的四种。\n\n| 向左倾斜                                                                                               | 向右倾斜                                                                                               | 向前倾斜                                                                                               | 向后倾斜                                                                                               |\n|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|\n| ![TiltLeft](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_fd0d3e3ed8ec.png) | ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_758b7ca3ed77.png) | ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_6bd1716e6e2c.png) | ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_c924da8edf65.png) |\n\n其余八种变换类型如下：\n\n| 倾斜类型0                                                                                         | 倾斜类型1                                                                                         | 倾斜类型2                                                                                         | 倾斜类型3                                                                                         |\n|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|\n| ![Skew0](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_9efad605f790.png) | ![Skew1](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_c37d0bf0fefd.png) | ![Skew2](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_edc68aa57b17.png) | ![Skew3](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_2d2b1875ac9a.png) |\n\n| 倾斜类型4                                                                                         | 倾斜类型5                                                                                         | 倾斜类型6                                                                                         | 倾斜类型7                                                                                         |\n|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|\n| ![Skew4](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_e065840c2505.png) | ![Skew5](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_befa5555ce1b.png) | ![Skew6](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_59eb324f3ac1.png) | ![Skew7](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_e7c45acfe98f.png) |\n\n### 保持尺寸的旋转\n\n默认情况下，旋转操作会保持原始图像的尺寸不变：\n\n| 原始图像                                                                                    | 旋转10度，自动裁剪                                                               |\n|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_79b9ebf6bea8.png) | ![Rotate](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_0b1e348e5813.png) |\n\n与其他软件的旋转效果相比：\n\n| 原始图像                                                                                    | 旋转10度                                                                                |\n|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_79b9ebf6bea8.png) | ![Rotate](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_a60ca9591988.png) |\n\n### 保持尺寸的剪切变换\n\n剪切变换还会自动从剪切后的图像中裁剪出正确的区域，从而得到一张没有黑色空白或填充的图像。\n\n| 原始图像                                                                                    | 沿x轴剪切20度                                                                              | 沿y轴剪切20度                                                                              |\n|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_79b9ebf6bea8.png) | ![ShearX](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_f647cbd8302c.png) | ![ShearY](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_a2b8e95ea14a.png) |\n\n与此相对比的是常规的处理方式：\n\n| 原始图像                                                                                    | 沿x轴剪切20度                                                                          | 沿y轴剪切20度                                                                          |\n|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_79b9ebf6bea8.png) | ![ShearX](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_29dc5895a61f.png) | ![ShearY](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_ed8c4042432b.png) |\n\n### 裁剪\n\n裁剪也可以以更适合机器学习图像增强的方式进行处理：\n\n| 原始图像                                                                                    | 随机裁剪 + 调整大小操作                                                                          |\n|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_79b9ebf6bea8.png) | ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_c484183de84f.gif) |\n\n### 随机擦除\n\n随机擦除是一种用于提高模型对遮挡鲁棒性的技术。这在训练用于导航场景中目标检测的神经网络时可能会很有用。\n\n| 原始图像\u003Csup>[2]\u003C\u002Fsup>                                                                                               | 随机擦除                                                                                                                        |\n|----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_31dc5d91d554.jpg) | ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_0e05faa522be.gif) |\n\n有关使用方法，请参阅 [Pipeline.random_erasing()](https:\u002F\u002Faugmentor.readthedocs.io\u002Fen\u002Fstable\u002Fcode.html#Augmentor.Pipeline.Pipeline.random_erasing) 文档。\n\n### 在流水线中串联操作\n\n只需几个操作，就可以对单张图像进行增强，生成大量保留标签的新样本：\n\n| 原始图像                                                                                           | 扭曲 + 镜像翻转                                                                                          |\n|----------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|\n| ![Original](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_020796805e8c.png) | ![DistortFlipFlop](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_ebce418f8595.gif) |\n\n在上面的例子中，我们应用了三个操作：首先随机扭曲图像，然后以50%的概率水平翻转，再以50%的概率垂直翻转。接着我们从这个流水线中采样100次，生成100个新的数据。\n\n```python\np.random_distortion(probability=1, grid_width=4, grid_height=4, magnitude=8)\np.flip_left_right(probability=0.5)\np.flip_top_bottom(probability=0.5)\np.sample(100)\n```\n\n## 教程笔记本\n\n### 使用生成器与Keras集成\nAugmentor可以替代Keras的增强功能。Augmentor能够根据你定义的流水线创建一个无限生成增强数据的生成器。详细信息请参阅以下笔记本：\n\n- 从本地目录读取图像，在运行时对其进行增强，并使用生成器将增强后的图像流传递给Keras卷积神经网络，详见 [`Augmentor_Keras.ipynb`](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Fblob\u002Fmaster\u002Fnotebooks\u002FAugmentor_Keras.ipynb)\n- 在内存中（以数组形式）增强数据，并使用生成器将这些新图像传递给Keras神经网络，详见 [`Augmentor_Keras_Array_Data.ipynb`](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Fblob\u002Fmaster\u002Fnotebooks\u002FAugmentor_Keras_Array_Data.ipynb)\n\n### 按类别增强策略\nAugmentor允许为每个类别定义不同的流水线。也就是说，对于给定的分类问题，你可以为每个类别单独定义不同的增强策略。\n\n有关示例，请参阅以下Jupyter笔记本：[`Per_Class_Augmentation_Strategy.ipynb`](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Fblob\u002Fmaster\u002Fnotebooks\u002FPer_Class_Augmentation_Strategy.ipynb)\n\n## 完整示例\n\n让我们对单张图片执行数据增强任务，展示 Augmentor 的工作流程及其多项功能。\n\n首先导入该包，并通过指向包含图像的目录来初始化一个 Pipeline 对象：\n\n```python\nimport Augmentor\n\np = Augmentor.Pipeline(\"\u002Fhome\u002Fuser\u002Faugmentor_data_tests\")\n```\n\n现在你可以开始向 pipeline 对象添加操作：\n\n```python\np.rotate90(probability=0.5)\np.rotate270(probability=0.5)\np.flip_left_right(probability=0.8)\np.flip_top_bottom(probability=0.3)\np.crop_random(probability=1, percentage_area=0.5)\np.resize(probability=1.0, width=120, height=120)\n```\n\n当你添加完所需的操作后，就可以从这个 pipeline 中采样生成图像：\n\n```python\np.sample(100)\n```\n\n一些示例输出：\n\n| 输入图像\u003Csup>[3]\u003C\u002Fsup>                                                                                          |   | 增强后的图像                                                                                                    |\n|--------------------------------------------------------------------------------------------------------------------|---|---------------------------------------------------------------------------------------------------------------------|\n| ![原始图](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_2e9fd6602a05.jpg) | → | ![增强图](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_43fd001c6255.gif) |\n\n例如，这些增强后的图像可能对边界检测任务很有用。\n\n## 许可与致谢\n\nAugmentor 根据 MIT 许可协议提供。详情请参阅 [`Licence.md`](https:\u002F\u002Fgithub.com\u002Fmdbloice\u002FAugmentor\u002Fblob\u002Fmaster\u002FLICENSE.md)。\n\n[1] 棋盘格图像来自维基共享资源，属于公有领域： \u003Chttps:\u002F\u002Fcommons.wikimedia.org\u002Fwiki\u002FFile:Checkerboard_pattern.svg>\n\n[2] 街景图像属于公有领域： \u003Chttp:\u002F\u002Fstokpic.com\u002Fproject\u002Fitalian-city-street-with-shoppers\u002F>\n\n[3] 皮肤病变图像来自 ISIC 归档：\n\n- 图像 ID = 5436e3abbae478396759f0cf\n- 下载链接： \u003Chttps:\u002F\u002Fisic-archive.com:443\u002Fapi\u002Fv1\u002Fimage\u002F5436e3abbae478396759f0cf\u002Fdownload>\n\n你可以使用 `urllib` 获取该皮肤病变图像，以重现上述增强后的图像：\n\n```python\n>>> from urllib import urlretrieve\n>>> im_url = \"https:\u002F\u002Fisic-archive.com:443\u002Fapi\u002Fv1\u002Fimage\u002F5436e3abbae478396759f0cf\u002Fdownload\"\n>>> urlretrieve(im_url, \"ISIC_0000000.jpg\")\n('ISIC_0000000.jpg', \u003Chttplib.HTTPMessage instance at 0x7f7bd949a950>)\n```\n\n注意：对于 Python 3，请使用 `from urllib.request import urlretrieve`。\n\n标志由 [LogoMakr.com](https:\u002F\u002Flogomakr.com) 创作。\n\n## 测试\n要运行自动化测试，请克隆仓库并执行以下命令：\n\n```bash\n$ py.test -v\n```\n\n在命令行中运行。如需查看每次提交后运行的持续集成测试，请访问 \u003Chttps:\u002F\u002Ftravis-ci.org\u002Fmdbloice\u002FAugmentor>。\n\n## Asciicast\n点击下方预览，观看 Augmentor 使用的视频演示：\n\n[![asciicast](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_readme_341a6b069f5d.png)](https:\u002F\u002Fasciinema.org\u002Fa\u002F105368?autoplay=1&speed=3)","# Augmentor 快速上手指南\n\nAugmentor 是一个用于机器学习的 Python 图像增强库。它旨在成为一个独立、跨平台且框架无关的库，通过构建随机化的操作管道（Pipeline），帮助用户自动化生成人工数据以扩展数据集，特别适用于神经网络和深度学习任务。\n\n## 环境准备\n\n*   **操作系统**：跨平台支持（Windows, macOS, Linux）。\n*   **Python 版本**：支持 Python 2.7, 3.5, 3.6, 3.7, 3.8, 3.9。\n*   **前置依赖**：需安装 `pip` 包管理工具。\n*   **国内加速建议**：在中国大陆地区，建议使用清华或阿里镜像源加速安装过程。\n\n## 安装步骤\n\n使用 `pip` 从命令行进行安装。\n\n**标准安装：**\n```bash\npip install Augmentor\n```\n\n**使用国内镜像源加速安装（推荐）：**\n```bash\npip install Augmentor -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n**升级现有版本：**\n```bash\npip install Augmentor --upgrade\n```\n\n## 基本使用\n\nAugmentor 的核心工作流程是创建一个**管道（Pipeline）**，向其中添加一系列操作（如旋转、缩放等），然后执行该管道以生成增强后的图像。\n\n### 1. 初始化管道\n首先，实例化一个 `Pipeline` 对象，指向包含原始图像的目录。\n\n```python\nimport Augmentor\n\n# 将 \"\u002Fpath\u002Fto\u002Fimages\" 替换为你的图片文件夹路径\np = Augmentor.Pipeline(\"\u002Fpath\u002Fto\u002Fimages\")\n```\n\n### 2. 添加增强操作\n向管道对象 `p` 中添加所需的操作。每个操作都需要指定一个 `probability`（概率），用于决定该操作是否应用于每张图像。\n\n```python\n# 70% 的概率进行旋转，左旋最大 10 度，右旋最大 10 度\np.rotate(probability=0.7, max_left_rotation=10, max_right_rotation=10)\n\n# 50% 的概率进行缩放，缩放因子在 1.1 到 1.5 之间\np.zoom(probability=0.5, min_factor=1.1, max_factor=1.5)\n```\n\n### 3. 生成增强数据\n定义好管道后，调用 `sample()` 方法生成指定数量的增强图像。默认情况下，生成的图像会保存在初始化路径下的 `output` 文件夹中。\n\n```python\n# 生成 10,000 张增强图像\np.sample(10000)\n```\n\n### 进阶提示\n*   **全量处理**：如果你希望对目录中的每张图像确切地执行一次操作（例如统一调整大小），请使用 `p.process()` 方法，并将所有操作的概率设置为 `1`。\n*   **多线程加速**：`sample()` 方法默认启用多线程以加快生成速度。如果处理极小图像时遇到性能下降，可设置 `multi_threaded=False`。\n*   **框架集成**：如果不希望将图片保存到磁盘，Augmentor 还支持直接生成用于 Keras (`keras_generator`) 或 PyTorch (`torch_transform`) 的数据生成器。","某医疗 AI 团队正在开发肺炎 X 光片辅助诊断系统，但面临原始标注数据稀缺且模型泛化能力不足的困境。\n\n### 没有 Augmentor 时\n- **数据扩充效率低下**：工程师需手动编写复杂的图像变换脚本（如旋转、缩放），代码冗余且难以维护，耗费大量开发时间。\n- **样本多样性不足**：人工生成的增强图片往往变换角度单一，缺乏真实临床场景中的随机性（如拍摄角度微偏、亮度不均），导致模型过拟合。\n- **流程控制僵化**：难以灵活调整不同增强操作的发生概率，无法模拟真实世界中某些干扰因素仅偶尔出现的情况。\n- **资源利用不充分**：缺乏内置的多线程支持，处理大规模医学影像数据集时速度缓慢，严重拖慢实验迭代周期。\n\n### 使用 Augmentor 后\n- **流水线式自动化构建**：通过简单的 API 链式调用即可定义包含旋转、变焦、扭曲等操作的处理管道，几分钟内完成原本数天的脚本开发工作。\n- **高度逼真的随机增强**：利用概率控制机制（如 `probability=0.7`），让每张 X 光片以不同概率经历多种变换，生成成千上万张具备“临床噪声”的高质量训练样本。\n- **细粒度策略调控**：可精确设定每个操作的最大旋转角度或缩放因子，轻松模拟特定医疗设备成像特征，显著提升模型对未知数据的鲁棒性。\n- **高效并行处理**：借助内置的多线程功能，快速处理海量高分辨率医学影像，将数据准备时间从数小时缩短至分钟级。\n\nAugmentor 通过构建灵活随机的增强流水线，以极低代码成本解决了医疗小样本场景下的数据匮乏难题，大幅提升了诊断模型的准确率与泛化能力。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmdbloice_Augmentor_457b9a33.png","mdbloice","Marcus D. Bloice","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fmdbloice_8b2683d5.jpg","Medical Imaging, Machine Learning","Medical University Graz","Graz, Austria","marcus.bloice@medunigraz.at",null,"https:\u002F\u002Fimi.medunigraz.at","https:\u002F\u002Fgithub.com\u002Fmdbloice",[87],{"name":88,"color":89,"percentage":90},"Python","#3572A5",100,5141,875,"2026-03-31T09:26:29","MIT",1,"Linux, macOS, Windows","未说明",{"notes":99,"python":100,"dependencies":101},"该工具旨在成为独立库，不依赖特定的机器学习框架（如 TensorFlow 或 PyTorch），但提供与 Keras 和 PyTorch 的生成器接口。支持多线程加速图像生成（默认开启，小图可关闭）。可通过 pip 直接安装。","2.7, 3.5, 3.6, 3.7, 3.8, 3.9",[102],"Pillow (隐含依赖，用于图像处理)",[13],[105,106,107,108],"augmentation","machine-learning","deep-learning","neural-networks","2026-03-27T02:49:30.150509","2026-04-06T11:32:00.642888",[],[113,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170],{"id":114,"version":115,"summary_zh":83,"released_at":83},116726,"0.2.12",{"id":117,"version":118,"summary_zh":83,"released_at":83},116727,"0.2.11",{"id":120,"version":121,"summary_zh":83,"released_at":83},116728,"0.2.10",{"id":123,"version":124,"summary_zh":83,"released_at":83},116729,"0.2.9",{"id":126,"version":127,"summary_zh":83,"released_at":83},116730,"0.2.8",{"id":129,"version":130,"summary_zh":83,"released_at":83},116731,"0.2.7",{"id":132,"version":133,"summary_zh":83,"released_at":83},116732,"0.2.6",{"id":135,"version":136,"summary_zh":83,"released_at":83},116733,"0.2.5",{"id":138,"version":139,"summary_zh":83,"released_at":83},116734,"0.2.4",{"id":141,"version":142,"summary_zh":83,"released_at":83},116735,"0.2.3",{"id":144,"version":145,"summary_zh":83,"released_at":83},116736,"0.2.2",{"id":147,"version":148,"summary_zh":83,"released_at":83},116737,"0.2.1",{"id":150,"version":151,"summary_zh":83,"released_at":83},116738,"0.2.0",{"id":153,"version":154,"summary_zh":83,"released_at":83},116739,"0.1.10",{"id":156,"version":157,"summary_zh":83,"released_at":83},116740,"0.1.9",{"id":159,"version":160,"summary_zh":83,"released_at":83},116741,"0.1.8",{"id":162,"version":163,"summary_zh":83,"released_at":83},116742,"0.1.7",{"id":165,"version":166,"summary_zh":83,"released_at":83},116743,"0.1.6",{"id":168,"version":169,"summary_zh":83,"released_at":83},116744,"0.1.5",{"id":171,"version":172,"summary_zh":83,"released_at":83},116745,"0.1.4"]