# jj-quesada/bct architecture

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

- Interactive diagram: https://gitdiagram.com/jj-quesada/bct
- Repository: https://github.com/jj-quesada/bct

## Overview

##### Main Components

A. Input Processing Layer
- Video Input Component (from assets/videos)

B. Core Processing Pipeline
1. Detection System
- Ball Handler Detection Module
- BPDv1 Detection Module
2. Segmentation System
- SegmentV1 Module
- SegmentV2 Module
3. Homography Processing Module

C. Model Management
- YOLO Base Models Repository
- Trained Models Storage
- Training Results Storage

**┌─────────────────────────────────────────────┐**
- Input Layer                  │
- ┌─────────────┐           ┌────────────┐  │
- ┴─────────────┴───────────┴────────────┴──┘
- ↓                    ↓
**┌─────────────────────────────────────────────┐**
- Processing Pipeline              │
- ┌─────────────┐   ┌────────────────────┐  │
- Detection  │←→ │    Homography      │  │
- System    │   │    Processing      │  │
- ┘   └────────────────────┘  │
- ↕                     ↕            │
- ┌─────────────┐                           │
- Segmentation │                           │
- System    │                           │
- ┘                           │
- ┘
- ↑                    ↑
**┌─────────────────────────────────────────────┐**
- Model Repository                 │
- ┌─────────────┐           ┌────────────┐  │
- YOLO Models  │           │Training    │  │
- Results     │  │
- ┴─────────────┴───────────┴────────────┴──┘

##### Detailed Component Specifications

A. For each detection model:
- Input resolution
- Specify YOLO version (YOLOv11n)
- Connection to training results

B. For the segmentation models:
- Both versions (segmentv1 and segmentv2)
- Connection to base segmentation model

C. For the homography component:
- Transformation flow

##### Technical Details to Highlight

- YOLO model architecture (YOLOv11n base)
- Multiple detection and segmentation model versions
- Training pipeline flow
- Video processing pipeline
- Court mapping and transformation process

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Input Layer
    subgraph Input
        VI[Video Input]
        CD[Court Diagrams]
    end
    click VI "https://github.com/jj-quesada/BCT/tree/main/assets/videos/"
    click CD "https://github.com/jj-quesada/BCT/tree/main/assets/court_diagrams/"

    %% Processing Pipeline
    subgraph Pipeline
        %% Detection System
        subgraph Detection
            BH[Ball Handler Detection]
            BPD[BPDv1 Detection]
        end
        click BH "https://github.com/jj-quesada/BCT/blob/main/yolo_models/detection/ballhandler.pt"
        click BPD "https://github.com/jj-quesada/BCT/blob/main/yolo_models/detection/bpdv1.pt"

        %% Segmentation System
        subgraph Segmentation
            SV1[SegmentV1]
            SV2[SegmentV2]
        end
        click SV1 "https://github.com/jj-quesada/BCT/blob/main/yolo_models/segmentation/segmentv1.pt"
        click SV2 "https://github.com/jj-quesada/BCT/blob/main/yolo_models/segmentation/segmentv2.pt"

        %% Homography
        HP[Homography Processing]
        click HP "https://github.com/jj-quesada/BCT/blob/main/homography.ipynb"
    end

    %% Model Repository
    subgraph Models
        YB[YOLO Base Models]
        YD[Base YOLO Detection]
        YS[Base YOLO Segmentation]
        TR[Training Results]
    end
    click YB "https://github.com/jj-quesada/BCT/tree/main/yolo_models/base_models/"
    click YD "https://github.com/jj-quesada/BCT/blob/main/yolo_models/base_models/yolo11n.pt"
    click YS "https://github.com/jj-quesada/BCT/blob/main/yolo_models/base_models/yolo11n-seg.pt"
    click TR "https://github.com/jj-quesada/BCT/tree/main/training_results/"

    %% Notebooks
    subgraph Notebooks
        BCT[BCT Main]
        DT["Detection & Tracking"]
    end
    click BCT "https://github.com/jj-quesada/BCT/blob/main/BCT.ipynb"
    click DT "https://github.com/jj-quesada/BCT/blob/main/detection-and-tracking.ipynb"

    %% Connections
    VI --> Detection
    CD --> HP
    Detection <--> HP
    Detection <--> Segmentation
    YB --> Detection
    YB --> Segmentation
    TR --> Detection
    TR --> Segmentation
    Detection --> DT
    Segmentation --> DT
    HP --> BCT
    DT --> BCT

    %% Styling
    classDef input fill:#a8d1ff
    classDef processing fill:#90EE90
    classDef models fill:#ffb366
    classDef notebooks fill:#e6e6e6

    class VI,CD input
    class BH,BPD,SV1,SV2,HP processing
    class YB,YD,YS,TR models
    class BCT,DT notebooks

    %% Legend
    subgraph Legend
        L1[Input Components]:::input
        L2[Processing Modules]:::processing
        L3[Model Components]:::models
        L4[Notebooks]:::notebooks
    end
```
