This repository implements an advanced model (ENet) for efficient learning tasks, integrating a custom LA optimizer. This optimizer enhances model performance by leveraging adaptive learning techniques. The project is designed for tasks requiring fast and scalable model training, such as image classification.
- Custom LA Optimizer: Improves learning efficiency by adapting learning rates dynamically during training.
- Modular Codebase: Easily extensible to different models and datasets.
- Docker Support: The project comes with a
Dockerfile
for quick setup and deployment. - Comprehensive Metrics: Evaluation tools for tracking performance across various metrics.
Make sure you have the following installed:
- Python 3.8 or higher
- PyTorch 1.9 or higher
- Other dependencies (see
requirements.txt
)
To install dependencies, run:
pip install -r requirements.txt
-
Train the model:
To train the model using the LA optimizer, run the following command:
python train.py --optimizer LA
-
Test the model:
After training, you can evaluate the model using:
python test.py --model-path <path_to_saved_model>
The LA Optimizer (implemented in LA.py
) is a custom learning rate optimizer designed to adjust the learning rate dynamically based on loss landscapes. Its goal is to achieve faster convergence and improved generalization by balancing learning rate decay and adaptive learning techniques.
lr_init
: Initial learning rate for the optimizer.decay_factor
: Factor by which the learning rate decreases after each epoch.momentum
: Momentum factor to accelerate convergence.
The optimizer can be fine-tuned with the following flags:
--lr_init
: Set the initial learning rate.--momentum
: Control the momentum for smoother learning.--decay_factor
: Define the decay rate for the learning rate over time.
.
├── LA.py # LA optimizer implementation
├── base_model.py # Base model class definition
├── dataload.py # Data loading utilities
├── transforms.py # Data preprocessing utilities
├── train.py # Training script
├── test.py # Testing script
├── models/ # Directory containing model architectures
├── utils.py # Utility functions
├── requirements.txt # Python dependencies
└── README.md # Project documentation
python train.py --epochs 50 --batch_size 32 --optimizer LA --lr 0.01
python train.py --epochs 50 --batch_size 32 --optimizer LA --lr 0.01 --momentum 0.9 --decay_factor 0.95
For easy setup and reproducibility, the project includes a Docker configuration. To build and run the project using Docker:
-
Build the Docker image:
docker build -t enet_la_optimizer .
-
Run the container:
docker run -it enet_la_optimizer
The LA optimizer has shown to improve convergence speed by up to 20% compared to standard optimizers like SGD and Adam. The following metrics can be tracked during training:
- Accuracy
- Loss
- Learning Rate Evolution
Results from the last experiment:
Metric | Value |
---|---|
Accuracy | 94.5% |
Training Time | 2 hours |
We aim to further enhance the LA optimizer by introducing:
- Dynamic momentum adjustment based on gradient variance.
- Learning rate warm-up techniques for smoother convergence in early epochs.