[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-jwyang--faster-rcnn.pytorch":3,"tool-jwyang--faster-rcnn.pytorch":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},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,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},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 真正成长为懂上",150037,2,"2026-04-10T23:33:47",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":78,"owner_email":76,"owner_twitter":76,"owner_website":79,"owner_url":80,"languages":81,"stars":106,"forks":107,"last_commit_at":108,"license":109,"difficulty_score":110,"env_os":111,"env_gpu":112,"env_ram":113,"env_deps":114,"category_tags":122,"github_topics":123,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":126,"updated_at":127,"faqs":128,"releases":158},6427,"jwyang\u002Ffaster-rcnn.pytorch","faster-rcnn.pytorch","A faster pytorch implementation of faster r-cnn","faster-rcnn.pytorch 是一个基于 PyTorch 框架的高效目标检测工具，旨在加速 Faster R-CNN 模型的训练过程。它主要解决了早期开源实现中依赖 NumPy 导致效率低下、难以支持多图像批量训练以及多 GPU 并行计算受限等痛点。\n\n该项目特别适合计算机视觉领域的研究人员和开发者使用，尤其是那些希望深入理解目标检测底层原理、进行算法改进或需要灵活定制训练流程的技术人员。值得注意的是，官方已说明该仓库在代码架构上略显陈旧，不再积极维护，建议追求最新工业级方案的用户转向 Detectron2 或 MMDetection 等项目，但将其作为学习“纯 PyTorch\"实现的游乐场依然极具价值。\n\n其核心技术亮点在于完全摒弃了 NumPy，实现了纯粹的 PyTorch 代码化；创新性地改造了数据加载器及 RPN、ROI Pooling 等关键层，使其原生支持多图像批处理和多 GPU 训练；同时集成了 ROI Pooling、ROI Align 和 ROI Crop 三种池化方法。此外，通过限制图像长宽比并将相似比例的图片分组训练，显著提升了显存利用效率，使得在单张显","faster-rcnn.pytorch 是一个基于 PyTorch 框架的高效目标检测工具，旨在加速 Faster R-CNN 模型的训练过程。它主要解决了早期开源实现中依赖 NumPy 导致效率低下、难以支持多图像批量训练以及多 GPU 并行计算受限等痛点。\n\n该项目特别适合计算机视觉领域的研究人员和开发者使用，尤其是那些希望深入理解目标检测底层原理、进行算法改进或需要灵活定制训练流程的技术人员。值得注意的是，官方已说明该仓库在代码架构上略显陈旧，不再积极维护，建议追求最新工业级方案的用户转向 Detectron2 或 MMDetection 等项目，但将其作为学习“纯 PyTorch\"实现的游乐场依然极具价值。\n\n其核心技术亮点在于完全摒弃了 NumPy，实现了纯粹的 PyTorch 代码化；创新性地改造了数据加载器及 RPN、ROI Pooling 等关键层，使其原生支持多图像批处理和多 GPU 训练；同时集成了 ROI Pooling、ROI Align 和 ROI Crop 三种池化方法。此外，通过限制图像长宽比并将相似比例的图片分组训练，显著提升了显存利用效率，使得在单张显卡上训练大型骨干网络成为可能。","# A *Faster* Pytorch Implementation of Faster R-CNN\n\n## Write at the beginning\n\n[05\u002F29\u002F2020] This repo was initaited about two years ago, developed as the first open-sourced object detection code which supports multi-gpu training. It has been integrating tremendous efforts from many people. However, we have seen many high-quality repos emerged in the last years, such as:\n\n* [maskrcnn-benchmark](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fmaskrcnn-benchmark)\n* [detectron2](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdetectron2)\n* [mmdetection](https:\u002F\u002Fgithub.com\u002Fopen-mmlab\u002Fmmdetection)\n\n**At this point, I think this repo is out-of-data in terms of the pipeline and coding style, and will not maintain actively. Though you can still use this repo as a playground, I highly recommend you move to the above repos to delve into west world of object detection!**\n\n## Introduction\n\n### :boom: Good news! This repo supports pytorch-1.0 now!!! We borrowed some code and techniques from [maskrcnn-benchmark](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fmaskrcnn-benchmark). Just go to pytorch-1.0 branch!\n\nThis project is a *faster* pytorch implementation of faster R-CNN, aimed to accelerating the training of faster R-CNN object detection models. Recently, there are a number of good implementations:\n\n* [rbgirshick\u002Fpy-faster-rcnn](https:\u002F\u002Fgithub.com\u002Frbgirshick\u002Fpy-faster-rcnn), developed based on Pycaffe + Numpy\n\n* [longcw\u002Ffaster_rcnn_pytorch](https:\u002F\u002Fgithub.com\u002Flongcw\u002Ffaster_rcnn_pytorch), developed based on Pytorch + Numpy\n\n* [endernewton\u002Ftf-faster-rcnn](https:\u002F\u002Fgithub.com\u002Fendernewton\u002Ftf-faster-rcnn), developed based on TensorFlow + Numpy\n\n* [ruotianluo\u002Fpytorch-faster-rcnn](https:\u002F\u002Fgithub.com\u002Fruotianluo\u002Fpytorch-faster-rcnn), developed based on Pytorch + TensorFlow + Numpy\n\nDuring our implementing, we referred the above implementations, especailly [longcw\u002Ffaster_rcnn_pytorch](https:\u002F\u002Fgithub.com\u002Flongcw\u002Ffaster_rcnn_pytorch). However, our implementation has several unique and new features compared with the above implementations:\n\n* **It is pure Pytorch code**. We convert all the numpy implementations to pytorch!\n\n* **It supports multi-image batch training**. We revise all the layers, including dataloader, rpn, roi-pooling, etc., to support multiple images in each minibatch.\n\n* **It supports multiple GPUs training**. We use a multiple GPU wrapper (nn.DataParallel here) to make it flexible to use one or more GPUs, as a merit of the above two features.\n\n* **It supports three pooling methods**. We integrate three pooling methods: roi pooing, roi align and roi crop. More importantly, we modify all of them to support multi-image batch training.\n\n* **It is memory efficient**. We limit the image aspect ratio, and group images with similar aspect ratios into a minibatch. As such, we can train resnet101 and VGG16 with batchsize = 4 (4 images) on a single Titan X (12 GB). When training with 8 GPU, the maximum batchsize for each GPU is 3 (Res101), totaling 24.\n\n* **It is faster**. Based on the above modifications, the training is much faster. We report the training speed on NVIDIA TITAN Xp in the tables below.\n\n### What we are doing and going to do\n\n- [x] Support both python2 and python3 (great thanks to [cclauss](https:\u002F\u002Fgithub.com\u002Fcclauss)).\n- [x] Add deformable pooling layer (mainly supported by [Xander](https:\u002F\u002Fgithub.com\u002Fxanderchf)).\n- [x] Support pytorch-0.4.0 (this branch).\n- [x] Support tensorboardX.\n- [x] Support pytorch-1.0 (go to pytorch-1.0 branch).\n\n## Other Implementations\n\n* [Feature Pyramid Network (FPN)](https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffpn.pytorch)\n\n* [Mask R-CNN](https:\u002F\u002Fgithub.com\u002Froytseng-tw\u002Fmask-rcnn.pytorch) (~~ongoing~~ already implemented by [roytseng-tw](https:\u002F\u002Fgithub.com\u002Froytseng-tw))\n\n* [Graph R-CNN](https:\u002F\u002Fgithub.com\u002Fjwyang\u002Fgraph-rcnn.pytorch) (extension to scene graph generation)\n\n## Tutorial\n\n* [Blog](http:\u002F\u002Fwww.telesens.co\u002F2018\u002F03\u002F11\u002Fobject-detection-and-classification-using-r-cnns\u002F) by [ankur6ue](https:\u002F\u002Fgithub.com\u002Fankur6ue)\n\n## Benchmarking\n\nWe benchmark our code thoroughly on three datasets: pascal voc, coco and visual genome, using two different network architectures: vgg16 and resnet101. Below are the results:\n\n1). PASCAL VOC 2007 (Train\u002FTest: 07trainval\u002F07test, scale=600, ROI Align)\n\nmodel    | #GPUs | batch size | lr        | lr_decay | max_epoch     |  time\u002Fepoch | mem\u002FGPU | mAP\n---------|--------|-----|--------|-----|-----|-------|--------|-----\n[VGG-16](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F6ief4w7qzka6083\u002Ffaster_rcnn_1_6_10021.pth?dl=0)     | 1 | 1 | 1e-3 | 5   | 6   |  0.76 hr | 3265MB   | 70.1\n[VGG-16](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fcpj2nu35am0f9hp\u002Ffaster_rcnn_1_9_2504.pth?dl=0)     | 1 | 4 | 4e-3 | 8   | 9  |  0.50 hr | 9083MB   | 69.6\n[VGG-16](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F1a31y7vicby0kvy\u002Ffaster_rcnn_1_10_625.pth?dl=0)     | 8 | 16| 1e-2 | 8   | 10  |  0.19 hr | 5291MB   | 69.4\n[VGG-16](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fhkj7i6mbhw9tq4k\u002Ffaster_rcnn_1_11_416.pth?dl=0)     | 8 | 24| 1e-2 | 10  | 11  |  0.16 hr | 11303MB  | 69.2\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F4v3or0054kzl19q\u002Ffaster_rcnn_1_7_10021.pth?dl=0)   | 1 | 1 | 1e-3 | 5   | 7   |  0.88 hr | 3200 MB  | 75.2\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F8bhldrds3mf0yuj\u002Ffaster_rcnn_1_10_2504.pth?dl=0)    | 1 | 4 | 4e-3 | 8   | 10  |  0.60 hr | 9700 MB  | 74.9\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F5is50y01m1l9hbu\u002Ffaster_rcnn_1_10_625.pth?dl=0)    | 8 | 16| 1e-2 | 8   | 10  |  0.23 hr | 8400 MB  | 75.2 \n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fcn8gneumg4gjo9i\u002Ffaster_rcnn_1_12_416.pth?dl=0)    | 8 | 24| 1e-2 | 10  | 12  |  0.17 hr | 10327MB  | 75.1  \n\n\n2). COCO (Train\u002FTest: coco_train+coco_val-minival\u002Fminival, scale=800, max_size=1200, ROI Align)\n\nmodel     | #GPUs | batch size |lr        | lr_decay | max_epoch     |  time\u002Fepoch | mem\u002FGPU | mAP\n---------|--------|-----|--------|-----|-----|-------|--------|-----\nVGG-16     | 8 | 16    |1e-2| 4   | 6  |  4.9 hr | 7192 MB  | 29.2\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F5if6l7mqsi4rfk9\u002Ffaster_rcnn_1_6_14657.pth?dl=0)    | 8 | 16    |1e-2| 4   | 6  |  6.0 hr    |10956 MB  | 36.2\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fbe0isevd22eikqb\u002Ffaster_rcnn_1_10_14657.pth?dl=0)    | 8 | 16    |1e-2| 4   | 10  |  6.0 hr    |10956 MB  | 37.0\n\n**NOTE**. Since the above models use scale=800, you need add \"--ls\" at the end of test command.\n\n3). COCO (Train\u002FTest: coco_train+coco_val-minival\u002Fminival, scale=600, max_size=1000, ROI Align)\n\nmodel     | #GPUs | batch size |lr        | lr_decay | max_epoch     |  time\u002Fepoch | mem\u002FGPU | mAP\n---------|--------|-----|--------|-----|-----|-------|--------|-----\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fy171ze1sdw1o2ph\u002Ffaster_rcnn_1_6_9771.pth?dl=0)    | 8 | 24    |1e-2| 4   | 6  |  5.4 hr    |10659 MB  | 33.9\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fdpq6qv0efspelr3\u002Ffaster_rcnn_1_10_9771.pth?dl=0)    | 8 | 24    |1e-2| 4   | 10  |  5.4 hr    |10659 MB  | 34.5\n\n4). Visual Genome (Train\u002FTest: vg_train\u002Fvg_test, scale=600, max_size=1000, ROI Align, category=2500)\n\nmodel     | #GPUs | batch size |lr        | lr_decay | max_epoch     |  time\u002Fepoch | mem\u002FGPU | mAP\n---------|--------|-----|--------|-----|-----|-------|--------|-----\n[VGG-16](http:\u002F\u002Fdata.lip6.fr\u002Fcadene\u002Ffaster-rcnn.pytorch\u002Ffaster_rcnn_1_19_48611.pth)    | 1 P100 | 4    |1e-3| 5   | 20  |  3.7 hr    |12707 MB  | 4.4\n\nThanks to [Remi](https:\u002F\u002Fgithub.com\u002FCadene) for providing the pretrained detection model on visual genome!\n\n* Click the links in the above tables to download our pre-trained faster r-cnn models.\n* If not mentioned, the GPU we used is NVIDIA Titan X Pascal (12GB).\n\n## Preparation\n\n\nFirst of all, clone the code\n```\ngit clone https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch.git\n```\n\nThen, create a folder:\n```\ncd faster-rcnn.pytorch && mkdir data\n```\n\n### prerequisites\n\n* Python 2.7 or 3.6\n* Pytorch 0.4.0 (**now it does not support 0.4.1 or higher**)\n* CUDA 8.0 or higher\n\n### Data Preparation\n\n* **PASCAL_VOC 07+12**: Please follow the instructions in [py-faster-rcnn](https:\u002F\u002Fgithub.com\u002Frbgirshick\u002Fpy-faster-rcnn#beyond-the-demo-installation-for-training-and-testing-models) to prepare VOC datasets. Actually, you can refer to any others. After downloading the data, create softlinks in the folder data\u002F.\n\n* **COCO**: Please also follow the instructions in [py-faster-rcnn](https:\u002F\u002Fgithub.com\u002Frbgirshick\u002Fpy-faster-rcnn#beyond-the-demo-installation-for-training-and-testing-models) to prepare the data.\n\n* **Visual Genome**: Please follow the instructions in [bottom-up-attention](https:\u002F\u002Fgithub.com\u002Fpeteanderson80\u002Fbottom-up-attention) to prepare Visual Genome dataset. You need to download the images and object annotation files first, and then perform proprecessing to obtain the vocabulary and cleansed annotations based on the scripts provided in this repository.\n\n### Pretrained Model\n\nWe used two pretrained models in our experiments, VGG and ResNet101. You can download these two models from:\n\n* VGG16: [Dropbox](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fs3brpk0bdq60nyb\u002Fvgg16_caffe.pth?dl=0), [VT Server](https:\u002F\u002Ffilebox.ece.vt.edu\u002F~jw2yang\u002Ffaster-rcnn\u002Fpretrained-base-models\u002Fvgg16_caffe.pth)\n\n* ResNet101: [Dropbox](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fiev3tkbz5wyyuz9\u002Fresnet101_caffe.pth?dl=0), [VT Server](https:\u002F\u002Ffilebox.ece.vt.edu\u002F~jw2yang\u002Ffaster-rcnn\u002Fpretrained-base-models\u002Fresnet101_caffe.pth)\n\nDownload them and put them into the data\u002Fpretrained_model\u002F.\n\n**NOTE**. We compare the pretrained models from Pytorch and Caffe, and surprisingly find Caffe pretrained models have slightly better performance than Pytorch pretrained. We would suggest to use Caffe pretrained models from the above link to reproduce our results.\n\n**If you want to use pytorch pre-trained models, please remember to transpose images from BGR to RGB, and also use the same data transformer (minus mean and normalize) as used in pretrained model.**\n\n### Compilation\n\nAs pointed out by [ruotianluo\u002Fpytorch-faster-rcnn](https:\u002F\u002Fgithub.com\u002Fruotianluo\u002Fpytorch-faster-rcnn), choose the right `-arch` in `make.sh` file, to compile the cuda code:\n\n  | GPU model  | Architecture |\n  | ------------- | ------------- |\n  | TitanX (Maxwell\u002FPascal) | sm_52 |\n  | GTX 960M | sm_50 |\n  | GTX 1080 (Ti) | sm_61 |\n  | Grid K520 (AWS g2.2xlarge) | sm_30 |\n  | Tesla K80 (AWS p2.xlarge) | sm_37 |\n\nMore details about setting the architecture can be found [here](https:\u002F\u002Fdeveloper.nvidia.com\u002Fcuda-gpus) or [here](http:\u002F\u002Farnon.dk\u002Fmatching-sm-architectures-arch-and-gencode-for-various-nvidia-cards\u002F)\n\nInstall all the python dependencies using pip:\n```\npip install -r requirements.txt\n```\n\nCompile the cuda dependencies using following simple commands:\n\n```\ncd lib\nsh make.sh\n```\n\nIt will compile all the modules you need, including NMS, ROI_Pooing, ROI_Align and ROI_Crop. The default version is compiled with Python 2.7, please compile by yourself if you are using a different python version.\n\n**As pointed out in this [issue](https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch\u002Fissues\u002F16), if you encounter some error during the compilation, you might miss to export the CUDA paths to your environment.**\n\n## Train\n\nBefore training, set the right directory to save and load the trained models. Change the arguments \"save_dir\" and \"load_dir\" in trainval_net.py and test_net.py to adapt to your environment.\n\nTo train a faster R-CNN model with vgg16 on pascal_voc, simply run:\n```\nCUDA_VISIBLE_DEVICES=$GPU_ID python trainval_net.py \\\n                   --dataset pascal_voc --net vgg16 \\\n                   --bs $BATCH_SIZE --nw $WORKER_NUMBER \\\n                   --lr $LEARNING_RATE --lr_decay_step $DECAY_STEP \\\n                   --cuda\n```\nwhere 'bs' is the batch size with default 1. Alternatively, to train with resnet101 on pascal_voc, simple run:\n```\n CUDA_VISIBLE_DEVICES=$GPU_ID python trainval_net.py \\\n                    --dataset pascal_voc --net res101 \\\n                    --bs $BATCH_SIZE --nw $WORKER_NUMBER \\\n                    --lr $LEARNING_RATE --lr_decay_step $DECAY_STEP \\\n                    --cuda\n```\nAbove, BATCH_SIZE and WORKER_NUMBER can be set adaptively according to your GPU memory size. **On Titan Xp with 12G memory, it can be up to 4**.\n\nIf you have multiple (say 8) Titan Xp GPUs, then just use them all! Try:\n```\npython trainval_net.py --dataset pascal_voc --net vgg16 \\\n                       --bs 24 --nw 8 \\\n                       --lr $LEARNING_RATE --lr_decay_step $DECAY_STEP \\\n                       --cuda --mGPUs\n\n```\n\nChange dataset to \"coco\" or 'vg' if you want to train on COCO or Visual Genome.\n\n## Test\n\nIf you want to evaluate the detection performance of a pre-trained vgg16 model on pascal_voc test set, simply run\n```\npython test_net.py --dataset pascal_voc --net vgg16 \\\n                   --checksession $SESSION --checkepoch $EPOCH --checkpoint $CHECKPOINT \\\n                   --cuda\n```\nSpecify the specific model session, checkepoch and checkpoint, e.g., SESSION=1, EPOCH=6, CHECKPOINT=416.\n\n## Demo\n\nIf you want to run detection on your own images with a pre-trained model, download the pretrained model listed in above tables or train your own models at first, then add images to folder $ROOT\u002Fimages, and then run\n```\npython demo.py --net vgg16 \\\n               --checksession $SESSION --checkepoch $EPOCH --checkpoint $CHECKPOINT \\\n               --cuda --load_dir path\u002Fto\u002Fmodel\u002Fdirectoy\n```\n\nThen you will find the detection results in folder $ROOT\u002Fimages.\n\n**Note the default demo.py merely support pascal_voc categories. You need to change the [line](https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch\u002Fblob\u002F530f3fdccaa60d05fa068bc2148695211586bd88\u002Fdemo.py#L156) to adapt your own model.**\n\nBelow are some detection results:\n\n\u003Cdiv style=\"color:#0000FF\" align=\"center\">\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjwyang_faster-rcnn.pytorch_readme_7c15abf94330.jpg\" width=\"430\"\u002F> \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjwyang_faster-rcnn.pytorch_readme_f5174a9fb826.jpg\" width=\"430\"\u002F>\n\u003C\u002Fdiv>\n\n## Webcam Demo\n\nYou can use a webcam in a real-time demo by running\n```\npython demo.py --net vgg16 \\\n               --checksession $SESSION --checkepoch $EPOCH --checkpoint $CHECKPOINT \\\n               --cuda --load_dir path\u002Fto\u002Fmodel\u002Fdirectoy \\\n               --webcam $WEBCAM_ID\n```\nThe demo is stopped by clicking the image window and then pressing the 'q' key.\n\n## Authorship\n\nThis project is equally contributed by [Jianwei Yang](https:\u002F\u002Fgithub.com\u002Fjwyang) and [Jiasen Lu](https:\u002F\u002Fgithub.com\u002Fjiasenlu), and many others (thanks to them!).\n\n## Citation\n\n    @article{jjfaster2rcnn,\n        Author = {Jianwei Yang and Jiasen Lu and Dhruv Batra and Devi Parikh},\n        Title = {A Faster Pytorch Implementation of Faster R-CNN},\n        Journal = {https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch},\n        Year = {2017}\n    }\n\n    @inproceedings{renNIPS15fasterrcnn,\n        Author = {Shaoqing Ren and Kaiming He and Ross Girshick and Jian Sun},\n        Title = {Faster {R-CNN}: Towards Real-Time Object Detection\n                 with Region Proposal Networks},\n        Booktitle = {Advances in Neural Information Processing Systems ({NIPS})},\n        Year = {2015}\n    }\n","# 一种*更快速*的 PyTorch 版 Faster R-CNN 实现\n\n## 写在前面\n\n[2020年5月29日] 本仓库大约在两年前启动，最初是首个支持多 GPU 训练的开源目标检测代码。它凝聚了众多开发者的心血。然而，近年来涌现出许多高质量的项目，例如：\n\n* [maskrcnn-benchmark](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fmaskrcnn-benchmark)\n* [detectron2](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdetectron2)\n* [mmdetection](https:\u002F\u002Fgithub.com\u002Fopen-mmlab\u002Fmmdetection)\n\n**目前，我认为该仓库在流程和代码风格上已经落后，因此将不再积极维护。尽管你仍然可以将其作为练习平台使用，但我强烈建议你转向上述项目，深入探索目标检测领域的前沿技术！**\n\n## 简介\n\n### :boom: 喜讯！本仓库现已支持 PyTorch 1.0！！！我们借鉴了 [maskrcnn-benchmark](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fmaskrcnn-benchmark) 中的部分代码和技巧。请切换到 pytorch-1.0 分支！\n\n本项目是一个 *更快* 的 PyTorch 版 Faster R-CNN 实现，旨在加速 Faster R-CNN 目标检测模型的训练。近期已有不少优秀的实现：\n\n* [rbgirshick\u002Fpy-faster-rcnn](https:\u002F\u002Fgithub.com\u002Frbgirshick\u002Fpy-faster-rcnn)，基于 PyCaffe + NumPy 开发\n* [longcw\u002Ffaster_rcnn_pytorch](https:\u002F\u002Fgithub.com\u002Flongcw\u002Ffaster_rcnn_pytorch)，基于 PyTorch + NumPy 开发\n* [endernewton\u002Ftf-faster-rcnn](https:\u002F\u002Fgithub.com\u002Fendernewton\u002Ftf-faster-rcnn)，基于 TensorFlow + NumPy 开发\n* [ruotianluo\u002Fpytorch-faster-rcnn](https:\u002F\u002Fgithub.com\u002Fruotianluo\u002Fpytorch-faster-rcnn)，基于 PyTorch + TensorFlow + NumPy 开发\n\n我们在实现过程中参考了以上项目，尤其是 [longcw\u002Ffaster_rcnn_pytorch](https:\u002F\u002Fgithub.com\u002Flongcw\u002Ffaster_rcnn_pytorch)。不过，我们的实现相比这些项目有几项独特且创新的功能：\n\n* **纯 PyTorch 代码**。我们将所有 NumPy 实现转换为 PyTorch。\n* **支持多图像批量训练**。我们对数据加载器、RPN、RoI 池化等各个模块进行了改造，使其能够在一个 mini-batch 中处理多张图像。\n* **支持多 GPU 训练**。通过使用 nn.DataParallel 多 GPU 封装，结合上述两项特性，我们可以灵活地选择使用单 GPU 或多 GPU 进行训练。\n* **支持三种池化方法**。我们集成了 RoI Pooling、RoI Align 和 RoI Crop 三种池化方式，并对其进行了修改以支持多图像批量训练。\n* **内存高效**。我们对图像的宽高比进行限制，将相似宽高比的图像分组到同一个 mini-batch 中。这样，在单块 Titan X（12 GB 显存）上，我们就可以以 batch size = 4 的规模训练 ResNet101 和 VGG16；而在 8 卡环境下，每张卡的最大 batch size 可达 3（ResNet101），总 batch size 为 24。\n* **速度更快**。基于上述优化，训练速度显著提升。我们在下表中展示了在 NVIDIA TITAN Xp 上的训练速度。\n\n### 我们正在做以及未来计划做的事情\n\n- [x] 同时支持 Python 2 和 Python 3（特别感谢 [cclauss](https:\u002F\u002Fgithub.com\u002Fcclauss)）。\n- [x] 添加可变形池化层（主要由 [Xander](https:\u002F\u002Fgithub.com\u002Fxanderchf) 支持）。\n- [x] 支持 PyTorch 0.4.0（此分支）。\n- [x] 支持 tensorboardX。\n- [x] 支持 PyTorch 1.0（请切换到 pytorch-1.0 分支）。\n\n## 其他相关实现\n\n* [特征金字塔网络 (FPN)](https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffpn.pytorch)\n\n* [Mask R-CNN](https:\u002F\u002Fgithub.com\u002Froytseng-tw\u002Fmask-rcnn.pytorch)（~~正在进行中~~ 已由 [roytseng-tw](https:\u002F\u002Fgithub.com\u002Froytseng-tw) 实现）\n\n* [图 R-CNN](https:\u002F\u002Fgithub.com\u002Fjwyang\u002Fgraph-rcnn.pytorch)（用于场景图生成的扩展）\n\n## 教程\n\n* [博客](http:\u002F\u002Fwww.telesens.co\u002F2018\u002F03\u002F11\u002Fobject-detection-and-classification-using-r-cnns\u002F) 由 [ankur6ue](https:\u002F\u002Fgithub.com\u002Fankur6ue) 撰写\n\n## 基准测试\n\n我们在三个数据集上对我们的代码进行了全面的基准测试：Pascal VOC、COCO 和 Visual Genome，使用了两种不同的网络架构：VGG16 和 ResNet101。以下是结果：\n\n1). PASCAL VOC 2007（训练\u002F测试：07trainval\u002F07test，尺度=600，ROI Align）\n\n模型    | GPU 数量 | 批量大小 | 学习率        | 学习率衰减 | 最大 epoch 数     | 每 epoch 时间 | 每 GPU 显存 | mAP\n---------|--------|-----|--------|-----|-----|-------|--------|-----\n[VGG-16](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F6ief4w7qzka6083\u002Ffaster_rcnn_1_6_10021.pth?dl=0)     | 1 | 1 | 1e-3 | 5   | 6   |  0.76 小时 | 3265MB   | 70.1\n[VGG-16](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fcpj2nu35am0f9hp\u002Ffaster_rcnn_1_9_2504.pth?dl=0)     | 1 | 4 | 4e-3 | 8   | 9  |  0.50 小时 | 9083MB   | 69.6\n[VGG-16](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F1a31y7vicby0kvy\u002Ffaster_rcnn_1_10_625.pth?dl=0)     | 8 | 16| 1e-2 | 8   | 10  |  0.19 小时 | 5291MB   | 69.4\n[VGG-16](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fhkj7i6mbhw9tq4k\u002Ffaster_rcnn_1_11_416.pth?dl=0)     | 8 | 24| 1e-2 | 10  | 11  |  0.16 小时 | 11303MB  | 69.2\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F4v3or0054kzl19q\u002Ffaster_rcnn_1_7_10021.pth?dl=0)   | 1 | 1 | 1e-3 | 5   | 7   |  0.88 小时 | 3200 MB  | 75.2\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F8bhldrds3mf0yuj\u002Ffaster_rcnn_1_10_2504.pth?dl=0)    | 1 | 4 | 4e-3 | 8   | 10  |  0.60 小时 | 9700 MB  | 74.9\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F5is50y01m1l9hbu\u002Ffaster_rcnn_1_10_625.pth?dl=0)    | 8 | 16| 1e-2 | 8   | 10  |  0.23 小时 | 8400 MB  | 75.2 \n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fcn8gneumg4gjo9i\u002Ffaster_rcnn_1_12_416.pth?dl=0)    | 8 | 24| 1e-2 | 10  | 12  |  0.17 小时 | 10327MB  | 75.1  \n\n\n2). COCO（训练\u002F测试：coco_train+coco_val-minival\u002Fminival，尺度=800，最大尺寸=1200，ROI Align）\n\n模型     | GPU 数量 | 批量大小 |学习率        | 学习率衰减 | 最大 epoch 数     | 每 epoch 时间 | 每 GPU 显存 | mAP\n---------|--------|-----|--------|-----|-----|-------|--------|-----\nVGG-16     | 8 | 16    |1e-2| 4   | 6  |  4.9 小时 | 7192 MB  | 29.2\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F5if6l7mqsi4rfk9\u002Ffaster_rcnn_1_6_14657.pth?dl=0)    | 8 | 16    |1e-2| 4   | 6  |  6.0 小时    |10956 MB  | 36.2\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fbe0isevd22eikqb\u002Ffaster_rcnn_1_10_14657.pth?dl=0)    | 8 | 16    |1e-2| 4   | 10  |  6.0 小时    |10956 MB  | 37.0\n\n**注意**。由于上述模型使用尺度=800，您需要在测试命令末尾添加“--ls”。\n\n3). COCO（训练\u002F测试：coco_train+coco_val-minival\u002Fminival，尺度=600，最大尺寸=1000，ROI Align）\n\n模型     | GPU 数量 | 批量大小 |学习率        | 学习率衰减 | 最大 epoch 数     | 每 epoch 时间 | 每 GPU 显存 | mAP\n---------|--------|-----|--------|-----|-----|-------|--------|-----\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fy171ze1sdw1o2ph\u002Ffaster_rcnn_1_6_9771.pth?dl=0)    | 8 | 24    |1e-2| 4   | 6  |  5.4 小时    |10659 MB  | 33.9\n[Res-101](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fdpq6qv0efspelr3\u002Ffaster_rcnn_1_10_9771.pth?dl=0)    | 8 | 24    |1e-2| 4   | 10  |  5.4 小时    |10659 MB  | 34.5\n\n4). Visual Genome（训练\u002F测试：vg_train\u002Fvg_test，尺度=600，最大尺寸=1000，ROI Align，类别=2500）\n\n模型     | GPU 数量 | 批量大小 |学习率        | 学习率衰减 | 最大 epoch 数     | 每 epoch 时间 | 每 GPU 显存 | mAP\n---------|--------|-----|--------|-----|-----|-------|--------|-----\n[VGG-16](http:\u002F\u002Fdata.lip6.fr\u002Fcadene\u002Ffaster-rcnn.pytorch\u002Ffaster_rcnn_1_19_48611.pth)    | 1 P100 | 4    |1e-3| 5   | 20  |  3.7 小时    |12707 MB  | 4.4\n\n感谢 [Remi](https:\u002F\u002Fgithub.com\u002FCadene) 提供的 Visual Genome 上的预训练检测模型！\n\n* 点击上述表格中的链接以下载我们预训练的 Faster R-CNN 模型。\n* 如果未特别说明，我们使用的 GPU 是 NVIDIA Titan X Pascal（12GB）。\n\n## 准备工作\n\n\n首先，克隆代码\n```\ngit clone https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch.git\n```\n\n然后，创建一个文件夹：\n```\ncd faster-rcnn.pytorch && mkdir data\n```\n\n### 前提条件\n\n* Python 2.7 或 3.6\n* PyTorch 0.4.0（**目前不支持 0.4.1 或更高版本**）\n* CUDA 8.0 或更高版本\n\n### 数据准备\n\n* **PASCAL_VOC 07+12**：请按照 [py-faster-rcnn](https:\u002F\u002Fgithub.com\u002Frbgirshick\u002Fpy-faster-rcnn#beyond-the-demo-installation-for-training-and-testing-models) 中的说明准备 VOC 数据集。实际上，您可以参考其他任何方法。下载数据后，在 data\u002F 文件夹中创建软链接。\n\n* **COCO**：同样，请按照 [py-faster-rcnn](https:\u002F\u002Fgithub.com\u002Frbgirshick\u002Fpy-faster-rcnn#beyond-the-demo-installation-for-training-and-testing-models) 中的说明准备数据。\n\n* **Visual Genome**：请按照 [bottom-up-attention](https:\u002F\u002Fgithub.com\u002Fpeteanderson80\u002Fbottom-up-attention) 中的说明准备 Visual Genome 数据集。您需要先下载图像和目标标注文件，然后根据该仓库提供的脚本进行预处理，以获得词汇表和清理后的标注。\n\n### 预训练模型\n\n我们在实验中使用了两个预训练模型，VGG 和 ResNet101。您可以从以下链接下载这两个模型：\n\n* VGG16：[Dropbox](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fs3brpk0bdq60nyb\u002Fvgg16_caffe.pth?dl=0)，[VT Server](https:\u002F\u002Ffilebox.ece.vt.edu\u002F~jw2yang\u002Ffaster-rcnn\u002Fpretrained-base-models\u002Fvgg16_caffe.pth)\n\n* ResNet101：[Dropbox](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fiev3tkbz5wyyuz9\u002Fresnet101_caffe.pth?dl=0)，[VT Server](https:\u002F\u002Ffilebox.ece.vt.edu\u002F~jw2yang\u002Ffaster-rcnn\u002Fpretrained-base-models\u002Fresnet101_caffe.pth)\n\n下载后将其放入 data\u002Fpretrained_model\u002F 目录中。\n\n**注意**。我们比较了 PyTorch 和 Caffe 的预训练模型，令人惊讶的是，Caffe 的预训练模型性能略优于 PyTorch 的预训练模型。我们建议使用上述链接中的 Caffe 预训练模型来复现我们的结果。\n\n**如果您想使用 PyTorch 预训练模型，请务必先将图像从 BGR 转换为 RGB，并且使用与预训练模型相同的预处理方式（减去均值并归一化）。**\n\n### 编译\n\n如 [ruotianluo\u002Fpytorch-faster-rcnn](https:\u002F\u002Fgithub.com\u002Fruotianluo\u002Fpytorch-faster-rcnn) 所述，在 `make.sh` 文件中选择正确的 `-arch` 参数，以编译 CUDA 代码：\n\n  | GPU 型号  | 架构 |\n  | ------------- | ------------- |\n  | TitanX (Maxwell\u002FPascal) | sm_52 |\n  | GTX 960M | sm_50 |\n  | GTX 1080 (Ti) | sm_61 |\n  | Grid K520 (AWS g2.2xlarge) | sm_30 |\n  | Tesla K80 (AWS p2.xlarge) | sm_37 |\n\n有关设置架构的更多详细信息，请参阅 [此处](https:\u002F\u002Fdeveloper.nvidia.com\u002Fcuda-gpus) 或 [此处](http:\u002F\u002Farnon.dk\u002Fmatching-sm-architectures-arch-and-gencode-for-various-nvidia-cards\u002F)。\n\n使用 pip 安装所有 Python 依赖项：\n```\npip install -r requirements.txt\n```\n\n通过以下简单命令编译 CUDA 依赖项：\n```\ncd lib\nsh make.sh\n```\n\n这将编译您所需的所有模块，包括 NMS、ROI_Pooling、ROI_Align 和 ROI_Crop。默认版本是使用 Python 2.7 编译的，如果您使用的是其他 Python 版本，请自行编译。\n\n**正如此 [issue](https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch\u002Fissues\u002F16) 中所指出的那样，如果在编译过程中遇到错误，可能是您未将 CUDA 路径导出到环境变量中。**\n\n## 训练\n\n在训练之前，请设置正确的目录来保存和加载训练好的模型。请修改 `trainval_net.py` 和 `test_net.py` 中的 `save_dir` 和 `load_dir` 参数，以适应您的环境。\n\n要在 Pascal VOC 数据集上使用 VGG16 训练 Faster R-CNN 模型，只需运行：\n```\nCUDA_VISIBLE_DEVICES=$GPU_ID python trainval_net.py \\\n                   --dataset pascal_voc --net vgg16 \\\n                   --bs $BATCH_SIZE --nw $WORKER_NUMBER \\\n                   --lr $LEARNING_RATE --lr_decay_step $DECAY_STEP \\\n                   --cuda\n```\n其中 `bs` 是批大小，默认为 1。或者，要在 Pascal VOC 数据集上使用 ResNet101 训练，只需运行：\n```\nCUDA_VISIBLE_DEVICES=$GPU_ID python trainval_net.py \\\n                    --dataset pascal_voc --net res101 \\\n                    --bs $BATCH_SIZE --nw $WORKER_NUMBER \\\n                    --lr $LEARNING_RATE --lr_decay_step $DECAY_STEP \\\n                    --cuda\n```\n上述 `BATCH_SIZE` 和 `WORKER_NUMBER` 可根据您的 GPU 显存大小进行调整。**在显存为 12G 的 Titan Xp 上，最大可设为 4。**\n\n如果您有多个（比如 8 个）Titan Xp GPU，那就全部用起来吧！尝试以下命令：\n```\npython trainval_net.py --dataset pascal_voc --net vgg16 \\\n                       --bs 24 --nw 8 \\\n                       --lr $LEARNING_RATE --lr_decay_step $DECAY_STEP \\\n                       --cuda --mGPUs\n```\n\n如果想在 COCO 或 Visual Genome 数据集上训练，可将 `dataset` 参数改为 “coco” 或 “vg”。\n\n## 测试\n\n如果您想评估一个预训练的 VGG16 模型在 Pascal VOC 测试集上的检测性能，只需运行：\n```\npython test_net.py --dataset pascal_voc --net vgg16 \\\n                   --checksession $SESSION --checkepoch $EPOCH --checkpoint $CHECKPOINT \\\n                   --cuda\n```\n请指定具体的模型会话、检查周期和检查点，例如 SESSION=1，EPOCH=6，CHECKPOINT=416。\n\n## 演示\n\n如果您想使用预训练模型对自己的图像进行目标检测，可以先下载上述表格中列出的预训练模型，或者先训练自己的模型，然后将图像放入 `$ROOT\u002Fimages` 文件夹中，再运行：\n```\npython demo.py --net vgg16 \\\n               --checksession $SESSION --checkepoch $EPOCH --checkpoint $CHECKPOINT \\\n               --cuda --load_dir path\u002Fto\u002Fmodel\u002Fdirectoy\n```\n\n检测结果将出现在 `$ROOT\u002Fimages` 文件夹中。\n\n**请注意，默认的 `demo.py` 仅支持 Pascal VOC 类别。您需要修改 [此行](https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch\u002Fblob\u002F530f3fdccaa60d05fa068bc2148695211586bd88\u002Fdemo.py#L156)，以适配您自己的模型。**\n\n以下是一些检测结果：\n\n\u003Cdiv style=\"color:#0000FF\" align=\"center\">\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjwyang_faster-rcnn.pytorch_readme_7c15abf94330.jpg\" width=\"430\"\u002F> \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjwyang_faster-rcnn.pytorch_readme_f5174a9fb826.jpg\" width=\"430\"\u002F>\n\u003C\u002Fdiv>\n\n## 网络摄像头演示\n\n您可以通过运行以下命令，在实时演示中使用网络摄像头：\n```\npython demo.py --net vgg16 \\\n               --checksession $SESSION --checkepoch $EPOCH --checkpoint $CHECKPOINT \\\n               --cuda --load_dir path\u002Fto\u002Fmodel\u002Fdirectoy \\\n               --webcam $WEBCAM_ID\n```\n演示可通过点击图像窗口并按下 ‘q’ 键来停止。\n\n## 作者\n\n该项目由 [Jianwei Yang](https:\u002F\u002Fgithub.com\u002Fjwyang) 和 [Jiasen Lu](https:\u002F\u002Fgithub.com\u002Fjiasenlu) 以及其他许多人共同贡献（感谢他们！）。\n\n## 引用\n\n    @article{jjfaster2rcnn,\n        Author = {Jianwei Yang and Jiasen Lu and Dhruv Batra and Devi Parikh},\n        Title = {一种更快的 Faster R-CNN PyTorch 实现},\n        Journal = {https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch},\n        Year = {2017}\n    }\n\n    @inproceedings{renNIPS15fasterrcnn,\n        Author = {Shaoqing Ren and Kaiming He and Ross Girshick and Jian Sun},\n        Title = {Faster {R-CNN}: 向基于区域建议网络的实时目标检测迈进},\n        Booktitle = {神经信息处理系统进展 ({NIPS})},\n        Year = {2015}\n    }","# faster-rcnn.pytorch 快速上手指南\n\n> **⚠️ 重要提示**：本项目已停止主动维护，代码风格和流程相对过时。仅建议作为学习参考或实验场（Playground）。对于生产环境或深入研究，强烈推荐使用 [Detectron2](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fdetectron2) 或 [MMDetection](https:\u002F\u002Fgithub.com\u002Fopen-mmlab\u002Fmmdetection) 等现代框架。本指南基于原文提供的 `pytorch-1.0` 分支及经典用法整理。\n\n## 1. 环境准备\n\n在开始之前，请确保满足以下系统和依赖要求：\n\n*   **操作系统**: Linux (推荐)\n*   **Python**: 2.7 或 3.6\n*   **PyTorch**: \n    *   主分支支持 PyTorch 0.4.0 (**不支持** 0.4.1 及以上版本)。\n    *   若需使用新版，请切换至 `pytorch-1.0` 分支。\n*   **CUDA**: 8.0 或更高版本\n*   **GPU**: 支持 CUDA 的 NVIDIA 显卡（编译时需指定对应的架构代码）\n\n## 2. 安装步骤\n\n### 2.1 克隆代码与创建目录\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch.git\ncd faster-rcnn.pytorch && mkdir data\n```\n\n### 2.2 安装 Python 依赖\n建议使用国内镜像源加速安装：\n```bash\npip install -r requirements.txt -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n### 2.3 编译 CUDA 扩展\n根据显卡型号修改 `lib\u002Fmake.sh` 中的 `-arch` 参数（例如 Titan X 为 `sm_52`, GTX 1080 为 `sm_61`），然后执行编译：\n\n```bash\ncd lib\nsh make.sh\n```\n*注：此步骤将编译 NMS, ROI_Pooling, ROI_Align 和 ROI_Crop 等模块。如遇报错，请检查是否已正确导出 CUDA 环境变量。*\n\n### 2.4 准备预训练模型\n下载骨干网络预训练模型并放入 `data\u002Fpretrained_model\u002F` 目录。原文推荐使用 Caffe 转制的模型以获得更好效果：\n\n*   **VGG16**: [下载链接](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fs3brpk0bdq60nyb\u002Fvgg16_caffe.pth?dl=0)\n*   **ResNet101**: [下载链接](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002Fiev3tkbz5wyyuz9\u002Fresnet101_caffe.pth?dl=0)\n\n```bash\n# 示例：将下载的 .pth 文件移动至指定目录\nmv vgg16_caffe.pth data\u002Fpretrained_model\u002F\n```\n\n### 2.5 数据集准备\n按照 [py-faster-rcnn](https:\u002F\u002Fgithub.com\u002Frbgirshick\u002Fpy-faster-rcnn) 的说明准备 PASCAL VOC 或 COCO 数据集，并在 `data\u002F` 目录下建立软链接。\n\n## 3. 基本使用\n\n### 训练模型\n以在 PASCAL VOC 数据集上使用 VGG16  backbone 进行训练为例：\n\n```bash\nCUDA_VISIBLE_DEVICES=$GPU_ID python trainval_net.py \\\n                   --dataset pascal_voc --net vgg16 \\\n                   --bs $BATCH_SIZE --nw $WORKER_NUMBER \\\n                   --lr $LEARNING_RATE --lr_decay_step $DECAY_STEP \\\n                   --cuda\n```\n\n**参数说明：**\n*   `$GPU_ID`: 指定使用的 GPU 编号（如 0）。\n*   `--net`: 选择网络架构，可选 `vgg16` 或 `res101`。\n*   `--bs`: Batch Size，根据显存大小调整（单卡 Titan X 可设 4）。\n*   `--cuda`: 启用 GPU 训练。\n\n若使用 ResNet101，只需将 `--net` 参数改为 `res101`：\n\n```bash\nCUDA_VISIBLE_DEVICES=$GPU_ID python trainval_net.py \\\n                    --dataset pascal_voc --net res101 \\\n                    --bs $BATCH_SIZE --nw $WORKER_NUMBER \\\n                    --lr $LEARNING_RATE --lr_decay_step $DECAY_STEP \\\n                    --cuda\n```\n\n### 测试模型\n训练完成后，使用 `test_net.py` 进行评估（具体命令参考原库文档，需注意不同数据集的缩放比例参数，如 COCO 数据集测试时可能需要添加 `--ls` 参数）。","某自动驾驶初创公司的算法团队正急需在有限时间内训练出高精度的车辆与行人检测模型，以应对即将进行的路测验证。\n\n### 没有 faster-rcnn.pytorch 时\n- **框架依赖混乱**：团队被迫使用基于 Pycaffe 或混合 TensorFlow 的旧版实现，导致环境配置极其复杂，且无法充分利用团队熟悉的 PyTorch 生态。\n- **单图训练效率低**：原有代码仅支持单张图片输入，无法进行多图像批量（Batch）训练，导致 GPU 算力大量闲置，数据吞吐量极低。\n- **多卡扩展困难**：缺乏原生的多 GPU 支持，想要加速训练必须手动编写复杂的分布式逻辑，甚至只能单卡运行，严重拖慢迭代速度。\n- **显存占用过高**：由于未对图像长宽比进行优化分组，训练大模型（如 ResNet101）时显存爆炸，不得不大幅缩小 Batch Size，影响模型收敛效果。\n\n### 使用 faster-rcnn.pytorch 后\n- **纯 PyTorch 重构**：直接采用全 PyTorch 代码实现，无缝对接现有开发流程，消除了跨框架调试的痛苦，代码可读性与维护性显著提升。\n- **高效批量训练**：利用其支持的多图像 Batch 训练特性，配合改进的 ROI Pooling 层，大幅提升了单次迭代的数据处理量。\n- **灵活多卡并行**：借助内置的 `nn.DataParallel` 封装，团队轻松在 8 张 GPU 上启动训练，总 Batch Size 提升至 24，训练周期从数周缩短至数天。\n- **显存管理优化**：通过限制图像长宽比并将相似比例图片分组，成功在单卡上以更大 Batch Size 训练深层网络，显著提升了模型最终的检测精度。\n\nfaster-rcnn.pytorch 通过纯 PyTorch 架构与高效的显存及多卡策略，将原本漫长的模型研发周期压缩了数倍，让团队能专注于算法优化而非底层工程适配。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjwyang_faster-rcnn.pytorch_7c15abf9.jpg","jwyang","Jianwei Yang","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fjwyang_2dc0faab.jpg",null,"xAI","WA","https:\u002F\u002Fjwyang.github.io","https:\u002F\u002Fgithub.com\u002Fjwyang",[82,86,90,94,98,102],{"name":83,"color":84,"percentage":85},"Python","#3572A5",74.2,{"name":87,"color":88,"percentage":89},"C","#555555",13.9,{"name":91,"color":92,"percentage":93},"Cuda","#3A4E3A",10.4,{"name":95,"color":96,"percentage":97},"C++","#f34b7d",0.6,{"name":99,"color":100,"percentage":101},"Shell","#89e051",0.5,{"name":103,"color":104,"percentage":105},"MATLAB","#e16737",0.4,7864,2307,"2026-04-10T12:14:26","MIT",4,"Linux","必需 NVIDIA GPU。支持 Titan X (Maxwell\u002FPascal), GTX 960M, GTX 1080\u002FTi, Tesla K80 等。显存需求取决于模型和批次大小：单卡训练 VGG16\u002FResNet101 (batch_size=4) 需约 9-12GB；多卡训练最大批次下显存占用可达 10-13GB。CUDA 版本需 8.0 或更高。","未说明",{"notes":115,"python":116,"dependencies":117},"1. 该仓库已不再积极维护，代码风格较旧，建议迁移至 detectron2 或 mmdetection 等新项目。\n2. 严格依赖 PyTorch 0.4.0，不支持 0.4.1 及更高版本。\n3. 需要手动编译 CUDA 扩展（NMS, ROI_Pooling 等），需在 make.sh 中根据显卡型号设置正确的 '-arch' 参数，并确保导出 CUDA 路径环境变量。\n4. 建议使用提供的 Caffe 预训练模型以获得更好效果；若使用 PyTorch 预训练模型，需注意图像通道顺序 (BGR 转 RGB) 及归一化方式。","2.7 或 3.6",[118,119,120,121],"pytorch==0.4.0","tensorboardX","numpy","cuda (compiled via make.sh)",[14],[124,125],"faster-rcnn","pytorch","2026-03-27T02:49:30.150509","2026-04-11T08:12:46.747479",[129,134,139,144,149,153],{"id":130,"question_zh":131,"answer_zh":132,"source_url":133},29080,"运行时出现 'No module named cython_bbox' 错误怎么办？","这通常是因为 Cython 扩展模块未正确编译。请检查并运行项目根目录下的 `lib\u002Fmake.sh` 脚本来编译必要的 CUDA 和 Cython 扩展。确保已安装 Cython (`pip install cython`) 且 CUDA 环境配置正确。如果编译后仍报错，请确认是否在正确的 Python 环境中执行了编译脚本。","https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch\u002Fissues\u002F9",{"id":135,"question_zh":136,"answer_zh":137,"source_url":138},29081,"编译时遇到 'gcc' 命令失败或 'undefined symbol: __cudaPopCallConfiguration' 错误如何解决？","这通常是由于 GCC 版本过高或与 CUDA\u002FPyTorch 版本不兼容导致的。解决方案包括：1. 加载较低版本的 GCC（如 gcc 5.5.0），命令示例：`module load gcc\u002F5.5.0` 或使用 conda 安装特定版本；2. 如果是 PyTorch 0.4+ 版本，可能需要手动修改生成的 C 文件，将 `xxxx->size[x]` 替换为 `THFloatTensor_size(xxxx, x)`，将 `xxxx->stride[x]` 替换为 `THFloatTensor_stride(xxxx, x)`，涉及文件位于 `lib\u002Fmodel\u002Fnms`, `lib\u002Fmodel\u002Froi_align`, `lib\u002Fmodel\u002Froi_crop` 和 `lib\u002Fmodel\u002Froi_pooling` 目录下。","https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch\u002Fissues\u002F235",{"id":140,"question_zh":141,"answer_zh":142,"source_url":143},29082,"训练自定义数据集时出现坐标溢出或负值错误怎么办？","在解析标注文件（如 Pascal VOC 的 XML）时，如果坐标计算出现负值会导致溢出错误。需要在 `lib\u002Fdatasets\u002Fpascal_voc.py` 文件的 `_load_pascal_annotation` 函数中，对读取的坐标值进行裁剪处理。将代码修改为：`x1 = max(float(bbox.find('xmin').text) - 1, 0)`，`y1`、`x2`、`y2` 同理。这样可以确保坐标值非负，避免程序崩溃。","https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch\u002Fissues\u002F75",{"id":145,"question_zh":146,"answer_zh":147,"source_url":148},29083,"找不到 '_roi_pooling.so' 文件或编译失败如何处理？","该文件需要通过编译 CUDA 内核生成。首先运行 `sh make.sh`。如果自动编译失败，可以手动进入 `lib\u002Fmodel\u002Froi_pooling\u002Fsrc` 目录，使用 nvcc 手动编译：`nvcc -c -o roi_pooling.cu.o roi_pooling_kernel.cu -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -gencode arch=compute_XX,code=sm_XX`（请将 XX 替换为你的显卡算力版本，如 61）。编译生成 `.o` 文件后，再次运行 `make.sh` 完成链接。","https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch\u002Fissues\u002F15",{"id":150,"question_zh":151,"answer_zh":152,"source_url":133},29084,"训练时出现 'out of memory' 或 'zero-sized dimensions' 错误怎么办？","显存不足通常是因为 Batch Size 设置过大。建议将最小 Batch Size 设置为 2。如果仍然显存不足，可以尝试减小输入图像的尺寸，或者改用参数量较小的 backbone 网络（例如使用 ResNet 替代 VGG16）。此外，确保 `RPN_BATCHSIZE` 参数与 `BATCH_SIZE` 匹配，避免因数据采样维度为零导致的 PyTorch 运行时错误。",{"id":154,"question_zh":155,"answer_zh":156,"source_url":157},29085,"在 Google Colab 上运行时遇到 Python 版本或 Torch 版本不匹配的问题？","Colab 默认环境可能不兼容此项目（通常需要 Python 3.6 和特定版本的 PyTorch\u002FCUDA）。如果在 Colab 上遇到 `ImportError` 或版本冲突，尝试使用 Conda 创建一个新的虚拟环境，指定 Python 3.6 版本，并重新安装匹配的 PyTorch（如 0.4.0）和 CUDA 工具包。注意仅修改表面版本号可能无效，必须确保底层库文件真正对应。","https:\u002F\u002Fgithub.com\u002Fjwyang\u002Ffaster-rcnn.pytorch\u002Fissues\u002F190",[]]