This project focuses on the use of data augmentation techniques with popular machine learning frameworks, including TensorFlow, PyTorch, and OpenCV. Data augmentation is an essential step in the preprocessing pipeline of machine learning models, particularly for image classification tasks, because it improves model generalization by artificially expanding the training dataset.
In Question 3, we look at how data augmentation is implemented with two popular machine learning (ML) frameworks: TensorFlow and PyTorch. The ImageDataGenerator class in TensorFlow allows for the application of a variety of image transformations. Similarly, PyTorch includes the transforms module, which enables advanced image manipulation techniques. By applying these tools to the COTS (Common Objects of a Traveling Scientist) dataset, we show how effective each framework is at generating augmented data. The task entails creating Jupyter Notebooks for both frameworks, and producing multiple augmented images per input. The results are then saved and analyzed using comparative metrics to determine the differences with the original images.
In Question 4, we look at how to implement data augmentation techniques with OpenCV. Unlike TensorFlow and PyTorch, OpenCV requires a more manual approach to transformations. This question addresses both photometric and geometric distortions, including brightness variation, contrast adjustment, rotation, saturation, shearing and translation. We use these techniques on the same subset of the COTS dataset as in Question 3, resulting in multiple augmented images per input. The goal is to compare OpenCV results to TensorFlow and PyTorch results, which will provide insights into the practical application and effectiveness of custom augmentation implementations.
Data augmentation is an important technique in the field of machine learning, especially for image classification. It entails creating new training examples by applying various transformations to the original dataset, thereby increasing its size and variability without collecting additional data. This process improves the generalization capabilities of machine learning models, making them more resistant to variations in input data and less prone to overfitting.
- Python 3.x
- Python libraries:
os
,shutil
,cv2
,matplotlib
,numpy
,ImageDataGenerator
,Image from PIL
,shutil
,re
,pandas
,seaborn
,SSIM
,read_image
&write_jpeg
- Important libraries (auto-install):
tensorflow
,structural_similarity from skimage.metrics
,torch
&pytorch-ignite
Clone the repository:
git clone https://github.com/AFLucas-UOM/ARI2129-Group-Project-Part-B.git
-
Navigate to the project directory:
cd ARI2129-Group-Project-Part-B
-
For Question 3, open the Jupyter Notebooks for TensorFlow and PyTorch:
jupyter notebook "Question 3/1. TensorFlow/Q3-a.ipynb" jupyter notebook "Question 3/2. PyTorch/Q3-b.ipynb"
-
For Question 4, open the Jupyter Notebook for OpenCV:
jupyter notebook "Question 4/1. JupyterNotebook & PDF/Q4.ipynb"
-
Follow the instructions in each notebook to run the cells and generate augmented images.
This project was developed as part of an academic assignment. Unit: ARI2129
at the University of Malta
.
- TensorFlow implementation (question 3-a): Andrea Filiberto Lucas
- PyTorch implementation (questions 3-b): Thomas Koppens
- OpenCV implementation (question 4): Sean David Muscat
For any inquiries or feedback, please contact Andrea Filiberto Lucas, Sean David Muscat & Thomas Koppens