LeNet-MiniPlaces is a project that implements the LeNet-5 Convolutional Neural Network (CNN) architecture and customizes it for the MiniPlaces scene recognition dataset. This project explores deep learning techniques using PyTorch and involves training and evaluating models under different configurations.
-
Goal:
- Implement and train the LeNet-5 CNN architecture.
- Understand trainable parameters and explore how hyperparameters affect training outcomes.
- Design a custom CNN for scene recognition using the MiniPlaces dataset.
-
Dataset: MiniPlaces, a subset of the Places2 dataset, containing:
- 100,000 training images
- 10,000 validation images
- 10,000 testing images
- Images are resized to 32x32 for training efficiency.
-
Technologies:
- Python
- PyTorch
- MiniPlaces dataset
- Conda for environment management
git clone https://github.com/your_username/LeNet-MiniPlaces.git
cd LeNet-MiniPlaces- Install Miniconda.
- Create and activate the project environment:
conda create -n lenet-miniplaces pytorch torchvision torchaudio tqdm cpuonly -c pytorch conda activate lenet-miniplaces
- Download the dataset (MiniPlaces) from here or use the provided backup link.
- Unpack the dataset:
tar -xvf data.tar.gz mkdir -p data/miniplaces && mv images/* data/miniplaces/
- Update the
MiniPlacesconstructor todownload=Falsein all scripts.
The LeNet-5 architecture is implemented as follows:
- Conv Layer 1: 6 output channels, kernel size 5, stride 1, ReLU activation, MaxPooling (2x2).
- Conv Layer 2: 16 output channels, kernel size 5, stride 1, ReLU activation, MaxPooling (2x2).
- Fully Connected Layers:
- FC1: Output dimension 256, ReLU activation.
- FC2: Output dimension 128, ReLU activation.
- FC3: Output dimension = 100 (number of classes).
Train the model under the following configurations:
- Default settings
- Batch sizes: 8, 16
- Learning rates: 0.05, 0.01
- Epochs: 20, 5
Scripts:
- Training:
train_miniplaces.py - Evaluation:
eval_miniplaces.py
Train the model:
python train_miniplaces.pyEvaluate the model:
python eval_miniplaces.py --load ./outputs/model_best.pth.tarResults are saved in results.txt.
- Implementation of a foundational CNN architecture (LeNet-5).
- Support for training with adjustable hyperparameters.
- Accurate validation metrics.
- Customizable network design for scene recognition.
LeNet-MiniPlaces/
│
├── data/ # Dataset directory
├── outputs/ # Model checkpoints and evaluation outputs
├── train_miniplaces.py # Training script
├── eval_miniplaces.py # Evaluation script
├── dataloader.py # Data loading utilities
├── student_code.py # Core LeNet-5 implementation
└── README.md # Project documentation
- LeNet-5: Gradient-Based Learning Applied to Document Recognition
- MiniPlaces Dataset: MiniPlaces Dataset
- PyTorch: PyTorch Documentation
If you encounter issues or have questions, feel free to open an issue on this repository!
Happy Learning!