AI in Data Science Project
AI in Data Science Project
FOR
AI PROJECT
COURSE CODE: INT404
SECTION: K21ND
1. Introduction
2. Objective
3. Methodology
4. Different Applications of AI in Data Science
5. Impact of AI in Data Science
6. Use Case Diagram
7. Code
8. Results
9. Future Scope
10.Roles and Responsibilities
11.Gantt Chart
12. Conclusion
13. References
INTRODUCTION
Face mask detection using artificial intelligence (AI) is a computer vision technology that uses
machine learning algorithms to automatically detect whether individuals are wearing face masks
or not. With the ongoing COVID-19 pandemic, face masks have become an important measure
to prevent the spread of the virus. AI-based face mask detection systems have been developed to
assist in enforcing mask-wearing policies in public places such as airports, train stations,
shopping malls, and workplaces.
Face mask detection with AI typically involves training a machine learning model using large
datasets of labeled images of people with and without face masks. The model learns to recognize
patterns and features in the images that distinguish between masked and unmasked faces. Once
trained, the model can be deployed in real-time to analyze live video feeds or images from
cameras to identify individuals who are not wearing masks.
The benefits of using AI for face mask detection include increased accuracy, efficiency, and
consistency compared to manual monitoring. AI systems can process large amounts of data
quickly, making them suitable for monitoring crowded spaces in real-time. They can also operate
24/7 without fatigue, making them ideal for continuous surveillance. AI-powered face mask
detection systems can help reinforce mask-wearing policies, promote public health measures,
and contribute to the overall safety and well-being of individuals in public settings.
However, it's important to note that AI-based face mask detection systems are not perfect and
may have limitations. Factors such as lighting conditions, camera angles, mask types, and
occlusions may affect the accuracy of the detection. Ethical considerations, such as privacy
concerns and potential biases, should also be taken into account when implementing AI-based
technologies.
In conclusion, face mask detection with AI is a promising technology that can help in the
enforcement of mask-wearing policies during the COVID-19 pandemic and beyond. It has the
potential to improve public health measures and contribute to a safer environment in public
spaces. However, careful consideration of ethical concerns and limitations of the technology is
necessary for responsible implementation.
Objective:
The main objective of face mask detection with AI is to automatically identify and differentiate
between individuals who are wearing face masks and those who are not, using computer vision
and machine learning techniques. The specific objectives of face mask detection with AI can
include:
1. Enforcing mask-wearing policies: AI-powered face mask detection systems can help
ensure compliance with mask-wearing policies in public places, such as airports, train stations,
shopping malls, and workplaces. By accurately identifying individuals who are not wearing
masks, the system can trigger alerts or notifications to prompt them to wear masks, or to alert
security personnel for further action.
2. Promoting public health measures: Wearing face masks is an important measure to
prevent the spread of infectious diseases, particularly during pandemics like COVID-19. Face
mask detection with AI can help raise awareness and promote the adoption of this public health
measure by providing real-time feedback on mask-wearing compliance in public settings.
3. Enhancing safety and security: AI-based face mask detection systems can contribute to
the safety and security of individuals in public spaces by identifying potential health risks. By
detecting individuals who are not wearing masks, the system can help identify those who may be
violating mask-wearing policies, potentially posing a risk to others in terms of disease
transmission.
4. Improving efficiency and accuracy: Automating face mask detection with AI can
improve the efficiency and accuracy of monitoring compared to manual methods. AI models can
analyze large amounts of data in real-time, operate 24/7 without fatigue, and provide consistent
results, reducing the need for human intervention and potential human errors.
5. Supporting public health campaigns: AI-powered face mask detection systems can be
used as a tool to support public health campaigns aimed at promoting mask-wearing and
preventing the spread of infectious diseases. By providing real-time data on mask-wearing
compliance, these systems can help assess the effectiveness of public health campaigns and
inform decision-making.
Overall, the objective of face mask detection with AI is to leverage advanced technologies to
enhance mask-wearing compliance, promote public health measures, and contribute to the safety
and well-being of individuals in public settings.
Methodology:
1.Importing Libraries: The necessary libraries such as tensorflow.keras, numpy, matplotlib,
and cv2 are imported to build and train the convolutional neural network (CNN) model,
preprocess the images, and perform image-related operations.
2.Mounting Google Drive: The code mounts the Google Drive to access the dataset and save
the trained model.
3.Dataset Preparation: The dataset is prepared by defining the main directory path, train, test,
and validation directory paths, and obtaining the list of file names for mask and non-mask
images.
1. Predictive modeling: AI can be used to build predictive models that can analyze data
and make predictions about future outcomes. This can be used in areas such as finance,
healthcare, and marketing.
2. Natural Language Processing (NLP): NLP is a branch of AI that deals with the
interaction between computers and humans using natural language. NLP can be used to
analyze and understand text data, such as social media posts, customer reviews, and chat
logs.
3. Computer Vision: Computer Vision is a branch of AI that deals with the ability of
computers to interpret and analyze visual information from the world around us. This can
be used in areas such as autonomous vehicles, surveillance, and image recognition.
4. Recommender systems: AI can be used to build recommender systems that can analyze
user data and recommend products, services, or content based on their preferences.
6. Speech recognition: AI can be used to recognize and transcribe human speech. This can
be used in areas such as customer service, voice assistants, and transcription services.
7. Sentiment analysis: AI can be used to analyze the sentiment of text data, such as social
media posts and customer reviews. This can be used to gauge customer satisfaction,
public opinion, and market trends.
Artificial Intelligence (AI) is having a significant impact on data science in several ways. Here
are a few ways in which AI is changing the field of data science:
2.Improved Data Quality: AI can help improve the quality of data used in data science. With
the help of AI-powered tools, data scientists can clean, preprocess, and transform data more
efficiently, reducing errors and ensuring that data is accurate, complete, and consistent.
3.Increased Automation: AI is helping automate many data science tasks, such as data
preparation, data analysis, and data visualization. This reduces the time and effort required to
complete these tasks, allowing data scientists to focus on more complex work.
train_mask_dir = os.path.join(train_dir,'Mask')
train_nomask_dir = os.path.join(train_dir,'Non Mask')
print(train_mask_dir)
train_mask_names =os.listdir(train_mask_dir)
print(train_mask_names[:10])
train_nomask_names =os.listdir(train_nomask_dir)
print(train_nomask_names[:10])
train_datagen =ImageDataGenerator(rescale =1./255,
zoom_range =0.2,
rotation_range= 40,
horizontal_flip= True)
train_generator =train_datagen.flow_from_directory(train_dir,
target_size=(150,150),
batch_size =32,
class_mode ='binary'
)
test_generator=test_datagen.flow_from_directory(test_dir,
target_size=(150,150),
batch_size =32,
class_mode ='binary'
)
valid_generator=valid_datagen.flow_from_directory(valid_dir,
target_size=(150,150),
batch_size =32,
class_mode ='binary'
)
train_generator.class_indices
train_generator.image_shape
model=Sequential()
model.add(Conv2D(32,(3,3),padding ='SAME',activation='relu',input_shape= (150,150,3)))
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Dropout(0.5))
model.add(Flatten())
model.add(Dense(256,activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(1,activation ='sigmoid'))
model.summary()
model.compile(Adam(lr=0.001),loss ='binary_crossentropy',metrics=['accuracy'])
history =model.fit(train_generator,
epochs =10,
validation_data= valid_generator)
test_loss,test_acc =model.evaluate(test_generator)
print('test_acc:{}test loss:{}'.format(test_acc,test_loss))
model.save('/newsaved_model.h5')
import numpy as np
import tensorflow as tf
from google.colab import files
from keras.preprocessing import image
uploaded =files.upload()
#print(uploaded)
for f in uploaded.keys():
img_path ='/content/'+f
img=tf.keras.utils.load_img(img_path,target_size =(150,150))
images =tf.keras.utils.img_to_array(img)
images=np.expand_dims(images,axis =0)
prediction =model.predict(images)
if prediction==0:
print(f,'Mask is present')
else:
print(f,'mask is not present')
import cv2
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.image import load_img , img_to_array
import numpy as np
from google.colab.patches import cv2_imshow
if response==False:
break
scale =50
width =int(color_img.shape[1]*scale/100)
height =int(color_img.shape[0]*scale/100)
dim=(width,height)
cv2_imshow(color_img)
if cv2.waitKey(1) & 0xFF==ord('q'):
break
cap.release()
cv2.destroyAllWindows()
RESULT:
FUTURE SCOPE:-
The future scope of AI in data science is vast, as AI is expected to have a significant impact on
the field of data science in the coming years. Here are a few ways in which AI is expected to
shape the future of data science:
1.Increased Automation: AI is expected to automate many of the repetitive and time-
consuming tasks in data science, such as data cleaning, data preprocessing, and model selection.
This will free up data scientists to focus on more complex work, such as model design,
validation, and deployment.
2.Improved Decision-Making: AI is expected to provide data scientists with more accurate and
actionable insights, enabling them to make better-informed decisions. This will be particularly
useful in industries such as healthcare, finance, and marketing, where decisions can have a
significant impact on outcomes.
3.Better Personalization: AI is expected to enable data scientists to deliver more personalized
experiences to users, based on their data. For example, AI-powered recommendation systems can
provide personalized product recommendations to customers, based on their purchase history,
browsing behavior, and other data.
4.Improved Predictive Analytics: AI is expected to improve the accuracy of predictive
analytics by enabling data scientists to identify patterns and trends that are difficult or impossible
to detect using traditional statistical methods. This will be particularly useful in industries such
as manufacturing, logistics, and transportation, where accurate predictions can help optimize
operations and reduce costs.
5.Increased Accessibility: AI is expected to make data science more accessible to a wider range
of people, by automating many of the tasks that require specialized knowledge and expertise.
This will enable more people to use data science tools and techniques to solve real-world
problems.
GANTT CHART:
CONCLUSION:
In conclusion, AI has become a transformative force in the field of data science, revolutionizing
how data is processed, analyzed, and utilized to derive insights and make informed decisions.
Through the use of advanced machine learning algorithms, deep learning models, and other AI
techniques, data scientists are able to extract valuable knowledge from vast amounts of data,
uncover hidden patterns, and generate predictive models.
AI has been applied across various industries and domains, including healthcare, finance,
marketing, transportation, and many others, to solve complex problems and drive innovation. In
data science, AI has enabled organizations to automate data-driven processes, optimize
operations, and gain a competitive edge by leveraging data as a strategic asset.
Moreover, AI has opened new opportunities in data science, such as natural language processing
(NLP), computer vision, reinforcement learning, and generative models, which have expanded
the scope and capabilities of data science applications. These advancements have led to
breakthroughs in areas such as personalized medicine, fraud detection, recommendation systems,
autonomous vehicles, and virtual assistants, among others.
However, it is important to recognize that ethical considerations, fairness, accountability, and
transparency are crucial in the use of AI in data science. Bias in data, model interpretability,
privacy, and security are challenges that need to be addressed to ensure responsible and ethical
use of AI in data science applications.
In summary, AI has revolutionized the field of data science by enabling organizations to extract
insights and make data-driven decisions that have a significant impact on their operations,
products, and services. The continued advancements in AI and data science will likely unlock
even more possibilities for leveraging data to drive innovation and create value in the future.
REFERENCES:-
1. https://www.kaggle.com/datasets/andrewmvd/face-mask-detection
2. https://pyimagesearch.com/2020/05/04/covid-19-face-mask-detector-with-opencv-keras-
tensorflow-and-deep-learning/
3. https://hevodata.com/learn/artificial-intelligence-in-data-science/