lewjiayi / Crowd-Analysis

System integrated with YOLOv4 and Deep SORT for real-time crowd monitoring, then perform crowd analysis. The system is able to monitor for abnormal crowd activity, social distance violation and restricted entry. The other part of the system can then process crowd movement data into optical flow, heatmap and energy graph.
MIT License
54 stars 19 forks source link

question: How do you decide what should be the values for ABNORMAL_ENERGY and ABNORMAL_THRESH? #9

Closed NotSharwan closed 2 years ago

NotSharwan commented 2 years ago

I've been working on this project and i'm not able to understand on what parameters you used ABNORMAL_ENERGY as 1866? Like what is the signficance of calculating the energies?

lewjiayi commented 2 years ago

Well, the abnormal activity detection in this project is rather conceptual. When I design this function, what I had in my head was to detect if there are sudden absolute velocity spike among most of the person currently tracked in the frame. If you are familiar with kinematics, kinetic energy is more sensitive to the change of speed rather than measuring the speed itself. Measuring weight would be another topic, so I set all weight to 1. Technically what I am doing here is just squaring the velocity.

The number for abnormal energy should come from data processing. Each footage has different angle and distance from pedestrian as well as recoding FPS. The velocity of a person (in unit of frames per second) will appears different when record by two camera at the same time. Hence, the for this project, the energy for different camera or footage will have to be determine after you have some footage recorded and process the footage.

abnormal_data_process.py is a simple data processing tools to trim extreme ends and propose a possible normal energy level. The proposed value is based on mean value to the power of 1.05. The idea is have a range of 5% from the mean value, since energy is velocity squared, we take the power of 5% for energy.

ABNORMAL_THRESH is somewhat a experience or data based value as well. At times you will have some pedestrian moving faster than usual. This might trigger the abnormal energy level. ABNORMAL_THRESH is used as a second check to identify is the are more than X% of crowd exceed the abnormal energy threshold.

All in all, this project is rather conceptual. I hope this can walk you through my design concept and give you some idea on how to work on similar projects or even improve this one.