![](https://static.wixstatic.com/media/11062b_64ae2a899006496dac01c2e81fac97f1f000.jpg/v1/fill/w_980,h_551,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/11062b_64ae2a899006496dac01c2e81fac97f1f000.jpg)
The
Crowd
Density
Project
SPAIC 2019
A Project Showcase
![](https://static.wixstatic.com/media/1a9dce_c31ed63ac6734e329dd24cde9137f663~mv2.jpg/v1/fill/w_151,h_164,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/1a9dce_c31ed63ac6734e329dd24cde9137f663~mv2.jpg)
THE PROBLEM
"Exploring Crowd Counting with Computer Vision, aimed at preventing stampedes and promoting safer gatherings everywhere"
​
"STAMPEDES ARE PREVENTABLE MAN-MADE DISASTERS"
"More than 3000 people have lost their lives in stampedes between 2000 and 2015, in india alone"
2015 Mina Stampede News Report
![](https://static.wixstatic.com/media/1a9dce_09e4882bb78c469ea349541197e1ea7f~mv2.jpg/v1/fill/w_589,h_285,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/1a9dce_09e4882bb78c469ea349541197e1ea7f~mv2.jpg)
"THE
ELPHINSTONE RAILWAY STATION STAMPEDE OF 2017 CLAIMED 23 LIVES"
"THE KUMBH MELA IN INDIA, ONE OF THE WORLD'S LARGEST RELIGIOUS FESTIVALS, HAS CLAIMED SCORES OF LIVES IN MASSIVE STAMPEDES ACROSS THE PAST SEVERAL YEARS"
​
![](https://static.wixstatic.com/media/1a9dce_bbf854d8654a4fb89e0bd536266cc706~mv2.jpg/v1/fill/w_439,h_298,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/1a9dce_bbf854d8654a4fb89e0bd536266cc706~mv2.jpg)
KUMBH MELA, INDIA
Watch TEDx talk by Nilay Kulkarni, pioneer of 'Ashioto' technology used to reduce stampedes at Kumbh Mela(one of our inspirations)
![](https://static.wixstatic.com/media/11062b_537efba8f8604df9aa8336b4099575a9f000.png/v1/fill/w_980,h_1138,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/11062b_537efba8f8604df9aa8336b4099575a9f000.png)
"The most cost-effective stampede prevention solutions currently employed, depend extensively on sensor-based hardware which brings along with it the possibility of hardware failure, degradation and maintenance costs"
About Our Project
Our Purpose
We believe that human stampedes are very much preventable disasters. It is absolutely unacceptable that even in this advanced age where technology has the power to prevent such incidents, so many lives are being lost in this manner. Every human being at every public gathering, deserves to return home safely.
Our Vision
-
To give Crowd Density Detection the platform of significance that it deserves, with regards to safety at every public gathering.
-
To explore current trends in Crowd Density Detection.
-
To make consistent efforts towards building pure software-based solutions that can give high accurate information that can help detect and prevent imminent stampedes.
Exploration
Throughout the course of our journey on the Facebook Secure and Private AI Challenge 2019, we have tried to explore this topic from every angle. Right from the various use cases of Crowd Density Detection to the varieties of different models and data sets used, we have tried to make our exploration as comprehensive as possible within our short journey as a team. Here, you can see a collation of all of these efforts.
Project Work: Implementations
![](https://static.wixstatic.com/media/d0220c_a7f38a088979498b9254e7a1c6ccac1d~mv2.png/v1/fill/w_239,h_188,al_c,lg_1,q_85,enc_auto/d0220c_a7f38a088979498b9254e7a1c6ccac1d~mv2.png)
![](https://static.wixstatic.com/media/d0220c_6140a2819d134cc28245da959cd2336b~mv2.png/v1/fill/w_239,h_188,al_c,lg_1,q_85,enc_auto/d0220c_6140a2819d134cc28245da959cd2336b~mv2.png)
Visitor Counter for Public Events
![](https://static.wixstatic.com/media/1a9dce_a697206c85094284867bda93e97afd53f000.jpg/v1/fill/w_640,h_480,al_c,q_80,enc_auto/1a9dce_a697206c85094284867bda93e97afd53f000.jpg)
-
Based on the centroid tracking algorithm and uses OpenCV,Numpy,dlib,imutils and the MobileNet-SSD model to achieve tracking of people moving in both directions w.r.t the reference line drawn in the middle of the screen.
-
Program code could be run on cameras placed above entrances/exits at festivals/conferences to calculate net number of visitors to various sub-events and judge the popularity of various programmes.
-
Could also be used to determine the most crowded areas at a public expo and take precautions to prevent stampedes.
-
Output of 34 Frames Per Second(FPS) was recorded on this implementation.
​
![](https://static.wixstatic.com/media/1a9dce_8f7f11aee7a94c29b91e210bee4c1415~mv2.jpg/v1/fill/w_36,h_32,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/1a9dce_8f7f11aee7a94c29b91e210bee4c1415~mv2.jpg)
![](https://static.wixstatic.com/media/1a9dce_558224e5664e45748107ba6cd552f452~mv2.jpg/v1/fill/w_33,h_32,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/1a9dce_558224e5664e45748107ba6cd552f452~mv2.jpg)
Face-Level People Counter for Incoming Crowds
![](https://static.wixstatic.com/media/d0220c_4e64d7e1227d4327a88458c858facae7~mv2.png/v1/fill/w_32,h_32,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/d0220c_4e64d7e1227d4327a88458c858facae7~mv2.png)
![](https://static.wixstatic.com/media/1a9dce_ce3001a7ae7845db83786e2b9dfaeba2f000.jpg/v1/fill/w_980,h_551,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/1a9dce_ce3001a7ae7845db83786e2b9dfaeba2f000.jpg)
-
Achieved using DeepSort Algorithm, NumPy, sklean, OpenCV, Pillow and YOLOv3.
​
-
Can be used to get live counts of individuals from live cameras, that face incoming crowds.
​
-
Can be used to get dynamic stats of net number of people in a room/area at malls/public places at once, irrespective of which direction they are walking in.
​
-
Counts coming from different regions can be used to update and constantly improve a crowd count predictor, using Federated Learning approach.
​
-
Can be integrated with a decentralized approach to get live stats about crowds at different places in the same mall/venue at once(bird's eye view of crowd counts across the venue).
​
-
Output rate: 10 FPS
![](https://static.wixstatic.com/media/1a9dce_8f7f11aee7a94c29b91e210bee4c1415~mv2.jpg/v1/fill/w_36,h_32,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/1a9dce_8f7f11aee7a94c29b91e210bee4c1415~mv2.jpg)
![](https://static.wixstatic.com/media/1a9dce_558224e5664e45748107ba6cd552f452~mv2.jpg/v1/fill/w_33,h_32,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/1a9dce_558224e5664e45748107ba6cd552f452~mv2.jpg)
CSRnet Implementation on images
![](https://static.wixstatic.com/media/d0220c_4e64d7e1227d4327a88458c858facae7~mv2.png/v1/fill/w_32,h_32,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/d0220c_4e64d7e1227d4327a88458c858facae7~mv2.png)
![](https://static.wixstatic.com/media/1a9dce_9defb3eea7df4a33a53fc37986baa777~mv2.png/v1/fill/w_312,h_599,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/1a9dce_9defb3eea7df4a33a53fc37986baa777~mv2.png)
-
Achieved using PyTorch, CUDA and CSRnet model on ShanghaiTech dataset.
​
-
Can provide impressively accurate counts of people from images alone.
​
-
Can be used for creation of crowd count predictors specific for various events and programmes, trained on counts generated from images alone(no need for live video capture). Past records of images taken at the venue can be used to predict future crowd counts to plan in advance for stampede prevention measures.
​
-
Would be especially useful at large scale religious festivals like the Kumbh Mela, to accurately predict and prepare for crowds based on past images.
​
-
Would be ideal to use with a Federated Learning Approach if image dataset is too large and spread across several machines.
​
-
Would have comparively much less data storage requirements as images are being used, not space-consuming video archives.
![](https://static.wixstatic.com/media/1a9dce_8f7f11aee7a94c29b91e210bee4c1415~mv2.jpg/v1/fill/w_36,h_32,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/1a9dce_8f7f11aee7a94c29b91e210bee4c1415~mv2.jpg)
![](https://static.wixstatic.com/media/1a9dce_558224e5664e45748107ba6cd552f452~mv2.jpg/v1/fill/w_33,h_32,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/1a9dce_558224e5664e45748107ba6cd552f452~mv2.jpg)
C ^3 Framework: An Open-source PyTorch Framework for Crowd Counting
![](https://static.wixstatic.com/media/d0220c_4e64d7e1227d4327a88458c858facae7~mv2.png/v1/fill/w_32,h_32,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/d0220c_4e64d7e1227d4327a88458c858facae7~mv2.png)
![](https://static.wixstatic.com/media/1a9dce_dedb0e39a99c4ef793ffe22b2d9b195e~mv2.jpg/v1/fill/w_388,h_276,al_c,lg_1,q_80,enc_auto/1a9dce_dedb0e39a99c4ef793ffe22b2d9b195e~mv2.jpg)
-
We also briefly explored the Crowd-Counting-Code(C^3) Framework, an open-source framework based on PyTorch, intended for crowd counting.
-
It generates Gaussian Density Maps from input images and counts crowds using it.
-
This framework is intended to reduce the human cost in training.
![](https://static.wixstatic.com/media/1a9dce_8f7f11aee7a94c29b91e210bee4c1415~mv2.jpg/v1/fill/w_36,h_32,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/1a9dce_8f7f11aee7a94c29b91e210bee4c1415~mv2.jpg)
![](https://static.wixstatic.com/media/1a9dce_558224e5664e45748107ba6cd552f452~mv2.jpg/v1/fill/w_33,h_32,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/1a9dce_558224e5664e45748107ba6cd552f452~mv2.jpg)
Concluding Notes
![](https://static.wixstatic.com/media/d0220c_740c7c5b57fa4adab3e6924433541cbb~mv2_d_5500_3671_s_4_2.jpg/v1/fill/w_980,h_654,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/d0220c_740c7c5b57fa4adab3e6924433541cbb~mv2_d_5500_3671_s_4_2.jpg)
The Future : Improving the Project with Secure and Private AI
We see a lot of scope to further work on this project. We think that Secure and Private AI can be significantly employed on this project to achieve the following:
​​
-
Encrypt the identity of individuals in crowds, and ensure that only the requisite statistical analysis is obtained from the Crowd Density Detector(no particulars about any individual is retrievable)(Scope for incorporating Differential Privacy)
-
Federated Learning and Secure Aggregation can be employed during large-scale events, that involve a network of cameras recording live visuals of various areas of the venue or sub-events.
-
In this case, the model would be downloaded to each station(surveillance unit for a particular area), and it would train on the live visuals being generated at that area.
-
The results from multiple such stations would be uploaded and averaged before being used to update the model at the central server, which gains better crowd counting/predicting ability as a result of this iterative process.
-
This smarter model is then downloaded and employed at all the stations supervising the different areas.
​
Reinforcing the Aim of this Project
-
Stampede Detection and Prevention is among the most overlooked and underestimated disasters, for which there is usually very less preparedness. But this is an attitude that must change. Stampedes are such dynamic situations, so much so that a crowd that seemed normal can turn into a violent stampede in a matter of seconds.
​
-
The only way to prevent such incidents is to ensure that crowds that exceed the capacity of a venue are never formed; this can be done only by actively monitoring crowds and keeping a tab on COUNTING the number of individuals in the crowd. If the count exceeds the safe threshold, the authorities must take precautionary measures to prevent am imminent stampede at all costs. This is exactly where The Crowd Density Project comes in.
​
-
'PREVENTION IS BETTER THAN CURE' - This is the saying that this project embodies. Managing a crowd that is ALREADY in a stampede is not an option(this is near impossible). So, the best and only option at preventing such incidents and protecting human lives in such crowds, is to maintain active surveillance, send alerts in the event of threshold-exceeding counts and take crowd redirection measures accordingly.
​
-
We sincerely hope that this project and the collation on this website inspires more tech enthusiasts to see the real challenge that crowds and stampedes are. Human lives are too precious to be lost on avoidable incidents like these. This website collation was intended to serve as a starting ground for anyone who is trying to explore the field of crowd counting and its applications. We understand that getting one's feet wet in a new technical area can be challenging, and all our blogs and implementations are aimed at helping anyone who is trying to explore this field for the first time.
A 'Note' of Thanks
-
On behalf of the entire team comprising myself(Pooja Vinod), Sreekanth Zipsy, Ramkrishna Acharya and Suraiya Khan, I would like to thank the Facebook Udacity Secure and Private AI Scholarship Challenge Community 2019 for being the most supportive space for this project. We would like to thank the entire team at #sg_wonder_vision for encouraging us throughout and providing all the help we needed.
​
-
I would also like to thank the amazing technologists out there, who truly make the world of Computer Vision easy to explore. My sincere thanks to Adrian Rosebrock of PyImageSearch, whose blogs and tutorials were my guideposts to many successful implementations. Thanks also go out to the AnalyticsVidhya blog and the authors of the C3 framework for helping us explore the world of crowd counting further.
​
-
Last but not the least, I want to thank my awesome teammates without whose support and cooperation, this project would have never reached realization.