ML | Unsupervised Face Clustering Pipeline
Last Updated :
04 Jan, 2023
Live face-recognition is a problem that automated security division still face. With the advancements in Convolutions Neural Networks and specifically creative ways of Region-CNN, it’s already confirmed that with our current technologies, we can opt for supervised learning options such as FaceNet, YOLO for fast and live face-recognition in a real-world environment.
To train a supervised model, we need to get datasets of our target labels which is still a tedious task. We need an efficient and automated solution for the dataset generation with minimal labeling effort by user intervention.
Proposed Solution -
Introduction: We are proposing a dataset generation pipeline which takes a video clip as source and extracts all the faces and clusters them to limited and accurate sets of images representing a distinct person. Each set can easily be labeled by human input with ease.
Technical Details: We are going to use opencv lib for per second frames extraction from input video clip. 1 second seems appropriate for covering relevant data and limited frames for processing.
We will use face_recognition library (backed by dlib) for extracting the faces from the frames and align them for feature extractions.
Then, we will extract the human observable features and cluster them using DBSCAN clustering provided by scikit-learn.
For the solution, we will crop out all the faces, create labels and group them in folders for users to adapt them as a dataset for their training use-cases.
Challenges in implementation: For a larger audience, we plan to implement the solution for execution in CPU rather than an NVIDIA GPU. Using an NVIDIA GPU may increase the efficiency of the pipeline.
CPU implementation of facial embedding extraction is very slow (30+ sec per images). To cope up with the problem, we implement them with parallel pipeline executions (resulting in ~13sec per image) and later merge their results for further clustering tasks. We introduce tqdm along with PyPiper for progress updates and the resizing of frames extracted from input video for smooth execution of pipeline.
Input: Footage.mp4
Output:

Required Python3 modules:
os, cv2, numpy, tensorflow, json, re, shutil, time, pickle, pyPiper, tqdm, imutils, face_recognition, dlib, warnings, sklearn
Snippets Section:
For the contents of the file FaceClusteringLibrary.py, which contains all the class definitions, following are the snippets and explanation of their working.
Class implementation of ResizeUtils provides function rescale_by_height and rescale_by_width.
"rescale_by_width" is a function that takes 'image' and 'target_width' as input. It upscales/downscales the image dimension for width to meet the target_width. The height is automatically calculated so that aspect ratio stays the same. rescale_by_height is also the same but instead of width, it targets height.
Python3
'''
The ResizeUtils provides resizing function
to keep the aspect ratio intact
Credits: AndyP at StackOverflow'''
class ResizeUtils:
# Given a target height, adjust the image
# by calculating the width and resize
def rescale_by_height(self, image, target_height,
method = cv2.INTER_LANCZOS4):
# Rescale `image` to `target_height`
# (preserving aspect ratio)
w = int(round(target_height * image.shape[1] / image.shape[0]))
return (cv2.resize(image, (w, target_height),
interpolation = method))
# Given a target width, adjust the image
# by calculating the height and resize
def rescale_by_width(self, image, target_width,
method = cv2.INTER_LANCZOS4):
# Rescale `image` to `target_width`
# (preserving aspect ratio)
h = int(round(target_width * image.shape[0] / image.shape[1]))
return (cv2.resize(image, (target_width, h),
interpolation = method))
Following is the definition of FramesGenerator class. This class provides functionality to extract jpg images by reading the video sequentially. If we take an example of an input video file, it can have a framerate of ~30 fps. We can conclude that for 1 second of video, there will be 30 images. For even a 2 minute video, the number of images for processing will be 2 * 60 * 30 = 3600. It's a too much high number of images to process and may take hours for complete pipeline processing.
But there comes one more fact that faces and people may not change within a second. So considering a 2-minute video, generating 30 images for 1 second is cumbersome and repetitive to process. Instead, we can just take only 1 snap of image in 1 second. The implementation of "FramesGenerator" dumps only 1 image per second from a video clip.
Considering the dumped images are subject to face_recognition/dlib processing for face extraction, we try to keep a threshold of the height no greater than 500 and width capped to 700. This limit is imposed by the "AutoResize" function that further calls rescale_by_height or rescale_by_width to reduce the size of the image if limits are hit but still preserves the aspect ratio.
Coming to the following snippet, AutoResize function tries to impose a limit to given image's dimension. If the width is greater than 700, we down-scale it to keep the width 700 and keep maintaining aspect ratio. Another limit set here is, the height must not be greater than 500.
Python3
# The FramesGenerator extracts image
# frames from the given video file
# The image frames are resized for
# face_recognition / dlib processing
class FramesGenerator:
def __init__(self, VideoFootageSource):
self.VideoFootageSource = VideoFootageSource
# Resize the given input to fit in a specified
# size for face embeddings extraction
def AutoResize(self, frame):
resizeUtils = ResizeUtils()
height, width, _ = frame.shape
if height > 500:
frame = resizeUtils.rescale_by_height(frame, 500)
self.AutoResize(frame)
if width > 700:
frame = resizeUtils.rescale_by_width(frame, 700)
self.AutoResize(frame)
return frame
Following is the snippet for GenerateFrames function. It queries the fps to decide among how many frames, 1 image can be dumped. We clear the output directory and start iterating throughout the frames. Before dumping any image, we resize the image if it hits the limit specified in AutoResize function.
Python3
# Extract 1 frame from each second from video footage
# and save the frames to a specific folder
def GenerateFrames(self, OutputDirectoryName):
cap = cv2.VideoCapture(self.VideoFootageSource)
_, frame = cap.read()
fps = cap.get(cv2.CAP_PROP_FPS)
TotalFrames = cap.get(cv2.CAP_PROP_FRAME_COUNT)
print("[INFO] Total Frames ", TotalFrames, " @ ", fps, " fps")
print("[INFO] Calculating number of frames per second")
CurrentDirectory = os.path.curdir
OutputDirectoryPath = os.path.join(
CurrentDirectory, OutputDirectoryName)
if os.path.exists(OutputDirectoryPath):
shutil.rmtree(OutputDirectoryPath)
time.sleep(0.5)
os.mkdir(OutputDirectoryPath)
CurrentFrame = 1
fpsCounter = 0
FrameWrittenCount = 1
while CurrentFrame < TotalFrames:
_, frame = cap.read()
if (frame is None):
continue
if fpsCounter > fps:
fpsCounter = 0
frame = self.AutoResize(frame)
filename = "frame_" + str(FrameWrittenCount) + ".jpg"
cv2.imwrite(os.path.join(
OutputDirectoryPath, filename), frame)
FrameWrittenCount += 1
fpsCounter += 1
CurrentFrame += 1
print('[INFO] Frames extracted')
Following is the snippet for FramesProvider class. It inherits "Node", which can be used to construct the image processing pipeline. We implement "setup" and "run" functions. Any arguments defined in "setup" function can have the parameters, which will be expected by constructor as parameters at the time of object creation. Here, we can pass sourcePath parameter to the FramesProvider object. "setup" function only runs once. "run" function runs and keeps emitting data by calling emit function to processing pipeline till close function is called.
Here, in the "setup", we accept sourcePath as an argument and iterate through all the files in the given frames directory. Whichever file's extension is .jpg (which will be generated by the class FrameGenerator), we add it to "filesList" list.
During the calls of run function, all the jpg image paths from "filesList" are packed with attributes specifying unique "id" and "imagePath" as an object and emitted to the pipeline for processing.
Python3
# Following are nodes for pipeline constructions.
# It will create and asynchronously execute threads
# for reading images, extracting facial features and
# storing them independently in different threads
# Keep emitting the filenames into
# the pipeline for processing
class FramesProvider(Node):
def setup(self, sourcePath):
self.sourcePath = sourcePath
self.filesList = []
for item in os.listdir(self.sourcePath):
_, fileExt = os.path.splitext(item)
if fileExt == '.jpg':
self.filesList.append(os.path.join(item))
self.TotalFilesCount = self.size = len(self.filesList)
self.ProcessedFilesCount = self.pos = 0
# Emit each filename in the pipeline for parallel processing
def run(self, data):
if self.ProcessedFilesCount < self.TotalFilesCount:
self.emit({'id': self.ProcessedFilesCount,
'imagePath': os.path.join(self.sourcePath,
self.filesList[self.ProcessedFilesCount])})
self.ProcessedFilesCount += 1
self.pos = self.ProcessedFilesCount
else:
self.close()
Following is the class implementation of "FaceEncoder" which inherits "Node", and can be pushed in image processing pipeline. In the "setup" function, we accept "detection_method" value for "face_recognition/dlib" face recognizer to invoke. It can have "cnn" based detector or "hog" based one.
The "run" function unpacks the incoming data into "id" and "imagePath".
Subsequently, it reads the image from "imagePath", runs the "face_location" defined in "face_recognition/dlib" library to crop out aligned face image, which is our region of interest. An aligned face image is a rectangular cropped image that has eyes and lips aligned to a specific location in the image (Note: The implementation may differ with other libraries e.g. opencv).
Further, we call "face_encodings" function defined in "face_recognition/dlib" to extract the facial embeddings from each box. This embeddings floating values can help you reach the exact location of features in an aligned face image.
We define variable "d" as an array of boxes and respective embeddings. Now, we pack the "id" and the array of embeddings as "encoding" key in an object and emit it to the image processing pipeline.
Python3
# Encode the face embedding, reference path
# and location and emit to pipeline
class FaceEncoder(Node):
def setup(self, detection_method = 'cnn'):
self.detection_method = detection_method
# detection_method can be cnn or hog
def run(self, data):
id = data['id']
imagePath = data['imagePath']
image = cv2.imread(imagePath)
rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
boxes = face_recognition.face_locations(
rgb, model = self.detection_method)
encodings = face_recognition.face_encodings(rgb, boxes)
d = [{"imagePath": imagePath, "loc": box, "encoding": enc}
for (box, enc) in zip(boxes, encodings)]
self.emit({'id': id, 'encodings': d})
Following is an implementation of DatastoreManager which again inherits from "Node" and can be plugged into the image processing pipeline. The aim for the class is to dump the "encodings" array as pickle file and use "id" parameter to uniquely name the pickle file. We want the pipeline to run multithreaded.
To exploit the multithreading for performance improvement, we need to properly separate out the asynchronous tasks and try to avoid any need of synchronization. So, for maximum performance, we independently let the threads in the pipeline to write the data out to individual separate file without interfering any other thread operation.
In case you are thinking how much time it saved, in used development hardware, without multithreading, the average embedding extraction time was ~30 seconds. After the multithreaded pipeline, (with 4 threads) it decreased to ~10 seconds but with the cost of high CPU usage.
Since the thread takes around ~10 seconds, frequent disk writes do not occur and it does not hamper our multithreaded performance.
Another case, if you are thinking why pickle is used instead of JSON alternative? The truth is JSON is a better alternative to pickle. Pickle is very unsafe for data storage and communication. Pickles can be maliciously modified for embedding executable codes in Python. The JSON files are human readable and faster for encoding and decoding. The only thing pickle is good at is the error-free dumping of python objects and contents into binary files.
Since we are not planning to store and distribute the pickle files, and for error-free execution, we are using pickle. Else, JSON and other alternatives are strongly recommended.
Python3
# Receive the face embeddings for clustering and
# id for naming the distinct filename
class DatastoreManager(Node):
def setup(self, encodingsOutputPath):
self.encodingsOutputPath = encodingsOutputPath
def run(self, data):
encodings = data['encodings']
id = data['id']
with open(os.path.join(self.encodingsOutputPath,
'encodings_' + str(id) + '.pickle'), 'wb') as f:
f.write(pickle.dumps(encodings))
Following is the implementation of class PickleListCollator. It is designed to read arrays of objects in multiple pickle files, merge into one array and dump the combined array into a single pickle file.
Here, there is only one function GeneratePickle which accepts outputFilepath which specifies the single output pickle file which will contain the merged array.
Python3
# PicklesListCollator takes multiple pickle
# files as input and merges them together
# It is made specifically to support use-case
# of merging distinct pickle files into one
class PicklesListCollator:
def __init__(self, picklesInputDirectory):
self.picklesInputDirectory = picklesInputDirectory
# Here we will list down all the pickles
# files generated from multiple threads,
# read the list of results append them to a
# common list and create another pickle
# with combined list as content
def GeneratePickle(self, outputFilepath):
datastore = []
ListOfPickleFiles = []
for item in os.listdir(self.picklesInputDirectory):
_, fileExt = os.path.splitext(item)
if fileExt == '.pickle':
ListOfPickleFiles.append(os.path.join(
self.picklesInputDirectory, item))
for picklePath in ListOfPickleFiles:
with open(picklePath, "rb") as f:
data = pickle.loads(f.read())
datastore.extend(data)
with open(outputFilepath, 'wb') as f:
f.write(pickle.dumps(datastore))
The following is the implementation of FaceClusterUtility class. There's a constructor defined which takes "EncodingFilePath" with value as a path to merged pickle file. We read the array from the pickle file and try to cluster them using "DBSCAN" implementation in "scikit" library. Unlike k-means, the DBSCAN scan does not require the number of clusters. The number of clusters depends on the threshold parameter and will automatically be calculated.
The DBSCAN implementation is provided in "scikit" and also accepts the number of threads for computation.
Here, we have a function "Cluster", that will be invoked to read the array data from the pickle file, run "DBSCAN", print the unique clusters as unique faces and return the labels. The labels are unique values representing categories, which can be used to identify the category for a face present in array. (The array contents come from pickle file).
Python3
# Face clustering functionality
class FaceClusterUtility:
def __init__(self, EncodingFilePath):
self.EncodingFilePath = EncodingFilePath
# Credits: Arian's pyimagesearch for the clustering code
# Here we are using the sklearn.DBSCAN functionality
# cluster all the facial embeddings to get clusters
# representing distinct people
def Cluster(self):
InputEncodingFile = self.EncodingFilePath
if not (os.path.isfile(InputEncodingFile) and
os.access(InputEncodingFile, os.R_OK)):
print('The input encoding file, ' +
str(InputEncodingFile) +
' does not exists or unreadable')
exit()
NumberOfParallelJobs = -1
# load the serialized face encodings
# + bounding box locations from disk,
# then extract the set of encodings to
# so we can cluster on them
print("[INFO] Loading encodings")
data = pickle.loads(open(InputEncodingFile, "rb").read())
data = np.array(data)
encodings = [d["encoding"] for d in data]
# cluster the embeddings
print("[INFO] Clustering")
clt = DBSCAN(eps = 0.5, metric ="euclidean",
n_jobs = NumberOfParallelJobs)
clt.fit(encodings)
# determine the total number of
# unique faces found in the dataset
labelIDs = np.unique(clt.labels_)
numUniqueFaces = len(np.where(labelIDs > -1)[0])
print("[INFO] # unique faces: {}".format(numUniqueFaces))
return clt.labels_
Following is the implementation of TqdmUpdate class which inherits from "tqdm". tqdm is a Python library that visualizes a progress bar in console interface.
The variables "n" and "total" are recognized by "tqdm". The values of these two variables are used to calculate the progress made.
The parameters "done" and "total_size" in "update" function are provided values when bound to update event in the pipeline framework "PyPiper". The super().refresh() invokes the implementation of "refresh" function in "tqdm" class which visualizes and updates the progress bar in console.
Python3
# Inherit class tqdm for visualization of progress
class TqdmUpdate(tqdm):
# This function will be passed as progress
# callback function. Setting the predefined
# variables for auto-updates in visualization
def update(self, done, total_size = None):
if total_size is not None:
self.total = total_size
self.n = done
super().refresh()
Following is the implementation of FaceImageGenerator class. This class provides functionality to generate a montage, cropped portrait image and an annotation for future training purpose (e.g. Darknet YOLO) from the labels that result after clustering.
The constructor expects EncodingFilePath as the merged pickle file path. It will be used to load all the face encodings. We are now interested in the "imagePath" and face coordinates for generating the image.
The call to "GenerateImages" does the intended job. We load the array from the merged pickle file. We apply the unique operation on labels and loop throughout the labels. Inside the iteration of the labels, for each unique label, we list down all the array indexes having the same current label.
These array indexes are again iterated to process each face.
For processing face, we use the index to obtain the path for the image file and coordinates of the face.
The image file is loaded from the path of the image file. The coordinates of the face are expanded to a portrait shape (and we also ensure it does not expand more than the dimensions of the image) and it is cropped and dumped to file as a portrait image.
We start again with original coordinates and expand a little to create annotations for future supervised training options for improved recognition capabilities.
For annotation, we just designed it for "Darknet YOLO", but it can also be adapted for any other framework. Finally, we build a montage and write it out into an image file.
Python3
class FaceImageGenerator:
def __init__(self, EncodingFilePath):
self.EncodingFilePath = EncodingFilePath
# Here we are creating montages for
# first 25 faces for each distinct face.
# We will also generate images for all
# the distinct faces by using the labels
# from clusters and image url from the
# encodings pickle file.
# The face bounding box is increased a
# little more for training purposes and
# we also created the exact annotation for
# each face image (similar to darknet YOLO)
# to easily adapt the annotation for future
# use in supervised training
def GenerateImages(self, labels, OutputFolderName = "ClusteredFaces",
MontageOutputFolder = "Montage"):
output_directory = os.getcwd()
OutputFolder = os.path.join(output_directory, OutputFolderName)
if not os.path.exists(OutputFolder):
os.makedirs(OutputFolder)
else:
shutil.rmtree(OutputFolder)
time.sleep(0.5)
os.makedirs(OutputFolder)
MontageFolderPath = os.path.join(OutputFolder, MontageOutputFolder)
os.makedirs(MontageFolderPath)
data = pickle.loads(open(self.EncodingFilePath, "rb").read())
data = np.array(data)
labelIDs = np.unique(labels)
# loop over the unique face integers
for labelID in labelIDs:
# find all indexes into the `data` array
# that belong to the current label ID, then
# randomly sample a maximum of 25 indexes
# from the set
print("[INFO] faces for face ID: {}".format(labelID))
FaceFolder = os.path.join(OutputFolder, "Face_" + str(labelID))
os.makedirs(FaceFolder)
idxs = np.where(labels == labelID)[0]
# initialize the list of faces to
# include in the montage
portraits = []
# loop over the sampled indexes
counter = 1
for i in idxs:
# load the input image and extract the face ROI
image = cv2.imread(data[i]["imagePath"])
(o_top, o_right, o_bottom, o_left) = data[i]["loc"]
height, width, channel = image.shape
widthMargin = 100
heightMargin = 150
top = o_top - heightMargin
if top < 0: top = 0
bottom = o_bottom + heightMargin
if bottom > height: bottom = height
left = o_left - widthMargin
if left < 0: left = 0
right = o_right + widthMargin
if right > width: right = width
portrait = image[top:bottom, left:right]
if len(portraits) < 25:
portraits.append(portrait)
resizeUtils = ResizeUtils()
portrait = resizeUtils.rescale_by_width(portrait, 400)
FaceFilename = "face_" + str(counter) + ".jpg"
FaceImagePath = os.path.join(FaceFolder, FaceFilename)
cv2.imwrite(FaceImagePath, portrait)
widthMargin = 20
heightMargin = 20
top = o_top - heightMargin
if top < 0: top = 0
bottom = o_bottom + heightMargin
if bottom > height: bottom = height
left = o_left - widthMargin
if left < 0: left = 0
right = o_right + widthMargin
if right > width:
right = width
AnnotationFilename = "face_" + str(counter) + ".txt"
AnnotationFilePath = os.path.join(FaceFolder, AnnotationFilename)
f = open(AnnotationFilePath, 'w')
f.write(str(labelID) + ' ' +
str(left) + ' ' + str(top) + ' ' +
str(right) + ' ' + str(bottom) + "\n")
f.close()
counter += 1
montage = build_montages(portraits, (96, 120), (5, 5))[0]
MontageFilenamePath = os.path.join(
MontageFolderPath, "Face_" + str(labelID) + ".jpg")
cv2.imwrite(MontageFilenamePath, montage)
Save the file as FaceClusteringLibrary.py, which will contain all the class definitions.
Following is file Driver.py, which invokes the functionalities to create a pipeline.
Python3
# importing all classes from above Python file
from FaceClusteringLibrary import *
if __name__ == "__main__":
# Generate the frames from given video footage
framesGenerator = FramesGenerator("Footage.mp4")
framesGenerator.GenerateFrames("Frames")
# Design and run the face clustering pipeline
CurrentPath = os.getcwd()
FramesDirectory = "Frames"
FramesDirectoryPath = os.path.join(CurrentPath, FramesDirectory)
EncodingsFolder = "Encodings"
EncodingsFolderPath = os.path.join(CurrentPath, EncodingsFolder)
if os.path.exists(EncodingsFolderPath):
shutil.rmtree(EncodingsFolderPath, ignore_errors = True)
time.sleep(0.5)
os.makedirs(EncodingsFolderPath)
pipeline = Pipeline(
FramesProvider("Files source", sourcePath = FramesDirectoryPath) |
FaceEncoder("Encode faces") |
DatastoreManager("Store encoding",
encodingsOutputPath = EncodingsFolderPath),
n_threads = 3, quiet = True)
pbar = TqdmUpdate()
pipeline.run(update_callback = pbar.update)
print()
print('[INFO] Encodings extracted')
# Merge all the encodings pickle files into one
CurrentPath = os.getcwd()
EncodingsInputDirectory = "Encodings"
EncodingsInputDirectoryPath = os.path.join(
CurrentPath, EncodingsInputDirectory)
OutputEncodingPickleFilename = "encodings.pickle"
if os.path.exists(OutputEncodingPickleFilename):
os.remove(OutputEncodingPickleFilename)
picklesListCollator = PicklesListCollator(
EncodingsInputDirectoryPath)
picklesListCollator.GeneratePickle(
OutputEncodingPickleFilename)
# To manage any delay in file writing
time.sleep(0.5)
# Start clustering process and generate
# output images with annotations
EncodingPickleFilePath = "encodings.pickle"
faceClusterUtility = FaceClusterUtility(EncodingPickleFilePath)
faceImageGenerator = FaceImageGenerator(EncodingPickleFilePath)
labelIDs = faceClusterUtility.Cluster()
faceImageGenerator.GenerateImages(
labelIDs, "ClusteredFaces", "Montage")
Montage Output:



Troubleshooting -
Question1: The whole pc freezes when extracting facial embedding.
Solution: The solution is to decrease the values in frame resize function when extracting frames from an input video clip. Remember, decreasing the values too much will result in improper face clustering. Instead of resizing frame, we can introduce some frontal face detection and clip out the frontal faces only for improved accuracy.
Question2: The pc becomes slow while running the pipeline.
Solution: The CPU will be used at a maximum level. To cap the usage, you can decrease the number of threads specified at pipeline constructor.
Question3: The output clustering is too much inaccurate.
Solution: The only reason for the case can be the frames extracted from the input video clip will have very faces with a very small resolution or the number of frames is very less (around 7-8). Kindly get a video clip with bright and clear images of faces in it or for the latter case, get a 2-minute video or mod with source code for video frames extraction.
Refer Github link for complete code and additional file used : https://github.com/cppxaxa/FaceRecognitionPipeline_GeeksForGeeks
References:
1. Adrian's blog post for face clustering
2. PyPiper guide
3. OpenCV manual
4. StackOverflow
Similar Reads
Python Projects - Beginner to Advanced Python is one of the most popular programming languages due to its simplicity, versatility, and supportive community. Whether youâre a beginner eager to learn the basics or an experienced programmer looking to challenge your skills, there are countless Python projects to help you grow.Hereâs a list
10 min read
Projects for Beginners
Number guessing game in Python 3 and CThe objective of this project is to build a simple number guessing game that challenges the user to identify a randomly selected number within a specified range. The game begins by allowing the user to define a range by entering a lower and an upper bound (for example, from A to B). Once the range i
4 min read
Python Program for word Guessing GameLearn how to create a simple Python word-guessing game, where players attempt to guess a randomly selected word within a limited number of tries.Word guessing Game in PythonThis program is a simple word-guessing game where the user has to guess the characters in a randomly selected word within a lim
5 min read
Hangman Game in PythonHangman Wiki:The origins of Hangman are obscure meaning not discovered, but it seems to have arisen in Victorian times, " says Tony Augarde, author of The Oxford Guide to Word Games. The game is mentioned in Alice Bertha Gomme's "Traditional Games" in 1894 under the name "Birds, Beasts and Fishes."
8 min read
21 Number game in Python21, Bagram, or Twenty plus one is a game which progresses by counting up 1 to 21, with the player who calls "21" is eliminated. It can be played between any number of players. Implementation This is a simple 21 number game using Python programming language. The game illustrated here is between the p
11 min read
Mastermind Game using PythonGiven the present generation's acquaintance with gaming and its highly demanded technology, many aspire to pursue the idea of developing and advancing it further. Eventually, everyone starts at the beginning. Mastermind is an old code-breaking game played by two players. The game goes back to the 19
8 min read
2048 Game in PythonIn this article we will look python code and logic to design a 2048 game you have played very often in your smartphone. If you are not familiar with the game, it is highly recommended to first play the game so that you can understand the basic functioning of it.How to play 2048 :1. There is a 4*4 gr
10 min read
Python | Program to implement simple FLAMES gamePython is a multipurpose language and one can do literally anything with it. Python can also be used for game development. Letâs create a simple FLAMES game without using any external game libraries like PyGame. FLAMES is a popular game named after the acronym: Friends, Lovers, Affectionate, Marriag
6 min read
Python | Pokémon Training GameProblem : You are a Pokémon trainer. Each Pokémon has its own power, described by a positive integer value. As you travel, you watch Pokémon and you catch each of them. After each catch, you have to display maximum and minimum powers of Pokémon caught so far. You must have linear time complexity. So
1 min read
Python program to implement Rock Paper Scissor gamePython is a multipurpose language and one can do anything with it. Python can also be used for game development. Let's create a simple command-line Rock-Paper-Scissor game without using any external game libraries like PyGame. In this game, the user gets the first chance to pick the option between R
5 min read
Taking Screenshots using pyscreenshot in PythonPython offers multiple libraries to ease our work. Here we will learn how to take a screenshot using Python. Python provides a module called pyscreenshot for this task. It is only a pure Python wrapper, a thin layer over existing backends. Performance and interactivity are not important for this lib
2 min read
Desktop Notifier in PythonThis article demonstrates how to create a simple Desktop Notifier application using Python. A desktop notifier is a simple application which produces a notification message in form of a pop-up message on desktop. Notification content In the example we use in this article, the content that will appea
4 min read
Get Live Weather Desktop Notifications Using PythonWe know weather updates are how much important in our day-to-day life. So, We are introducing the logic and script with some easiest way to understand for everyone. Letâs see a simple Python script to show the live update for Weather information. Modules Needed In this script, we are using some lib
3 min read
How to use pynput to make a Keylogger?Prerequisites: Python Programming LanguageThe package pynput.keyboard contains classes for controlling and monitoring the keyboard. pynput is the library of Python that can be used to capture keyboard inputs there the coolest use of this can lie in making keyloggers. The code for the keylogger is gi
1 min read
Python - Cows and Bulls gameCows and Bulls is a pen and paper code-breaking game usually played between 2 players. In this, a player tries to guess a secret code number chosen by the second player. The rules are as follows: A player will create a secret code, usually a 4-digit number. Â This number should have no repeated digit
3 min read
Simple Attendance Tracker using PythonIn many colleges, we have an attendance system for each subject, and the lack of the same leads to problems. It is difficult for students to remember the number of leaves taken for a particular subject. If every time paperwork has to be done to track the number of leaves taken by staff and check whe
9 min read
Higher-Lower Game with PythonIn this article, we will be looking at the way to design a game in which the user has to guess which has a higher number of followers and it displays the scores. Game Play:The name of some Instagram accounts will be displayed, you have to guess which has a higher number of followers by typing in the
8 min read
Fun Fact Generator Web App in PythonIn this article, we will discuss how to create a Fun Fact Generator Web App in Python using the PyWebio module. Essentially, it will create interesting facts at random and display them on the web interface. This script will retrieve data from uselessfacts.jsph.pl with the help of GET method, and we
3 min read
Check if two PDF documents are identical with PythonPython is an interpreted and general purpose programming language. It is a Object-Oriented and Procedural paradigms programming language. There are various types of modules imported in python such as difflib, hashlib. Modules used:difflib : It is a module that contains function that allows to compar
2 min read
Creating payment receipts using PythonCreating payment receipts is a pretty common task, be it an e-commerce website or any local store for that matter. Here, we will see how to create our own transaction receipts just by using python. We would be using reportlab to generate the PDFs. Generally, it comes as a built-in package but someti
3 min read
How To Create a Countdown Timer Using Python?In this article, we will see how to create a countdown timer using Python. The code will take input from the user regarding the length of the countdown in seconds. After that, a countdown will begin on the screen of the format 'minutes: seconds'. We will use the time module here.Step-by-Step Approac
2 min read
Convert emoji into text in PythonConverting emoticons or emojis into text in Python can be done using the demoji module. It is used to accurately remove and replace emojis in text strings. To install the demoji module the below command can be used: pip install demoji The demoji module also requires an initial download of data from
1 min read
Create a Voice Recorder using PythonPython can be used to perform a variety of tasks. One of them is creating a voice recorder. We can use python's sounddevice module to record and play audio. This module along with the wavio or the scipy module provides a way to save recorded audio.Installation:sounddevice: This module provides funct
3 min read
Create a Screen recorder using PythonPython is a widely used general-purpose language. It allows for performing a variety of tasks. One of them can be recording a video. It provides a module named pyautogui which can be used for the same. This module along with NumPy and OpenCV provides a way to manipulate and save the images (screensh
5 min read
Projects for Intermediate
How to Build a Simple Auto-Login Bot with PythonIn this article, we are going to see how to built a simple auto-login bot using python. In this present scenario, every website uses authentication and we have to log in by entering proper credentials. But sometimes it becomes very hectic to login again and again to a particular website. So, to come
3 min read
How to make a Twitter Bot in Python?Twitter is an American microblogging and social networking service on which users post and interact with messages known as "tweets". In this article we will make a Twitter Bot using Python. Python as well as Javascript can be used to develop an automatic Twitter bot that can do many tasks by its own
3 min read
Building WhatsApp bot on PythonA WhatsApp bot is application software that is able to carry on communication with humans in a spoken or written manner. And today we are going to learn how we can create a WhatsApp bot using python. First, let's see the requirements for building the WhatsApp bot using python language. System Requir
6 min read
Create a Telegram Bot using PythonIn this article, we are going to see how to create a telegram bot using Python. In recent times Telegram has become one of the most used messaging and content sharing platforms, it has no file sharing limit like Whatsapp and it comes with some preinstalled bots one can use in any channels (groups in
6 min read
Twitter Sentiment Analysis using PythonThis article covers the sentiment analysis of any topic by parsing the tweets fetched from Twitter using Python. What is sentiment analysis? Sentiment Analysis is the process of 'computationally' determining whether a piece of writing is positive, negative or neutral. Itâs also known as opinion mini
10 min read
Employee Management System using PythonThe task is to create a Database-driven Employee Management System in Python that will store the information in the MySQL Database. The script will contain the following operations : Add EmployeeRemove EmployeePromote EmployeeDisplay EmployeesThe idea is that we perform different changes in our Empl
8 min read
How to make a Python auto clicker?Auto-clickers are tools that simulate mouse clicks automatically at a given location and interval. Whether you're automating repetitive tasks in games, productivity applications, or testing graphical user interfaces (GUIs), creating an auto-clicker in Python is both a fun and practical project. In t
4 min read
Instagram Bot using Python and InstaPyIn this article, we will design a simple fun project âInstagram Botâ using Python and InstaPy. As beginners want to do some extra and learning small projects so that it will help in building big future projects. Now, this is the time to learn some new projects and a better future. This python projec
3 min read
File Sharing App using PythonComputer Networks is an important topic and to understand the concepts, practical application of the concepts is needed. In this particular article, we will see how to make a simple file-sharing app using Python. Â An HTTP Web Server is software that understands URLs (web address) and HTTP (the proto
4 min read
Send message to Telegram user using PythonHave you ever wondered how people do automation on Telegram? You may know that Telegram has a big user base and so it is one of the preferred social media to read people. What good thing about Telegram is that it provides a bunch of API's methods, unlike Whatsapp which restricts such things. So in t
3 min read
Python | Whatsapp birthday botHave you ever wished to automatically wish your friends on their birthdays, or send a set of messages to your friend ( or any Whastapp contact! ) automatically at a pre-set time, or send your friends by sending thousands of random text on whatsapp! Using Browser Automation you can do all of it and m
10 min read
Corona HelpBotThis is a chatbot that will give answers to most of your corona-related questions/FAQ. The chatbot will give you answers from the data given by WHO(https://www.who.int/). This will help those who need information or help to know more about this virus. It uses a neural network with two hidden layers(
9 min read
Amazon product availability checker using PythonAs we know Python is a multi-purpose language and widely used for scripting. Its usage is not just limited to solve complex calculations but also to automate daily life task. Letâs say we want to track any Amazon product availability and grab the deal when the product availability changes and inform
3 min read
Python | Fetch your gmail emails from a particular userIf you are ever curious to know how we can fetch Gmail e-mails using Python then this article is for you.As we know Python is a multi-utility language which can be used to do a wide range of tasks. Fetching Gmail emails though is a tedious task but with Python, many things can be done if you are wel
5 min read
How to Create a Chatbot in Android with BrainShop API?We have seen many apps and websites in which we will get to see a chatbot where we can chat along with the chatbot and can easily get solutions for our questions answered from the chatbot. In this article, we will take a look at building a chatbot in Android. What we are going to build in this artic
11 min read
Spam bot using PyAutoGUIPyAutoGUI is a Python module that helps us automate the key presses and mouse clicks programmatically. In this article we will learn to develop a spam bot using PyAutoGUI. Spamming - Refers to sending unsolicited messages to large number of systems over the internet. This mini-project can be used f
2 min read
Hotel Management SystemGiven the data for Hotel management and User:Hotel Data: Hotel Name Room Available Location Rating Price per RoomH1 4 Bangalore 5 100H2 5 Bangalore 5 200H3 6 Mumbai 3 100User Data: User Name UserID Booking CostU1 2 1000U2 3 1200U3 4 1100The task is to answer the following question. Print the hotel d
15+ min read
Web Scraping
Build a COVID19 Vaccine Tracker Using PythonAs we know the world is facing an unprecedented challenge with communities and economies everywhere affected by the COVID19. So, we are going to do some fun during this time by tracking their vaccine. Let's see a simple Python script to improve for tracking the COVID19 vaccine. Modules Neededbs4: Be
2 min read
Email Id Extractor Project from sites in Scrapy PythonScrapy is open-source web-crawling framework written in Python used for web scraping, it can also be used to extract data for general-purpose. First all sub pages links are taken from the main page and then email id are scraped from these sub pages using regular expression. This article shows the e
8 min read
Automating Scrolling using Python-Opencv by Color DetectionPrerequisites:Â OpencvPyAutoGUI It is possible to perform actions without actually giving any input through touchpad or mouse. This article discusses how this can be done using opencv module. Here we will use color detection to scroll screen. When a certain color is detected by the program during ex
2 min read
How to scrape data from google maps using Python ?In this article, we will discuss how to scrape data like Names, Ratings, Descriptions, Reviews, addresses, Contact numbers, etc. from google maps using Python. Modules needed:Selenium: Usually, to automate testing, Selenium is used. We can do this for scraping also as the browser automation here hel
6 min read
Scraping weather data using Python to get umbrella reminder on emailIn this article, we are going to see how to scrape weather data using Python and get reminders on email. If the weather condition is rainy or cloudy this program will send you an "umbrella reminder" to your email reminding you to pack an umbrella before leaving the house. Â We will scrape the weather
5 min read
Scraping Reddit using PythonIn this article, we are going to see how to scrape Reddit using Python, here we will be using python's PRAW (Python Reddit API Wrapper) module to scrape the data. Praw is an acronym Python Reddit API wrapper, it allows Reddit API through Python scripts. Installation To install PRAW, run the followin
4 min read
How to fetch data from Jira in Python?Jira is an agile, project management tool, developed by Atlassian, primarily used for, tracking project bugs, and, issues. It has gradually developed, into a powerful, work management tool, that can handle, all stages of agile methodology. In this article, we will learn, how to fetch data, from Jira
8 min read
Scrape most reviewed news and tweet using PythonMany websites will be providing trendy news in any technology and the article can be rated by means of its review count. Suppose the news is for cryptocurrencies and news articles are scraped from cointelegraph.com, we can get each news item reviewer to count easily and placed in MongoDB collection.
4 min read
Extraction of Tweets using TweepyIntroduction: Twitter is a popular social network where users share messages called tweets. Twitter allows us to mine the data of any user using Twitter API or Tweepy. The data will be tweets extracted from the user. The first thing to do is get the consumer key, consumer secret, access key and acce
5 min read
Predicting Air Quality Index using PythonAir pollution is a growing concern globally, and with increasing industrialization and urbanization, it becomes crucial to monitor and predict air quality in real-time. One of the most reliable ways to quantify air pollution is by calculating the Air Quality Index (AQI). In this article, we will exp
3 min read
Scrape Content from Dynamic WebsitesScraping from dynamic websites means extracting data from pages where content is loaded or updated using JavaScript after the initial HTML is delivered. Unlike static websites, dynamic ones require tools that can handle JavaScript execution to access the fully rendered content. Simple scrapers like
5 min read
Automating boring Stuff Using Python
Automate Instagram Messages using PythonIn this article, we will see how to send a single message to any number of people. We just have to provide a list of users. We will use selenium for this task. Packages neededSelenium: It is an open-source tool that automates web browsers. It provides a single interface that lets you write test scri
6 min read
Python | Automating Happy Birthday post on Facebook using SeleniumAs we know Selenium is a tool used for controlling web browsers through a program. It can be used in all browsers, OS, and its program are written in various programming languages i.e Java, Python (all versions). Selenium helps us automate any kind of task that we frequently do on our laptops, PCs
3 min read
Automatic Birthday mail sending with PythonAre you bored with sending birthday wishes to your friends or do you forget to send wishes to your friends or do you want to wish them at 12 AM but you always fall asleep? Why not automate this simple task by writing a Python script. The first thing we do is import six libraries:Â pandasdatetimesmtp
3 min read
Automated software testing with PythonSoftware testing is the process in which a developer ensures that the actual output of the software matches with the desired output by providing some test inputs to the software. Software testing is an important step because if performed properly, it can help the developer to find bugs in the softwa
12 min read
Python | Automate Google Search using SeleniumGoogle search can be automated using Python script in just 2 minutes. This can be done using selenium (a browser automation tool). Selenium is a portable framework for testing web applications. It can automatically perform the same interactions that any you need to perform manually and this is a sma
3 min read
Automate linkedin connections using PythonAutomating LinkedIn connections using Python involves creating a script that navigates LinkedIn, finds users based on specific criteria (e.g., job title, company, or location), and sends personalized connection requests. In this article, we will walk you through the process, using Selenium for web a
5 min read
Automated Trading using PythonAutomated trading using Python involves building a program that can analyze market data and make trading decisions. Weâll use yfinance to get stock market data, Pandas and NumPy to organize and analyze it and Matplotlib to create simple charts to see trends and patterns. The idea is to use past stoc
4 min read
Automate the Conversion from Python2 to Python3We can convert Python2 scripts to Python3 scripts by using 2to3 module. It changes Python2 syntax to Python3 syntax. We can change all the files in a particular folder from python2 to python3. Installation This module does not come built-in with Python. To install this type the below command in the
1 min read
Bulk Posting on Facebook Pages using SeleniumAs we are aware that there are multiple tasks in the marketing agencies which are happening manually, and one of those tasks is bulk posting on several Facebook pages, which is very time-consuming and sometimes very tedious to do. In this project-based article, we are going to explore a solution tha
9 min read
Share WhatsApp Web without Scanning QR code using PythonPrerequisite: Selenium, Browser Automation Using Selenium In this article, we are going to see how to share your Web-WhatsApp with anyone over the Internet without Scanning a QR code. Web-Whatsapp store sessions Web Whatsapp stores sessions in IndexedDB with the name wawc and syncs those key-value p
5 min read
Automate WhatsApp Messages With Python using Pywhatkit moduleWe can automate a Python script to send WhatsApp messages. In this article, we will learn the easiest ways using pywhatkit module that the website web.whatsapp.com uses to automate the sending of messages to any WhatsApp number. Installing pywhatkit module: pywhatkit is a python module for sending W
4 min read
How to Send Automated Email Messages in PythonIn this article, we are going to see how to send automated email messages which involve delivering text messages, essential photos, and important files, among other things. in Python. We'll be using two libraries for this: email, and smtplib, as well as the MIMEMultipart object. This object has mul
6 min read
Automate backup with Python ScriptIn this article, we are going to see how to automate backup with a Python script. File backups are essential for preserving your data in local storage. We will use the shutil, os, and sys modules. In this case, the shutil module is used to copy data from one file to another, while the os and sys mod
4 min read
Automated software testing with PythonSoftware testing is the process in which a developer ensures that the actual output of the software matches with the desired output by providing some test inputs to the software. Software testing is an important step because if performed properly, it can help the developer to find bugs in the softwa
12 min read
Hotword detection with PythonMost of us have heard about Alexa, Ok google or hey Siri and may have thought of creating your own Virtual Personal Assistant with your favorite name like, Hey Thanos!. So here's the easiest way to do it without getting your hands dirty.Requirements: Linux pc with working microphones (I have tested
2 min read
Automate linkedin connections using PythonAutomating LinkedIn connections using Python involves creating a script that navigates LinkedIn, finds users based on specific criteria (e.g., job title, company, or location), and sends personalized connection requests. In this article, we will walk you through the process, using Selenium for web a
5 min read
Tkinter Projects
Create First GUI Application using Python-TkinterWe are now stepping into making applications with graphical elements, we will learn how to make cool apps and focus more on its GUI(Graphical User Interface) using Tkinter.What is Tkinter?Tkinter is a Python Package for creating GUI applications. Python has a lot of GUI frameworks, but Tkinter is th
12 min read
Simple GUI calculator using Tkinter-PythonPython offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter outputs the fastest and easiest way to create GUI app
3 min read
Python - Compound Interest GUI Calculator using TkinterPython offers multiple options for developing a GUI (Graphical User Interface). Out of all the Python GUI Libraries, Tkinter is the most commonly used method. In this article, we will learn how to create a Compound Interest GUI Calculator application using Tkinter.Letâs create a GUI-based Compound I
6 min read
Python | Loan calculator using TkinterPrerequisite: Tkinter Introduction Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter outputs the fastest
5 min read
Rank Based Percentile Gui Calculator using TkinterPython offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. In this article, we will learn how to create a Rank Based - Percentile Gui Calculator application using Tkinter, with a step-by-step guide. Prerequisi
7 min read
Standard GUI Unit Converter using Tkinter in PythonPrerequisites: Introduction to tkinter, Introduction to webbrowser In this article, we will learn how to create a standard converter using tkinter. Now we are going to create an introduction window that displays loading bar, welcome text, and user's social media profile links so that when he/she sha
12 min read
Create Table Using TkinterPython offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter is the fastest and easiest way to create GUI applicat
3 min read
Python | GUI Calendar using TkinterPrerequisites: Introduction to Tkinter Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. Python with Tkinter outputs the fastest and easiest way to create GUI applications. In this article, we will le
4 min read
File Explorer in Python using TkinterPrerequisites: Introduction to Tkinter Python offers various modules to create graphics programs. Out of these Tkinter provides the fastest and easiest way to create GUI applications. The following steps are involved in creating a tkinter application: Importing the Tkinter module. Creation of the
2 min read
Python | ToDo GUI Application using TkinterPrerequisites : Introduction to tkinter Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. In this article, we will learn how to create a ToDo GUI application using Tkinter, with a step-by-step guide.
5 min read
Python: Weight Conversion GUI using TkinterPrerequisites: Python GUI â tkinterPython offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter outputs the fastes
2 min read
Python: Age Calculator using TkinterPrerequisites :Introduction to tkinter Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter outputs the fa
5 min read
Python | Create a GUI Marksheet using TkinterCreate a python GUI mark sheet. Where credits of each subject are given, enter the grades obtained in each subject and click on Submit. The credits per subject, the total credits as well as the SGPA are displayed after being calculated automatically. Use Tkinter to create the GUI interface. Refer t
8 min read
Python | Create a digital clock using TkinterAs we know Tkinter is used to create a variety of GUI (Graphical User Interface) applications. In this article we will learn how to create a Digital clock using Tkinter. Prerequisites: Python functions Tkinter basics (Label Widget) Time module Using Label widget from Tkinter and time module: In the
2 min read
Create Countdown Timer using Python-TkinterPrerequisites: Python GUI â tkinterPython Tkinter is a GUI programming package or built-in library. Tkinter provides the Tk GUI toolkit with a potent object-oriented interface. Python with Tkinter is the fastest and easiest way to create GUI applications. Creating a GUI using Tkinter is an easy task
2 min read
Tkinter Application to Switch Between Different Page FramesPrerequisites: Python GUI â tkinter Sometimes it happens that we need to create an application with several pops up dialog boxes, i.e Page Frames. Here is a step by step process to create multiple Tkinter Page Frames and link them! This can be used as a boilerplate for more complex python GUI applic
6 min read
Color game using Tkinter in PythonTKinter is widely used for developing GUI applications. Along with applications, we can also use Tkinter GUI to develop games. Let's try to make a game using Tkinter. In this game player has to enter color of the word that appears on the screen and hence the score increases by one, the total time to
4 min read
Python | Simple FLAMES game using TkinterPrerequisites: Introduction to TkinterProgram to implement simple FLAMES game Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Pyt
5 min read
Simple registration form using Python TkinterTkinter is Python's standard GUI (Graphical User Interface) library and OpenPyXL is a module that allows for reading and writing Excel files. This guide shows you how to create a simple registration form with Tkinter, where users enter their details and those details are written into an Excel file.
2 min read
Image Viewer App in Python using TkinterPrerequisites: Python GUI â tkinter, Python: Pillow Have you ever wondered to make a Image viewer with the help of Python? Here is a solution to making the Image viewer with the help of Python. We can do this with the help of Tkinter and pillow. We will discuss the module needed and code below. Mod
5 min read
How to create a COVID19 Data Representation GUI?Prerequisites: Python Requests, Python GUI â tkinterSometimes we just want a quick fast tool to really tell whats the current update, we just need a bare minimum of data. Web scraping deals with taking some data from the web and then processing it and displaying the relevant content in a short and c
2 min read
GUI to Shutdown, Restart and Logout from the PC using PythonIn this article, we are going to write a python script to shut down or Restart or Logout your system and bind it with GUI Application. The OS module in Python provides functions for interacting with the operating system. OS is an inbuilt library python. Syntax : For shutdown your system : os.system
1 min read
Create a GUI to extract Lyrics from song Using PythonIn this article, we are going to write a python script to extract lyrics from the song and bind with its GUI application. We will use lyrics-extractor to get lyrics of a song just by passing in the song name, it extracts and returns the song's title and song lyrics from various websites. Before star
3 min read
Application to get live USD/INR rate Using PythonIn this article, we are going to write a python scripts to get live information of USD/INR rate and bind with it GUI application. Modules Required:bs4: Beautiful Soup is a Python library for pulling data out of HTML and XML files. Installation: pip install bs4requests: This module allows you to send
3 min read
Build an Application for Screen Rotation Using PythonIn this article, we are going to write a python script for screen rotation and implement it with GUI. The display can be modified to four orientations using some methods from the rotatescreen module, it is a small Python package for rotating the screen in a system. Installation:pip install rotate-s
2 min read
Build an Application to Search Installed Application using PythonIn this article, we are going to write python scripts to search for an installed application on Windows and bind it with the GUI application. We are using winapps modules for managing installed applications on Windows. Prerequisite - Tkinter in Python To install the module, run this command in your
6 min read
Text detection using PythonPython language is widely used for modern machine learning and data analysis. One can detect an image, speech, can even detect an object through Python. For now, we will detect whether the text from the user gives a positive feeling or negative feeling by classifying the text as positive, negative,
4 min read
Python - Spell Corrector GUI using TkinterPython offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. Python with Tkinter outputs the fastest and easiest way to create GUI applications. In this article, we will learn how to create a GUI Spell Corrector
5 min read
Make Notepad using TkinterLet's see how to create a simple notepad in Python using Tkinter. This notepad GUI will consist of various menu like file and edit, using which all functionalities like saving the file, opening a file, editing, cut and paste can be done. Now for creating this notepad, Python 3 and Tkinter should alr
6 min read
Sentiment Detector GUI using Tkinter - PythonPrerequisites : Introduction to tkinter | Sentiment Analysis using Vader Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. Python with Tkinter outputs the fastest and easiest way to create GUI applica
4 min read
Create a GUI for Weather Forecast using openweathermap API in PythonPrerequisites: Find current weather of any city using openweathermap API The idea of this article is to provide a simple GUI application to users to get the current temperature of any city they wish to see. The system also provides a simple user interface for simplification of application. It also p
4 min read
Build a Voice Recorder GUI using PythonPrerequisites: Python GUI â tkinter, Create a Voice Recorder using Python Python provides various tools and can be used for various purposes. One such purpose is recording voice. It can be done using the sounddevice module. This recorded file can be saved using the soundfile module Module NeededSoun
2 min read
Create a Sideshow application in PythonIn this article, we will create a slideshow application i.e we can see the next image without changing it manually or by clicking. Modules Required:Tkinter: The tkinter package (âTk interfaceâ) is the standard Python interface to the Tk GUI toolkit.Pillow: The Python Imaging Library adds image proc
2 min read
Visiting Card Scanner GUI Application using PythonPython is an emerging programming language that consists of many in-built modules and libraries. Which provides support to many web and agile applications. Due to its clean and concise syntax behavior, many gigantic and renowned organizations like Instagram, Netflix so-and-so forth are working in Py
6 min read
Turtle Projects
Create digital clock using Python-TurtleTurtle is a special feature of Python. Using Turtle, we can easily draw on a drawing board. First, we import the turtle module. Then create a window, next we create a turtle object and using the turtle methods we can draw in the drawing board. Prerequisites: Turtle Programming in Python Installation
3 min read
Draw a Tic Tac Toe Board using Python-TurtleThe Task Here is to Make a Tic Tac Toe board layout using Turtle Graphics in Python. For that lets first know what is Turtle Graphics. Turtle graphics In computer graphics, turtle graphics are vector graphics using a relative cursor upon a Cartesian plane. Turtle is drawing board like feature which
2 min read
Draw Chess Board Using Turtle in PythonPrerequisite: Turtle Programming Basics Turtle is an inbuilt module in Python. It provides drawing using a screen (cardboard) and turtle (pen). To draw something on the screen, we need to move the turtle (pen). To move turtle, there are some functions i.e forward(), backward(), etc. For drawing Ches
2 min read
Draw an Olympic Symbol in Python using TurtlePrerequisites: Turtle Programming in Python The Olympic rings are five interlaced rings, colored blue, yellow, black, green, and red on a white field. As shown in the below image. Approach:import Turtle moduleset the thickness for each ringdraw each circle with specific coordinates Below is the impl
1 min read
Draw Rainbow using Turtle Graphics in PythonTurtle is an inbuilt module in Python. It provides:Â Drawing using a screen (cardboard).Turtle (pen). To draw something on the screen, we need to move the turtle (pen), and to move the turtle, there are some functions like the forward(), backward(), etc. Prerequisite: Turtle Programming Basics Draw
2 min read
How to Make an Indian Flag in PythonHere, we will be making "The Great Indian Flag" using Python. Python's turtle graphics module is built into the Python software installation and is part of the standard library. This means that you don't need to install anything extra to use the turtle lib. Here, we will be using many turtle functio
3 min read
Draw moving object using Turtle in PythonPrerequisite: Python Turtle Basics Turtle is an inbuilt module in python. It provides drawing using a screen (cardboard) and turtle (pen). To draw something on the screen, we need to move the turtle. To move turtle, there are some functions i.e forward(), backward(), etc. 1.)Move the Object (ball)
2 min read
Create a simple Animation using Turtle in PythonTurtle is a built-in Python module that provides a simple way to draw and create graphics using a virtual turtle on the screen. You can control the turtle using commands like forward() and right() to move it around and draw shapes. In this article, we'll use Turtle to create a fun animation where mu
2 min read
Create a Simple Two Player Game using Turtle in PythonPrerequisites: Turtle Programming in Python TurtleMove game is basically a luck-based game. In this game two-players (Red & Blue), using their own turtle (object) play the game. How to play The game is played in the predefined grid having some boundaries. Both players move the turtle for a unit
4 min read
Flipping Tiles (memory game) using Python3Flipping tiles game can be played to test our memory. In this, we have a certain even number of tiles, in which each number/figure has a pair. The tiles are facing downwards, and we have to flip them to see them. In a turn, one flips 2 tiles, if the tiles match then they are removed. If not then the
3 min read
Create pong game using Python - TurtlePong is one of the most famous arcade games, simulating table tennis. Each player controls a paddle in the game by dragging it vertically across the screen's left or right side. Players use their paddles to strike back and forth on the ball. Turtle is an inbuilt graphic module in Python. It uses a p
3 min read
OpenCV Projects
Python | Program to extract frames using OpenCVOpenCV comes with many powerful video editing functions. In the current scenario, techniques such as image scanning and face recognition can be accomplished using OpenCV. OpenCV library can be used to perform multiple operations on videos. Letâs try to do something interesting using CV2. Take a vide
2 min read
Displaying the coordinates of the points clicked on the image using Python-OpenCVOpenCV helps us to control and manage different types of mouse events and gives us the flexibility to operate them. There are many types of mouse events. These events can be displayed by running the following code segment : import cv2 [print(i) for i in dir(cv2) if 'EVENT' in i] Output : EVENT_FLAG_
3 min read
White and black dot detection using OpenCV | PythonImage processing using Python is one of the hottest topics in today's world. But image processing is a bit complex and beginners get bored in their first approach. So in this article, we have a very basic image processing python program to count black dots in white surface and white dots in the blac
4 min read
Python | OpenCV BGR color palette with trackbarsOpenCV is a library of programming functions mainly aimed at real-time computer vision. In this article, Let's create a window which will contain RGB color palette with track bars. By moving the trackbars the value of RGB Colors will change b/w 0 to 255. So using the same, we can find the color with
2 min read
Draw a rectangular shape and extract objects using Python's OpenCVOpenCV is an open-source computer vision and machine learning software library. Various image processing operations such as manipulating images and applying tons of filters can be done with the help of it. It is broadly used in Object detection, Face Detection, and other Image processing tasks. Let'
4 min read
Drawing with Mouse on Images using Python-OpenCVOpenCV is a huge open-source library for computer vision, machine learning, and image processing. OpenCV supports a wide variety of programming languages like Python, C++, Java, etc. It can process images and videos to identify objects, faces, or even the handwriting of a human. In this article, we
3 min read
Text Detection and Extraction using OpenCV and OCROptical Character Recognition (OCR) is a technology used to extract text from images which is used in applications like document digitization, license plate recognition and automated data entry. In this article, we explore how to detect and extract text from images using OpenCV for image processing
2 min read
Invisible Cloak using OpenCV | Python ProjectHave you ever seen Harry Potter's Invisible Cloak; Was it wonderful? Have you ever wanted to wear that cloak? If Yes!! then in this post, we will build the same cloak which Harry Potter uses to become invisible. Yes, we are not building it in a real way but it is all about graphics trickery. In this
4 min read
Background subtraction - OpenCVBackground subtraction is a way of eliminating the background from image. To achieve this we extract the moving foreground from the static background. Background Subtraction has several use cases in everyday life, It is being used for object segmentation, security enhancement, pedestrian tracking, c
2 min read
ML | Unsupervised Face Clustering PipelineLive face-recognition is a problem that automated security division still face. With the advancements in Convolutions Neural Networks and specifically creative ways of Region-CNN, itâs already confirmed that with our current technologies, we can opt for supervised learning options such as FaceNet, Y
15+ min read
Pedestrian Detection using OpenCV-PythonOpenCV is an open-source library, which is aimed at real-time computer vision. This library is developed by Intel and is cross-platform - it can support Python, C++, Java, etc. Computer Vision is a cutting edge field of Computer Science that aims to enable computers to understand what is being seen
3 min read
Saving Operated Video from a webcam using OpenCVOpenCV is a vast library that helps in providing various functions for image and video operations. With OpenCV, we can perform operations on the input video. OpenCV also allows us to save that operated video for further usage. For saving images, we use cv2.imwrite() which saves the image to a specif
4 min read
Face Detection using Python and OpenCV with webcamFace detection is a important application of computer vision that involves identifying human faces in images or videos. In this Article, we will see how to build a simple real-time face detection application using Python and OpenCV where webcam will be used as the input source.Step 1: Installing Ope
3 min read
Gun Detection using Python-OpenCVGun Detection using Object Detection is a helpful tool to have in your repository. It forms the backbone of many fantastic industrial applications. We can use this project for real threat detection in companies or organizations. Prerequisites: Python OpenCV OpenCV(Open Source Computer Vision Libra
4 min read
Multiple Color Detection in Real-Time using Python-OpenCVFor a robot to visualize the environment, along with the object detection, detection of its color in real-time is also very important. Why this is important? : Some Real-world ApplicationsIn self-driving car, to detect the traffic signals.Multiple color detection is used in some industrial robots, t
4 min read
Detecting objects of similar color in Python using OpenCVOpenCVÂ is a library of programming functions mainly aimed at real-time computer vision. In this article, we will see how to get the objects of the same color in an image. We can select a color by slide bar which is created by the cv2 command cv2.createTrackbar. Libraries needed:OpenCV NumpyApproach:
3 min read
Opening multiple color windows to capture using OpenCV in PythonOpenCV is an open source computer vision library that works with many programming languages and provides a vast scope to understand the subject of computer vision.In this example we will use OpenCV to open the camera of the system and capture the video in two different colors. Approach: With the lib
2 min read
Python | Play a video in reverse mode using OpenCVOpenCV (Open Source Computer Vision) is a computer vision library that contains various functions to perform operations on Images or videos. OpenCV's application areas include : 1) Facial recognition system 2) motion tracking 3) Artificial neural network 4) Deep neural network 5) video streaming etc
3 min read
Template matching using OpenCV in PythonTemplate matching is a technique for finding areas of an image that are similar to a patch (template). A patch is a small image with certain features. The goal of template matching is to find the patch/template in an image. To find it, the user has to give two input images: Source Image (S) - The im
6 min read
Cartooning an Image using OpenCV - PythonInstead of sketching images by hand we can use OpenCV to convert a image into cartoon image. In this tutorial you'll learn how to turn any image into a cartoon. We will apply a series of steps like:Smoothing the image (like a painting)Detecting edges (like a sketch)Combining both to get a cartoon ef
2 min read
Vehicle detection using OpenCV PythonVehicle detection is an important application of computer vision that helps in monitoring traffic, automating parking systems and surveillance systems. In this article, weâll implement a simple vehicle detection system using Python and OpenCV using a pre-trained Haar Cascade classifier and we will g
3 min read
Count number of Faces using Python - OpenCVPrerequisites: Face detection using dlib and openCV In this article, we will use image processing to detect and count the number of faces. We are not supposed to get all the features of the face. Instead, the objective is to obtain the bounding box through some methods i.e. coordinates of the face i
3 min read
Live Webcam Drawing using OpenCVLet us see how to draw the movement of objects captured by the webcam using OpenCV. Our program takes the video input from the webcam and tracks the objects we are moving. After identifying the objects, it will make contours precisely. After that, it will print all your drawing on the output screen.
3 min read
Detect and Recognize Car License Plate from a video in real timeRecognizing a Car License Plate is a very important task for a camera surveillance-based security system. We can extract the license plate from an image using some computer vision techniques and then we can use Optical Character Recognition to recognize the license number. Here I will guide you thro
11 min read
Track objects with Camshift using OpenCVOpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in todayâs systems. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a
3 min read
Replace Green Screen using OpenCV- PythonPrerequisites: OpenCV Python TutorialOpenCV (Open Source Computer Vision) is a computer vision library that contains various functions to perform operations on pictures or videos. This library is cross-platform that is it is available on multiple programming languages such as Python, C++, etc.Green
1 min read
Python - Eye blink detection projectIn this tutorial you will learn about detecting a blink of human eye with the feature mappers knows as haar cascades. Here in the project, we will use the python language along with the OpenCV library for the algorithm execution and image processing respectively. The haar cascades we are going to us
4 min read
Connect your android phone camera to OpenCV - PythonPrerequisites: OpenCV OpenCV is a huge open-source library for computer vision, machine learning, and image processing. OpenCV supports a wide variety of programming languages like Python, C++, Java, etc. It can process images and videos to identify objects, faces, or even the handwriting of a human
2 min read
Determine The Face Tilt Using OpenCV - PythonIn this article, we are going to see how to determine the face tilt using OpenCV in Python. To achieve this we will be using a popular computer vision library opencv-python. In this program with the help of the OpenCV library, we will detect faces in a live stream from a webcam or a video file and s
4 min read
Right and Left Hand Detection Using PythonIn this article, we are going to see how to Detect Hands using Python. We will use mediapipe and OpenCV libraries in python to detect the Right Hand and Left Hand. We will be using the Hands model from mediapipe solutions to detect hands, it is a palm detection model that operates on the full image
5 min read
Brightness Control With Hand Detection using OpenCV in PythonIn this article, we are going to make a Python project that uses OpenCV and Mediapipe to see hand gesture and accordingly set the brightness of the system from a range of 0-100. We have used a HandTracking module that tracks all points on the hand and detects hand landmarks, calculate the distance
6 min read
Creating a Finger Counter Using Computer Vision and OpenCv in PythonIn this article we are going to create a finger counter using Computer Vision and OpenCv. This is a simple project that can be applied in various fields such as gesture recognition, human-computer interaction and educational tools. By the end of this article you will have a working Python applicatio
5 min read
Python Django Projects
Python Web Development With DjangoPython Django is a web framework that allows to quickly create efficient web pages. Django is also called batteries included framework because it provides built-in features such as Django Admin Interface, default database - SQLite3, etc. When youâre building a website, you always need a similar set
15+ min read
How to Create an App in Django ?In Django, an app is a web application that performs a specific functionality, such as blog posts, user authentication or comments. A single Django project can consist of multiple apps, each designed to handle a particular task. Each app is a modular and reusable component that includes everything n
3 min read
Weather app using Django - PythonOur task is to create a Weather app using Django that lets users enter a city name and view current weather details like temperature, humidity, and pressure. We will build this by setting up a Django project, creating a view to fetch data from the OpenWeatherMap API, and designing a simple template
2 min read
Django Sign Up and login with confirmation Email | PythonDjango provides a built-in authentication system that handles users, login, logout, and registration. In this article, we will implement a user registration and login system with email confirmation using Django and django-crispy-forms for elegant form rendering.Install crispy forms using the termina
7 min read
ToDo webapp using DjangoOur task is to create a simple ToDo app using Django that allows users to add, view, and delete notes. We will build this by setting up a Django project, creating a Todo model, designing forms and views to handle user input, and creating templates to display the tasks. Step-by-step, we'll implement
4 min read
How to Send Email with DjangoDjango, a high-level Python web framework, provides built-in functionality to send emails effortlessly. Whether you're notifying users about account activations, sending password reset links, or dispatching newsletters, Djangoâs robust email handling system offers a straightforward way to manage ema
4 min read
Django project to create a Comments SystemWe will build a straightforward Django app where users can view posts and add comments, all using just two simple templates. We will learn how to set up models, handle form submissions and create clean views to power an interactive comment system. Itâs perfect for getting a solid foundation with Dja
4 min read
Voting System Project Using Django FrameworkProject Title: Pollster (Voting System) web application using Django frameworkType of Application (Category): Web application.Introduction: We will create a pollster (voting system) web application using Django. This application will conduct a series of questions along with many choices. A user will
13 min read
Determine The Face Tilt Using OpenCV - PythonIn this article, we are going to see how to determine the face tilt using OpenCV in Python. To achieve this we will be using a popular computer vision library opencv-python. In this program with the help of the OpenCV library, we will detect faces in a live stream from a webcam or a video file and s
4 min read
How to add Google reCAPTCHA to Django forms ?We will learn how to integrate Google reCAPTCHA into our Django forms to protect our website from spam and automated bots. We'll cover everything from registering our site with Google, setting up the necessary keys in your Django project, to adding the reCAPTCHA widget in your forms and validating i
3 min read
E-commerce Website using DjangoThis project deals with developing a Virtual website âE-commerce Websiteâ. It provides the user with a list of the various products available for purchase in the store. For the convenience of online shopping, a shopping cart is provided to the user. After the selection of the goods, it is sent for t
11 min read
College Management System using Django - Python ProjectIn this article, we are going to build College Management System using Django and will be using dbsqlite database. In the times of covid, when education has totally become digital, there comes a need for a system that can connect teachers, students, and HOD and that was the motivation behind buildin
15+ min read
Create Word Counter App using DjangoOur task is to build a simple Django application that counts the number of words in a given text. This is a great beginner project if you have some basic knowledge of Django.Refer to the below article to know about basics of Django.Django BasicsHow to Create a Basic Project using MVT in Django ?Step
3 min read
Python Text to Speech and Vice-Versa
Speak the meaning of the word using PythonThe following article shows how by the use of two modules named, pyttsx3 and PyDictionary, we can make our system say out the meaning of the word given as input. It is module which speak the meaning when we want to have the meaning of the particular word. Modules neededPyDictionary: It is a Dictiona
2 min read
Convert PDF File Text to Audio Speech using PythonLet us see how to read a PDF that is converting a textual PDF file into audio.Packages Used:pyttsx3: It is a Python library for Text to Speech. It has many functions which will help the machine to communicate with us. It will help the machine to speak to usPyPDF2: It will help to the text from the P
2 min read
Speech Recognition in Python using Google Speech APISpeech recognition means converting spoken words into text. It used in various artificial intelligence applications such as home automation, speech to text, etc. In this article, youâll learn how to do basic speech recognition in Python using the Google Speech Recognition API.Step 1: Install Require
2 min read
Convert Text to Speech in PythonThere are several APIs available to convert text to speech in Python. One of such APIs is the Google Text to Speech API commonly known as the gTTS API. gTTS is a very easy to use tool which converts the text entered, into audio which can be saved as a mp3 file. The gTTS API supports several language
4 min read
Python Text To Speech | pyttsx modulepyttsx is a cross-platform text to speech library which is platform independent. The major advantage of using this library for text-to-speech conversion is that it works offline. However, pyttsx supports only Python 2.x. Hence, we will see pyttsx3 which is modified to work on both Python 2.x and Pyt
2 min read
Python: Convert Speech to text and text to SpeechSpeech Recognition is an important feature in several applications used such as home automation, artificial intelligence, etc. This article aims to provide an introduction on how to make use of the SpeechRecognition and pyttsx3 library of Python.Installation required: Python Speech Recognition modul
3 min read
Personal Voice Assistant in PythonAs we know Python is a suitable language for script writers and developers. Let's write a script for Personal Voice Assistant using Python. The query for the assistant can be manipulated as per the user's need. The implemented assistant can open up the application (if it's installed in the system),
6 min read
Build a Virtual Assistant Using PythonVirtual desktop assistant is an awesome thing. If you want your machine to run on your command like Jarvis did for Tony. Yes it is possible. It is possible using Python. Python offers a good major library so that we can use it for making a virtual assistant. Windows has Sapi5 and Linux has Espeak wh
8 min read
Python | Create a simple assistant using Wolfram Alpha API.The Wolfram|Alpha Webservice API provides a web-based API allowing the computational and presentation capabilities of Wolfram|Alpha to be integrated into web, mobile, desktop, and enterprise applications. Wolfram Alpha is an API which can compute expert-level answers using Wolframâs algorithms, know
2 min read
Voice Assistant using pythonSpeech recognition is the process of turning spoken words into text. It is a key part of any voice assistant. In Python the SpeechRecognition module helps us do this by capturing audio and converting it to text. In this guide weâll create a basic voice assistant using Python.Step 1: Install Required
3 min read
Voice search Wikipedia using PythonEvery day, we visit so many applications, be it messaging platforms like Messenger, Telegram or ordering products on Amazon, Flipkart, or knowing about weather and the list can go on. And we see that these websites have their own software program for initiating conversations with human beings using
5 min read
Language Translator Using Google API in PythonAPI stands for Application Programming Interface. It acts as an intermediate between two applications or software. In simple terms, API acts as a messenger that takes your request to destinations and then brings back its response for you. Google API is developed by Google to allow communications wit
3 min read
How to make a voice assistant for E-mail in Python?As we know, emails are very important for communication as each professional communication can be done by emails and the best service for sending and receiving mails is as we all know GMAIL. Gmail is a free email service developed by Google. Users can access Gmail on the web and using third-party pr
9 min read
Voice Assistant for Movies using PythonIn this article, we will see how a voice assistant can be made for searching for movies or films. After giving input as movie name in audio format and it will give the information about that movie in audio format as well. As we know the greatest searching website for movies is IMDb. IMDb is an onlin
6 min read