# jkcamarador/yolo-v4-handgun-detection architecture

> Architecture diagram of the GitHub repository jkcamarador/yolo-v4-handgun-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jkcamarador/yolo-v4-handgun-detection
- Repository: https://github.com/jkcamarador/yolo-v4-handgun-detection

## Overview

This repository presents a handgun-detection workflow: a collected image dataset is prepared for YOLOv4 training, the trained detector is evaluated, and notebooks demonstrate testing and real-time detection. The README also describes a YOLOv3 benchmark, stratified k-fold validation, and paired significance testing. The tree includes training and testing configurations, class metadata, and links to trained weights. Only generate_train.py was excerpted, so notebook internals and most runtime connections are not verified; links between those stages reflect README statements.

Main entry points: [`YOLOv4_Handgun_Detection_Training.ipynb`](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/YOLOv4_Handgun_Detection_Training.ipynb) (YOLOv4 Training), [`YOLOv4_Handgun_Detection_Testing.ipynb`](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/YOLOv4_Handgun_Detection_Testing.ipynb) (Model Testing), [`backup/Trained .weights files Gdrive Link.txt`](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/backup/Trained%20.weights%20files%20Gdrive%20Link.txt) (Trained Weights), [`generate_train.py`](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/generate_train.py) (Training Manifest Generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Dataset Preparation"]
  node_dataset[("Gun Image Dataset")]
  node_train_manifest["Training Manifest Generator<br/>[generate_train.py]"]
end

subgraph group_model["YOLOv4 Model"]
  node_train_config["Training Configuration<br/>[yolov4-obj.cfg]"]
  node_class_metadata["Class Metadata<br/>[obj.names]"]
  node_data_metadata["Dataset Metadata<br/>[obj.data]"]
  node_training["YOLOv4 Training"]
  node_trained_weights["Trained Weights"]
end

subgraph group_evaluation["Evaluation and Detection"]
  node_testing["Model Testing"]
  node_test_config["Testing Configuration"]
  node_realtime["Real-time Detection"]
  node_benchmark["YOLOv3 Benchmark"]
end

node_kaggle(("Kaggle Dataset"))

node_kaggle -->|"provides images"| node_dataset
node_dataset -.->|"supplies images"| node_train_manifest
node_train_manifest -.->|"prepares training list"| node_training
node_training -->|"produces weights"| node_trained_weights
node_training -.->|"uses configuration"| node_train_config
node_training -.->|"uses class labels"| node_class_metadata
node_training -.->|"uses dataset metadata"| node_data_metadata
node_testing -.->|"tests model"| node_trained_weights
node_testing -.->|"uses configuration"| node_test_config
node_realtime -->|"runs detector"| node_trained_weights
node_benchmark -->|"compared with"| node_testing

click node_train_manifest "https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/generate_train.py"
click node_train_config "https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/yolov4-obj.cfg"
click node_class_metadata "https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/obj.names"
click node_data_metadata "https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/obj.data"
click node_training "https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/YOLOv4_Handgun_Detection_Training.ipynb"
click node_trained_weights "https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/backup/Trained%20.weights%20files%20Gdrive%20Link.txt"
click node_testing "https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/YOLOv4_Handgun_Detection_Testing.ipynb"
click node_test_config "https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/yolov4-obj-testing.cfg"
click node_realtime "https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/Realtime_Handgun_Detection_v4.ipynb"

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_dataset,node_train_manifest toneBlue
class node_train_config,node_class_metadata,node_data_metadata,node_training,node_trained_weights toneAmber
class node_testing,node_test_config,node_realtime,node_benchmark toneMint
class node_kaggle toneIndigo
```

## Components

### Dataset Preparation

- **Gun Image Dataset**
- [Training Manifest Generator](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/generate_train.py): `generate_train.py`

### YOLOv4 Model

- [Training Configuration](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/yolov4-obj.cfg): `yolov4-obj.cfg`
- [Class Metadata](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/obj.names): `obj.names`
- [Dataset Metadata](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/obj.data): `obj.data`
- [YOLOv4 Training](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/YOLOv4_Handgun_Detection_Training.ipynb): `YOLOv4_Handgun_Detection_Training.ipynb`
- [Trained Weights](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/backup/Trained%20.weights%20files%20Gdrive%20Link.txt): `backup/Trained .weights files Gdrive Link.txt`

### Evaluation and Detection

- [Model Testing](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/YOLOv4_Handgun_Detection_Testing.ipynb): `YOLOv4_Handgun_Detection_Testing.ipynb`
- [Testing Configuration](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/yolov4-obj-testing.cfg): `yolov4-obj-testing.cfg`
- [Real-time Detection](https://github.com/jkcamarador/yolo-v4-handgun-detection/blob/master/Realtime_Handgun_Detection_v4.ipynb): `Realtime_Handgun_Detection_v4.ipynb`
- **YOLOv3 Benchmark**

### Other components

- **Kaggle Dataset**

## Connections

- Kaggle Dataset → Gun Image Dataset: provides images (evidence: `README.md`)
- Gun Image Dataset → Training Manifest Generator: supplies images
- Training Manifest Generator → YOLOv4 Training: prepares training list
- YOLOv4 Training → Trained Weights: produces weights (evidence: `README.md`)
- YOLOv4 Training → Training Configuration: uses configuration
- YOLOv4 Training → Class Metadata: uses class labels
- YOLOv4 Training → Dataset Metadata: uses dataset metadata
- Model Testing → Trained Weights: tests model
- Model Testing → Testing Configuration: uses configuration
- Real-time Detection → Trained Weights: runs detector (evidence: `README.md`)
- YOLOv3 Benchmark → Model Testing: compared with (evidence: `README.md`)
