# asasori/pbl5 architecture

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

- Interactive diagram: https://gitdiagram.com/asasori/pbl5
- Repository: https://github.com/asasori/pbl5

## Overview

##### Main Components

A. Data Processing Layer
- Input Processing (Camera/Video Stream)
- Frame Processing (30-frame and realtime processing paths)
- Data Collection and Preprocessing (indicated by Ipynb/collect_data_optional.ipynb)

B. Model Architecture Layer
Multiple model implementations should be shown:
- 1D CNN + Transformer Models (various versions)
- LSTM Models
- Uniformer Models

C. Streaming System
- Real-time streaming components
- 30-frame streaming components
- Client-Server Architecture

**[Input Layer] → [Processing Layer] → [Inference Layer] → [Output Layer]**

- ┌─ 1D CNN + Transformer Branch
- LSTM Branch
- Uniformer Branch

##### Key Elements to Highlight

- Blue: Input/Output components
- Green: Processing components
- Yellow: Model components
- Gray: Support services

- Rectangles: Processing units
- Diamonds: Decision points

##### Important Architectural Details

- Client-server architecture for both streaming implementations:
- [Client] ←→ [Server Handler] ←→ [Server]

- Model versioning system:
- [Model Repository]
- Train 8
- Train 9
- Train 10...13

##### Implementation Notes

- Version numbers for different model implementations
- Frame processing paths (30-frame vs. realtime)

##### Technical Specifications

- Model architectures (1DCNN_Transformer, LSTM, Uniformer)
- Frame processing specifications (15F, 30F)
- Dimension information (dim192, dim256, etc.)
- Input/Output formats

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef input fill:#a8d1f0,stroke:#333
    classDef processing fill:#90EE90,stroke:#333
    classDef model fill:#FFE5B4,stroke:#333
    classDef output fill:#FFB6C1,stroke:#333
    classDef server fill:#D3D3D3,stroke:#333

    %% Input Layer
    subgraph Input
        Camera["Camera Input"]:::input
        VideoFile["Video File Input"]:::input
        StreamInput["Streaming Input"]:::input
    end

    %% Data Processing Layer
    subgraph Processing
        CamTest["Camera Testing"]:::processing
        DataCollect["Data Collection"]:::processing
        FrameProc["Frame Processing"]:::processing
        DataConfig["Data Configuration"]:::processing
    end

    %% Model Layer
    subgraph Models
        subgraph CNN_Trans["1D CNN + Transformer Models"]
            Train8["Train 8"]:::model
            Train9["Train 9"]:::model
            Train10["Train 10"]:::model
            Train11["Train 11"]:::model
            Train12["Train 12"]:::model
            Train13["Train 13"]:::model
        end
        LSTM["LSTM Model"]:::model
        Uniformer["Uniformer Model"]:::model
    end

    %% Streaming Systems
    subgraph Streaming
        subgraph RealTime["Real-time Streaming"]
            RTClient["Client"]:::server
            RTHandler["Handler"]:::server
            RTServer["Server"]:::server
        end
        subgraph Frame30["30-Frame Streaming"]
            F30Client["Client"]:::server
            F30Handler["Handler"]:::server
            F30Server["Server"]:::server
        end
    end

    %% Prediction Systems
    subgraph Prediction
        RT_Pred["Real-time Prediction"]:::output
        F30_Pred["30-Frame Prediction"]:::output
    end

    %% Connections
    Camera --> CamTest
    Camera & VideoFile & StreamInput --> DataCollect
    DataCollect --> FrameProc
    FrameProc --> |"30-Frame"| F30_Pred
    FrameProc --> |"Real-time"| RT_Pred
    DataConfig --> Processing

    Models --> Prediction
    RTClient --> RTHandler --> RTServer
    F30Client --> F30Handler --> F30Server

    %% Click Events
    click CamTest "https://github.com/ASasori/PBL5/blob/main/check_cam.py"
    click DataCollect "https://github.com/ASasori/PBL5/blob/main/Ipynb/collect_data_optional.ipynb"
    click LSTM "https://github.com/ASasori/PBL5/tree/main/models/lstm_model/"
    click Train8 "https://github.com/ASasori/PBL5/tree/main/models/model_train_8/"
    click Train9 "https://github.com/ASasori/PBL5/tree/main/models/model_train_9/"
    click Train10 "https://github.com/ASasori/PBL5/tree/main/models/model_train_10/"
    click Train11 "https://github.com/ASasori/PBL5/tree/main/models/model_train_11/"
    click Train12 "https://github.com/ASasori/PBL5/tree/main/models/model_train_12/"
    click Train13 "https://github.com/ASasori/PBL5/tree/main/models/model_train_13/"
    click Uniformer "https://github.com/ASasori/PBL5/tree/main/models/uniformer_model/"
    click RTClient "https://github.com/ASasori/PBL5/blob/main/streaming_realtime/client.py"
    click RTServer "https://github.com/ASasori/PBL5/blob/main/streaming_realtime/server.py"
    click RTHandler "https://github.com/ASasori/PBL5/blob/main/streaming_realtime/server_handler.py"
    click F30Client "https://github.com/ASasori/PBL5/blob/main/streaming_on30frame/client.py"
    click F30Server "https://github.com/ASasori/PBL5/blob/main/streaming_on30frame/server.py"
    click F30Handler "https://github.com/ASasori/PBL5/blob/main/streaming_on30frame/server_handler.py"
    click RT_Pred "https://github.com/ASasori/PBL5/blob/main/predict_realtime.py"
    click F30_Pred "https://github.com/ASasori/PBL5/blob/main/predict_on_30frame.py"
    click DataConfig "https://github.com/ASasori/PBL5/blob/main/label_list.json"

    %% Legend
    subgraph Legend
        L1["Input Components"]:::input
        L2["Processing Components"]:::processing
        L3["Model Components"]:::model
        L4["Output Components"]:::output
        L5["Server Components"]:::server
    end
```
