# xiangg67/naruto-jutsu architecture

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

- Interactive diagram: https://gitdiagram.com/xiangg67/naruto-jutsu
- Repository: https://github.com/xiangg67/naruto-jutsu

## Overview

This repository builds a webcam-based Naruto jutsu game and includes workflows for collecting and training its hand-seal and visual-seal models. In play, the webcam feeds the game runtime; detected seals are sequenced into jutsu, which trigger visual and audio effects. Separate workflows gather hand samples and seal photos, prepare labels and datasets, and train models. The sampled source shows the main runtime integrations and hand-data pipeline; some image-training links are supported by tool docstrings rather than inspected training code.

Main entry points: [`main.py`](https://github.com/xiangg67/naruto-jutsu/blob/main/main.py) (Game runtime), [`train.py`](https://github.com/xiangg67/naruto-jutsu/blob/main/train.py) (Hand classifier training), [`prepare_dataset.py`](https://github.com/xiangg67/naruto-jutsu/blob/main/prepare_dataset.py) (YOLO dataset preparation), [`collect_data.py`](https://github.com/xiangg67/naruto-jutsu/blob/main/collect_data.py) (Hand sample capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Live game"]
  node_runtime["Game runtime<br/>[main.py]"]
  node_sequence["Jutsu sequences<br/>[jutsu.py]"]
  node_visuals["Visual effects<br/>[effects.py]"]
  node_clones["Shadow clones<br/>[clones.py]"]
end

subgraph group_hand["Hand classifier"]
  node_handcapture["Hand sample capture<br/>[collect_data.py]"]
  node_features["Hand features<br/>[features.py]"]
  node_handdata[("Hand samples<br/>[seals.csv]")]
  node_handtrain["Hand classifier training<br/>[train.py]"]
end

subgraph group_vision["Seal detector"]
  node_photocapture["Seal photo capture<br/>[capture_images.py]"]
  node_photolabel["Photo labeling<br/>[label_images.py]"]
  node_photos[("Raw seal photos")]
  node_datasetprep["YOLO dataset preparation<br/>[prepare_dataset.py]"]
  node_yolotrain["YOLO training<br/>[train_yolo.py]"]
  node_sealnames["Seal class names<br/>[seals.py]"]
end

subgraph group_assets["Models and media"]
  node_handmodel["Hand classifier model"]
  node_yolomodel["YOLO seal model<br/>[seal_yolo.pt]"]
  node_media["Game audio"]
end

node_player(("Player"))
node_camera["Webcam"]

node_player -->|"poses for"| node_camera
node_camera -->|"supplies frames"| node_runtime
node_runtime -->|"detects seals"| node_yolomodel
node_runtime -.->|"classifies hands"| node_handmodel
node_runtime -->|"updates"| node_sequence
node_sequence -->|"returns jutsu"| node_runtime
node_runtime -->|"runs effects"| node_visuals
node_runtime -->|"renders clones"| node_clones
node_runtime -->|"plays sounds"| node_media
node_player -->|"records poses"| node_handcapture
node_handcapture -->|"extracts features"| node_features
node_handcapture -->|"writes samples"| node_handdata
node_handtrain -->|"reads samples"| node_handdata
node_handtrain -->|"uses feature columns"| node_features
node_handtrain -->|"saves model"| node_handmodel
node_player -->|"makes seal poses"| node_photocapture
node_photocapture -->|"saves photos"| node_photos
node_photolabel -->|"labels photos"| node_photos
node_photolabel -->|"uses class names"| node_sealnames
node_datasetprep -->|"arranges photos"| node_photos
node_datasetprep -->|"writes class mapping"| node_sealnames
node_datasetprep -.->|"provides training data"| node_yolotrain
node_yolotrain -.->|"trains detector"| node_yolomodel

click node_runtime "https://github.com/xiangg67/naruto-jutsu/blob/main/main.py"
click node_sequence "https://github.com/xiangg67/naruto-jutsu/blob/main/jutsu.py"
click node_visuals "https://github.com/xiangg67/naruto-jutsu/blob/main/effects.py"
click node_clones "https://github.com/xiangg67/naruto-jutsu/blob/main/clones.py"
click node_handcapture "https://github.com/xiangg67/naruto-jutsu/blob/main/collect_data.py"
click node_features "https://github.com/xiangg67/naruto-jutsu/blob/main/features.py"
click node_handdata "https://github.com/xiangg67/naruto-jutsu/blob/main/data/seals.csv"
click node_handtrain "https://github.com/xiangg67/naruto-jutsu/blob/main/train.py"
click node_handmodel "https://github.com/xiangg67/naruto-jutsu/blob/main/models/seal_classifier.pkl"
click node_photocapture "https://github.com/xiangg67/naruto-jutsu/blob/main/capture_images.py"
click node_photolabel "https://github.com/xiangg67/naruto-jutsu/blob/main/label_images.py"
click node_datasetprep "https://github.com/xiangg67/naruto-jutsu/blob/main/prepare_dataset.py"
click node_yolotrain "https://github.com/xiangg67/naruto-jutsu/blob/main/train_yolo.py"
click node_yolomodel "https://github.com/xiangg67/naruto-jutsu/blob/main/models/seal_yolo.pt"
click node_media "https://github.com/xiangg67/naruto-jutsu/tree/main/assets"
click node_sealnames "https://github.com/xiangg67/naruto-jutsu/blob/main/seals.py"

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_runtime,node_sequence,node_visuals,node_clones toneBlue
class node_handcapture,node_features,node_handdata,node_handtrain toneAmber
class node_photocapture,node_photolabel,node_photos,node_datasetprep,node_yolotrain,node_sealnames toneMint
class node_handmodel,node_yolomodel,node_media toneRose
class node_player,node_camera toneIndigo
```

## Components

### Live game

- [Game runtime](https://github.com/xiangg67/naruto-jutsu/blob/main/main.py): `main.py`
- [Jutsu sequences](https://github.com/xiangg67/naruto-jutsu/blob/main/jutsu.py): `jutsu.py`
- [Visual effects](https://github.com/xiangg67/naruto-jutsu/blob/main/effects.py): `effects.py`
- [Shadow clones](https://github.com/xiangg67/naruto-jutsu/blob/main/clones.py): `clones.py`

### Hand classifier

- [Hand sample capture](https://github.com/xiangg67/naruto-jutsu/blob/main/collect_data.py): `collect_data.py`
- [Hand features](https://github.com/xiangg67/naruto-jutsu/blob/main/features.py): `features.py`
- [Hand samples](https://github.com/xiangg67/naruto-jutsu/blob/main/data/seals.csv): `data/seals.csv`
- [Hand classifier training](https://github.com/xiangg67/naruto-jutsu/blob/main/train.py): `train.py`

### Seal detector

- [Seal photo capture](https://github.com/xiangg67/naruto-jutsu/blob/main/capture_images.py): `capture_images.py`
- [Photo labeling](https://github.com/xiangg67/naruto-jutsu/blob/main/label_images.py): `label_images.py`
- **Raw seal photos**
- [YOLO dataset preparation](https://github.com/xiangg67/naruto-jutsu/blob/main/prepare_dataset.py): `prepare_dataset.py`
- [YOLO training](https://github.com/xiangg67/naruto-jutsu/blob/main/train_yolo.py): `train_yolo.py`
- [Seal class names](https://github.com/xiangg67/naruto-jutsu/blob/main/seals.py): `seals.py`

### Models and media

- [Hand classifier model](https://github.com/xiangg67/naruto-jutsu/blob/main/models/seal_classifier.pkl): `models/seal_classifier.pkl`
- [YOLO seal model](https://github.com/xiangg67/naruto-jutsu/blob/main/models/seal_yolo.pt): `models/seal_yolo.pt`
- [Game audio](https://github.com/xiangg67/naruto-jutsu/tree/main/assets): `assets`

### Other components

- **Player**
- **Webcam**

## Connections

- Player → Webcam: poses for
- Webcam → Game runtime: supplies frames (evidence: `main.py`)
- Game runtime → YOLO seal model: detects seals (evidence: `main.py`)
- Game runtime → Hand classifier model: classifies hands
- Game runtime → Jutsu sequences: updates (evidence: `main.py`)
- Jutsu sequences → Game runtime: returns jutsu (evidence: `main.py`)
- Game runtime → Visual effects: runs effects (evidence: `main.py`)
- Game runtime → Shadow clones: renders clones (evidence: `main.py`)
- Game runtime → Game audio: plays sounds (evidence: `main.py`)
- Player → Hand sample capture: records poses (evidence: `collect_data.py`)
- Hand sample capture → Hand features: extracts features (evidence: `collect_data.py`)
- Hand sample capture → Hand samples: writes samples (evidence: `collect_data.py`)
- Hand classifier training → Hand samples: reads samples (evidence: `train.py`)
- Hand classifier training → Hand features: uses feature columns (evidence: `train.py`)
- Hand classifier training → Hand classifier model: saves model (evidence: `train.py`)
- Player → Seal photo capture: makes seal poses (evidence: `capture_images.py`)
- Seal photo capture → Raw seal photos: saves photos (evidence: `capture_images.py`)
- Photo labeling → Raw seal photos: labels photos (evidence: `label_images.py`)
- Photo labeling → Seal class names: uses class names (evidence: `label_images.py`)
- YOLO dataset preparation → Raw seal photos: arranges photos (evidence: `prepare_dataset.py`)
- YOLO dataset preparation → Seal class names: writes class mapping (evidence: `prepare_dataset.py`)
- YOLO dataset preparation → YOLO training: provides training data
- YOLO training → YOLO seal model: trains detector
