# berkgulay/weather-prediction-from-image architecture

> Architecture diagram of the GitHub repository berkgulay/weather-prediction-from-image, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/berkgulay/weather-prediction-from-image
- Repository: https://github.com/berkgulay/weather-prediction-from-image

## Overview

##### Project type and purpose
- From the file tree and README, this is a machine-learning research project (“Weather Condition Prediction from Image”) implemented in Python.
- It focuses on extracting features from images, training several classifiers (Decision Tree, Random Forest, SVM, Convolutional Neural Network), persisting models, and then running inference (prediction) on new images.

##### File structure
- Top-level scripts:
- CNN_train.py & CNN_test.py – train/test routines for the CNN model
- DT_train.py, RF_train.py, SVM_train.py – training scripts for classical ML models
- predictImages.py – inference pipeline on new images
- Features.py & ImageDescriptor.py – feature-extraction modules
- tools.py – utility functions (e.g., I/O, common routines)
- modelsCNN/ – directory containing saved .h5 CNN model files organized by input size
- No web frontend or backend—this is a standalone data-science pipeline

##### README for additional insights
- The README clarifies the goal (predict weather condition from image), points to dataset links, and shows that multiple label types and feature-extraction methods are evaluated.

##### Detailed checklist for the principal software engineer
- [ ] Define all components and give them short, clear labels
- [ ] Group similar components (e.g., all training scripts) together visually
- [ ] Include technology annotations (e.g., “scikit-learn”, “Keras”) beside each model component
- [ ] Ensure model persistence layers (HDF5 vs pickle) are distinct and labeled
- [ ] Show end-to-end flow from dataset to final predictions

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Sources
    ExternalDrive["External Dataset Storage (Google Drive)"]:::data
    RawImages["Raw Images (.jpg)"]:::data

    %% Data Ingestion & Preprocessing
    DataIngestion["Data Ingestion & Preprocessing"]:::process
    click DataIngestion "https://github.com/berkgulay/weather-prediction-from-image/blob/development/tools.py"

    %% Feature Extraction
    FeatureExtractLow["ImageDescriptor (low-level)"]:::process
    click FeatureExtractLow "https://github.com/berkgulay/weather-prediction-from-image/blob/development/ImageDescriptor.py"
    FeatureExtractHigh["Features (aggregation)"]:::process
    click FeatureExtractHigh "https://github.com/berkgulay/weather-prediction-from-image/blob/development/Features.py"

    %% Model Training
    subgraph "Model Training"
        DT["Decision Tree"]:::process
        click DT "https://github.com/berkgulay/weather-prediction-from-image/blob/development/DT_train.py"
        RF["Random Forest"]:::process
        click RF "https://github.com/berkgulay/weather-prediction-from-image/blob/development/RF_train.py"
        SVM["Support Vector Machine"]:::process
        click SVM "https://github.com/berkgulay/weather-prediction-from-image/blob/development/SVM_train.py"
        CNNTrain["CNN Training"]:::process
        click CNNTrain "https://github.com/berkgulay/weather-prediction-from-image/blob/development/CNN_train.py"
        CNNTest["CNN Evaluation"]:::evaluation
        click CNNTest "https://github.com/berkgulay/weather-prediction-from-image/blob/development/CNN_test.py"
    end

    %% Model Persistence
    subgraph "Model Persistence"
        PickleStore["Pickle Store (Classical Models)"]:::artifact
        HDF5Store100["HDF5 Store size100"]:::artifact
        click HDF5Store100 "https://github.com/berkgulay/weather-prediction-from-image/tree/development/modelsCNN/size100/"
        HDF5Store50["HDF5 Store size50"]:::artifact
        click HDF5Store50 "https://github.com/berkgulay/weather-prediction-from-image/tree/development/modelsCNN/size50/"
    end

    %% Prediction / Inference
    Prediction["Prediction Service"]:::inference
    click Prediction "https://github.com/berkgulay/weather-prediction-from-image/blob/development/predictImages.py"
    Result["Predicted Outputs"]:::inference

    %% Flow Connections
    ExternalDrive --> RawImages
    RawImages --> DataIngestion
    DataIngestion --> FeatureExtractLow
    FeatureExtractLow --> FeatureExtractHigh

    FeatureExtractHigh --> DT
    FeatureExtractHigh --> RF
    FeatureExtractHigh --> SVM
    FeatureExtractHigh --> CNNTrain

    DT --> PickleStore
    RF --> PickleStore
    SVM --> PickleStore

    CNNTrain --> HDF5Store100
    CNNTrain --> HDF5Store50
    HDF5Store100 --> CNNTest
    HDF5Store50 --> CNNTest

    PickleStore --> Prediction
    HDF5Store100 --> Prediction
    HDF5Store50 --> Prediction
    FeatureExtractHigh --> Prediction

    Prediction --> Result

    %% Styles
    classDef data fill:#cce5ff,stroke:#004085,color:#004085;
    classDef process fill:#d4edda,stroke:#155724,color:#155724;
    classDef artifact fill:#fff3cd,stroke:#856404,color:#856404;
    classDef inference fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
    classDef evaluation fill:#f8d7da,stroke:#721c24,color:#721c24;
```
