# alessandrosebastianelli/cnnspecklefilter architecture

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

- Interactive diagram: https://gitdiagram.com/alessandrosebastianelli/cnnspecklefilter
- Repository: https://github.com/alessandrosebastianelli/cnnspecklefilter

## Overview

##### Main Components

a) Data Pipeline Components:
- Input Layer (GRD Data Ingestion)
- Dataset Handler (represented by DatasetHandler.py)
- Data Preprocessing Module
- Utility Functions Layer (utils.py)

b) Model Architecture Components:
- Residual CNN Model (Model.py)
- Multiple Model Variants (as evidenced by different weight files)
- Training Pipeline
- Inference Pipeline

c) Evaluation Components:
- Testing Module (test_models.py)
- Statistical Analysis Component (Stats.ipynb)
- Comparison with Traditional Filters

##### Component Relationships

**[Input Data] → [Dataset Handler] → [Preprocessing]**
- ↓
**[Model Architecture] ← [Weights] → [Training/Inference]**
- ↓
**[Evaluation Metrics] → [Output Results]**

##### Specific Implementation Details

- Blue: Data processing components
- Green: Model components
- Yellow: Evaluation components
- Gray: Storage/weight files

##### Important Elements to Highlight

a) Model Variants:
- Weight file relationships with different noise variations (0.01-0.1 variance)

b) Processing Pipeline:
- Residual CNN architecture as presented in the README image
- Data flow between layers
- Skip connections in the residual architecture

##### Technical Details

- Input Format: 256x256 Sentinel-1 GRD products
- Model Architecture: Residual CNN
- Output Format: Speckle-filtered imagery
- Evaluation Metrics: Edge preservation, statistical characteristics

##### Implementation Notes

- Annotations for key parameters and configurations
- Integration points with external dependencies

Remember to highlight the project's unique aspects, such as:
- Multiple model variants for different noise levels
- Integration with Sentinel-1 data
- Statistical validation components
- Comparison with traditional filtering methods

This will create a comprehensive system design that accurately represents the project's architecture while maintaining clarity and usefulness for development and documentation purposes.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Data_Layer
        Input["Input Data"]:::data
        DataHandler["Dataset Handler"]:::processing
        Preprocess["Preprocessing"]:::processing
        Utils["Utility Functions"]:::processing
    end

    subgraph Model_Layer
        ModelArch["Model Architecture"]:::model
        subgraph Weights["Model Weights"]
            Model12["12-Layer Variant"]:::weights
            Model30["30-Layer Variant"]:::weights
            GaussianVar["Gaussian Noise Variants"]:::weights
        end
    end

    subgraph Training_Layer
        Train["Training Pipeline"]:::training
        Inference["Inference Pipeline"]:::training
    end

    subgraph Evaluation_Layer
        Testing["Testing Module"]:::eval
        Stats["Statistical Analysis"]:::eval
        RealTest["Real Data Testing"]:::eval
        Demo["Demo Interface"]:::eval
    end

    Input --> DataHandler
    DataHandler --> Preprocess
    Utils --> DataHandler
    Utils --> Preprocess
    
    Preprocess --> ModelArch
    ModelArch --> Train
    Weights --> Train
    ModelArch --> Inference
    Weights --> Inference
    
    Train --> Testing
    Inference --> Testing
    Testing --> Stats
    Testing --> RealTest
    RealTest --> Demo

    classDef data fill:#AED6F1
    classDef processing fill:#85C1E9
    classDef model fill:#82E0AA
    classDef training fill:#F8C471
    classDef eval fill:#F1948A
    classDef weights fill:#D7BDE2

    click Input "https://github.com/alessandrosebastianelli/CNNSpeckleFilter/tree/main/GRD_data"
    click DataHandler "https://github.com/alessandrosebastianelli/CNNSpeckleFilter/blob/main/DatasetHandler.py"
    click Utils "https://github.com/alessandrosebastianelli/CNNSpeckleFilter/blob/main/utils.py"
    click ModelArch "https://github.com/alessandrosebastianelli/CNNSpeckleFilter/blob/main/Model.py"
    click Model12 "https://github.com/alessandrosebastianelli/CNNSpeckleFilter/blob/main/weights/new_model_12.h5"
    click Model30 "https://github.com/alessandrosebastianelli/CNNSpeckleFilter/blob/main/weights/new_model_30.h5"
    click Testing "https://github.com/alessandrosebastianelli/CNNSpeckleFilter/blob/main/test_models.py"
    click Stats "https://github.com/alessandrosebastianelli/CNNSpeckleFilter/blob/main/Stats.ipynb"
    click RealTest "https://github.com/alessandrosebastianelli/CNNSpeckleFilter/blob/main/TestRealData.ipynb"
    click Train "https://github.com/alessandrosebastianelli/CNNSpeckleFilter/blob/main/SpeckleFiltering.ipynb"
    click Demo "https://github.com/alessandrosebastianelli/CNNSpeckleFilter/blob/main/Demo.ipynb"

    %% Legend
    subgraph Legend
        L1["Data Components"]:::data
        L2["Processing Components"]:::processing
        L3["Model Components"]:::model
        L4["Training Components"]:::training
        L5["Evaluation Components"]:::eval
        L6["Weight Files"]:::weights
    end
```
