# Crowd Surge Analysis

**The Challenge**

Design a computer vision solution that can assess the crowd density and behavior in a venue and inform the operators of the typical points of crowd convergence and the current crowd situation.

**The Approach**

1. To estimate the number of people in a crowd.

2. To use the count to understand the crowd density of specific areas.

The first thing we have to do to approach the challenge is to break it down into simpler logical steps.

From here we quickly understand that the first step is to estimate the number of people and how it is distributed in a given camera frame. For this we use a Deep Learning Crowd Counting model that receives an image as input and outputs a matrix with the estimated number of persons per pixel of that image.

The second step is to determine the density of specific areas. Having the count of persons per pixel, we apply a grid to the output matrix and determine the density of each square by adding the value of all of its points. The new matrix shows us how many people are currently accumulated in each area. Knowing this, we can create rules to determine the status of a zone in terms of its capacity and alert the event organizers in real-time. We can also create a historical dataset of area occupancy to be studied and used in the preparation of other events.

**The Model**

Our proposed solution utilizes a Density Estimation Model. The model receives the frames from the cameras and produces the present count of people per pixel on that frame in the form of a 2D matrix.

**Type of model**

The crowd counting model used is a custom Convolutional Neural Network developed in PyTorch that takes an image as input and outputs a matrix with the estimated number of people per pixel.

**How the model works**

The model is composed of a consecutive sequence of layers connected by activation functions.

Each layer is itself a smaller matrix, called a filter, with values called weights. The model receives the image divided into three equal-sized matrices, corresponding to the RGB values of the image colors, runs each filter over each matrix…