How pranavphoenix/wavemix works
Project Type and Purpose
• This is an open-source Python library (“wavemix”) for resource-efficient computer-vision tasks: image classification, semantic segmentation, and single-image super-resolution.
• It provides core neural architectures (WaveMix and WaveMix-Lite) based on 2D discrete wavelet transforms, example scripts for various datasets, and pretrained model weights.
File Structure Analysis
• Top-level folders:
• Image_Classification, Semantic_Segmentation, Image_Super_Resolution – example/training scripts for each task.
• Saved_weights – pretrained model checkpoints organized by dataset.
• wavemix/ – core Python package implementing the WaveMix architectures:
– classification.py
– SemSegment.py
– sisr.py
– waveblock modules (in __init__.py or submodules)
• Other files: setup.py for packaging, README.md for project description, LICENSE.
README Insights
• Describes three main use-cases: classification, segmentation, super-resolution.
• Lists dependencies (PyTorch), installation, usage examples for each task.
Main Components
a. User Applications / Scripts
• Example scripts under Image_Classification, Semantic_Segmentation, Image_Super_Resolution.
• They handle dataset loading, model instantiation, training/inference loops, evaluation.
b. Core Library (“wavemix” package)
• Task-specific modules: classification.py, SemSegment.py, sisr.py.
• Shared WaveMix blocks implementing 2D-DWT token mixing.
• Utilities: initial convolutions, upsampling/deconvolutions, feed-forward MLP layers.
c. External Dependencies
• PyTorch (torch), torchvision or custom dataset loaders.
d. Data Sources
• Datasets (CIFAR-10, ImageNet, Cityscapes, DIV2K, Galaxy10, TinyImageNet, etc.)
• Data augmentation and preprocessing pipelines.
e. Model Weights Store
• Saved_weights directory organizing pretrained checkpoints.
f. Output / Evaluation
• Metrics (accuracy, mIoU, PSNR).
• Inference outputs (class labels, segmentation masks, super-resolved images).
Component Relationships and Data Flow
• Scripts → Core Library: example scripts import wavemix modules.
• Core Library uses WaveMix Blocks to build models.
• Data Loader feeds mini-batches to Model.
• Model produces predictions → loss calculation → backpropagation → updated Model.
• Trained Weights saved to Saved_weights.
• Inference Pipeline loads Saved_weights, runs Model on new images → outputs.
Architectural Patterns and Design Principles
• Modular Package Design: clear separation by task, shared building blocks.
• Plugin-style extensibility: adding new tasks only requires new module + WaveMix parameters.
• Layered Abstraction:
• Data layer (loaders, augmentations)
• Model layer (initial conv → WaveMix blocks → head)
• Training/Evaluation layer (loss, optimizer, metrics)
• Persistence layer (checkpoint saving/loading)
Relevant Technologies and Frameworks
• Python 3.x, PyTorch
• 2D Discrete Wavelet Transform (via PyWavelets or custom implementations)
• Packaging: setuptools (setup.py)