# johnrott/fpga-accelerated-human-detection architecture

> Architecture diagram of the GitHub repository johnrott/fpga-accelerated-human-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/johnrott/fpga-accelerated-human-detection
- Repository: https://github.com/johnrott/fpga-accelerated-human-detection

## Overview

The repository implements an FPGA-accelerated human-detection system: camera frames are reduced to grayscale and sent from a Raspberry Pi to an ESP32, then transferred over SPI to FPGA HOG feature extraction and SVM classification. The tree also contains the original standalone gradient-convolution accelerator. The README documents the full system; detailed runtime links beyond the sampled Raspberry Pi, HOG, and SVM code rely on that documentation.

Main entry points: [`histogram/code/hog_accel.cpp`](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/histogram/code/hog_accel.cpp) (HOG accelerator), [`Extension/SVM/svm_predict.cpp`](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/SVM/svm_predict.cpp) (SVM predictor), [`Extension/Raspberry Pi/pitoesp.py`](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/Raspberry%20Pi/pitoesp.py) (Frame sender), [`Extension/ESP32/pi_fpga_transfer.ino`](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/ESP32/pi_fpga_transfer.ino) (ESP32 receiver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and transport"]
  node_camera(("Pi camera"))
  node_pi_sender["Frame sender<br/>[pitoesp.py]"]
  node_wifi["Wi-Fi link"]
end

subgraph group_hardware["FPGA interface"]
  node_esp_receiver["ESP32 receiver"]
  node_spi["SPI interface<br/>[spi_image_top.v]"]
  node_fpga["Zynq FPGA"]
end

subgraph group_vision["HOG features"]
  node_hog_accel["HOG accelerator<br/>[hog_accel.cpp]"]
  node_gradient_stream["Gradient stream<br/>[hog_accel.cpp]"]
  node_hog_histogram["HOG histogram<br/>[hog_accel.cpp]"]
  node_gradient_hw["Gradient accelerator"]
end

subgraph group_classification["Detection"]
  node_svm["SVM predictor<br/>[svm_predict.cpp]"]
  node_detection["Detection outputs<br/>[svm_predict.cpp]"]
end

node_camera -->|"captures frames"| node_pi_sender
node_pi_sender -->|"sends packets"| node_wifi
node_wifi -->|"delivers frames"| node_esp_receiver
node_esp_receiver -->|"transfers frames"| node_spi
node_spi -->|"receives frames"| node_fpga
node_fpga -->|"runs HOG"| node_hog_accel
node_hog_accel -->|"calls"| node_gradient_stream
node_gradient_stream -->|"streams gradients"| node_hog_histogram
node_fpga -->|"runs classification"| node_svm
node_hog_accel -->|"provides features"| node_svm
node_svm -->|"writes results"| node_detection
node_fpga -.->|"runs standalone"| node_gradient_hw

click node_pi_sender "https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/Raspberry%20Pi/pitoesp.py"
click node_esp_receiver "https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/ESP32/pi_fpga_transfer.ino"
click node_spi "https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/SPI/spi_image_top.v"
click node_hog_accel "https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/histogram/code/hog_accel.cpp"
click node_gradient_stream "https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/histogram/code/hog_accel.cpp"
click node_hog_histogram "https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/histogram/code/hog_accel.cpp"
click node_gradient_hw "https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/gradient_convolution/code/gradient_convolution.cpp"
click node_svm "https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/SVM/svm_predict.cpp"
click node_detection "https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/SVM/svm_predict.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_camera,node_pi_sender,node_wifi toneBlue
class node_esp_receiver,node_spi,node_fpga toneAmber
class node_hog_accel,node_gradient_stream,node_hog_histogram,node_gradient_hw toneMint
class node_svm,node_detection toneRose
```

## Components

### Capture and transport

- **Pi camera**
- [Frame sender](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/Raspberry%20Pi/pitoesp.py): `Extension/Raspberry Pi/pitoesp.py`
- **Wi-Fi link**

### FPGA interface

- [ESP32 receiver](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/ESP32/pi_fpga_transfer.ino): `Extension/ESP32/pi_fpga_transfer.ino`
- [SPI interface](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/SPI/spi_image_top.v): `Extension/SPI/spi_image_top.v`
- **Zynq FPGA**

### HOG features

- [HOG accelerator](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/histogram/code/hog_accel.cpp): `histogram/code/hog_accel.cpp`
- [Gradient stream](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/histogram/code/hog_accel.cpp): `histogram/code/hog_accel.cpp`
- [HOG histogram](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/histogram/code/hog_accel.cpp): `histogram/code/hog_accel.cpp`
- [Gradient accelerator](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/gradient_convolution/code/gradient_convolution.cpp): `gradient_convolution/code/gradient_convolution.cpp`

### Detection

- [SVM predictor](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/SVM/svm_predict.cpp): `Extension/SVM/svm_predict.cpp`
- [Detection outputs](https://github.com/johnrott/fpga-accelerated-human-detection/blob/main/Extension/SVM/svm_predict.cpp): `Extension/SVM/svm_predict.cpp`

## Connections

- Pi camera → Frame sender: captures frames (evidence: `README.md`)
- Frame sender → Wi-Fi link: sends packets (evidence: `Extension/Raspberry Pi/pitoesp.py`)
- Wi-Fi link → ESP32 receiver: delivers frames (evidence: `README.md`)
- ESP32 receiver → SPI interface: transfers frames (evidence: `README.md`)
- SPI interface → Zynq FPGA: receives frames (evidence: `README.md`)
- Zynq FPGA → HOG accelerator: runs HOG (evidence: `README.md`)
- HOG accelerator → Gradient stream: calls (evidence: `histogram/code/hog_accel.cpp`)
- Gradient stream → HOG histogram: streams gradients (evidence: `histogram/code/hog_accel.cpp`)
- Zynq FPGA → SVM predictor: runs classification (evidence: `README.md`)
- HOG accelerator → SVM predictor: provides features (evidence: `README.md`)
- SVM predictor → Detection outputs: writes results (evidence: `Extension/SVM/svm_predict.cpp`)
- Zynq FPGA → Gradient accelerator: runs standalone
