# bigballon/cifar-zoo architecture

> Architecture diagram of the GitHub repository bigballon/cifar-zoo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bigballon/cifar-zoo
- Repository: https://github.com/bigballon/cifar-zoo

## Overview

##### Project Type Analysis
This is a machine learning research project specifically focused on implementing and comparing various CNN architectures and training techniques for image classification on CIFAR datasets.

##### Main Components

A. Core Components:
- Model Architecture Module
- Training Pipeline
- Evaluation Pipeline
- Data Processing
- Configuration Management
- Utilities

B. Key Architectural Elements:
- Multiple CNN Model Implementations
- Training Enhancement Methods
- Learning Rate Schedulers
- Experiment Management

##### Top-Level Organization

**[Data Input Layer]**

**[Configuration Management]**

**[Training Pipeline] ←→ [Model Zoo] ←→ [Enhancement Methods]**

**[Evaluation Pipeline]**

**[Results & Logging]**

##### Component Details

a) Data Input Layer:
- CIFAR-10/100 dataset input
- Data augmentation methods (RandomCrop, RandomHorizontalFlip, Normalize)
- Additional augmentation options (Cutout, Mixup)

b) Model Zoo (models/):
- Architectures by families:
- Classic CNNs (LeNet, AlexNet, VGG)
- Modern Architectures (ResNet, DenseNet)
- Attention-based (SE-ResNext, CBAM, BAM)
- Specialized Variants (Shake-Shake, GENet, SKNet)

c) Training Pipeline:
- Multi-GPU training support
- Learning rate schedulers:
- Step Decay
- Cosine Annealing
- Hyperbolic-Tangent Decay

d) Enhancement Methods:
- Regularization techniques:
- Cutout
- Mixup
- Shake-Shake

e) Configuration Management:
- YAML config system
- Experiment organization
- Hyperparameter management

f) Monitoring & Evaluation:
- Tensorboard integration
- Logging system
- Evaluation metrics

##### Important Relationships to Highlight

- How experiments/ directory structure maps to different model configurations
- Relationship between training pipeline and enhancement methods
- Demonstrate how configuration management affects all components
- Evaluation feedback loop

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Data Input Layer"
        DataInput["CIFAR-10/100 Datasets"]
        DataAug["Data Augmentation"]
        DataInput --> DataAug
    end

    subgraph "Configuration Management"
        Config["Configuration System"]:::config
        ExpMgmt["Experiment Management"]:::config
        HyperParams["Hyperparameter Control"]:::config
        Config --> ExpMgmt
        Config --> HyperParams
    end

    subgraph "Model Zoo"
        direction TB
        ClassicCNN["Classic CNNs"]:::models
        ModernCNN["Modern CNNs"]:::models
        AttentionCNN["Attention-based CNNs"]:::models
        SpecialCNN["Specialized CNNs"]:::models

        subgraph "Classic"
            LeNet["LeNet"]:::model
            AlexNet["AlexNet"]:::model
            VGG["VGG"]:::model
        end

        subgraph "Modern"
            ResNet["ResNet"]:::model
            DenseNet["DenseNet"]:::model
            ResNext["ResNext"]:::model
        end

        subgraph "Attention"
            CBAM["CBAM-ResNext"]:::model
            SENet["SENet"]:::model
        end

        subgraph "Specialized"
            ShakeShake["Shake-Shake"]:::model
            GENet["GENet"]:::model
            SKNet["SKNet"]:::model
        end

        ClassicCNN --> LeNet & AlexNet & VGG
        ModernCNN --> ResNet & DenseNet & ResNext
        AttentionCNN --> CBAM & SENet
        SpecialCNN --> ShakeShake & GENet & SKNet
    end

    subgraph "Training Pipeline"
        Train["Training System"]:::train
        LRScheduler["Learning Rate Schedulers"]:::train
        MultiGPU["Multi-GPU Support"]:::train
        Train --> LRScheduler
        Train --> MultiGPU
    end

    subgraph "Enhancement Methods"
        Cutout["Cutout"]:::enhance
        Mixup["Mixup"]:::enhance
        ShakeReg["Shake-Shake Regularization"]:::enhance
    end

    subgraph "Monitoring & Evaluation"
        Eval["Evaluation System"]:::eval
        Tensorboard["Tensorboard Logging"]:::eval
        Metrics["Evaluation Metrics"]:::eval
        Eval --> Tensorboard
        Eval --> Metrics
    end

    DataAug --> Train
    Config --> Train
    Train <--> Cutout & Mixup & ShakeReg
    Train --> ClassicCNN & ModernCNN & AttentionCNN & SpecialCNN
    Train --> Eval

    %% Click events for component mapping
    click Train "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/train.py"
    click Eval "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/eval.py"
    click ClassicCNN "https://github.com/BIGBALLON/CIFAR-ZOO/tree/master/models/"
    click ModernCNN "https://github.com/BIGBALLON/CIFAR-ZOO/tree/master/models/"
    click AttentionCNN "https://github.com/BIGBALLON/CIFAR-ZOO/tree/master/models/"
    click SpecialCNN "https://github.com/BIGBALLON/CIFAR-ZOO/tree/master/models/"
    click LeNet "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/models/lenet.py"
    click AlexNet "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/models/alexnet.py"
    click VGG "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/models/vgg.py"
    click ResNet "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/models/resnet.py"
    click DenseNet "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/models/densenet.py"
    click ResNext "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/models/resnext.py"
    click CBAM "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/models/cbam_resnext.py"
    click SENet "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/models/senet.py"
    click ShakeShake "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/models/shake_shake.py"
    click GENet "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/models/genet.py"
    click SKNet "https://github.com/BIGBALLON/CIFAR-ZOO/blob/master/models/sknet.py"
    click Config "https://github.com/BIGBALLON/CIFAR-ZOO/tree/master/experiments/"
    click LRScheduler "https://github.com/BIGBALLON/CIFAR-ZOO/tree/master/experiments/cos_htd/"
    click Cutout "https://github.com/BIGBALLON/CIFAR-ZOO/tree/master/experiments/cutout+mixup+cos/"

    %% Styling
    classDef config fill:#f9f,stroke:#333,stroke-width:2px
    classDef models fill:#fcba03,stroke:#333,stroke-width:2px
    classDef model fill:#fcd703,stroke:#333,stroke-width:1px
    classDef train fill:#0373fc,stroke:#333,stroke-width:2px
    classDef eval fill:#03fc90,stroke:#333,stroke-width:2px
    classDef enhance fill:#fc0373,stroke:#333,stroke-width:2px
```
