A repo for building a CNN from scratch to classify Cats and Dogs in a picture with varying qualities
Dogs vs. Cats Image Classification Dataset
Link
Project ideas and methodology
Link
Tasks monitoring and milestones
Link
Presentation Slides
Link
Start a virtual environment (this requires you to have a python 3.11 installed):
py -3.11 -m venv .venv
Activate the virtual environment (from project root):
.\.venv\Scripts\Activate.ps1
Install the required libraries:
pip install -r requirements.txt
Set up your environment variable
You should have your training and testing data folder
in the structure of
<folder name>
| - train
| - |- dog
| - |- cat
|
| - test
| - |- dog
| - |- cat
your .env should look like
input_train_data_location="<path to the whole train dataset>"
input_test_data_location="<path to the whole test dataset>"
output_train_data_location="<path to the filtered train dataset>"
output_test_data_location="<path to the filtered test dataset>"
We used file size as the filter (keeping size > 16 kB)
run
python .\preprocessing.py
you should see a filtered dataset folder being created, this would be the data for the model to train
Train the model using the training dataset,
the script will automatically split the training set into a 80%, 20% segments
and use the 20% segment as validation set.
Running the training script might take longer time if running on GPU,
I waited about 1 hour for my laptop to train on the dataset
python .\infr_EfficientNet.py
Once done, you should see a model.pth in the project root,
that is the trained weight
Test your trained efficientnet instance by running
python .\use_trained_eff_net.py
the end result should be Dog (1.0000), where 1.0000 represents the probabilty