# NOTICE — Attribution and Provenance This repository hosts an **INT8-quantized ONNX derivative** of **YOLOv4-tiny-416**, prepared by **Pablo Mendoza** (`@thefalley`) for deployment on a custom INT8 DPU (ZedBoard XC7Z020 FPGA). The work this repo adds (ONNX export pipeline + INT8 quantization with COCO calibration) is released under the MIT License (see `LICENSE`). All upstream components keep their original licenses, listed below in dependency order. --- ## Provenance chain ``` AlexeyAB / darknet (YOLO License v2 = public domain) yolov4-tiny.weights (23.13 MiB) yolov4-tiny.cfg │ │ parsed and loaded by: ▼ gwinndr / YOLOv4-Pytorch (MIT) (used as conversion tool) utilities/configs.py::parse_config — parses darknet .cfg dynamically utilities/weights.py::load_weights — reads AlexeyAB binary .weights + small in-repo patch to handle [route] groups + DarknetRaw wrapper (this repo, MIT) that captures pre-YoloLayer outputs │ │ torch.onnx.export(opset=13) ▼ yolov4-tiny-416_float.onnx (this repo, MIT — derivative) 2 raw outputs: out_stride16 — shape (1, 255, 26, 26) out_stride32 — shape (1, 255, 13, 13) │ │ onnxruntime.quantize_static (MIT, used as tool) │ + COCO val2017 calibration (1000 images, CC BY 4.0) ▼ yolov4-tiny-416_int8_qop.onnx (this repo, MIT — derivative) External Python decoder (this repo, MIT) reproduces the standard YOLOv4 post-processing: sigmoid + scale_xy + grid offset + anchor multiplication + NMS. This decoder is not part of the ONNX graph (matches the standard deployable design where the decoder runs on the host CPU after the DPU executes the conv backbone+neck+head). ``` --- ## Component-level attribution ### 1. Model weights — AlexeyAB / darknet - **Project**: `AlexeyAB/darknet` - **Source**: https://github.com/AlexeyAB/darknet - **Weights URL**: https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.weights - **License**: YOLO License v2 — *"Darknet is public domain. Do whatever you want with it."* - **What we use**: the trained `yolov4-tiny.weights` file (23.13 MiB) and the corresponding `yolov4-tiny.cfg`. No modifications. ### 2. Darknet → PyTorch conversion — gwinndr / YOLOv4-Pytorch - **Project**: `gwinndr/YOLOv4-Pytorch` - **Source**: https://github.com/gwinndr/YOLOv4-Pytorch - **License**: MIT (Copyright (c) 2020 Damon Gwinn) - **What we use**: the `parse_config` cfg parser and the `load_weights` AlexeyAB binary loader. - **Modifications we made** (to handle yolov4-tiny's CSPDarknet route trick): - Patched `utilities/configs.py::parse_route_block` to read `groups` and `group_id` from `[route]` blocks. - Patched `model/layers/route.py::RouteLayer` to apply channel-wise split when `groups > 1`. - These patches are also released under MIT. - We do NOT redistribute gwinndr's source code in this HF repo. We reference it as a build-time tool. To reproduce, clone gwinndr's repo and apply the patches in our companion firmware repository. ### 3. ONNX export - **Tool**: `torch.onnx.export` (PyTorch core, BSD-3-Clause). Used as a tool, not redistributed. - **Wrapper**: `DarknetRaw` (≈ 30 lines, this work, MIT) intercepts the pre-YoloLayer feature maps and exports them as 2 raw 4D tensors. The decoder lives in `inference.py` (Python, MIT). ### 4. INT8 quantization - **Tool**: `onnxruntime.quantization.quantize_static` (Microsoft, MIT). Used as a tool, not redistributed. - **Configuration**: - `quant_format = QuantFormat.QOperator` - `weight_type = QuantType.QInt8` (per-tensor, symmetric) - `activation_type = QuantType.QInt8` (per-tensor, asymmetric) - `per_channel = False` - `reduce_range = False` - **Calibration data**: 1000 randomly-sampled images from MS COCO val2017 (CC BY 4.0). No COCO image is embedded inside the ONNX file; the dataset's role ends after calibration. ### 5. Calibration dataset — COCO val2017 - **Source**: https://cocodataset.org - **License**: Creative Commons Attribution 4.0 (CC BY 4.0) for both images and annotations. --- ## File-level integrity (SHA-256) | File | Size | SHA-256 | |---|---:|---| | `yolov4-tiny.weights` (AlexeyAB upstream) | 24,251,276 B | `cf9fbfd0f6d4869b35762f56100f50ed05268084078805f0e7989efe5bb8ca87` | | `yolov4-tiny-416_float.onnx` | 24,230,209 B | `eea691d460fd3eb5c1a250b4e5f822784cd44e11aaa77a24299b0952b9f4fc9f` | | `yolov4-tiny-416_int8_qop.onnx` | 6,113,440 B | `c30c8f0a33b3a0edc13a2ca21726a288228e1448b3c38940f9da0c7d8cee4760` | --- ## Author of the INT8 derivative **Pablo Mendoza** — HuggingFace [`@thefalley`](https://huggingface.co/thefalley) Companion repositories: | Repository | Purpose | |---|---| | [`Thefalley/yolov4-leaky-416-int8-qop`](https://huggingface.co/Thefalley/yolov4-leaky-416-int8-qop) | Larger sibling: full YOLOv4-Leaky-416 INT8 (61.66 MiB) for higher mAP | | `Thefalley/dpu-firmware` (GitHub, ***) | Bare-metal C firmware + RTL for the custom DPU on ZedBoard XC7Z020 | ## Contact If you are a rights holder and believe this attribution is inaccurate or incomplete, please open an issue on this repository and it will be corrected promptly.