Cs Projects
Cs Projects
2024 – 2025
COMPUTER SCIENCE
PROJECT REPORT
Submitted by
TAMZHILSELVAN.V
1
CERTIFICATE
PRINCIPAL
2
ACKNOWLEDGEMENT
First, I would like to thank the Almighty for all the blessings
which are endowed upon me. With profound sense of indebtedness, I
thank my parents and friends for their immense love and support to do
the project
I am grateful to thank our Principal Mr. Ravula Vara Praveen
for his inspiration and permission to undergo the project.
I express my immense gratitude to my subject teacher
Mr. T.VENKATESAN, Business studies Faculty, who always gave
valuable suggestions and guidance for completion of my project.
He helped me to understand and remember the important details
of the project.
I would like to take this opportunity to record my gratitude to all
those persons who have enthusiastically assisted me during all the
phases of project.
TAMZHILSELVAN.V
XII - LOTUS
3
CONTENT
1 Introduction 5
9 SOURCE CODE 20
11 Bibliography 25
4
INTRODUCTION
5
Key Concepts of Age and
Gender Detector
1. Computer Vision
Computer vision involves enabling machines to interpret and
analyze visual data like images and videos. In this project,
computer vision techniques are used to detect faces in
images or live video feeds.
3. Face Detection
4. Age Prediction
6
5. Gender Prediction
6. Image Preprocessing
7. Output Visualization
7
Tools and Libraries for Age
and Gender Detector
1. Programming Language
Python: The project is implemented using Python, a
versatile and beginner-friendly programming language
widely used for AI and computer vision applications.
2. Libraries Used
a. OpenCV (Open Source Computer Vision Library)
Used for image and video processing.
Key functionalities:
o Face detection using pre-trained deep learning
models.
o Drawing rectangles and labels on detected faces
o Installation :
b. NumPy
A library for numerical computations and data
manipulation.
Used for handling arrays and scaling data.
Installation
pip install numpy
8
c. Pre-trained Deep Learning Models (Caffe
Framework)
Pre-trained models are used to avoid training from scratch,
making the project implementation efficient.
Face Detection Model:
o Files: deploy.prototxt and
res10_300x300_ssd_iter_140000.caffe
model.
o Detects faces in an image or video feed.
age_net.caffemodel.
o Predicts age groups like (0-2), (15-20), (25-
32).
o
Gender Prediction Model:
o Files: gender_deploy.prototxt and
gender_net.caffemodel.
o Classifies gender as Male or Female.
mandatory).
Software:
o Python IDE (e.g., PyCharm, Jupyter Notebook, or
VS Code).
o Necessary Python libraries installed via pip.
9
workings of the Age and
Gender Detector
1. Input Data
The program can process:
Live video feed from a webcam.
Static images uploaded by the user.
2. Preprocessing
The input image is resized to a standard size suitable for
the deep learning models.
A blob (Binary Large Object) is created from the image
using OpenCV’s cv2.dnn.blobFromImage.
o Adjusts size, scales pixel values, and performs mean
subtraction.
3. Face Detection
A pre-trained Caffe SSD (Single Shot MultiBox Detector)
model is used to locate faces in the input image.
Steps:
1. The face detection model outputs bounding boxes
for detected faces.
2. Confidence scores are checked to filter out weak
detections (e.g., confidence > 0.5).
3. Each detected face is cropped and passed to the
next stage for predictions.
10
4. Age and Gender Prediction
Gender Prediction:
o The cropped face is passed to the gender prediction
5. Output Visualization
For each detected face, the program overlays:
1. A rectangle around the face.
2. A label displaying the predicted age group and
gender.
The processed frame is displayed in a window, updating
in real-time for video feeds.
11
Applications of Age and
Gender Detector
2. Targeted Advertising
Helps advertisers customize campaigns based on the
demographic profile (age and gender) of their audience.
For example, displaying ads for toys to children or
cosmetics to women in retail stores or malls.
3. Retail Analytics
Used in retail environments to gather insights on
customer demographics.
Helps store owners understand their customer base and
improve product placement or services.
12
5. Healthcare Applications
Used in telemedicine to gather basic demographic
information.
Helps in early detection of age-related conditions like
wrinkles, skin issues, or other visible health factors.
13
Input for Age and Gender
Detector
14
3. Video File Input
Description:
A pre-recorded video file (e.g., .mp4, .avi) is processed
frame by frame to detect faces and predict their age and
gender.
How It Works:
The video file is read using
cv2.VideoCapture("video_path.mp4").
Each frame is processed similarly to the webcam feed.
Advantages:
Useful for testing on a larger dataset or controlled
scenarios.
4. Input Specifications
Image Requirements:
o Formats: .jpg, .png, .bmp, etc.
detection accuracy.
Video Requirements:
o Formats: .mp4, .avi, .mkv, etc.
detection.
15
Output of the Age and Gender
Detector
1. Visual Output
The project generates a processed image or video feed with
the following:
Bounding Boxes:
Rectangles drawn around the detected faces in the
input.
Predicted Labels:
Text labels showing the predicted age group and gender
for each detected face.
2. Textual Output
The labels displayed for each detected face include:
16
Output in Different Input Scenarios
"Female, (15-20)".
c. Pre-Recorded Video
Each frame of the video is processed similarly to the
webcam feed.
The video can be saved with overlaid predictions for
later review.
17
Sample Output Demonstration
Here’s an example of what the output might look like:
1. Detected Face 1:
o Bounding Box: Drawn around the face.
2. Detected Face 2:
o Bounding Box: Drawn around another face.
Output Characteristics
1) Real-Time Processing:
Dynamic predictions for live webcam or video input.
2) Accurate Predictions:
Results are dependent on the quality of the input image
and the pre-trained models.
3) Visual Clarity: Clean and user-friendly display with
bounding boxes and text labels.
18
Steps to Run the Code
Install Required Libraries:
Install the necessary Python libraries using pip:
pip install opencv-python numpy
o res10_300x300_ssd_iter_140000.caffe
model
o
Age Prediction:
o age_deploy.prototxt
o age_net.caffemodel
Gender Prediction:
o gender_deploy.prototxt
o gender_net.caffemodel
Ensure all the model files are in the same directory as your
Python script.
19
SOURCE CODE
import cv2
import numpy as np
for i in range(detections.shape[2]):
confidence = detections[0, 0, i, 2]
if confidence > confidence_threshold:
box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
(x1, y1, x2, y2) = box.astype("int")
20
faces.append((x1, y1, x2, y2))
return faces
# Gender prediction
gender_net.setInput(blob)
gender_preds = gender_net.forward()
gender = GENDER_LIST[gender_preds[0].argmax()]
# Age prediction
age_net.setInput(blob)
age_preds = age_net.forward()
age = AGE_LIST[age_preds[0].argmax()]
cap.release()
cv2.destroyAllWindows()
if __name__ == "__main__":
main()
22
Conclusion of the Age and
Gender Detector
Key Takeaways:
Integration of Advanced Technologies:
The project highlights the practical implementation of
technologies such as:
24
BIBLIOGRAPHY
1) https://www.vedantu.com/
2) https://byjus.com/
3) https://www.wikipedia.org/
4) https://www.learncbse.in/
25