Sample Major Project Report Jul-Dec 24
Sample Major Project Report Jul-Dec 24
Guided by:
Submitted by:
Prof. ……………………
Vedik Sharma (0827CS141117)
Professor, CSE
Yash Sanskari (0827CS141119)
Acropolis Institute of Technology & Research, Indore
July - Dec 2024
EXAMINER APPROVAL
conclusion drawn therein, but approve the project only for the purpose for
Date: Date:
RECOMMENDATION
This is to certify that the work embodied in this major project entitled
(Project Guide)
(Project Coordinator)
(Dean Academics)
STUDENTS UNDERTAKING
Dr. Kamal Kumar Sethi. The whole responsibility of the work done in this
project is ours. The sole intension of this work is only for practical learning
and research.
does not contain any part of any work which has been submitted for the
Deemed University without proper citation and if the same work found
There are number of people without whom this project would not
have been feasible. Their high academic standards and personal integrity
provided me with continuous guidance and support.
CHAPTER 1. INTRODUCTION 1
...........................................................................
1.1 Overview 1
...............................................................................
1.2 Background and Motivation 2
.................................................
1.3 Problem Statement and Objectives 2
......................................
1.4 Scope of the Project 3
..............................................................
1.5 Team Organization 5
................................................................
1.6 Report Structure 5
...................................................................
CHAPTER 5. CONCLUSION........................................................................... 3
.... 6
5.1 Conclusion 36
...........................................................................
5.2 Limitations of the Work 36
......................................................
5.3 Suggestion and Recommendations for Future Work 37
.........
BIBLIOGRAPHY..................................................................................................... 3
..... 8
PROJECT
PLAN………………………………………………………………………………
…41
GUIDE INTERACTION
SHEET…………………………………………………………...42
SOURCE
CODE………………………………………………………………………………
….43
Real-Time Object Detection and Recognition
Chapter 1. Introduction
Introduction
The project uses image analysis for object detection and recognition
in order to determine the activities and track objects. Here, Machine
learning is used to train the machine for particular set of objects so that a
system can be implemented for counting those objects by detecting and
then recognizing them in real-time.
1.1 Overview
The project is based on image processing and analysis from a video
that is captured from the camera in real-time. A camera placed at the
entrance of the college is used to detect students who enter inside the
campus.
1
Real-Time Object Detection and Recognition
2
Real-Time Object Detection and Recognition
3
Real-Time Object Detection and Recognition
persons.
Vedika Shrivastava :
Yash Bhawsar :
Also, worked on Back end design for storing results in database for
maintaining logs.
5
Real-Time Object Detection and Recognition
6
Real-Time Object Detection and Recognition
Review of Literature
Object Detection and Recognition is being studies for more than four
decades now and significant efforts have been paid to develop
representation schemes and algorithms aiming at recognizing generic
objects in images taken under different imaging conditions. Within a
limited scope of distinct objects, such as handwritten digits, fingerprints,
faces, and road signs, substantial success has been achieved. Object
recognition is also related to content-based image retrieval and multimedia
indexing as a number of generic objects can be recognized. In addition,
significant progress towards object categorization from images has been
made in the recent years . Object recognition has also been studied
extensively in psychology, computational neuroscience and cognitive
science.
dedicated person who manually does all the work of counting the
students and vehicles and keeping away the animals, that is done by
this project by automation.
7
Real-Time Object Detection and Recognition
The study brought out that moving targets are extracted from
8
Real-Time Object Detection and Recognition
9
Real-Time Object Detection and Recognition
The paper introduced a new real-time traffic light recognition system for
1
0
Real-Time Object Detection and Recognition
1
1
Real-Time Object Detection and Recognition
The paper brings in new techniques to detect and analyze periodic motion
The paper advocated that Camera based systems are routinely used for
The paper presented a method for real-time 3D object detection that does
not require a time consuming training stage, and can handle untextured
objects. At its core, is a novel template representation that is designed to
be robust to small image transformations. It tests only a small subset of all
possible pixel locations when parsing the image, and to represent a 3D
object with a limited set of templates. It showed that together with a
binary representation that makes evaluation very fast and a
branch-and-bound approach to efficiently scan the image, it can detect
untextured objects in complex situations and provide their 3D pose in
real-time. [5]
According to paper, Robust object recognition is a crucial skill for robots
1
2
Real-Time Object Detection and Recognition
The paper brings in YOLO, a new approach to object detection. Prior work
1
3
Real-Time Object Detection and Recognition
body parts in variant to pose, body shape, clothing, etc. The system runs at
200 frames per second on consumer hardware. The evaluation shows high
accuracy on both synthetic and real test sets, and investigates the effect of
several training parameters. [20]
2.3.1 Conclusion
This chapter reviews the literature surveys that have been done during the
research work. The related work that has been proposed by many
researchers has been discussed. The research papers related to object
detection and recognition of objects from 1985 to 2015 have been shown
which discussed about different methods and algorithm to identify objects.
1
4
Real-Time Object Detection and Recognition
Proposed System
It can also count the vehicles that come inside the college and
classify them if it is car , motorcycle , bicycle , truck etc. and store that
information in the database. It can give the individual count of different
objects.
system :
Man Power : It does not require any person or their efforts to stand
and count the number of people.
1
5
Real-Time Object Detection and Recognition
3.4.1 Technical
For any real-time detection system, there is a need to process images from
the video. For this, the kind of framework used must be the one that is
capable of extracting those objects from the images easily and accurately in
real-time. The framework used in this is Tensorflow, which is a framework
designed by Google for efficiently dealing with deep learning and concepts
like neural networks , making the system technically feasible.
3.4.2 Economical
For any real-time object detection system, there is a need of a High
definition Camera for better and accurate results.
3.4.3 Operational
The main motto of our system is to reduce the manual efforts of counting
the students and vehicles by automating it.
2
0
Real-Time Object Detection and Recognition
3.6.1 Hardware
21
Real-Time Object Detection and Recognition
3.6.2 Software
OpenCV
Tensor Flow
Chapter 4 . Implementation
Implementation
For the problem of counting the number of students and vehicles entering
the college campus manually, the system is designed in such a way so as to
automate the process by placing a camera at the entrance gate so that
students, bikes and cars getting inside the college campus can be identified
and counted.
4.2.1 OpenCV
Adopted all around the world, OpenCV has more than 47 thousand
people of user community and estimated number of downloads exceeding
14 million. Usage ranges from interactive art, to mines inspection, stitching
maps on the web or through advanced robotics.
4.2.3 Models
The TensorFlow official models are a collection of example models that use
TensorFlow's high-level APIs. They are intended to be well-maintained,
tested, and kept up to date with the latest TensorFlow API. They should
also be reasonably optimized for fast performance while still being easy to
read.
Table 3 : Types of Models
2
7
Real-Time Object Detection and Recognition
captioning dataset.
The system uses COCO data set Model which is Common Object in Context
designed by Mirosoft.
COCO Model :
Object Detection
Recognition in context
91 stuff categories
2
8
Real-Time Object Detection and Recognition
The distribution of the objects in this database can be obtained from their
website. In section Explore, it is possible to choose and combine each of the
objects and observe how many images these objects appear. The
distribution for each of the objects in training/validation set is shown in
the following image:
Simple :
Object Oriented :
Extensive Libraries :
3
1
Real-Time Object Detection and Recognition
4.4 Screenshots
The Following are the screenshots of the result of the project :
3
2
Real-Time Object Detection and Recognition
4.5 Testing
Testing is the process of evaluation of a system to detect differences
between given input and expected output and also to assess the feature of
the system. Testing assesses the quality of the product. It is a process that
is done during the development process. .
Functionality testing
Implementation testing
The texting method used here is Black Box Testing. It is carried out to test
functionality of the program. It is also called ‘Behavioral’ testing. The tester
in this case, has a set of input values and respective desired results. On
providing input, if the output matches with the desired results, the
program is tested ‘ok’, and problematic otherwise.
Test Case It will check whether the system detects the students entering
in the college with accuracy >=50% or not.
Summary
Procedure
Expected The students must be detected with accuracy greater than
Result 50%.
Actual Result The Students with accuracy greater than 50% are detected.
Status Pass
Test Case It will check whether the entry for each student entering in Th
e
college is stored in the database with the timestamp or not.
Summary
3
4
Real-Time Object Detection and Recognition
3
5
Real-Time Object Detection and Recognition
Chapter 5.Conclusion
Conclusion
5.1 Conclusion
The aim of the project that was to automatically detect , identify and count
the number of students, vehicles and animals and save their details in the
database is successfully and accurately done by this project with the use of
concepts like Deep learning, Convolutional Neural Networks, OpenCV and
TensorFlow.
The models that we are using for identifying the objects are
In the system, scanning of each frame is one per second but still it
needs improvement. If the objects move too fast, it may not detect
them.
3
6
Real-Time Object Detection and Recognition
Bibliography
[3] K. Levi and Y. Weiss, "Learning Object Detection from a Small Number
of Examples: the Importance of Good Features," in IEEE Computer
Society Conference, 2004.
[6] J. Zhou and J. Hoang, "Real Time Robust Human Detection and
Tracking System," in IEEE Computer Society Conference, 2005.
3
8
Real-Time Object Detection and Recognition
[15] J. Heikkila and O. Silven, "A real-time system for monitoring of cyclists
and pedestrians," Image and Vision Computing, 2004.
3
9
Real-Time Object Detection and Recognition
[18] J. Redmon, S. Divvala, R. Girshik and A. Farhadi, "You Only Look Once:
Unified, Real-Time Object Detection," in IEEE conference on Computer
Vision and Pattern Rocgnition, 2016.
Project Plan
Gantt Chart
4
1
Real-Time Object Detection and Recognition
Source Code
1. Create_record.py
import hashlib
import io
import logging
import os
import random
import re
import PIL.Image
import tensorflow as tf
flags = tf.app.flags
FLAGS = flags.FLAGS
def get_class_name_from_filename(file_name):
Args:
ie. "american_pit_bull_terrier_105.jpg"
Returns:
example: The converted tf.Example.
4
3
Real-Time Object Detection and Recognition
def dict_to_tf_example(data,
label_map_dict,
image_subdirectory,
ignore_difficult_instances=False):
Notice that this function normalizes the bounding box coordinates provided
by the raw data.
Args:
data: dict holding PASCAL XML fields for a single image (obtained by
running dataset_util.recursive_parse_xml_to_dict)
Returns:
Raises:
encoded_jpg = fid.read()
encoded_jpg_io = io.BytesIO(encoded_jpg)
image = PIL.Image.open(encoded_jpg_io)
if image.format != 'JPEG':
key = hashlib.sha256(encoded_jpg).hexdigest()
width = int(data['size']['width'])
height = int(data['size']['height'])
xmin = []
4
4
Real-Time Object Detection and Recognition
ymin = []
xmax = []
ymax = []
classes = []
classes_text = []
truncated = []
poses = []
difficult_obj = []
difficult = bool(int(obj['difficult']))
continue
difficult_obj.append(int(difficult))
xmin.append(float(obj['bndbox']['xmin']) / width)
ymin.append(float(obj['bndbox']['ymin']) / height)
xmax.append(float(obj['bndbox']['xmax']) / width)
ymax.append(float(obj['bndbox']['ymax']) / height)
class_name = get_class_name_from_filename(data['filename'])
classes_text.append(class_name)
classes.append(label_map_dict[class_name])
truncated.append(int(obj['truncated']))
poses.append(obj['pose'])
example = tf.train.Example(features=tf.train.Features(feature={
'image/height': dataset_util.int64_feature(height), 'image/width':
dataset_util.int64_feature(width), 'image/filename':
dataset_util.bytes_feature(data['filename']), 'image/source_id':
dataset_util.bytes_feature(data['filename']), 'image/key/sha256':
dataset_util.bytes_feature(key), 'image/encoded':
dataset_util.bytes_feature(encoded_jpg), 'image/format':
dataset_util.bytes_feature('jpeg'), 'image/object/bbox/xmin':
dataset_util.float_list_feature(xmin), 'image/object/bbox/xmax':
dataset_util.float_list_feature(xmax), 'image/object/bbox/ymin':
dataset_util.float_list_feature(ymin), 'image/object/bbox/ymax':
dataset_util.float_list_feature(ymax), 'image/object/class/text':
dataset_util.bytes_list_feature(classes_text),
'image/object/class/label': dataset_util.int64_list_feature(classes),
'image/object/difficult': dataset_util.int64_list_feature(difficult_obj),
'image/object/truncated': dataset_util.int64_list_feature(truncated),
4
5
Real-Time Object Detection and Recognition
'image/object/view': dataset_util.bytes_list_feature(poses),
}))
return example
def create_tf_record(output_filename,
label_map_dict,
annotations_dir,
image_dir,
examples):
Args:
"""
writer = tf.python_io.TFRecordWriter(output_filename)
if idx % 100 == 0:
if not os.path.exists(path):
continue
xml_str = fid.read()
xml = etree.fromstring(xml_str)
data = dataset_util.recursive_parse_xml_to_dict(xml)['annotation']
writer.write(tf_example.SerializeToString())
writer.close()
4
6
Real-Time Object Detection and Recognition
label_map_dict = label_map_util.get_label_map_dict(FLAGS.label_map_path)
examples_list = dataset_util.read_examples_list(examples_path)
# Test images are not included in the downloaded data set, so we shall perform
random.seed(42)
random.shuffle(examples_list)
num_examples = len(examples_list)
train_examples = examples_list[:num_train]
val_examples = examples_list[num_train:]
len(train_examples), len(val_examples))
image_dir, train_examples)
image_dir, val_examples)
if __name__ == '__main__':
tf.app.run()
2. Object_detection.py
4
7
Real-Time Object Detection and Recognition
import os
import cv2
import time
import argparse
import multiprocessing
import numpy as np
import tensorflow as tf
import datetime
import pymysql
CWD_PATH = os.getcwd()
# Path to frozen detection graph. This is the actual model that is used for the object
detection. MODEL_NAME = 'ssd_mobilenet_v1_coco_11_06_2017'
# List of the strings that is used to add correct label for each box.
NUM_CLASSES = 90
label_map = label_map_util.load_labelmap(PATH_TO_LABELS)
categories = label_map_util.convert_label_map_to_categories(label_map,
max_num_classes=NUM_CLASSES,
use_display_name=True)
category_index = label_map_util.create_category_index(categories)
4
8
Real-Time Object Detection and Recognition
# Each box represents a part of the image where a particular object was
detected. boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
# Each score represent how level of confidence for each of the objects.
# Score is shown on the result image, together with the class label.
scores = detection_graph.get_tensor_by_name('detection_scores:0')
classes = detection_graph.get_tensor_by_name('detection_classes:0')
num_detections = detection_graph.get_tensor_by_name('num_detections:0')
# Actual detection.
feed_dict={image_tensor: image_np_expanded})
conn = pymysql.connect(host="localhost",user="root",passwd="",db="DB_detect")
mycursor = conn.cursor()
co=0
if(category_index[i]['id']==1):
co = co+1
print(category_index[i]['name'])
4
9
Real-Time Object Detection and Recognition
if(category_index[i]['id']==3):
co = co+1
print(category_index[i]['name'])
print("------------------------------------------------------------------------------")
conn.commit()
conn.close()
5
0