# kiyoshiiriemon/yolov4_darknet architecture

> Architecture diagram of the GitHub repository kiyoshiiriemon/yolov4_darknet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kiyoshiiriemon/yolov4_darknet
- Repository: https://github.com/kiyoshiiriemon/yolov4_darknet

## Overview

##### Project type and purpose
- This is an open-source, full-stack neural-network framework (“Darknet”) implementing real-time object detection (YOLO v2/v3/v4) for Windows, Linux, macOS.
- It provides a C/C++/CUDA core engine, language bindings (C API, C++ API, Python, C#), command-line tools, build scripts, model definitions, data-processing scripts, and CI/CD integration.

##### File structure
- Top-level orchestration
- .circleci, .github (CI/CD pipelines)
- CMakeLists.txt, Makefile, build.ps1 (cross-platform build)
- vcpkg.json (Windows package manager)
- Third-party dependencies
- 3rdparty/pthreads (threading)
- 3rdparty/stb (image IO)
- Build outputs
- build/ (Visual Studio solutions, generated binaries, wrappers)
- Configuration & data
- cfg/ (network definitions, data files)
- data/ (label lists, datasets)
- Core engine
- src/ (modular layer implementations: convolution, pooling, batchnorm, YOLO layers, parser, network scheduler)
- / (darknet.h, yolo_v2_class.hpp)
- Language bindings & demos
- src/csharp (C# wrapper)
- darknet.py, darknet_video.py (Python bindings)
- yolo_console_dll (C++ example)
- Scripts & tooling
- scripts/ (data download, preprocessing, evaluation, anchor calculation, deployment)
- shell (.sh) and PowerShell (.ps1) helpers

##### README for additional insights
- Highlights supported models, performance benchmarks, requirements (CUDA, cuDNN, OpenCV), training/inference workflows, multi-GPU training, metrics (mAP, IoU), and integration points (JSON/MJPEG server, COCO evaluation server, conversion to TensorFlow/PyTorch/ONNX/OpenVINO).

##### Elements
- Rectangles (functional components: Core Engine, Wrappers, Scripts)
- Parallelograms (scripts, CLI tools)
- Clouds (external services: COCO server, HTTP streams)

## Diagram (Mermaid)

```mermaid
graph TB
  %% CI/CD Pipelines
  subgraph "CI/CD Pipelines"
    CI[".circleci/"]:::ci
    GH[".github/"]:::ci
  end

  %% Build System & Orchestration
  subgraph "Build System & Orchestration"
    CMake["CMakeLists.txt"]:::build
    Make["Makefile"]:::build
    PS["build.ps1"]:::build
    VCPKG["vcpkg.json"]:::build
    CMakeMod["cmake/"]:::build
  end

  %% Third-Party Dependencies
  subgraph "Third-Party Dependencies"
    PThread["3rdparty/pthreads/"]:::third
    STB["3rdparty/stb/"]:::third
  end

  %% Core Engine
  subgraph "Core Engine"
    SRC["src/"]:::core
    INC["include/"]:::core
  end

  %% Language Wrappers & Demos
  subgraph "Language Wrappers & Demos"
    CSharp["src/csharp/"]:::wrap
    Py1["darknet.py"]:::wrap
    Py2["darknet_images.py"]:::wrap
    Py3["darknet_video.py"]:::wrap
    Cpp1["yolo_console_dll.cpp"]:::wrap
    Cpp2["darknet.c"]:::wrap
  end

  %% Configuration & Models
  subgraph "Configuration & Models"
    CFG["cfg/"]:::config
    DATA["data/"]:::config
  end

  %% Scripts & Tooling
  subgraph "Scripts & Tooling"
    SCRIPTS["scripts/"]:::scripts
    SH1["image_yolov3.sh"]:::scripts
    SH2["image_yolov4.sh"]:::scripts
    SH3["json_mjpeg_streams.sh"]:::scripts
    SH4["net_cam_v3.sh"]:::scripts
    SH5["net_cam_v4.sh"]:::scripts
    SH6["video_yolov3.sh"]:::scripts
    SH7["video_yolov4.sh"]:::scripts
  end

  %% Build Outputs & Examples
  subgraph "Build Outputs & Examples"
    BUILD_OUT["build/"]:::output
    BD_DARK["build/darknet/"]:::output
    BD_X64["build/darknet/x64/"]:::output
  end

  %% Utilities & Helpers
  subgraph "Utilities & Helpers"
    LOGPARSER["scripts/log_parser/"]:::utils
    GENANCH["scripts/gen_anchors.py"]:::utils
    VOC["scripts/voc_eval.py"]:::utils
  end

  %% Versioning & Metadata
  subgraph "Versioning & Metadata"
    VERH["src/version.h"]:::version
    VERCMAKE["DarknetConfig.cmake.in"]:::version
  end

  %% Relationships
  CMake -->|builds| SRC
  Make -->|builds| SRC
  PS -->|builds| SRC
  VCPKG -->|manages deps| PThread
  VCPKG -->|manages deps| STB

  CFG -->|configures| SRC
  DATA -->|feeds data| SRC
  SCRIPTS -->|orchestrate| SRC
  CSharp -->|wraps| SRC
  Py1 -->|wraps| SRC
  Py2 -->|wraps| SRC
  Py3 -->|wraps| SRC
  Cpp1 -->|examples| SRC
  Cpp2 -->|examples| SRC

  SRC -->|produces| BUILD_OUT
  BUILD_OUT --> BD_DARK
  BD_DARK --> BD_X64

  VERH -->|metadata| CMake

  %% Click Events
  click CI "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/.circleci/"
  click GH "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/.github/"
  click CMake "https://github.com/kiyoshiiriemon/yolov4_darknet/blob/master/CMakeLists.txt"
  click Make "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/Makefile"
  click PS "https://github.com/kiyoshiiriemon/yolov4_darknet/blob/master/build.ps1"
  click VCPKG "https://github.com/kiyoshiiriemon/yolov4_darknet/blob/master/vcpkg.json"
  click CMakeMod "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/cmake/"
  click PThread "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/3rdparty/pthreads/"
  click STB "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/3rdparty/stb/"
  click SRC "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/src/"
  click INC "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/include/"
  click CSharp "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/src/csharp/"
  click CFG "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/cfg/"
  click DATA "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/data/"
  click SCRIPTS "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/scripts/"
  click BUILD_OUT "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/build/"
  click BD_DARK "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/build/darknet/"
  click BD_X64 "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/build/darknet/x64/"
  click LOGPARSER "https://github.com/kiyoshiiriemon/yolov4_darknet/tree/master/scripts/log_parser/"
  click GENANCH "https://github.com/kiyoshiiriemon/yolov4_darknet/blob/master/scripts/gen_anchors.py"
  click VOC "https://github.com/kiyoshiiriemon/yolov4_darknet/blob/master/scripts/voc_eval.py"
  click VERH "https://github.com/kiyoshiiriemon/yolov4_darknet/blob/master/src/version.h"
  click VERCMAKE "https://github.com/kiyoshiiriemon/yolov4_darknet/blob/master/DarknetConfig.cmake.in"

  %% Styles
  classDef ci fill:#ffef96,stroke:#333,stroke-width:1px
  classDef build fill:#d0e6a5,stroke:#333,stroke-width:1px
  classDef third fill:#f7cac9,stroke:#333,stroke-width:1px
  classDef core fill:#92a8d1,stroke:#333,stroke-width:1px
  classDef wrap fill:#f28ab2,stroke:#333,stroke-width:1px
  classDef config fill:#b5e7a0,stroke:#333,stroke-width:1px
  classDef scripts fill:#ffeead,stroke:#333,stroke-width:1px
  classDef output fill:#c7ceea,stroke:#333,stroke-width:1px
  classDef utils fill:#ffcc5c,stroke:#333,stroke-width:1px
  classDef version fill:#96ceb4,stroke:#333,stroke-width:1px
```
