This project aims to correct pixelated images by utilizing a Convolutional Neural Network (CNN) model and SRGAN model is used to upscale pixelated images to higher resolutions. The project consists of two main parts: training the model and using the trained model to upscale and correct pixelated images.
- Introduction
- Project Structure
- Dependencies
- Dataset
- Model Training
- Upscaling Pixelated Images
- Results
- How to Use
- Contributors
Pixelated images are common in various scenarios, such as low-resolution cameras or privacy-preserving image sharing. This project addresses the challenge of restoring high-quality images from pixelated versions by leveraging deep learning techniques. The project is specifically designed to handle images with a resolution of 1920x1080 pixels, ensuring optimal performance and accuracy for high-definition images.
├── train_model.py # Code for training the model
├── upscaling.py # Code for upscaling and correcting pixelated images
├── README.md # Project documentation
├── /content/train # Directory containing training images
├── /content/test # Directory containing test images
├── /content/Image/Pixelated # Directory containing pixelated images for upscaling
├── /content/Image/Output # Directory for storing output images
To run this project, you will need the following dependencies:
- Python 3.x
- TensorFlow
- NumPy
- Pillow
- Matplotlib
- scikit-learn
You can install the dependencies using pip:
pip install tensorflow numpy pillow matplotlib scikit-learnThe dataset should consist of two main directories:
/content/train: Contains training images with subdirectories for each class (e.g., Non-pixelated and Pixelated).
/content/test: Contains test images with subdirectories for each class.(e.g., Non-pixelated and Pixelated).
Ensure that the dataset is organized properly for the ImageDataGenerator to work correctly.
The train_model.py script is used to train the CNN model. The script performs the following steps:
Defines image dimensions and batch size.
Creates image data generators for training and testing datasets.
Builds a lightweight CNN model for binary classification (non-pixelated vs. pixelated).
Compiles and trains the model.
Evaluates the model and prints the test accuracy.
Saves the trained model and quantizes it for better performance.
Usage
Run the following command to train the model:
python train_model.pyThe upscaling.py script is used to upscale and correct pixelated images using the trained and quantized TFLite model. The script performs the following steps:
Preprocesses the input image.
Loads the TFLite model and allocates tensors.
Invokes the model to process the image.
Saves and plots the super-resolution image.
Usage
Run the following command to upscale pixelated images:
python upscaling.pyThe model is evaluated using test accuracy, F1 Score, Precision, Recall, and Confusion Matrix. The quantized TFLite model size is also displayed for performance comparison.
Prepare the dataset and place it in the appropriate directories (/content/train and /content/test).
Train the model using train_model.py.
Place the pixelated images to be corrected in /content/Image/Pixelated.
Run the upscaling.py script to generate the corrected images in /content/Image/Output.
This project was a collaborative effort by a team of five friends. Each member contributed to different aspects of the project:
Bejisto Joseph.B : Data Collection,Model Architecture and Training.
Kamalesh.B : Model Evaluation and Quantization.
VijayaKumar.M : Upscaling Script and TFLite Integration.
Surya L : Documentation and Results Analysis.
Kovendhan.P : Project Coordination, Code Integration,Testing and GitHub Maintenance.