[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-hank-ai--darknet":3,"tool-hank-ai--darknet":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":79,"owner_email":80,"owner_twitter":79,"owner_website":81,"owner_url":82,"languages":83,"stars":115,"forks":116,"last_commit_at":117,"license":118,"difficulty_score":119,"env_os":120,"env_gpu":121,"env_ram":122,"env_deps":123,"category_tags":130,"github_topics":131,"view_count":10,"oss_zip_url":79,"oss_zip_packed_at":79,"status":16,"created_at":137,"updated_at":138,"faqs":139,"releases":167},658,"hank-ai\u002Fdarknet","darknet","Darknet\u002FYOLO object detection framework","Darknet 是一个基于 C、C++ 和 CUDA 编写的开源神经网络框架，专为运行 YOLO（You Only Look Once）系列目标检测算法而设计。它致力于解决物体检测任务中速度与精度难以兼顾的痛点，让系统能够在保证准确性的前提下实现实时处理。\n\n对于计算机视觉开发者、研究人员以及需要将检测功能集成到现有项目中的工程师而言，Darknet 提供了极佳的解决方案。它不仅完全免费且开源，允许直接用于商业产品，无需支付授权费。在性能方面，Darknet 表现优异，在高端显卡上可实现每秒上千帧的视频流处理，同时支持 Linux、Windows、macOS 等多种操作系统，甚至能部署在树莓派等边缘设备上。\n\n此外，Darknet 兼容 NVIDIA CUDA 和 AMD ROCm 硬件加速，构建方式灵活，支持 Docker 和 CMake。目前代码库已迁移至 Codeberg 持续维护，社区活跃并提供了丰富的预训练模型与文档，是探索和实践深度学习目标检测技术的可靠选择。","# Table of Contents\n\n* [Darknet Object Detection Framework and YOLO](#darknet-object-detection-framework-and-yolo)\n* [Papers](#papers)\n* [General Information](#general-information)\n\t* [Darknet Version](#darknet-version)\n* [Pre-trained Weights](#pre-trained-weights)\n\t* [People-R-People Pre-trained Weights](#people-r-people-pre-trained-weights)\n\t* [MSCOCO Pre-trained Weights](#mscoco-pre-trained-weights)\n* [Building](#building)\n\t* [Google Colab](#google-colab)\n\t* [WSL](#wsl)\n\t* [Linux CMake Method](#linux-cmake-method)\n\t* [Windows CMake Method](#windows-cmake-method)\n\t* [Docker](#docker)\n* [Using Darknet](#using-darknet)\n\t* [CLI](#cli)\n\t* [Training](#training)\n* [Other Tools and Links](#other-tools-and-links)\n* [Roadmap](#roadmap)\n\t* [Short-term goals](#short-term-goals)\n\t* [Mid-term goals](#mid-term-goals)\n\t* [Long-term goals](#long-term-goals)\n\n# Darknet Object Detection Framework and YOLO\n\n![darknet and hank.ai logos](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhank-ai_darknet_readme_9e568ad59643.png)\n\nDarknet is an open source neural network framework written in C, C++, and CUDA.\n\nYOLO (You Only Look Once) is a state-of-the-art, real-time, object detection system, which runs in the Darknet framework.\n\n* 2025-08:  Darknet\u002FYOLO repo has moved to **[Codeberg.org\u002FCCodeRun\u002Fdarknet\u002F](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002Fdarknet\u002F)**\n\t* All commits are automatically mirrored from Codeberg to the older Hank.ai GitHub repo.\n* See the **[Darknet\u002FYOLO web site](https:\u002F\u002Fdarknetcv.ai\u002F)**\n* Please read through the **[Darknet\u002FYOLO FAQ](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fdarknet_faq\u002F)**\n* Join the **[Darknet\u002FYOLO discord server](https:\u002F\u002Fdiscord.gg\u002FMQw32W9Cqr)**\n\n# Papers\n\n* Paper **[YOLOv7](https:\u002F\u002Farxiv.org\u002Fabs\u002F2207.02696)**\n* Paper **[Scaled-YOLOv4](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent\u002FCVPR2021\u002Fhtml\u002FWang_Scaled-YOLOv4_Scaling_Cross_Stage_Partial_Network_CVPR_2021_paper.html)**\n* Paper **[YOLOv4](https:\u002F\u002Farxiv.org\u002Fabs\u002F2004.10934)**\n* Paper **[YOLOv3](https:\u002F\u002Farxiv.org\u002Fabs\u002F1804.02767)**\n\n# General Information\n\nThe Darknet\u002FYOLO framework continues to be both **faster** and **more accurate** than other frameworks and versions of YOLO.\n\nThis framework is both **completely free** and **open source**.  You can incorporate Darknet\u002FYOLO into existing projects and\nproducts -- including commercial ones -- without a license or paying a fee.\n\nDarknet V3 (\"Jazz\") released in October 2024 can accurately run the LEGO dataset videos at up to **1000 FPS** when using\na NVIDIA RTX 3090 GPU, meaning each video frame is read, resized, and processed by Darknet\u002FYOLO in 1 millisecond or less.\nAdditional performance improvements have been implemented in Darknet V4 and the upcoming Darknet V5, without compromising\nthe quality of detections.\n\nPlease join the Darknet\u002FYOLO Discord server if you need help or you want to discuss Darknet\u002FYOLO and related tools:  https:\u002F\u002Fdiscord.gg\u002FMQw32W9Cqr\n\nThe CPU version of Darknet\u002FYOLO can run on simple devices such as Raspberry Pi, cloud &amp; colab servers, desktops,\nlaptops, and high-end training rigs.  The GPU version of Darknet\u002FYOLO requires either a CUDA-capable GPU from NVIDIA,\nor a ROCm-capable GPU from AMD.\n\nDarknet\u002FYOLO is known to work on Linux, Windows, and Mac.  See the [building instructions](#building) below.\n\n## Darknet Version\n\n* The original Darknet tool written by Joseph Redmon in 2013-2017 did not have a version number.  We consider this version 0.x.\n* The next popular Darknet repo maintained by Alexey Bochkovskiy between 2017-2021 also did not have a version number.  We consider this version 1.x.\n* The Darknet repo sponsored by Hank.ai and maintained by Stéphane Charette starting in 2023 was the first one with a `version` command.  From 2023 until late 2024, it returned version 2.x \"OAK\".\n\t* The goal was to try and break as little of the existing functionality while getting familiar with the codebase.\n\t* Re-wrote the build steps so we have 1 unified way to build using CMake on Windows, Linux, and Mac.\n\t* Converted the codebase to use the C++ compiler.\n\t* Enhanced chart.png while training.\n\t* Bug fixes and performance-related optimizations, mostly related to cutting down the time it takes to train a network.\n\t* The last branch of this codebase is version 2.1 in the `v2` branch.\n* The next phase of development started in mid-2024 and was released in October 2024.  The `version` command now returns 3.x \"JAZZ\".\n\t* Removed many old and unmaintained commands.\n\t\t* You can always do a checkout of the previous `v2` branch if you need to run one of these commands.  Let us know so we can investigate adding back any missing commands.\n\t* Many performance optimizations, both when training and during inference.\n\t* Legacy C API was modified; applications that use the original Darknet API will need minor modifications:  https:\u002F\u002Fdarknetcv.ai\u002Fapi\u002Fapi.html\n\t* New Darknet V3 C and C++ API to make it easier for developers to write applications that use Darknet\u002FYOLO:  https:\u002F\u002Fdarknetcv.ai\u002Fapi\u002Fapi.html\n\t* New apps and sample code in `src-examples`:  https:\u002F\u002Fdarknetcv.ai\u002Fapi\u002Ffiles.html\n* The next release was in early 2025.  The `version` command now returns 4.x \"SLATE\".\n\t* Added support for AMD GPUs using ROCm.\n\t\t* Still need to add support for MIOpen.\n\t* All `printf()` and `std::cout` calls have all been replaced so Darknet\u002FYOLO logging messages can easily be redirected.\n* The next release was in August 2025.  The `version` command now returns 5.x \"Moonlit\".\n\t* Move source code repo from github to [codeberg](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002Fdarknet#table-of-contents).\n\t* More performance optimizations.\n\t* Use of OpenBLAS when building CPU-only versions of Darknet.\n\t* Support for Profile-Guided Optimization.\n\t* ONNX export functionality.  [experimental]\n\t* JAVA language bindings.  [incomplete, in-progress]\n* The most recent release is v5.1, which continues the \"Moonlit\" name introduced in v5.0.\n\t* Released in December 2025.\n\t* The ONNX export tool now includes the necessary nodes to export both \"confs\" and \"boxes\".\n\t* The mAP function was re-written.\n\t* Small number of new performance optimizations.\n\n# Pre-trained Weights\n\nPeople are generally expected to [train their own network](#training).  But pre-trained weights are also popular.  These are weights which someone else has trained and made available for free on the internet.  This is sometimes convenient when first installing Darknet\u002FYOLO, since the software can be quickly tested without having to train a new neural network.\n\n* [People-R-People Pre-trained Weights](#people-r-people-pre-trained-weights) (2 classes, `person` and `head`)\n* [MSCOCO Pre-trained Weights](#mscoco-pre-trained-weights) (80 classes covering a large range of objects, such as `person`, `backpack`, `chair`, `clock`, ...)\n* There are several other simple datasets and pre-trained weights available for testing Darknet\u002FYOLO, such as [LEGO Gears](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002F2024-05-01_LegoGears\u002F) and [Rolodex](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002F2023-11-06_Rolodex\u002F).  See \u003Ca target=\"_blank\" href=\"https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#datasets\">the Darknet\u002FYOLO FAQ\u003C\u002Fa> for details.\n\n## People-R-People Pre-trained Weights\n\nThe People-R-People pre-trained weights are used to find people.  This dataset only has 2 classes:  `person` and `head`.\n\n![people-r-people example output](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhank-ai_darknet_readme_c00c19b77b87.jpg)\n\nYou can download these pre-trained weights directly from [C Code Run's web site](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002F2025-01-20_People-R-People\u002F).\n\n## MSCOCO Pre-trained Weights\n\nSeveral popular versions of YOLO were pre-trained for convenience on the [MSCOCO dataset](https:\u002F\u002Fcocodataset.org\u002F).  This dataset has 80 classes, which can be seen in the text file [`cfg\u002Fcoco.names`](cfg\u002Fcoco.names).\n\nThe MSCOCO pre-trained weights can be downloaded from several different locations, and are also available for download from this repo:\n\n* YOLOv2, November 2016\n  * [YOLOv2-tiny](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807469361)\n  * [YOLOv2-full](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807478865)\n* YOLOv3, May 2018\n  * [YOLOv3-tiny](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807479419)\n  * [YOLOv3-full](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807480139)\n* YOLOv4, May 2020\n  * [YOLOv4-tiny](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807480542)\n  * [YOLOv4-full](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807481315)\n* YOLOv7, August 2022\n  * [YOLOv7-tiny](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807483279)\n  * [YOLOv7-full](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807483787)\n\nThe MSCOCO pre-trained weights are provided for demo-purpose only.  The corresponding `.cfg` and `.names` files for MSCOCO are in [the cfg directory](cfg\u002F).  Example commands:\n\n```sh\nwget --no-clobber https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Freleases\u002Fdownload\u002Fv2.0\u002Fyolov4-tiny.weights\ndarknet_02_display_annotated_images coco.names yolov4-tiny.cfg yolov4-tiny.weights image1.jpg\ndarknet_03_display_videos coco.names yolov4-tiny.cfg yolov4-tiny.weights video1.avi\nDarkHelp coco.names yolov4-tiny.cfg yolov4-tiny.weights image1.jpg\nDarkHelp coco.names yolov4-tiny.cfg yolov4-tiny.weights video1.avi\n```\n\n# Building\n\nThe various build methods available in the past (pre-2023) have been merged together into a single unified solution.  Darknet requires C++17 or newer, OpenCV, and uses CMake to generate the necessary project files.\n\n> [!NOTE]\n> You do not need to know CMake, C++, C, Python, or any other programmaing language to build, install, nor run Darknet\u002FYOLO.  Some advanced topics -- such as using the Darknet\u002FYOLO API -- does require programming experience.\n\nSelect one of the following build types:\n\n* [Google Colab](#google-colab)\n* [WSL](#wsl)\n* [Linux](#linux-cmake-method)\n* [Windows](#windows-cmake-method)\n* [Docker](#docker)\n\n> [!CAUTION]\n> Beware if you are following old tutorials with more complicated build steps, or build steps that don't seem to match what is in this readme.  The new build steps started in August 2023.\n\nSoftware developers are encouraged to visit https:\u002F\u002Fdarknetcv.ai\u002F to get information on the internals of the Darknet\u002FYOLO object detection framework.\n\n> [!IMPORTANT]\n> An important change was made in Darknet v5.1 to one of the prediction structures.  If you have software that includes `darknet.h` or `darknet.hpp` you'll want to recompile your application to prevent segfaults.\n\n## Google Colab\n\nThe Google Colab instructions are the same as the [Linux](#linux-cmake-method) instructions.  Several [Jupyter notebooks are available](colab\u002F) showing how to do certain tasks, such as training a new network.\n\nSee the notebooks in the [`colab` subdirectory](colab\u002F) for details, and\u002For follow [the Linux instructions](#linux_cmake-method) below.\n\n## WSL\n\nIf you have a modern version of Windows and a decent computer, then the use of WSL (Windows Subsystem for Linux) and Ubuntu 24.04 LTS is **highly recommended**.\n\nWSL is a feature in Windows which allows people to run Linux-based applications from within their Windows desktop.  This is similar to a virtual machine with host\u002Fguest extensions.  Linux apps running in WSL have access to the GPU if you [install the Linux NVIDIA driver for WSL](https:\u002F\u002Fdocs.nvidia.com\u002Fcuda\u002Fwsl-user-guide\u002F), and you can train a new network with Darknet\u002FYOLO running within WSL.\n\n> [!TIP]\n> [Once WSL is installed](https:\u002F\u002Flearn.microsoft.com\u002Fwindows\u002Fwsl\u002Finstall), please remember to run `sudo apt-get update` at least once from your Ubuntu command prompt to get the updated list of packages, and then follow the usual [Linux instructions](#linux-cmake-method).\n\nIf you don't want to use Darknet\u002FYOLO from within WSL, then skip ahead to the [Windows instructions](#windows-cmake-method).\n\n## Linux CMake Method\n\n[![Darknet build tutorial for Linux](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhank-ai_darknet_readme_bf57901abd9a.jpg)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=WTT1s8JjLFk)\n\n> [!IMPORTANT]\n> Darknet can run without access to a GPU, but if you want to _train_ a custom network or you need higher performance, then a modern NVIDIA GPU or AMD GPU is _strongly recommended_.\n> * Depending on which GPU you have, please read the [NVIDIA GPU Readme](README_GPU_NVIDIA_CUDA.md) or the [AMD GPU Readme](README_GPU_AMD_ROCM.md).\n\n> [!TIP]\n> If you are building a CPU-only version of Darknet, you may want to install OpenBLAS to increase performance.  These libraries are only used on CPU-only builds:\n```sh\nsudo apt-get install libopenblas64-0 libopenblas64-0-openmp libopenblas64-openmp-dev\n```\n\nThe following instructions assume (but do not require!) a system running Ubuntu 22.04.  Adapt as necessary if you're using a different Linux distribution.\n\n```sh\nsudo apt-get install build-essential git libopencv-dev cmake libprotobuf-dev protobuf-compiler\nmkdir ~\u002Fsrc\ncd ~\u002Fsrc\ngit clone https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002Fdarknet.git\ncd darknet\nmkdir build\ncd build\ncmake -DCMAKE_BUILD_TYPE=Release ..\nmake -j4 package\nsudo dpkg -i darknet-\u003CINSERT-VERSION-YOU-BUILT-HERE>.deb\n```\n\n> [!WARNING]\n> **If you are using an older version of CMake** then you'll need to upgrade CMake before you can run the `cmake` command above.  Upgrading CMake on Ubuntu can be done with the following commands:\n```sh\nsudo apt-get purge cmake\nsudo snap install cmake --classic\n```\n\n> [!WARNING]\n> **If using `bash` as your command shell** you'll want to re-start your shell at this point.  If using `fish`, it should immediately pick up the new path.\n\n> [!TIP]\n> Advanced users:\u003Cbr>\n> See [the readme for PGO (Profile-Guided Optimization)](README_PGO.md) if you want to run an optimized Darknet\u002FYOLO.\n\n> [!TIP]\n> Advanced users:\u003Cbr>\n> If you want to build a RPM installation file instead of a DEB file, see the relevant lines in `CM_package.cmake`.  Prior to running `make -j4 package` you'll need to edit these two lines:\n```cmake\nSET (CPACK_GENERATOR \"DEB\")\n# SET (CPACK_GENERATOR \"RPM\")\n```\n> For distros such as Centos and OpenSUSE, you'll need to switch those two lines in `CM_package.cmake` to be:\n```cmake\n# SET (CPACK_GENERATOR \"DEB\")\nSET (CPACK_GENERATOR \"RPM\")\n```\n\n**To install the installation package** once it has finished building, use the usual package manager for your distribution.  For example, on Debian-based systems such as Ubuntu:\n\n```sh\nsudo dpkg -i darknet-2.0.1-Linux.deb\n```\n\nInstalling the `.deb` (or `.rpm`) package will install the following files:\n\n* `\u002Fusr\u002Fbin\u002Fdarknet*...` are the usual Darknet executables.  Run `darknet version` from the CLI to confirm it is installed correctly.\n* `\u002Fusr\u002Finclude\u002Fdarknet*...` are the Darknet API header files for C, C++, and Python developers.\n* `\u002Fusr\u002Flib\u002Flibdarknet.so` is the library to link against for C, C++, and Python developers.\n* `\u002Fopt\u002Fdarknet\u002Fcfg\u002F...` is where all the `.cfg` templates are stored.\n\nYou are now done!  Darknet has been built and installed into `\u002Fusr\u002Fbin\u002F`.  Run this to test:  `darknet version`.\n\n> [!CAUTION]\n> **If you don't have `\u002Fusr\u002Fbin\u002Fdarknet`** then this means you _did not_ install it, you only built it!  Make sure you install the `.deb` or `.rpm` file as described above.\n\n## Windows CMake Method\n\n> [!IMPORTANT]\n> Before building Darknet\u002FYOLO for Windows please see the note about using [WSL](#wsl).  (Spoiler ... Darknet\u002FYOLO works great in WSL!)\n\n- These instructions assume (but does not require) a brand new installation of Windows 11 22H2.\n- These instructions are for a native Windows installation, not using WSL.  If you'd rather use WSL, see [above](#wsl).\n\nOpen a normal `cmd.exe` command prompt window and run the following commands:\n\n```bat\nwinget install Git.Git\nwinget install Kitware.CMake\nwinget install nsis.nsis\nwinget install Microsoft.VisualStudio.2022.Community\n```\n\nAt this point we need to modify the Visual Studio installation to include support for C++ applications:\n\n* click on the \"Windows Start\" menu and run \"Visual Studio Installer\"\n* click on `Modify`\n* select `Desktop Development With C++`\n* click on `Modify` in the bottom-right corner, and then click on `Yes`\n\n> [!IMPORTANT]\n> Once everything is downloaded and installed, click on the \"Windows Start\" menu again and select `Developer Command Prompt for VS 2022`.  **Do not** use PowerShell for these steps, you will run into problems!\n\n> [!TIP]\n> Instead of running the `Developer Command Prompt`, you can use a normal command prompt or ssh into the device and manually run `\"\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\VsDevCmd.bat\"`.\n\n> [!WARNING]\n> **Please don't skip this step!**  Re-read the \"important\" description above to see what kind of window you **must** be using.  Anytime you want to use Visual Studio from the command prompt to compile C++ code you must use the Visual Studio developer command prompt as described above.\n\nOnce you have the **Developer Command Prompt**, run the following commands to install Microsoft VCPKG, which will then be used to build OpenBlas and OpenCV:\n\n```bat\ncd c:\\\nmkdir c:\\src\ncd c:\\src\ngit clone https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fvcpkg\ncd vcpkg\nbootstrap-vcpkg.bat\n.\\vcpkg.exe integrate install\n.\\vcpkg.exe integrate powershell\n.\\vcpkg.exe install opencv[contrib,dnn,freetype,jpeg,openmp,png,webp,world]:x64-windows protobuf:x64-windows\n```\n\nBe patient at this last step as it can take a long time to run.  It needs to download and build many things.\n\n> [!TIP]\n> Note there are many other optional modules you may want to add when building OpenCV.  Run `.\\vcpkg.exe search opencv` to see the full list.\n\n> [!IMPORTANT]\n> Darknet can run without access to a GPU, but if you want to _train_ a custom network or you need higher performance, then a modern NVIDIA GPU or AMD GPU is _strongly recommended_.\n> * Depending on which GPU you have, please read the [NVIDIA GPU Readme](README_GPU_NVIDIA_CUDA.md) or the [AMD GPU Readme](README_GPU_AMD_ROCM.md).\n\n> [!TIP]\n> Adding the vcpkg `bin` directory to the environment variable `PATH` will prevent later problems.  The directory you'll want to add is `C:\u002Fsrc\u002Fvcpkg\u002Finstalled\u002Fx64-windows\u002Fbin\u002F`.\n\n> [!TIP]\n> If you are building a CPU-only version of Darknet, you may want to install OpenBLAS to increase performance.  These libraries are only used on CPU-only builds:\n```sh\n.\\vcpkg.exe install openblas[core,threads]:x64-windows\n```\n\nOnce all of the previous steps have finished successfully, you need to clone Darknet and build it.  During this step we also need to tell CMake where vcpkg is located so it can find OpenCV and other dependencies.  Make sure you continue to use the **Developer Command Prompt** as described above when you run these commands:\n\n```bat\ncd c:\\src\ngit clone https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002Fdarknet.git\ncd darknet\nmkdir build\ncd build\ncmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:\u002Fsrc\u002Fvcpkg\u002Fscripts\u002Fbuildsystems\u002Fvcpkg.cmake ..\nmsbuild.exe \u002Fproperty:Platform=x64;Configuration=Release \u002Ftarget:Build -maxCpuCount -verbosity:normal -detailedSummary darknet.sln\nmsbuild.exe \u002Fproperty:Platform=x64;Configuration=Release PACKAGE.vcxproj\n```\n\n> [!TIP]\n> Note that the output of the `cmake` command is a normal Visual Studio solution file, `darknet.sln`.  If you are a software developer who regularly uses the Visual Studio GUI instead of `msbuild.exe` to build projects, you can ignore the command-line and load the Darknet project in Visual Studio.\n\nYou should now have this file you can run:  `C:\\src\\Darknet\\build\\src-cli\\Release\\darknet.exe`.  Run this to test:  `C:\\src\\Darknet\\build\\src-cli\\Release\\darknet.exe --version`.\n\nTo correctly install Darknet, the libraries, the include files, and the necessary DLLs, **run the NSIS installation wizard** that was built in the last step.  See the file `darknet-\u003CINSERT-VERSION-YOU-BUILT-HERE>-win64.exe` in the `build` directory.  For example:\n```bat\ndarknet-\u003CINSERT-VERSION-YOU-BUILT-HERE>-win64.exe\n```\n\nInstalling the NSIS installation package will:\n\n* Create a directory called `Darknet`, such as `C:\\Program Files\\Darknet\\`.\n* Install the CLI applications, `darknet.exe` and other sample apps.\n* Install the required 3rd-party `.dll` files, such as those from OpenCV and Darknet.\n* Install the neccesary Darknet `.dll`, `.lib` and header files to use `darknet.dll` from another application.\n* Install the template `.cfg` files.\n\n> [!IMPORTANT]\n> Make sure to update your `PATH` to include `C:\u002FProgram Files\u002FDarknet\u002Fbin` (or wherever you chose to install it).  Once you update `PATH` you'll need to restart your command prompt.\n\n> [!TIP]\n> If you encounter an error about some missing Protocol Buffer DLL files such as `libprotobuf.dll` and `abseil_dll.dll` when running the ONNX export tool, it probably means you forgot to update your `PATH` or restart the command prompt.  The missing DLLs can be found in `C:\u002Fsrc\u002Fvcpkg\u002Finstalled\u002Fx64-windows\u002Fbin\u002F`.\n\nYou are now done!  Once the installation wizard has finished and `PATH` has been updated, run this command to test:  `darknet.exe version`.\n\n> [!CAUTION]\n> **If you don't have `C:\u002FProgram Files\u002Fdarknet\u002Fbin\u002Fdarknet.exe`** then this means you _did not_ install it, you only built it!  Make sure you go through each panel of the NSIS installation wizard in the previous step.\n\n## Docker\n\nTo build Darknet via Docker with GPU support, [nvidia-container-toolkit](https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fnvidia-container-toolkit) must be installed on your system, and the build process must be executed in `docker run`.\n\nBelow is an example Dockerfile built with the following command:\n\n`docker build -t darknet-hankai . && docker run -it --gpus all darknet-hankai`\n\n```docker\nFROM nvidia\u002Fcuda:12.8.0-cudnn-devel-ubuntu24.04\n\n# Set environment variables\nENV DEBIAN_FRONTEND=noninteractive\nENV PATH=\"\u002Fusr\u002Flocal\u002Fcuda\u002Fbin:${PATH}\"\nENV LD_LIBRARY_PATH=\"\u002Fusr\u002Flocal\u002Fcuda\u002Flib64:${LD_LIBRARY_PATH}\"\n\n# Install dependencies\nRUN apt-get update\nRUN apt-get install -y build-essential git libopenblas64-openmp-dev libopencv-dev wget file cmake\n\n# Set working directory for Darknet\nWORKDIR \u002Fworkspace\n\n# Clone Darknet\nRUN git clone https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002Fdarknet.git\n\n# Defer building the Darknet package to runtime (GPU visible)\nCMD [\"\u002Fbin\u002Fbash\", \"-c\", \"\\\n    cd \u002Fworkspace\u002Fdarknet && \\\n    # initialize cmake\n    mkdir build && cd build && cmake ..; \\\n    # build darknet\n    make -j$(nproc) package && \\\n    # package darknet\n    dpkg -i \u002Fworkspace\u002Fdarknet\u002Fbuild\u002Fdarknet-*.deb && \\\n    # run darknet version to verify build & enter terminal\n    darknet version && \\\n    exec \u002Fbin\u002Fbash\"]\n```\n\n# Using Darknet\n\n## CLI\n\nThe following is not the full list of all commands supported by Darknet.\n\n> [!IMPORTANT]\n> In addition to the Darknet CLI, also note [the DarkHelp project CLI](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002FDarkHelp#what-is-the-darkhelp-c-api) which provides an _additional_ CLI to Darknet\u002FYOLO.  The DarkHelp CLI also has several advanced features that are not available directly in Darknet.  You can use both the Darknet CLI and the DarkHelp CLI together, they are not mutually exclusive.\n\n> [!TIP]\n> For most of the commands shown below, you'll need the `.weights` file with the corresponding `.names` and `.cfg` files.  You can either [train your own network](#training) (highly recommended!) or download a neural network that someone has already trained and made available for free on the internet.  Examples of pre-trained datasets include:\n> * \u003Ca target=\"_blank\" href=\"https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#datasets\">LEGO Gears\u003C\u002Fa> (finding ojects in an image)\n> * \u003Ca target=\"_blank\" href=\"https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#datasets\">Rolodex\u003C\u002Fa> (finding text in an image)\n> * [People-R-People](#people-r-people-pre-trained-weights) (finding people in an image)\n> * [MSCOCO](#mscoco-pre-trained-weights) (standard 80-class object detection)\n\nCommands to run include:\n\n* List some possible commands and options to run:\n\t* `darknet help`\n\n* Check the version:\n\t* `darknet version`\n\n* Predict using an image:\n\t* V2:  `darknet detector test cars.data cars.cfg cars_best.weights image1.jpg`\n\t* V3+:  `darknet_02_display_annotated_images cars.cfg image1.jpg`\n\t* DarkHelp:  `DarkHelp cars.cfg cars.cfg cars_best.weights image1.jpg`\n\n* Output coordinates:\n\t* V2:  `darknet detector test animals.data animals.cfg animals_best.weights -ext_output dog.jpg`\n\t* V3+:  `darknet_01_inference_images animals dog.jpg`\n\t* DarkHelp:  `DarkHelp --json animals.cfg animals.names animals_best.weights dog.jpg`\n\n* Working with videos:\n\t* V2:  `darknet detector demo animals.data animals.cfg animals_best.weights -ext_output test.mp4`\n\t* V3+:  `darknet_03_display_videos animals.cfg test.mp4`\n\t* DarkHelp:  `DarkHelp animals.cfg animals.names animals_best.weights test.mp4`\n\n* Reading from a webcam:\n\t* V2:  `darknet detector demo animals.data animals.cfg animals_best.weights -c 0`\n\t* V3+:  `darknet_08_display_webcam animals`\n\n* Save results to a video:\n\t* V2:  `darknet detector demo animals.data animals.cfg animals_best.weights test.mp4 -out_filename res.avi`\n\t* V3+:  `darknet_05_process_videos_multithreaded animals.cfg animals.names animals_best.weights test.mp4`\n\t* DarkHelp:  `DarkHelp animals.cfg animals.names animals_best.weights test.mp4`\n\n* JSON:\n\t* V2:  `darknet detector demo animals.data animals.cfg animals_best.weights test50.mp4 -json_port 8070 -mjpeg_port 8090 -ext_output`\n\t* V3+:  `darknet_06_images_to_json animals image1.jpg`\n\t* DarkHelp:  `DarkHelp --json animals.names animals.cfg animals_best.weights image1.jpg`\n\n* Running on a specific GPU:\n\t* V2:  `darknet detector demo animals.data animals.cfg animals_best.weights -i 1 test.mp4`\n\n* To check the accuracy of the neural network:\n```sh\ndarknet detector map driving.data driving.cfg driving_best.weights\n...\n  Id Name             AvgPrecision     TP     FN     FP     TN Accuracy ErrorRate Precision Recall Specificity FalsePosRate\n  -- ----             ------------ ------ ------ ------ ------ -------- --------- --------- ------ ----------- ------------\n   0 vehicle               91.2495  32648   3903   5826  65129   0.9095    0.0905    0.8486 0.8932      0.9179       0.0821\n   1 motorcycle            80.4499   2936    513    569   5393   0.8850    0.1150    0.8377 0.8513      0.9046       0.0954\n   2 bicycle               89.0912    570    124    104   3548   0.9475    0.0525    0.8457 0.8213      0.9715       0.0285\n   3 person                76.7937   7072   1727   2574  27523   0.8894    0.1106    0.7332 0.8037      0.9145       0.0855\n   4 many vehicles         64.3089   1068    509    733  11288   0.9087    0.0913    0.5930 0.6772      0.9390       0.0610\n   5 green light           86.8118   1969    239    510   4116   0.8904    0.1096    0.7943 0.8918      0.8898       0.1102\n   6 yellow light          82.0390    126     38     30   1239   0.9525    0.0475    0.8077 0.7683      0.9764       0.0236\n   7 red light             94.1033   3449    217    451   4643   0.9237    0.0763    0.8844 0.9408      0.9115       0.0885\n```\n* To check accuracy mAP@IoU=75:\n\t* `darknet detector map animals.data animals.cfg animals_best.weights -iou_thresh 0.75`\n\n* Recalculating anchors is best done in DarkMark, since it will run 100 consecutive times and select the best anchors from all the ones that were calculated.  But if you want to run the old version in Darknet:\n```sh\ndarknet detector calc_anchors animals.data -num_of_clusters 6 -width 320 -height 256\n```\n* Train a new network:\n\t* `darknet detector -map -dont_show train animals.data animals.cfg` (also see [the training section](#training) below)\n\n* Display YOLO heatmaps:\n\t* V3+:  `darknet_02_display_annotated_images --heatmaps cars images\u002F*.jpg`\n\t* V3+:  `darknet_03_display_videos --heatmaps cars videos\u002F*.m4v`\n\n* ONNX export:\n\t* `darknet_onnx_export cars.cfg`\n\n## Training\n\nQuick links to relevant sections of the Darknet\u002FYOLO FAQ:\n* [How should I setup my files and directories?](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#directory_setup)\n* [Which configuration file should I use?](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#configuration_template)\n* [What command should I use when training my own network?](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#training_command)\n\n> [!TIP]\n> The simplest way to annotate and train is with the use of [DarkMark](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002FDarkMark#what-is-darkmark) to create all of the necessary Darknet files.  This is definitely the recommended way to train a new neural network.\n\nIf you'd rather manually setup the various files to train a custom network:\n\n* Create a new folder where the files will be stored.  For this example, a neural network will be created to detect animals, so the following directory is created:  `~\u002Fnn\u002Fanimals\u002F`.\n* Copy one of the Darknet configuration files you'd like to use as a template.  For example, see `cfg\u002Fyolov4-tiny.cfg`.  Place this in the folder you created.  For this example, we now have `~\u002Fnn\u002Fanimals\u002Fanimals.cfg`.\n* Create a `animals.names` text file in the same folder where you placed the configuration file.  For this example, we now have `~\u002Fnn\u002Fanimals\u002Fanimals.names`.\n* Edit the `animals.names` file with your text editor.  List the classes you want to use.  You need to have exactly 1 entry per line, with no blank lines and no comments.  For this example, the `.names` file will contain exactly 4 lines:\n```txt\ndog\ncat\nbird\nhorse\n```\n\n* Create a `animals.data` text file in the same folder.  For this example, the `.data` file will contain:\n```txt\nclasses = 4\ntrain = \u002Fhome\u002Fusername\u002Fnn\u002Fanimals\u002Fanimals_train.txt\nvalid = \u002Fhome\u002Fusername\u002Fnn\u002Fanimals\u002Fanimals_valid.txt\nnames = \u002Fhome\u002Fusername\u002Fnn\u002Fanimals\u002Fanimals.names\nbackup = \u002Fhome\u002Fusername\u002Fnn\u002Fanimals\n```\n\n* Create a folder where you'll store your images and annotations.  For example, this could be `~\u002Fnn\u002Fanimals\u002Fdataset`.  Each image will need a coresponding `.txt` file which describes the annotations for that image.  The format of the `.txt` annotation files is very specific.  You cannot create these files by hand since each annotation needs to contain the exact coordinates for the annotation.  See [DarkMark](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002FDarkMark#what-is-darkmark) or other similar software to annotate your images.  The YOLO annotation format is described in the [Darknet\u002FYOLO FAQ](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#darknet_annotations).\n* Create the \"train\" and \"valid\" text files named in the `.data` file.  These two text files need to individually list all of the images which Darknet must use to train and for validation when calculating the mAP%.  Exactly one image per line.  The path and filenames may be relative or absolute.\n* Modify your `.cfg` file with a text editor.\n\t* Make sure that `batch=64`.\n\t* Note the subdivisions.  Depending on the network dimensions and the amount of memory available on your GPU, you may need to increase the subdivisions.  The best value to use is `1` so start with that.  See the [Darknet\u002FYOLO FAQ](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#cuda_out_of_memory) if `1` doesn't work for you.\n\t* Note `max_batches=...`.  A good value to use when starting out is 2000 x the number of classes.  For this example, we have 4 animals, so 4 * 2000 = 8000.  Meaning we'll use `max_batches=8000`.\n\t* Note `steps=...`.  This should be set to 80% and 90% of `max_batches`.  For this example we'd use `steps=6400,7200` since `max_batches` was set to 8000.\n\t* Note `width=...` and `height=...`.  These are the network dimensions.  The Darknet\u002FYOLO FAQ explains [how to calculate the best size to use](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fdarknet_faq\u002F#optimal_network_size).\n\t* Search for all instances of the line `classes=...` and modify it with the number of classes in your `.names` file.  For this example, we'd use `classes=4`.\n\t* Search for all instances of the line `filters=...` in the `[convolutional]` section **prior** to each `[yolo]` section.  The value to use is (number_of_classes + 5) * 3.  Meaning for this example, (4 + 5) * 3 = 27.  So we'd use `filters=27` on the appropriate lines.\n* Start training!  Run the following commands:\n```sh\ncd ~\u002Fnn\u002Fanimals\u002F\ndarknet detector -map -dont_show train animals.data animals.cfg\n```\n\n* If you have multiple GPUs, then use the `-gpus ...` flag like this example with 4 GPUs:\n```sh\ncd ~\u002Fnn\u002Fanimals\u002F\ndarknet detector -gpus 0,1,2,3 -map -dont_show train animals.data animals.cfg\n```\n\nBe patient.  The best weights will be saved as `animals_best.weights`.  And the progress of training can be observed by viewing the `chart.png` file.  See [the Darknet\u002FYOLO FAQ](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#training_command) for additional parameters you may want to use when training a new network.\n\nIf you want to see more details during training, add the `-verbose` parameter.  For example:\n```sh\ncd ~\u002Fnn\u002Fanimals\u002F\ndarknet detector -map -dont_show -verbose train animals.data animals.cfg\n```\n\nThe `-log ...` flag can be used to send all of the console output to a file.  For example:\n```sh\ncd ~\u002Fnn\u002Fanimals\u002F\ndarknet detector -gpus 0 -verbose -log output.log -map -dont_show train animals.data animals.cfg\n```\n\n# Other Tools and Links\n\n* To manage your Darknet\u002FYOLO projects, annotate images, verify your annotations, and generate the necessary files to train with Darknet, [see DarkMark](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002FDarkMark#what-is-darkmark).\n* For a robust alternative CLI to Darknet, to use image tiling, for object tracking in your videos, or for a robust C++ API that can easily be used in commercial applications, [see DarkHelp](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002FDarkHelp#what-is-the-darkhelp-c-api).\n* See if [the Darknet\u002FYOLO FAQ](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fdarknet_faq\u002F) can help answer your questions.\n* See the many tutorial and example videos on [Stéphane's YouTube channel](https:\u002F\u002Fwww.youtube.com\u002Fc\u002FStephaneCharette\u002Fvideos)\n* [C++ bindings for Darknet\u002FYOLO](https:\u002F\u002Fdarknetcv.ai\u002Fapi\u002Fapi.html#apiv3_cpp) (in the Darknet\u002FYOLO repo)\n* [C bindings for Darknet\u002FYOLO](https:\u002F\u002Fdarknetcv.ai\u002Fapi\u002Fapi.html#apiv3_c) (in the Darknet\u002FYOLO repo)\n* [Python bindings for Darknet\u002FYOLO](src-python\u002F) (in the Darknet\u002FYOLO repo)\n* [Java bindings for Darknet\u002FYOLO](https:\u002F\u002Fgithub.com\u002Fstephanecharette\u002FDarknetJava)  [incomplete, in-progress]\n* [Delphi bindings for Darknet\u002FYOLO](https:\u002F\u002Fgithub.com\u002Fhansvas\u002FDarknet4Delphi)\n* [C# bindings for Darknet\u002FYOLO](https:\u002F\u002Fgithub.com\u002Flibormasek\u002FDarknetCSharp)\n* [Darknet2Any](https:\u002F\u002Fgithub.com\u002Fjredmondson\u002Fdarknet2any\u002F)\n* If you have a support question or want to chat with other Darknet\u002FYOLO users, [join the Darknet\u002FYOLO discord server](https:\u002F\u002Fdiscord.gg\u002FMQw32W9Cqr).\n\n# Roadmap\n\nLast updated 2025-12-06:\n\n## Completed\n\n* [X] swap out qsort() for std::sort() where used during training (some other obscure ones remain)\n* [X] get rid of check_mistakes, getchar(), and system()\n* [X] convert Darknet to use the C++ compiler (g++ on Linux, VisualStudio on Windows)\n* [X] fix Windows build\n* [X] fix Python support\n* [X] build darknet library\n* [X] re-enable labels on predictions (\"alphabet\" code)\n* [X] re-enable CUDA\u002FGPU code\n* [X] re-enable CUDNN\n* [X] re-enable CUDNN half\n* [X] do not hard-code the CUDA architecture\n* [X] better CUDA version information\n* [X] re-enable AVX\n* [X] remove old solutions and Makefile\n* [X] make OpenCV non-optional\n* [X] remove dependency on the old pthread library\n* [X] remove STB\n* [X] re-write CMakeLists.txt to use the new CUDA detection\n* [X] remove old \"alphabet\" code, and delete the 700+ images in data\u002Flabels\n* [X] build out-of-source\n* [X] have better version number output\n* [X] performance optimizations related to training (on-going task)\n* [X] performance optimizations related to inference (on-going task)\n* [X] pass-by-reference where possible\n* [X] clean up .hpp files\n* [X] re-write darknet.h\n* [X] do not cast `cv::Mat` to `void*` but use it as a proper C++ object\n* [X] fix or be consistent in how internal `image` structure gets used\n* [X] fix build for ARM-based Jetson devices\n\t* [ ] ~~original Jetson devices~~ (unlikely to fix since they are no longer supported by NVIDIA and do not have a C++17 compiler)\n\t* [X] new Jetson Orin devices are working\n* [X] fix Python API in V3\n\t* [ ] better support for Python is needed **(any Python developers want to help with this?)**\n* [X] heatmaps\n* [X] remove all calls to printf() and std::cout and replace with std::ofstream to log to a file\n* [X] add support for AMD GPUs\n* [X] add support for OpenBLAS (CPU builds only)\n* [X] add support for Profile Guided Optimization\n* [X] move from github to codeberg\n* [X] ONNX export tool\n* [X] re-write function that calculates mAP (mean average precision)\n* [X] support both FP32 and FP16 with the ONNX export tool\n\n## Short-term goals\n\n* [ ] Java bindings **(in progress)**\n* [ ] look into old zed camera support\n* [ ] better and more consistent command line parsing **(in progress)**\n* [ ] add support for MIOpen\n\n## Mid-term goals\n\n* [ ] remove all `char*` code and replace with `std::string`\n* [ ] don't hide warnings and clean up compiler warnings **(in progress)**\n* [ ] better use of `cv::Mat` instead of the custom `image` structure in C **(in progress)**\n* [ ] replace old `list` functionality with `std::vector` or `std::list` **(in progress)**\n* [ ] fix support for 1-channel greyscale images\n* [ ] add support for N-channel images where N > 3 (e.g., images with an additional depth or thermal channel)\n* [ ] on-going code cleanup **(in progress)**\n* [ ] add support for 8-bit quantization in the ONNX export tool\n\n## Long-term goals\n\n* [ ] fix CUDA\u002FCUDNN issues with all GPUs\n* [ ] re-write CUDA+cuDNN code\n* [ ] look into adding support for additional hardware\n* [ ] rotated bounding boxes, or some sort of \"angle\" support\n* [ ] keypoints\u002Fskeletons\n* [ ] segmentation\n","# 目录\n\n* [Darknet 目标检测框架与 YOLO](#darknet-object-detection-framework-and-yolo)\n* [论文](#papers)\n* [一般信息](#general-information)\n\t* [Darknet 版本](#darknet-version)\n* [预训练权重](#pre-trained-weights)\n\t* [People-R-People 预训练权重](#people-r-people-pre-trained-weights)\n\t* [MSCOCO 预训练权重](#mscoco-pre-trained-weights)\n* [构建](#building)\n\t* [Google Colab](#google-colab)\n\t* [WSL](#wsl)\n\t* [Linux CMake 方法](#linux-cmake-method)\n\t* [Windows CMake 方法](#windows-cmake-method)\n\t* [Docker](#docker)\n* [使用 Darknet](#using-darknet)\n\t* [CLI (命令行界面)](#cli)\n\t* [训练](#training)\n* [其他工具和链接](#other-tools-and-links)\n* [路线图](#roadmap)\n\t* [短期目标](#short-term-goals)\n\t* [中期目标](#mid-term-goals)\n\t* [长期目标](#long-term-goals)\n\n# Darknet 目标检测框架与 YOLO\n\n![darknet and hank.ai logos](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhank-ai_darknet_readme_9e568ad59643.png)\n\nDarknet 是一个用 C、C++ 和 CUDA (并行计算平台) 编写的开源神经网络框架。\n\nYOLO (You Only Look Once) 是一种最先进的 (state-of-the-art)、实时 (real-time) 目标检测系统，运行在 Darknet 框架中。\n\n* 2025-08: Darknet\u002FYOLO 仓库已移至 **[Codeberg.org\u002FCCodeRun\u002Fdarknet\u002F](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002Fdarknet\u002F)**\n\t* 所有提交 (commits) 都会自动从 Codeberg 镜像到旧的 Hank.ai GitHub 仓库。\n* 查看 **[Darknet\u002FYOLO 网站](https:\u002F\u002Fdarknetcv.ai\u002F)**\n* 请阅读 **[Darknet\u002FYOLO 常见问题解答 (FAQ)](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fdarknet_faq\u002F)**\n* 加入 **[Darknet\u002FYOLO Discord 服务器](https:\u002F\u002Fdiscord.gg\u002FMQw32W9Cqr)**\n\n# 论文\n\n* 论文 **[YOLOv7](https:\u002F\u002Farxiv.org\u002Fabs\u002F2207.02696)**\n* 论文 **[Scaled-YOLOv4](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent\u002FCVPR2021\u002Fhtml\u002FWang_Scaled-YOLOv4_Scaling_Cross_Stage_Partial_Network_CVPR_2021_paper.html)**\n* 论文 **[YOLOv4](https:\u002F\u002Farxiv.org\u002Fabs\u002F2004.10934)**\n* 论文 **[YOLOv3](https:\u002F\u002Farxiv.org\u002Fabs\u002F1804.02767)**\n\n# 一般信息\n\nDarknet\u002FYOLO 框架继续比其它框架和 YOLO 版本**更快**且**更准确**。\n\n该框架完全免费且开源。您可以将 Darknet\u002FYOLO 整合到现有项目和产品中——包括商业产品——无需许可证或付费。\n\n2024 年 10 月发布的 Darknet V3（“爵士”）在使用 NVIDIA RTX 3090 GPU (图形处理器) 时，可以准确地以高达**1000 FPS (每秒帧数)** 的速度运行 LEGO 数据集视频，这意味着每个视频帧会在 1 毫秒或更少的时间内被 Darknet\u002FYOLO 读取、调整大小和处理。额外的性能改进已在 Darknet V4 和即将推出的 Darknet V5 中实施，同时不损害检测质量。\n\n如果您需要帮助或想讨论 Darknet\u002FYOLO 及相关工具，请加入 Darknet\u002FYOLO Discord 服务器：https:\u002F\u002Fdiscord.gg\u002FMQw32W9Cqr\n\nDarknet\u002FYOLO 的 CPU (中央处理器) 版本可以在简单的设备上运行，例如 Raspberry Pi、云 & Colab 服务器、台式机、笔记本电脑和高端训练设备。Darknet\u002FYOLO 的 GPU (图形处理器) 版本需要 NVIDIA 的 CUDA 兼容 GPU，或者 AMD 的 ROCm (AMD Radeon Open Compute 平台) 兼容 GPU。\n\n已知 Darknet\u002FYOLO 可在 Linux、Windows 和 Mac 上运行。请参阅下面的 [构建说明](#building)。\n\n## Darknet 版本\n\n* 2013-2017 年间由 Joseph Redmon 编写的原始 Darknet 工具没有版本号。我们将此版本视为 0.x。\n* 2017-2021 年间由 Alexey Bochkovskiy 维护的下一个流行的 Darknet 仓库也没有版本号。我们将此版本视为 1.x。\n* 2023 年开始由 Hank.ai 赞助并由 Stéphane Charette 维护的 Darknet 仓库是第一个拥有 `version` 命令的版本。从 2023 年到 2024 年末，它返回版本 2.x \"OAK\"。\n\t* 目标是尽可能少地破坏现有功能，同时熟悉代码库。\n\t* 重写了构建步骤，以便我们在 Windows、Linux 和 Mac 上使用 CMake (构建工具) 进行构建的统一方式。\n\t* 将代码库转换为使用 C++ 编译器。\n\t* 增强了训练时的 chart.png。\n\t* 修复了错误并进行了与性能相关的优化，主要涉及减少训练网络所需的时间。\n\t* 该代码库的最后一个分支是 `v2` 分支中的 2.1 版本。\n* 下一阶段开发始于 2024 年中，并于 2024 年 10 月发布。`version` 命令现在返回 3.x \"JAZZ\"。\n\t* 删除了许多旧且未维护的命令。\n\t\t* 如果需要运行这些命令之一，您始终可以检出之前的 `v2` 分支。请告知我们，以便我们调查添加回任何缺失的命令。\n\t* 许多性能优化，无论是在训练期间还是推理期间。\n\t* 遗留 C API (应用程序编程接口) 已修改；使用原始 Darknet API 的应用程序需要进行少量修改：https:\u002F\u002Fdarknetcv.ai\u002Fapi\u002Fapi.html\n\t* 新的 Darknet V3 C 和 C++ API，使开发人员更容易编写使用 Darknet\u002FYOLO 的应用程序：https:\u002F\u002Fdarknetcv.ai\u002Fapi\u002Fapi.html\n\t* `src-examples` 中的新应用程序和示例代码：https:\u002F\u002Fdarknetcv.ai\u002Fapi\u002Ffiles.html\n* 下一次发布是在 2025 年初。`version` 命令现在返回 4.x \"SLATE\"。\n\t* 添加了使用 ROCm 的 AMD GPU 支持。\n\t\t* 仍需添加对 MIOpen 的支持。\n\t* 所有 `printf()` 和 `std::cout` 调用均已替换，以便 Darknet\u002FYOLO 日志消息可以轻松重定向。\n* 下一次发布是在 2025 年 8 月。`version` 命令现在返回 5.x \"Moonlit\"。\n\t* 将源代码仓库从 github 移至 [codeberg](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002Fdarknet#table-of-contents)。\n\t* 更多性能优化。\n\t* 在构建仅 CPU 版本的 Darknet 时使用 OpenBLAS (开源 BLAS 库)。\n\t* 支持基于分析的配置优化 (Profile-Guided Optimization)。\n\t* ONNX (开放神经网络交换格式) 导出功能。[实验性]\n\t* JAVA 语言绑定。[不完整，进行中]\n* 最新版本是 v5.1，延续了 v5.0 中引入的 \"Moonlit\" 名称。\n\t* 发布于 2025 年 12 月。\n\t* ONNX 导出工具现在包含必要的节点来导出 \"confs\" 和 \"boxes\"。\n\t* mAP (平均精度均值) 函数被重写。\n\t* 少量新的性能优化。\n\n# 预训练权重\n\n通常人们被期望 [训练自己的网络](#training)。但预训练权重也很流行。这些是别人已经训练好并免费在互联网上提供的权重。这在初次安装 Darknet\u002FYOLO 时有时很方便，因为软件可以快速测试，而无需训练新的神经网络。\n\n* [People-R-People 预训练权重](#people-r-people-pre-trained-weights) (2 个类别，`person` 和 `head`)\n* [MSCOCO 预训练权重](#mscoco-pre-trained-weights) (80 个类别，涵盖广泛范围的物体，如 `person`, `backpack`, `chair`, `clock`, ...)\n* 还有其他几个简单的数据集和预训练权重可用于测试 Darknet\u002FYOLO，例如 [LEGO Gears](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002F2024-05-01_LegoGears\u002F) 和 [Rolodex](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002F2023-11-06_Rolodex\u002F)。详细信息请参阅 \u003Ca target=\"_blank\" href=\"https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#datasets\">Darknet\u002FYOLO 常见问题解答\u003C\u002Fa>。\n\n## People-R-People 预训练权重\n\nPeople-R-People 预训练权重用于识别人。该数据集仅包含 2 个类别：`person` 和 `head`。\n\n![people-r-people example output](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhank-ai_darknet_readme_c00c19b77b87.jpg)\n\n您可以直接从 [C Code Run 的网站](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002F2025-01-20_People-R-People\u002F) 下载这些预训练权重。\n\n## MSCOCO 预训练权重\n\n为了方便起见，几个流行的 YOLO 版本在 [MSCOCO 数据集](https:\u002F\u002Fcocodataset.org\u002F) 上进行了预训练。该数据集有 80 个类别，可以在文本文件 [`cfg\u002Fcoco.names`](cfg\u002Fcoco.names) 中看到。\n\nMSCOCO 预训练权重可以从多个不同位置下载，也可以从本仓库下载：\n\n* YOLOv2，2016 年 11 月\n  * [YOLOv2-tiny](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807469361)\n  * [YOLOv2-full](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807478865)\n* YOLOv3，2018 年 5 月\n  * [YOLOv3-tiny](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807479419)\n  * [YOLOv3-full](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807480139)\n* YOLOv4，2020 年 5 月\n  * [YOLOv4-tiny](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807480542)\n  * [YOLOv4-full](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807481315)\n* YOLOv7，2022 年 8 月\n  * [YOLOv7-tiny](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807483279)\n  * [YOLOv7-full](https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21#issuecomment-1807483787)\n\nMSCOCO 预训练权重仅提供用于演示目的。对应的 `.cfg` 和 `.names` 文件位于 [cfg 目录](cfg\u002F) 中。示例命令：\n\n```sh\nwget --no-clobber https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Freleases\u002Fdownload\u002Fv2.0\u002Fyolov4-tiny.weights\ndarknet_02_display_annotated_images coco.names yolov4-tiny.cfg yolov4-tiny.weights image1.jpg\ndarknet_03_display_videos coco.names yolov4-tiny.cfg yolov4-tiny.weights video1.avi\nDarkHelp coco.names yolov4-tiny.cfg yolov4-tiny.weights image1.jpg\nDarkHelp coco.names yolov4-tiny.cfg yolov4-tiny.weights video1.avi\n```\n\n# 构建\n\n过去可用的各种构建方法（2023 年之前）已合并为单一的统一解决方案。Darknet 需要 C++17 或更高版本、OpenCV，并使用 CMake 生成必要的项目文件。\n\n> [!NOTE]\n> 您不需要了解 CMake、C++、C、Python 或其他任何编程语言即可构建、安装或运行 Darknet\u002FYOLO。一些高级主题——例如使用 Darknet\u002FYOLO API——确实需要编程经验。\n\n选择以下构建类型之一：\n\n* [Google Colab](#google-colab)\n* [WSL](#wsl)\n* [Linux](#linux-cmake-method)\n* [Windows](#windows-cmake-method)\n* [Docker](#docker)\n\n> [!CAUTION]\n> 如果您正在遵循旧的教程，其中包含更复杂的构建步骤，或者构建步骤似乎与本文档中的内容不匹配，请小心。新的构建步骤始于 2023 年 8 月。\n\n鼓励软件开发人员访问 https:\u002F\u002Fdarknetcv.ai\u002F 以获取有关 Darknet\u002FYOLO 目标检测框架内部结构的信息。\n\n> [!IMPORTANT]\n> Darknet v5.1 中对其中一个预测结构进行了重要更改。如果您的软件包含 `darknet.h` 或 `darknet.hpp`，则需要重新编译您的应用程序以防止段错误。\n\n## Google Colab\n\nGoogle Colab 的说明与 [Linux](#linux-cmake-method) 说明相同。有几个 [Jupyter notebook](colab\u002F) 可用，展示如何执行某些任务，例如训练新网络。\n\n查看 [`colab` 子目录](colab\u002F) 中的 notebook 以获取详细信息，和\u002F或遵循下面的 [Linux 说明](#linux_cmake-method)。\n\n## WSL\n\n如果您拥有现代版本的 Windows 和一台不错的电脑，那么强烈建议使用 WSL (Windows Subsystem for Linux) 和 Ubuntu 24.04 LTS。\n\nWSL 是 Windows 的一项功能，允许用户在 Windows 桌面内运行基于 Linux 的应用程序。这类似于带有主机\u002F客户机扩展的虚拟机。如果您 [为 WSL 安装了 Linux NVIDIA 驱动程序](https:\u002F\u002Fdocs.nvidia.com\u002Fcuda\u002Fwsl-user-guide\u002F)，则在 WSL 中运行的 Linux 应用程序可以访问 GPU，并且您可以在 WSL 内运行 Darknet\u002FYOLO 来训练新网络。\n\n> [!TIP]\n> [一旦安装好 WSL](https:\u002F\u002Flearn.microsoft.com\u002Fwindows\u002Fwsl\u002Finstall)，请记住至少从 Ubuntu 命令提示符运行一次 `sudo apt-get update` 以获取更新后的软件包列表，然后遵循常规的 [Linux 说明](#linux-cmake-method)。\n\n如果您不想在 WSL 内使用 Darknet\u002FYOLO，请直接跳转到 [Windows 说明](#windows-cmake-method)。\n\n## Linux CMake 构建方法\n\n[![Darknet build tutorial for Linux](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhank-ai_darknet_readme_bf57901abd9a.jpg)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=WTT1s8JjLFk)\n\n> [!IMPORTANT]\n> Darknet 可以在没有访问 GPU (图形处理单元) 的情况下运行，但如果你想 _训练_ 自定义网络或者你需要更高的性能，那么 _强烈建议_ 使用现代 NVIDIA GPU 或 AMD GPU。\n> * 根据你拥有的 GPU 类型，请阅读 [NVIDIA GPU 说明文档](README_GPU_NVIDIA_CUDA.md) 或 [AMD GPU 说明文档](README_GPU_AMD_ROCM.md)。\n\n> [!TIP]\n> 如果你正在构建仅 CPU 版本的 Darknet，你可能想要安装 OpenBLAS (开源 BLAS 库) 以提升性能。这些库仅在仅 CPU 的构建中使用：\n```sh\nsudo apt-get install libopenblas64-0 libopenblas64-0-openmp libopenblas64-openmp-dev\n```\n\n以下说明假设（但不强制！）系统运行 Ubuntu 22.04。如果使用不同的 Linux 发行版，请根据需要调整。\n\n```sh\nsudo apt-get install build-essential git libopencv-dev cmake libprotobuf-dev protobuf-compiler\nmkdir ~\u002Fsrc\ncd ~\u002Fsrc\ngit clone https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002Fdarknet.git\ncd darknet\nmkdir build\ncd build\ncmake -DCMAKE_BUILD_TYPE=Release ..\nmake -j4 package\nsudo dpkg -i darknet-\u003CINSERT-VERSION-YOU-BUILT-HERE>.deb\n```\n\n> [!WARNING]\n> **如果你使用的是旧版本的 CMake (构建工具)** 那么在运行上述 `cmake` 命令之前，你需要升级 CMake。在 Ubuntu 上升级 CMake 可以通过以下命令完成：\n```sh\nsudo apt-get purge cmake\nsudo snap install cmake --classic\n```\n\n> [!WARNING]\n> **如果你使用 `bash` 作为命令行 Shell** 此时你需要重启你的 Shell。如果使用 `fish`，它应该会立即识别新的路径。\n\n> [!TIP]\n> 高级用户：\u003Cbr>\n> 参见 [PGO (Profile-Guided Optimization) 的说明文档](README_PGO.md)，如果你想运行优化后的 Darknet\u002FYOLO。\n\n> [!TIP]\n> 高级用户：\u003Cbr>\n> 如果你想构建 RPM 安装包而不是 DEB 文件，请查看 `CM_package.cmake` 中的相关行。在运行 `make -j4 package` 之前，你需要编辑这两行：\n```cmake\nSET (CPACK_GENERATOR \"DEB\")\n# SET (CPACK_GENERATOR \"RPM\")\n```\n> 对于 CentOS 和 openSUSE 等发行版，你需要将 `CM_package.cmake` 中的这两行切换为：\n```cmake\n# SET (CPACK_GENERATOR \"DEB\")\nSET (CPACK_GENERATOR \"RPM\")\n```\n\n**在安装包构建完成后**，请使用你所在发行版的常规软件包管理器进行安装。例如，在基于 Debian 的系统（如 Ubuntu）上：\n\n```sh\nsudo dpkg -i darknet-2.0.1-Linux.deb\n```\n\n安装 `.deb`（或 `.rpm`）包将安装以下文件：\n\n* `\u002Fusr\u002Fbin\u002Fdarknet*...` 是常规的 Darknet 可执行文件。从 CLI (命令行界面) 运行 `darknet version` 以确认安装正确。\n* `\u002Fusr\u002Finclude\u002Fdarknet*...` 是为 C、C++ 和 Python 开发者提供的 Darknet API (应用程序编程接口) 头文件。\n* `\u002Fusr\u002Flib\u002Flibdarknet.so` 是供 C、C++ 和 Python 开发者链接使用的库。\n* `\u002Fopt\u002Fdarknet\u002Fcfg\u002F...` 是所有 `.cfg` 模板的存储位置。\n\n你现在完成了！Darknet 已构建并安装到 `\u002Fusr\u002Fbin\u002F`。运行此命令进行测试：`darknet version`。\n\n> [!CAUTION]\n> **如果你没有 `\u002Fusr\u002Fbin\u002Fdarknet`** 这意味着你 _没有_ 安装它，只构建了它！请确保按照上述说明安装 `.deb` 或 `.rpm` 文件。\n\n## Windows CMake 方法\n\n> [!IMPORTANT]\n> 在构建适用于 Windows 的 Darknet\u002FYOLO 之前，请参阅关于使用 [WSL](#wsl) (Windows Subsystem for Linux) 的说明。（剧透……Darknet\u002FYOLO 在 WSL 中运行效果极佳！）\n\n- 本指南假设（但不强制要求）全新安装 Windows 11 22H2。\n- 本指南适用于原生 Windows 安装，不使用 WSL。如果您更倾向于使用 WSL，请参见 [上方](#wsl)。\n\n打开普通的 `cmd.exe` 命令提示符窗口并运行以下命令：\n\n```bat\nwinget install Git.Git\nwinget install Kitware.CMake\nwinget install nsis.nsis\nwinget install Microsoft.VisualStudio.2022.Community\n```\n\n此时我们需要修改 Visual Studio 安装以包含对 C++ 应用程序的支持：\n\n* 点击“Windows 开始”菜单并运行“Visual Studio Installer\"\n* 点击 `Modify`\n* 选择 `Desktop Development With C++`\n* 点击右下角的 `Modify`，然后点击 `Yes`\n\n> [!IMPORTANT]\n> 一旦所有内容下载并安装完成，再次点击“Windows 开始”菜单并选择 `Developer Command Prompt for VS 2022`。**不要**在这些步骤中使用 PowerShell，否则会遇到问题！\n\n> [!TIP]\n> 如果不运行 `Developer Command Prompt`，您可以使用普通命令提示符或 SSH 登录设备并手动运行 `\"\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\VsDevCmd.bat\"`。\n\n> [!WARNING]\n> **请不要跳过此步骤！** 重新阅读上面的“重要”描述，查看您**必须**使用的窗口类型。任何时候您想从命令提示符使用 Visual Studio 编译 C++ 代码，都必须如上所述使用 Visual Studio 开发者命令提示符。\n\n获得 **开发者命令提示符** 后，运行以下命令安装 Microsoft VCPKG，随后将用于构建 OpenBlas 和 OpenCV：\n\n```bat\ncd c:\\\nmkdir c:\\src\ncd c:\\src\ngit clone https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fvcpkg\ncd vcpkg\nbootstrap-vcpkg.bat\n.\\vcpkg.exe integrate install\n.\\vcpkg.exe integrate powershell\n.\\vcpkg.exe install opencv[contrib,dnn,freetype,jpeg,openmp,png,webp,world]:x64-windows protobuf:x64-windows\n```\n\n在最后这一步请耐心等候，因为它可能需要很长时间才能运行完毕。它需要下载并构建许多内容。\n\n> [!TIP]\n> 注意，在构建 OpenCV 时您可能还想添加许多其他可选模块。运行 `.\\vcpkg.exe search opencv` 可查看完整列表。\n\n> [!IMPORTANT]\n> Darknet 可以在没有 GPU 访问权限的情况下运行，但如果您想要 _训练_ 自定义网络或需要更高的性能，则 _强烈建议_ 使用现代 NVIDIA GPU 或 AMD GPU。\n* 根据您的 GPU 型号，请阅读 [NVIDIA GPU Readme](README_GPU_NVIDIA_CUDA.md) 或 [AMD GPU Readme](README_GPU_AMD_ROCM.md)。\n\n> [!TIP]\n> 将 vcpkg `bin` 目录添加到环境变量 `PATH` 可以防止后续出现问题。您需要添加的目录是 `C:\u002Fsrc\u002Fvcpkg\u002Finstalled\u002Fx64-windows\u002Fbin\u002F`。\n\n> [!TIP]\n> 如果您正在构建仅 CPU 版本的 Darknet，您可能希望安装 OpenBLAS 以提高性能。这些库仅用于仅 CPU 构建：\n```sh\n.\\vcpkg.exe install openblas[core,threads]:x64-windows\n```\n\n成功完成上述所有步骤后，您需要克隆 Darknet 并构建它。在此步骤中，我们还需要告诉 CMake vcpkg 的位置，以便它能找到 OpenCV 和其他依赖项。运行这些命令时，请确保继续使用上述描述的 **开发者命令提示符**：\n\n```bat\ncd c:\\src\ngit clone https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002Fdarknet.git\ncd darknet\nmkdir build\ncd build\ncmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:\u002Fsrc\u002Fvcpkg\u002Fscripts\u002Fbuildsystems\u002Fvcpkg.cmake ..\nmsbuild.exe \u002Fproperty:Platform=x64;Configuration=Release \u002Ftarget:Build -maxCpuCount -verbosity:normal -detailedSummary darknet.sln\nmsbuild.exe \u002Fproperty:Platform=x64;Configuration=Release PACKAGE.vcxproj\n```\n\n> [!TIP]\n> 请注意，`cmake` 命令的输出是一个普通的 Visual Studio 解决方案文件 `darknet.sln`。如果您是经常使用 Visual Studio GUI (图形用户界面) 而不是 `msbuild.exe` 来构建项目的软件开发者，您可以忽略命令行并在 Visual Studio 中加载 Darknet 项目。\n\n现在您应该有了这个可运行的文件：`C:\\src\\Darknet\\build\\src-cli\\Release\\darknet.exe`。运行此文件进行测试：`C:\\src\\Darknet\\build\\src-cli\\Release\\darknet.exe --version`。\n\n为了正确安装 Darknet、库、头文件和必要的 DLL (动态链接库)，请运行上一步生成的 NSIS 安装向导。请查看 `build` 目录中的文件 `darknet-\u003CINSERT-VERSION-YOU-BUILT-HERE>-win64.exe`。例如：\n```bat\ndarknet-\u003CINSERT-VERSION-YOU-BUILT-HERE>-win64.exe\n```\n\n安装 NSIS 安装包将：\n\n* 创建一个名为 `Darknet` 的目录，例如 `C:\\Program Files\\Darknet\\`。\n* 安装 CLI (命令行界面) 应用程序，`darknet.exe` 及其他示例应用。\n* 安装所需的第三方 `.dll` 文件，例如来自 OpenCV 和 Darknet 的文件。\n* 安装必要的 Darknet `.dll`、`.lib` 和头文件，以便从其他应用程序使用 `darknet.dll`。\n* 安装模板 `.cfg` 文件。\n\n> [!IMPORTANT]\n> 请确保更新您的 `PATH` 以包含 `C:\u002FProgram Files\u002FDarknet\u002Fbin`（或您选择安装的任何位置）。更新 `PATH` 后，您需要重启命令提示符。\n\n> [!TIP]\n> 如果在运行 ONNX 导出工具时遇到有关缺少 Protocol Buffer (协议缓冲区) DLL 文件（如 `libprotobuf.dll` 和 `abseil_dll.dll`）的错误，这很可能意味着您忘记更新 `PATH` 或重启命令提示符。缺失的 DLL 可以在 `C:\u002Fsrc\u002Fvcpkg\u002Finstalled\u002Fx64-windows\u002Fbin\u002F` 中找到。\n\n您已完成！安装向导完成后且 `PATH` 已更新，运行此命令进行测试：`darknet.exe version`。\n\n> [!CAUTION]\n> **如果您没有 `C:\u002FProgram Files\u002Fdarknet\u002Fbin\u002Fdarknet.exe`** 那么这意味着您 _未_ 安装它，仅构建了它！请确保在上一步中通过 NSIS 安装向导的每个面板。\n\n## Docker\n\n要通过 Docker 构建支持 GPU 的 Darknet，必须在系统上安装 [nvidia-container-toolkit](https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fnvidia-container-toolkit)，并且构建过程必须在 `docker run` 中执行。\n\n以下是使用以下命令构建的示例 Dockerfile：\n\n`docker build -t darknet-hankai . && docker run -it --gpus all darknet-hankai`\n\n```docker\nFROM nvidia\u002Fcuda:12.8.0-cudnn-devel-ubuntu24.04\n\n# Set environment variables\nENV DEBIAN_FRONTEND=noninteractive\nENV PATH=\"\u002Fusr\u002Flocal\u002Fcuda\u002Fbin:${PATH}\"\nENV LD_LIBRARY_PATH=\"\u002Fusr\u002Flocal\u002Fcuda\u002Flib64:${LD_LIBRARY_PATH}\"\n\n# Install dependencies\nRUN apt-get update\nRUN apt-get install -y build-essential git libopenblas64-openmp-dev libopencv-dev wget file cmake\n\n# Set working directory for Darknet\nWORKDIR \u002Fworkspace\n\n# Clone Darknet\nRUN git clone https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002Fdarknet.git\n\n```markdown\n# 将 Darknet 包的构建推迟到运行时（可见 GPU）\n```\n```dockerfile\nCMD [\"\u002Fbin\u002Fbash\", \"-c\", \"\\\n    cd \u002Fworkspace\u002Fdarknet && \\\n    # initialize cmake\n    mkdir build && cd build && cmake ..; \\\n    # build darknet\n    make -j$(nproc) package && \\\n    # package darknet\n    dpkg -i \u002Fworkspace\u002Fdarknet\u002Fbuild\u002Fdarknet-*.deb && \\\n    # run darknet version to verify build & enter terminal\n    darknet version && \\\n    exec \u002Fbin\u002Fbash\"]\n```\n\n# 使用 Darknet\n\n## 命令行界面 (CLI)\n\n以下并非 Darknet 支持的所有命令的完整列表。\n\n> [!IMPORTANT]\n> 除了 Darknet 命令行界面 (CLI)，还请注意 [DarkHelp 项目的 CLI](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002FDarkHelp#what-is-the-darkhelp-c-api)，它为 Darknet\u002FYOLO 提供了**额外**的 CLI。DarkHelp CLI 还具有几个 Darknet 中不可用的高级功能。您可以同时使用 Darknet CLI 和 DarkHelp CLI，它们不是互斥的。\n\n> [!TIP]\n> 对于下面显示的大多数命令，您需要 `.weights` 文件以及对应的 `.names` 和 `.cfg` 文件。您可以 [训练自己的网络](#training)（强烈推荐！）或者下载别人已经训练好并在互联网上免费提供的神经网络。预训练数据集的示例包括：\n> * \u003Ca target=\"_blank\" href=\"https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#datasets\">乐高齿轮\u003C\u002Fa> (在图像中寻找物体)\n> * \u003Ca target=\"_blank\" href=\"https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#datasets\">Rolodex\u003C\u002Fa> (在图像中寻找文本)\n> * [People-R-People](#people-r-people-pre-trained-weights) (在图像中寻找人)\n> * [MSCOCO](#mscoco-pre-trained-weights) (标准 80 类目标检测)\n\n运行的命令包括：\n\n* 列出一些可能的运行命令和选项：\n\t* `darknet help`\n\n* 检查版本：\n\t* `darknet version`\n\n* 使用图像进行预测：\n\t* V2:  `darknet detector test cars.data cars.cfg cars_best.weights image1.jpg`\n\t* V3+:  `darknet_02_display_annotated_images cars.cfg image1.jpg`\n\t* DarkHelp:  `DarkHelp cars.cfg cars.cfg cars_best.weights image1.jpg`\n\n* 输出坐标：\n\t* V2:  `darknet detector test animals.data animals.cfg animals_best.weights -ext_output dog.jpg`\n\t* V3+:  `darknet_01_inference_images animals dog.jpg`\n\t* DarkHelp:  `DarkHelp --json animals.cfg animals.names animals_best.weights dog.jpg`\n\n* 处理视频：\n\t* V2:  `darknet detector demo animals.data animals.cfg animals_best.weights -ext_output test.mp4`\n\t* V3+:  `darknet_03_display_videos animals.cfg test.mp4`\n\t* DarkHelp:  `DarkHelp animals.cfg animals.names animals_best.weights test.mp4`\n\n* 从网络摄像头读取：\n\t* V2:  `darknet detector demo animals.data animals.cfg animals_best.weights -c 0`\n\t* V3+:  `darknet_08_display_webcam animals`\n\n* 将结果保存到视频中：\n\t* V2:  `darknet detector demo animals.data animals.cfg animals_best.weights test.mp4 -out_filename res.avi`\n\t* V3+:  `darknet_05_process_videos_multithreaded animals.cfg animals.names animals_best.weights test.mp4`\n\t* DarkHelp:  `DarkHelp animals.cfg animals.names animals_best.weights test.mp4`\n\n* JSON：\n\t* V2:  `darknet detector demo animals.data animals.cfg animals_best.weights test50.mp4 -json_port 8070 -mjpeg_port 8090 -ext_output`\n\t* V3+:  `darknet_06_images_to_json animals image1.jpg`\n\t* DarkHelp:  `DarkHelp --json animals.names animals.cfg animals_best.weights image1.jpg`\n\n* 在特定 GPU 上运行：\n\t* V2:  `darknet detector demo animals.data animals.cfg animals_best.weights -i 1 test.mp4`\n\n* 检查神经网络的准确性：\n```sh\ndarknet detector map driving.data driving.cfg driving_best.weights\n...\n  Id Name             AvgPrecision     TP     FN     FP     TN Accuracy ErrorRate Precision Recall Specificity FalsePosRate\n  -- ----             ------------ ------ ------ ------ ------ -------- --------- --------- ------ ----------- ------------\n   0 vehicle               91.2495  32648   3903   5826  65129   0.9095    0.0905    0.8486 0.8932      0.9179       0.0821\n   1 motorcycle            80.4499   2936    513    569   5393   0.8850    0.1150    0.8377 0.8513      0.9046       0.0954\n   2 bicycle               89.0912    570    124    104   3548   0.9475    0.0525    0.8457 0.8213      0.9715       0.0285\n   3 person                76.7937   7072   1727   2574  27523   0.8894    0.1106    0.7332 0.8037      0.9145       0.0855\n   4 many vehicles         64.3089   1068    509    733  11288   0.9087    0.0913    0.5930 0.6772      0.9390       0.0610\n   5 green light           86.8118   1969    239    510   4116   0.8904    0.1096    0.7943 0.8918      0.8898       0.1102\n   6 yellow light          82.0390    126     38     30   1239   0.9525    0.0475    0.8077 0.7683      0.9764       0.0236\n   7 red light             94.1033   3449    217    451   4643   0.9237    0.0763    0.8844 0.9408      0.9115       0.0885\n```\n* 检查 mAP (平均精度均值)@IoU (交并比)=75 的准确率：\n\t* `darknet detector map animals.data animals.cfg animals_best.weights -iou_thresh 0.75`\n\n* 重新计算锚框 (anchors) 最好在 DarkMark 中进行，因为它会连续运行 100 次并从所有计算的锚框中选择最佳的。但如果您想在 Darknet 中运行旧版本：\n```sh\ndarknet detector calc_anchors animals.data -num_of_clusters 6 -width 320 -height 256\n```\n* 训练新网络：\n\t* `darknet detector -map -dont_show train animals.data animals.cfg` (另见下方的 [训练部分](#training))\n\n* 显示 YOLO 热力图：\n\t* V3+:  `darknet_02_display_annotated_images --heatmaps cars images\u002F*.jpg`\n\t* V3+:  `darknet_03_display_videos --heatmaps cars videos\u002F*.m4v`\n\n* ONNX (开放神经网络交换) 导出：\n\t* `darknet_onnx_export cars.cfg`\n```\n\n## 训练\n\nDarknet\u002FYOLO FAQ (常见问题解答) 中相关部分的快速链接：\n* [我应该如何设置我的文件和目录？](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#directory_setup)\n* [我应该使用哪个配置文件？](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#configuration_template)\n* [训练我自己的网络时应使用什么命令？](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#training_command)\n\n> [!TIP]\n> 最简单的方法是使用 [DarkMark](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002FDarkMark#what-is-darkmark) 来创建所有必要的 Darknet 文件进行标注和训练。这绝对是训练新神经网络的推荐方式。\n\n如果您更倾向于手动设置各种文件以训练自定义网络：\n\n* 创建一个新文件夹用于存储文件。本例中，将创建一个检测动物的神经网络，因此创建以下目录： `~\u002Fnn\u002Fanimals\u002F`。\n* 复制一个您想用作模板的 Darknet 配置文件。例如，参见 `cfg\u002Fyolov4-tiny.cfg`。将其放入您创建的文件夹中。本例中，我们现在有 `~\u002Fnn\u002Fanimals\u002Fanimals.cfg`。\n* 在您放置配置文件的同一文件夹中创建一个 `animals.names` 文本文件。本例中，我们现在有 `~\u002Fnn\u002Fanimals\u002Fanimals.names`。\n* 使用文本编辑器编辑 `animals.names` 文件。列出您想要使用的类别。您需要确保每行恰好有一个条目，没有空行且没有注释。本例中，`.names` 文件将恰好包含 4 行：\n```txt\ndog\ncat\nbird\nhorse\n```\n\n* 在同一文件夹中创建一个 `animals.data` 文本文件。本例中，`.data` 文件将包含：\n```txt\nclasses = 4\ntrain = \u002Fhome\u002Fusername\u002Fnn\u002Fanimals\u002Fanimals_train.txt\nvalid = \u002Fhome\u002Fusername\u002Fnn\u002Fanimals\u002Fanimals_valid.txt\nnames = \u002Fhome\u002Fusername\u002Fnn\u002Fanimals\u002Fanimals.names\nbackup = \u002Fhome\u002Fusername\u002Fnn\u002Fanimals\n```\n\n* 创建一个文件夹用于存储您的图像和标注。例如，这可以是 `~\u002Fnn\u002Fanimals\u002Fdataset`。每张图像都需要一个对应的 `.txt` 文件来描述该图像的标注。`.txt` 标注文件的格式非常具体。您无法手动创建这些文件，因为每个标注都需要包含精确的坐标。请查看 [DarkMark](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002FDarkMark#what-is-darkmark) 或其他类似软件来标注您的图像。YOLO 标注格式在 [Darknet\u002FYOLO FAQ](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#darknet_annotations) 中有描述。\n* 创建 `.data` 文件中命名的 \"train\" 和 \"valid\" 文本文件。这两个文本文件需要分别列出 Darknet 必须用于训练和计算 mAP% (平均精度均值百分比) 时的验证的所有图像。每行恰好一张图像。路径和文件名可以是相对的或绝对的。\n* 使用文本编辑器修改您的 `.cfg` 文件。\n\t* 确保 `batch=64`。\n\t* 注意 `subdivisions` (细分)。根据网络尺寸和您 GPU (图形处理器) 上的可用内存量，您可能需要增加细分值。要使用的最佳值是 `1`，所以从该值开始。如果 `1` 对您不起作用，请参阅 [Darknet\u002FYOLO FAQ](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#cuda_out_of_memory)。\n\t* 注意 `max_batches=...`。开始时使用的良好值是类别数的 2000 倍。本例中，我们有 4 种动物，所以 4 * 2000 = 8000。这意味着我们将使用 `max_batches=8000`。\n\t* 注意 `steps=...`。这应设置为 `max_batches` 的 80% 和 90%。本例中，由于 `max_batches` 设置为 8000，我们将使用 `steps=6400,7200`。\n\t* 注意 `width=...` 和 `height=...`。这些是网络尺寸。[Darknet\u002FYOLO FAQ](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fdarknet_faq\u002F#optimal_network_size) 解释了 [如何计算最佳使用尺寸](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fdarknet_faq\u002F#optimal_network_size)。\n\t* 搜索所有 `classes=...` 行的实例并修改为您 `.names` 文件中的类别数。本例中，我们将使用 `classes=4`。\n\t* 在每个 `[yolo]` 部分之前的 `[convolutional]` 部分中搜索所有 `filters=...` 行的实例。要使用的值是 `(类别数 + 5) * 3`。这意味着本例中，`(4 + 5) * 3 = 27`。因此我们将在相应的行上使用 `filters=27`。\n* 开始训练！运行以下命令：\n```sh\ncd ~\u002Fnn\u002Fanimals\u002F\ndarknet detector -map -dont_show train animals.data animals.cfg\n```\n\n* 如果您有多个 GPU，则像这个具有 4 个 GPU 的示例一样使用 `-gpus ...` 标志：\n```sh\ncd ~\u002Fnn\u002Fanimals\u002F\ndarknet detector -gpus 0,1,2,3 -map -dont_show train animals.data animals.cfg\n```\n\n请耐心等待。最佳权重将保存为 `animals_best.weights`。可以通过查看 `chart.png` 文件来观察训练进度。如需了解训练新网络时可能希望使用的其他参数，请参阅 [Darknet\u002FYOLO FAQ](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fyolo_faq\u002F#training_command)。\n\n如果您想在训练期间查看更多详细信息，请添加 `-verbose` 参数。例如：\n```sh\ncd ~\u002Fnn\u002Fanimals\u002F\ndarknet detector -map -dont_show -verbose train animals.data animals.cfg\n```\n\n`-log ...` 标志可用于将所有控制台输出发送到文件。例如：\n```sh\ncd ~\u002Fnn\u002Fanimals\u002F\ndarknet detector -gpus 0 -verbose -log output.log -map -dont_show train animals.data animals.cfg\n```\n\n# 其他工具和链接\n\n* 要管理您的 Darknet\u002FYOLO 项目、标注图像、验证标注以及生成与 Darknet 一起训练所需的文件，[请查看 DarkMark](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002FDarkMark#what-is-darkmark)。\n* 对于 Darknet 的强大替代 CLI (命令行界面)，用于图像平铺、视频中的目标跟踪，或易于在商业应用中使用的强大 C++ API，[请查看 DarkHelp](https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002FDarkHelp#what-is-the-darkhelp-c-api)。\n* 查看 [Darknet\u002FYOLO FAQ](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fdarknet_faq\u002F) 是否能帮助您回答问题。\n* 查看 Stéphane 的 [YouTube 频道](https:\u002F\u002Fwww.youtube.com\u002Fc\u002FStephaneCharette\u002Fvideos) 上的许多教程和示例视频\n* [Darknet\u002FYOLO 的 C++ 绑定](https:\u002F\u002Fdarknetcv.ai\u002Fapi\u002Fapi.html#apiv3_cpp) (在 Darknet\u002FYOLO 仓库中)\n* [Darknet\u002FYOLO 的 C 绑定](https:\u002F\u002Fdarknetcv.ai\u002Fapi\u002Fapi.html#apiv3_c) (在 Darknet\u002FYOLO 仓库中)\n* [Darknet\u002FYOLO 的 Python 绑定](src-python\u002F) (在 Darknet\u002FYOLO 仓库中)\n* [Darknet\u002FYOLO 的 Java 绑定](https:\u002F\u002Fgithub.com\u002Fstephanecharette\u002FDarknetJava) [不完整，进行中]\n* [Darknet\u002FYOLO 的 Delphi 绑定](https:\u002F\u002Fgithub.com\u002Fhansvas\u002FDarknet4Delphi)\n* [Darknet\u002FYOLO 的 C# 绑定](https:\u002F\u002Fgithub.com\u002Flibormasek\u002FDarknetCSharp)\n* [Darknet2Any](https:\u002F\u002Fgithub.com\u002Fjredmondson\u002Fdarknet2any\u002F)\n* 如果您有支持问题或想与其他 Darknet\u002FYOLO 用户聊天，[加入 Darknet\u002FYOLO Discord 服务器](https:\u002F\u002Fdiscord.gg\u002FMQw32W9Cqr)。\n\n# 路线图\n\n最后更新 2025-12-06：\n\n## 已完成\n\n* [X] 在训练期间使用的地方将 qsort() 替换为 std::sort()（其他一些晦涩的仍保留）\n* [X] 移除 check_mistakes、getchar() 和 system()\n* [X] 转换 Darknet 以使用 C++ 编译器（Linux 上使用 g++，Windows 上使用 VisualStudio）\n* [X] 修复 Windows 构建\n* [X] 修复 Python 支持\n* [X] 构建 darknet 库\n* [X] 重新启用预测标签（“字母表”代码）\n* [X] 重新启用 CUDA（计算统一设备架构）\u002FGPU（图形处理器）代码\n* [X] 重新启用 CUDNN\n* [X] 重新启用 CUDNN 半精度\n* [X] 不要硬编码 CUDA 架构\n* [X] 更好的 CUDA 版本信息\n* [X] 重新启用 AVX\n* [X] 移除旧的解决方案文件和 Makefile\n* [X] 使 OpenCV 成为必选项\n* [X] 移除对旧 pthread 库的依赖\n* [X] 移除 STB\n* [X] 重写 CMakeLists.txt 以使用新的 CUDA 检测\n* [X] 移除旧的“字母表”代码，并删除 data\u002Flabels 中的 700 多张图像\n* [X] 执行源外构建\n* [X] 生成更好的版本号输出\n* [X] 与训练相关的性能优化（进行中任务）\n* [X] 与推理（inference）相关的性能优化（进行中任务）\n* [X] 尽可能使用按引用传递\n* [X] 清理 .hpp 文件\n* [X] 重写 darknet.h\n* [X] 不要将 cv::Mat 强制转换为 void*，而是将其作为正确的 C++ 对象使用\n* [X] 修复或统一内部 image 结构的使用方式\n* [X] 修复基于 ARM 的 Jetson（英伟达嵌入式平台）设备的构建\n\t* [ ] ~~原始 Jetson 设备~~（不太可能修复，因为它们不再受 NVIDIA 支持且没有 C++17 编译器）\n\t* [X] 新的 Jetson Orin 设备已正常工作\n* [X] 修复 V3 中的 Python API\n\t* [ ] 需要更好的 Python 支持 **(有 Python 开发者愿意帮忙吗？)**\n* [X] 热力图\n* [X] 移除所有 printf() 和 std::cout 调用，替换为 std::ofstream 以将日志记录到文件\n* [X] 添加对 AMD GPU 的支持\n* [X] 添加对 OpenBLAS（开源基础线性代数子程序库）的支持（仅限 CPU 构建）\n* [X] 添加对 Profile Guided Optimization（基于分析的性能优化）的支持\n* [X] 从 GitHub 迁移到 Codeberg\n* [X] ONNX（开放神经网络交换格式）导出工具\n* [X] 重写计算 mAP（平均精度均值）的函数\n* [X] 支持 ONNX 导出工具的 FP32（32 位浮点数）和 FP16（16 位浮点数）\n\n## 短期目标\n\n* [ ] Java 绑定（进行中）\n* [ ] 研究旧版 ZED 相机支持\n* [ ] 更好且更一致的命令行解析（进行中）\n* [ ] 添加对 MIOpen（AMD 深度学习库）的支持\n\n## 中期目标\n\n* [ ] 移除所有 char* 代码并用 std::string 替换\n* [ ] 不要隐藏警告并清理编译器警告（进行中）\n* [ ] 更好地使用 cv::Mat 而不是 C 语言中的自定义 image 结构（进行中）\n* [ ] 用 std::vector 或 std::list 替换旧的 list 功能（进行中）\n* [ ] 修复对 1 通道灰度（greyscale）图像的支持\n* [ ] 添加对 N 通道图像的支持（其中 N > 3，例如具有额外深度或热通道的图像）\n* [ ] 持续进行代码清理（进行中）\n* [ ] 在 ONNX 导出工具中添加对 8 位量化（quantization）的支持\n\n## 长期目标\n\n* [ ] 修复所有 GPU 的 CUDA\u002FCUDNN 问题\n* [ ] 重写 CUDA+cuDNN 代码\n* [ ] 研究添加对额外硬件的支持\n* [ ] 旋转边界框（bounding boxes），或某种“角度”支持\n* [ ] 关键点\u002F骨架\n* [ ] 分割（segmentation）","# Darknet (YOLO) 快速上手指南\n\nDarknet 是一个用 C、C++ 和 CUDA 编写的开源神经网络框架，内置 YOLO（You Only Look Once）实时目标检测系统。该框架完全免费且开源，支持商业项目集成。\n\n## 1. 环境准备\n\n### 系统要求\n*   **操作系统**：支持 Linux、Windows 和 Mac。\n*   **硬件支持**：\n    *   **CPU**：可在树莓派、云服务器、桌面及笔记本上运行。\n    *   **GPU**：需要 NVIDIA CUDA 兼容显卡或 AMD ROCm 兼容显卡以获得最佳性能。\n*   **软件依赖**：\n    *   C++17 或更高版本编译器。\n    *   OpenCV。\n    *   CMake（用于统一构建）。\n\n> **注意**：基础使用无需掌握 C\u002FC++\u002FPython 编程知识；仅在使用 API 开发应用时需要编程经验。\n\n## 2. 安装步骤\n\n推荐使用最新的统一构建方法（自 2023 年 8 月起），通过 CMake 在 Windows、Linux 和 Mac 上构建。\n\n### 克隆代码库\n从最新仓库地址克隆项目：\n```sh\ngit clone https:\u002F\u002Fcodeberg.org\u002FCCodeRun\u002Fdarknet.git\ncd darknet\n```\n\n### 构建方法\n根据操作系统选择以下一种方式：\n\n*   **Linux \u002F Google Colab**：\n    使用 CMake 方法构建。确保已安装 `cmake` 和 `build-essential`。\n*   **Windows**：\n    推荐使用 **WSL (Windows Subsystem for Linux)** 配合 Ubuntu 24.04 LTS。\n    1.  安装 WSL 后，在终端运行 `sudo apt-get update`。\n    2.  按照 Linux 步骤进行构建。\n    3.  如需原生 Windows 构建，请参考 Windows CMake 方法。\n*   **Docker**：\n    可直接使用官方提供的 Docker 镜像。\n\n> **提示**：旧版教程中的复杂构建步骤已过时，请遵循上述统一 CMake 流程。\n\n## 3. 基本使用\n\n### 下载预训练权重\n首次使用可下载预训练权重进行测试，无需重新训练网络。\n\n**MSCOCO 数据集权重示例 (YOLOv4-tiny)**：\n```sh\nwget --no-clobber https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Freleases\u002Fdownload\u002Fv2.0\u002Fyolov4-tiny.weights\n```\n其他版本权重（YOLOv2\u002Fv3\u002Fv7）及配置文件位于 `cfg\u002F` 目录下。\n\n### 命令行推理示例\n使用 `darknet` 二进制文件对图片进行检测：\n```sh\ndarknet_03_display_videos coco.names yolov4-tiny.cfg yolov4-tiny.weights video1.avi\n```\n\n或使用 `DarkHelp` 工具处理图片与视频：\n```sh\nDarkHelp coco.names yolov4-tiny.cfg yolov4-tiny.weights image1.jpg\nDarkHelp coco.names yolov4-tiny.cfg yolov4-tiny.weights video1.avi\n```\n\n### 其他资源\n*   **官方文档**：[Darknet\u002FYOLO web site](https:\u002F\u002Fdarknetcv.ai\u002F)\n*   **社区支持**：[Discord Server](https:\u002F\u002Fdiscord.gg\u002FMQw32W9Cqr)\n*   **FAQ 与数据集**：[Darknet\u002FYOLO FAQ](https:\u002F\u002Fwww.ccoderun.ca\u002Fprogramming\u002Fdarknet_faq\u002F)","某电子制造厂质检团队需要在高速流水线上实时检测电路板焊接缺陷。\n\n### 没有 darknet 时\n- 依赖人工肉眼检查，工人易疲劳导致漏检率高达 5%，严重影响良品率。\n- 采购闭源商业视觉软件需支付高额年费，且无法根据特定缺陷定制模型。\n- 现有推理框架延迟高，单张图像处理耗时超过 200 毫秒，拖慢产线节拍。\n- 硬件适配困难，老旧工控机无法运行重型深度学习框架，算力浪费严重。\n\n### 使用 darknet 后\n- 基于 YOLO 架构训练自定义模型，检测精度提升至 98% 以上，彻底消除漏检。\n- 完全开源免费，无需支付授权费，且代码可自由修改以适应特殊生产需求。\n- 利用 CUDA 加速，RTX 显卡下可达 1000 FPS，单帧处理仅需 1 毫秒，满足高速流转。\n- 支持 Linux 及嵌入式环境，可无缝部署至边缘计算盒子，降低整体硬件成本。\n\ndarknet 凭借高性能与零成本优势，帮助工厂实现了从人工质检到智能自动化的高效转型。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhank-ai_darknet_c00c19b7.jpg","hank-ai","Hank AI, Inc.","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fhank-ai_0d262ff5.png","",null,"devs@hank.ai","https:\u002F\u002Fhank.ai","https:\u002F\u002Fgithub.com\u002Fhank-ai",[84,88,92,96,100,104,108,112],{"name":85,"color":86,"percentage":87},"C++","#f34b7d",86,{"name":89,"color":90,"percentage":91},"Cuda","#3A4E3A",8.4,{"name":93,"color":94,"percentage":95},"Python","#3572A5",2.3,{"name":97,"color":98,"percentage":99},"C","#555555",1.3,{"name":101,"color":102,"percentage":103},"CMake","#DA3434",1.2,{"name":105,"color":106,"percentage":107},"Jupyter Notebook","#DA5B0B",0.7,{"name":109,"color":110,"percentage":111},"Batchfile","#C1F12E",0,{"name":113,"color":114,"percentage":111},"Shell","#89e051",788,103,"2026-04-04T20:09:31","Apache-2.0",4,"Linux, macOS, Windows","非必需（支持 CPU 运行），GPU 版本需 NVIDIA CUDA 或 AMD ROCm 兼容显卡","未说明",{"notes":124,"python":125,"dependencies":126},"基于 C\u002FC++ 编写；无需 Python 即可构建和运行；v5.1 版预测结构变更需重新编译以防段错误；使用 CMake 统一构建流程","不需要",[127,128,101,129],"C++17","OpenCV","OpenBLAS",[14,13],[132,67,133,134,135,136],"computervision","machine-learning","neural-networks","object-detection","yolo","2026-03-27T02:49:30.150509","2026-04-06T07:13:26.018648",[140,145,149,154,158,163],{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},2716,"使用 GCC 14 和 NVCC 12.0 编译时报错 `unsupported GNU version` 怎么办？","请升级 NVCC 版本至 12.9 或更高。旧版 NVCC（如 12.0）不支持 GCC 13+，而 NVCC 12.9 移除了对 GCC 版本的严格检查，可以解决此兼容性问题。","https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F129",{"id":146,"question_zh":147,"answer_zh":148,"source_url":144},2717,"编译报错 `fatal error: filesystem: No such file or directory` 如何修复？","这通常与编译器支持的 C++ 标准有关。建议确认编译器是否支持 -std=c++17 并正确配置。此外，升级到较新的 NVCC 版本（如 12.9）也能解决相关的底层头文件兼容性问题。",{"id":150,"question_zh":151,"answer_zh":152,"source_url":153},2718,"构建 Darknet 后是否需要执行 `make install`？","不需要。根据维护者的回复，README 中指示的构建步骤已经足够清晰，无需额外运行 `make install` 命令。","https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F92",{"id":155,"question_zh":156,"answer_zh":157,"source_url":153},2719,"构建过程中出现 `file INSTALL cannot set permissions` 错误如何处理？","这是一个罕见错误，维护者表示未遇到过具体解决方案。建议检查目标安装目录的文件权限设置，或尝试在其他路径下重新构建。",{"id":159,"question_zh":160,"answer_zh":161,"source_url":162},2720,"YOLOv7-full 模型无法检测到物体（返回 0 objects）是什么原因？","这可能是特定 NVIDIA 显卡环境的兼容性问题。有用户在 AMD\u002FROCm 系统上测试显示无此问题。建议尝试更换不同的显卡硬件或在不同环境下测试。","https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F114",{"id":164,"question_zh":165,"answer_zh":166,"source_url":153},2721,"编译时出现 `nvcc warning : Cannot find valid GPU for '-arch=native'` 警告需要处理吗？","这是 nvcc 默认架构的警告，通常不影响构建结果。如果遇到 CMake 相关警告，可以使用 `-Wno-dev` 参数来抑制，或者忽略该 nvcc 警告继续编译。",[168],{"id":169,"version":170,"summary_zh":171,"released_at":172},102217,"v2.0","Weights:  https:\u002F\u002Fgithub.com\u002Fhank-ai\u002Fdarknet\u002Fissues\u002F21","2023-11-13T04:56:18"]