TEHNOMUS - New Technologies and Products in Machine Manufacturing Technologies
OCCUPANCY IN A CLASSROOM
ESTIM ATING THE NUMBE R OF PEOPLE IN A ROO M
Abhishek Gupta1, Mario Ramalho2, Carlos Silva3
1
Instituto Superior Tecnico,
[email protected].
2
Instituto Superior Tecnico,
[email protected].
3
Instituto Superior Tecnico,
[email protected] Abstract: Energy savings is one of the core issues scientists are concerned with. In this
article, one aspect of energy saving is discussed. We have considered a classroom/office
scenario where we consume significant amounts of energy for lighting, ventilation and
heating/cooling. To prevent unnecessary use of energy when nobody is in the space or to adjust
the systems operation to the number of occupants, we have proposed a method that will allow us
to know the number of people available in a classroom in a real-time scenario. Spatial
occupancy and Face detection method have been discussed here to count the number of people.
Experiments using image processing are performed. Due to the robust output of face detection
method using Viola-Jones algorithm we have found this more effective.
Keywords: save energy; number of people; face detection; Viola-Jones method.
1. Introduction
classroom with very high accuracy rate. The
It is important to know how many people
problem that we are dealing with is discussed
are present in a room (classroom in education
in section II. Section III describes the two
buildings or offices spaces) at a certain time in
order to optimize the use of electricity. Human different ways that we have tried to achieve
the goal - determine Space Occupancy based
detection in images is a challenging task
on Face Detection - in which the face detection
owing to their variable appearance and
using Viola-Jones algorithm [Alionte, 2015] is
variation in poses that they can adopt [Wang,
mainly highlighted. The limitations of the face
2007]. First, to discriminate cleanly, even in
detection method are also briefly mentioned in
cluttered backgrounds under difficult
section III. A modified perspective of the face
illumination we need a robust feature set, such
detection method has been shown in section
as facial properties, human body shapes etc.
IV. Finally, conclusions are presented.
Detecting a specific object class in a set of
images or video sequence is known as object
detection. It is an important, yet challenging 2. Problem
vision task. Face detection techniques have Generally, some energy is wasted in
been researched for years and are regarded as spaces occupied by multiple users. For an
the most complex and challenging problems in instance, during an ongoing class even if there
the field of computer vision. The face are a smaller number of students than the
detection method focuses on the frontal faces average and more than half of the room is
with sufficient illumination conditions. vacant, we keep the light, ventilation and
We have developed a strategy capable of heating and cooling systems turned on for the
detecting faces in a color image of the
62
TEHNOMUS - New Technologies and Products in Machine Manufacturing Technologies
whole room and the maximum number of adequate toolboxes. Our approach mainly
possible users. Also, when there is nobody in relies on object detection, first with a need for
the class, energy is being continuously used, background subtraction and second with face
wasting of energy and money. detection. To achieve the goal, initially we did
To prevent these kinds of misuse of image comparison to find the space occupancy
electricity and money, we have developed a but later as we did not get an efficient result,
system to monitor the classroom and detect the we opt for face detection method. Both the
number of people in the room at a certain time. methods are discussed below,
By estimating the correct number of people in
the room we will be able to control the energy 3.1 Space Occupancy
consumption by adjusting the system to the Space Occupancy method uses the space
occupation of the space. Therefore, in this
occupied by each people to estimate the
article we have presented a method to count number of people by comparing two images
the number of people in a classroom or in since each person occupies specific space in
similar cases. the room.
For this, we first take two images: one is
3. Approaches when there was no student in the class and
There are several methods to detect the another is with the students in the class. We
persons in an image. But when it comes to a resize the image and convert both the images
classroom scenario it becomes very into gray scale. Then we subtracted the images
complicated to find the people. In this section, to find the difference and space occupied by
the different approaches to find the specific the student. Later the color space has been
objects and count the number of relevant changed and the holes are filled. The feature
objects have been discussed. extraction procedure is done to find the
specific region of interest. Then we continued
Before going for the detection, we have to with blob measurements and draw the
set certain conditions for a better result. boundary boxes. Counting the boundary
Brightness is one of the key factors for these boxes, we can count the number of people. But
kinds of detections. If the image has been in this case the blobs show unexpected results
taken during the day, the illumination (Figure1) which causes the failure of this
condition can literally affect the image by method as per our procedure.
increasing the brightness but if it is taken
during night then it is crucial to have sufficient
artificial light to get a better output. Another
factor to notice is the color temperature. We
need to maintain proper color temperature to
maintain the same image condition for
multiple shots. The size of the room also a) Image without student b) Image with a student
becomes very important in order to detect the
faces and till ta certain distance (depends on
the camera), the image can produce good
results. If the room is relatively bigger then
this certain distance, it becomes difficult to
count the number of people through both c) Subtracted image d) Final image with bounding
special occupancy and face detection. Also, to boxes.
get an accurate result, the picture quality must Figure 1 Counting with Space Occupancy method.
have to be good in quality.
The system was implemented using image
processing in MATLAB R2016a with
63
TEHNOMUS - New Technologies and Products in Machine Manufacturing Technologies
3.2 Face Detection 3.3 Limitations of the method
A face detection method has to say whether The result of face detection highlights the
an image of arbitrary size contains a human limitations of this method are given below,
face and its placement. In the framework of
binary classification this problem has been One of the demerits of Viola-Jones
considered, where the classifier is used to method is that it hardly detects the
minimize the misclassification risk [Ahuja, change of tens of degrees in angle and
2002]. Actual prior probability to have face in that is why it could not detect the student
a given image is not possible to describe on the front row of Fig.3.
through objective distribution. To achieve the
acceptable performance, the algorithm must The two students on the extreme back are
minimize the false positive and false negative not detected because of the unclarity and
rates. small size which also lower the
Viola-Jones face detector is one of the most efficiency of this method.
extensively used learning based methods.
Because of its rapid computation of Haar-like
features, classifier learning with AdaBoost and
the attentional cascade structure, it can run in
real-time [Wang, 2014]. A complete
description of Viola-Jones face detection
method is presented in Fig.2. For creating the
system object detector for the image, we used
vision Cascade Object Detector. There are two
main steps for face detection. One is face
location for finding the face candidates and
another is facial feature detection for verifying
detected face candidates [Merialdo, 2012]. To
be successful, a face detection algorithm must Figure 2: Sequence of Face Detection Algorithm
possess two key features, accuracy and speed.
We have introduced the tic-toc feature to count 4. Improvements
the time taken for each processing which Improvements have been achieved,
helped us to improve the speed of the especially in the case of limited angle problem.
processing. Using the i7, 2 GB RAM we have For instance, (e.g. outside the classroom) a
achieved the minimum processing time around small rotation of the picture can make clear
0.98 sec were obtained. improvements as shown in Fig.3. We have
The block diagram represents the steps rotated the Normal Image. This improvement
followed to detect the faces from the color shows that the model can be largely used with
image. At first, we read the input image and further improvement. Here noticeable that the
convert it to a black and white image. As we two persons on the back-left side are also
took the picture in the evening, there was lack detected which makes the Viola-Jones method
of sufficient illumination; as a consequence, more effective than others.
we set the parameter to control the brightness It allows us to detect a person even just
for a better result. Next, we define the face with the face (Table 1). This result suggests
detector object and extract features to find the that the counting of the number of people
boundaries of the object and draw the inside the classroom could be improved with
bounding boxes. Then, we count the number higher efficiency using multiple shot of images
of bounding boxes which represents the along with image rotation feature which in this
number of people. case results the maximum efficiency.
64
TEHNOMUS - New Technologies and Products in Machine Manufacturing Technologies
classroom should be performed, in order to
evaluate robustness of the approach under
research. It is very encouraging to see the
achieved efficiencies using Viola-Jones
algorithm. We further examined the errors of
our test set with slight improvement to
understand the performance of the algorithm.
We found that with the improvement in angle
it becomes more effective which proves the
success of this model. By detecting the people
in a set of images with a certain angle of
rotation in each image, we could count the
exact number of people available in the
classroom. Upon completion, many other task
can be pursued complimentary, as, for
instance, face recognition or correlate people
with specific position.
Figure 3 Counting people using face detection.
Table 1: Efficiency of different approaches
Approaches Real Detected Efficiency
Faces Faces (%)
Space
Occupancy 1 0 0
Face
Detection 11 8 72
(Classroom)
Face
Detection 14 14 100
(Outside the
classroom) Figure 4 Face detection with 100% efficiency.
5. Conclusions
Acknowledgements
Detecting people in a classroom such as in
Fig.2 is a real challenge and still an open Authors thankfully acknowledge the
problem. Examples presented show its support provided by the students who kindly
feasibility and thus the interest of such an allow the pictures to be made.
approach. Tests such as verifying the
algorithm in more complicated scenario of a
65
TEHNOMUS - New Technologies and Products in Machine Manufacturing Technologies
References
1. [Wang, 2007] Liming Wang, J. S, G.S, I-f. S,
Object Detection Combining Recognition and
Segmentation, Springer-Link, 2007
2. [Alionte, 2015] Elena Alionte, C. L, A
Practical Implementation of Face Detection by
Using Matlab Cascade Object Detector, IEEE,
2015
3. [Ahuja, 2002] N. Ahuja, M-H Yang; D.J.K,
Detecting faces in images: a survey, IEEE,
2002.
4. [Merialdo, 2012] Q.L; U.N; B Merialdo, An
improved algorithm on Viola-Jones object
detector, IEEE, 2012.
5. [Wang, 2014] Y-Q Wang, An Analysis of the
Viola-Jones Face Detection Algorithm, Image
Processing On Line, 2014.
66