This project is aiming at achieving respectable accuracy on the cifar10 dataset using Convolutional Neural Networks.
To set up the environment and install all the necessary dependencies, follow these steps:
-
Clone the Repository:
git clone https://github.com/pelagecha/CNN cd CNN -
Create a Virtual Environment:
Create a virtual environment to isolate your project's dependencies. You can use
venvfor this:python -m venv myenv
Replace
myenvwith your preferred name for the virtual environment. -
Activate the Virtual Environment:
-
On Windows:
myenv\Scripts\activate
-
On macOS and Linux:
source myenv/bin/activate
-
-
Install Dependencies:
Install the packages listed in
requirements.txt. Pip will only download and install packages that are not already present in your virtual environment:pip install --upgrade -r requirements.txt
This command ensures that you have the required packages, upgrading them if necessary, and only installing those that are missing.
By following these steps, you will set up your environment and ensure that all dependencies are properly installed.
-
Configure the Training:
-
Dataset Selection: Modify the
dataset_namevariable intraining.pyto choose between"CIFAR10"or"MNIST".dataset_name = "CIFAR10" # Change to "MNIST" for the MNIST dataset
-
Adjust Hyperparameters: The batch size, learning rate, and number of epochs are specified in
datasets.json. You can adjust these values directly indatasets.jsonto fit your needs. Exampledatasets.jsonconfiguration:"CIFAR10": { "batch_size": 256, "learning_rate": 0.001, }
In
training.py, these parameters are loaded as follows:batch_size = settings["batch_size"] lr = settings["learning_rate"] num_epochs = 5
-
-
Run Training:
Execute the script to start training the model:
python3 train.py
The script will handle data loading, model training, and saving the trained model.