0% found this document useful (0 votes)
2 views

ai project 1

The document outlines a project on image colorization using Python, detailing the roles of team members, system requirements, and project methodology. It describes the use of deep learning techniques, specifically Convolutional Neural Networks (CNNs) and Long Short-Term Memory (LSTM) networks, to enhance grayscale images with color. The project aims for high accuracy and scalability, with potential applications in various fields such as healthcare and e-commerce.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

ai project 1

The document outlines a project on image colorization using Python, detailing the roles of team members, system requirements, and project methodology. It describes the use of deep learning techniques, specifically Convolutional Neural Networks (CNNs) and Long Short-Term Memory (LSTM) networks, to enhance grayscale images with color. The project aims for high accuracy and scalability, with potential applications in various fields such as healthcare and e-commerce.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

ACKNOWLEDGEMENT

I want to convey my heartfelt gratitude to my mentor for their support


and encouragement during the research and writing of this project.
Their expertise in the subject matter greatly contributed to the depth
and quality of the project.
Also, I would like to express my sincere gratitude to our Principal,
Mrs Sadhana Devi, for her unwavering support and encouragement
throughout this project. I am grateful for the opportunity to have
worked on this project under her guidance, and I am confident that my
learning and personal growth have been enriched as a result.
ROLE OF TEAM MEMBERS

1. Team Leader – Abhay Kumar Singh


2. Feasibility study – Aryan pandey
3. Required Analysis – Aryan pandey
4. Data Acquisition – Abhay Kumar Singh
5. Project methodology- shristi Singh
6. Coding – Abhay Kumar Singh
7. Result analysis – Shristi Singh
8. Testing the model -Anuvrat kumar gautam
SYSTEM REQUIREMENTS

OPERATING SYSTEM

● Window 8
● Window 10
● Window 11

RAM (Random Access Memory)

● 4GB

PROCESSOR

● Cross 86
● Cross 85
● Cross 64

SOFTWARE REQUIRED

● Python – IDLE
● Anaconda – Spyder
PROJECT METHODOLOGY

PROJECT TITLE: IMAGE COLOURIZATION BY PYTHON

PROBLEM STATEMENT FOR IMAGE COLOURIZATION:-

The objective of this project is to develop an Image colourizer using deep learning
technique and computer vision (cv).The system generates captions for images by
combining computer vision,numpy library and pre trained models.

This project aims to develop a bot which can non coloured images with:

1. High Accuracy: Generate image which matches colours of the real world.
2. Up scale work: Handle diverse image categories.
3. Efficiency: Provide real-time image colouring.
4. Scalability: Extendable to complex images and can be used by anyone.

PROJECT DESCRIPTION:
This project uses Convolutional Neural Networks (CNNs) for feature extraction from
images and Long Short-Term Memory (LSTM) networks for choosing suitable colours for
images.
Key Features:
1. Image Preprocessing: Resize and normalize images for model input.
2. Feature Extraction: Use pre-trained CV models like colorization_release_v2.caffemodel
and Tensor flow
3. Outcome:The program will display the original grayscale image and the colorized
version side by side.
4. Evaluation: BLEU score for performance metrics.

Facilitates Scalability: Adapt to different scales, from small user groups to large
databases, without significant loss in performance.

4W canvas for image caption generator:


● WHO….?
● Users: Security personnel, businesses, event organizers, app developers, and consumers.

● Stakeholders: Law enforcement agencies, privacy advocates, technology developers, and


regulatory bodies,as well as for normal public.

● WHAT…..?
Product/Service: Python-based Image Caption Generator.
● WHY…..?

Purpose : Enhance accessibility, improve AI-driven applications.


WHEN…..?
● Research & Planning: 1 week
● Design: 1 week
● Development: 1 weeks
● Testing & Debugging: 3 days
IMPLEMENTATION
Libraries Used:
● TensorFlow, Keras: Deep learning frameworks.
● Numpy, Pandas: Data manipulation.
● Matplotlib: Visualization.
● OpenCV: Image processing.
Summary of Key Functions Used:

Model Loading: load_colorization_model() handles the loading of the neural network


model and its parameters.
Image Processing: colorize_image(net, image) processes the grayscale image, applies the
model, and generates the colorized output.
Program Execution: main() serves as the entry point, coordinating the loading of the
model, reading the image, invoking the colorization, and displaying the results.
These functions work together to provide a complete workflow for image colorization
using a pre-trained deep learning model.

Code:
import cv2
import numpy as np
import matplotlib.pyplot as plt

# Load the pre-trained model


def load_colorization_model():
# Load the model files
net = cv2.dnn.readNetFromCaffe('colorization_deploy.prototxt', 'colorization_release.caffemodel')

# Load the cluster centers


pts_in_hull = np.load('pts_in_hull.npy')
net.getLayer(net.getLayerId('class8_ab')).blobs =
[pts_in_hull.astype(np.float32).transpose().reshape(313, 2)]
return net
# Colorize the image
def colorize_image(net, image):
# Convert the image to LAB color space
lab_image = cv2.cvtColor(image, cv2.COLOR_BGR2Lab)
l_channel, a_channel, b_channel = cv2.split(lab_image)

# Resize L channel to 224x224


l_channel_resized = cv2.resize(l_channel, (224, 224))
l_channel_normalized = l_channel_resized.astype(np.float32) / 255.0
l_channel_normalized = l_channel_normalized - 0.5
l_channel_normalized = l_channel_normalized * 2.0

# Prepare the input for the model


net.setInput(cv2.dnn.blobFromImage(l_channel_normalized))

# Forward pass to get the colorization


ab_channel = net.forward()[0, :, :, :].transpose((1, 2, 0))

# Resize the ab channel to the original image size


ab_channel_resized = cv2.resize(ab_channel, (image.shape[1], image.shape[0]))

# Combine L channel with the predicted ab channel


colorized_image = np.zeros(image.shape, dtype=np.float32)
colorized_image[:, :, 0] = l_channel
colorized_image[:, :, 1:] = ab_channel_resized

# Convert back to BGR color space


colorized_image = cv2.cvtColor(colorized_image.astype(np.uint8), cv2.COLOR_Lab2BGR)
return colorized_image

# Main function
def main():
# Load the model
net = load_colorization_model()

# Load a grayscale image


image_path = 'path_to_your_grayscale_image.jpg' # Change this to your image path
gray_image = cv2.imread(image_path)

# Colorize the image


colorized_image = colorize_image(net, gray_image)

# Display the results


plt.figure(figsize=(10, 5))
plt.subplot(1, 2, 1)
plt.title('Grayscale Image')
plt.imshow(cv2.cvtColor(gray_image, cv2.COLOR_BGR2RGB))
plt.axis('off')

plt.subplot(1, 2, 2)
plt.title('Colorized Image')
plt.imshow(cv2.cvtColor(colorized_image, cv2.COLOR_BGR2RGB))
plt.axis('off')
plt.show()

if __name__ == "__main__":
main()

Note- All librarian such as CV2 and numpy are needed to be installed before coding the program

PROJECT OUTCOMES

1. Functional Image Colourizer.


2. Efficient of handling of diverse image datasets.
3. High BLEU score, ensuring accuracy.
4. Scalability for real-world applications.
EXAMPLES AND USE CASES

1. For Black and white images:


o Input: A black and white picture of a dog playing in the park.
o Output:A coloured picture dog is playing in the park
2. Practical Use Case:
o Destroyed images which have lost it colours can get it colours back online
and in visual form.
o Automating content creation for e-commerce platforms.
3. Real-World Application:
o Integration into platforms like chatgpt for making coloured images.
ADDITIONAL CONSIDERATIONS

1. Model Fine-Tuning:
o Transfer learning techniques were used to enhance the model’s accuracy by
fine-tuning pre-trained CNN layers on domain-specific datasets and tested by
Peak Signal-to-Noise Ratio (PSNR) for the image quality Mean Squared
Error (MSE): Calculates the average squared difference between the
generated and ground truth images. Lower values signify better performance.
2. Dataset Used:
o The Kaggle dataset was used for training, which contains over 330,000
images and hosts image colourization task.Additional datasets like
Imagenet ,MIRFLICKR25k and GIT HUB were also experimented with
for comparison and to get testing data also.
3. Challenges Faced:
o Managing large datasets and ensuring optimal GPU utilization.
o Handling ambiguous and complex images where multiple colours can be
equally valid.
4. Future Improvements:
o Incorporating attention mechanisms for more accurate image colouring
o Extending support for making it more easy to use

FUTURE APPLICATIONS

1. Healthcare:
o For making coloured mri scan reports,x-ray reports and scans.
2. E-commerce:
o Automatic artworks can be made by colouring non coloured images and
selling them online.
3. Content Creation:
● Colouring old documentaries
and using old pictures in a coloured form.
REFERENCES
1. TensorFlow Documentation
2. "Deep Learning" by Ian Goodfellow
3. cv2.dnn.readNetFromCaffe('colorization_deploy.prototxt
4. Kaggle dataset for data:
kaggle.com

You might also like