Skip to content

This repository demonstrates data augmentation techniques using TensorFlow, PyTorch, and OpenCV to enhance image classification. It includes Jupyter Notebooks with practical applications on the COTS dataset and a comparative analysis of the results.

Notifications You must be signed in to change notification settings

AFLucas-UOM/ARI2129-Group-Project-Part-B

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ARI2129-Group-Project-Part-B

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.

Introduction

Question 3: Data Augmentation in Mainstream Machine Learning Frameworks

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.

Question 4: Implementing Data Augmentation Techniques Using OpenCV

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.

Motivation:

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.

Getting Started

Prerequisites

  • 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

Installation

Clone the repository:

git clone https://github.com/AFLucas-UOM/ARI2129-Group-Project-Part-B.git

Usage

  1. Navigate to the project directory:

    cd ARI2129-Group-Project-Part-B
  2. 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"
  3. For Question 4, open the Jupyter Notebook for OpenCV:

    jupyter notebook "Question 4/1. JupyterNotebook & PDF/Q4.ipynb"
  4. Follow the instructions in each notebook to run the cells and generate augmented images.

Additional Resources

Acknowledgments

This project was developed as part of an academic assignment. Unit: ARI2129 at the University of Malta.

Distribution of Work

Contact

For any inquiries or feedback, please contact Andrea Filiberto Lucas, Sean David Muscat & Thomas Koppens

About

This repository demonstrates data augmentation techniques using TensorFlow, PyTorch, and OpenCV to enhance image classification. It includes Jupyter Notebooks with practical applications on the COTS dataset and a comparative analysis of the results.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published