Image segmentation is a commonly used technique in digital image processing and analysis to partition an image into multiple parts or regions, often based on the characteristics of the pixels in the image. It is a method in which a digital image is broken down into various subgroups called Image segments which helps in reducing the complexity of the image to make further processing or analysis of the image simpler. Segmentation in easy words is assigning labels to pixels.
Crowd density refers to the number of objects within a unit area, such as people per square meter. Density is important to determine the maximum occupancy of a room or building to address safety concerns. Crowd density estimation is a hot issue in the analysis of crowd abnormal behavior. At present, the crowd density is calculated by the ratio of population and area. However, these methods ignore the influence of monitoring perspective and local crowd distribution in the selection and processing of area.
The Dataset can be downloaded from here and can also pe seen in release section.
The Shanghaitech dataset is a large-scale crowd counting dataset. It consists of 1198 annotated crowd images. The dataset is divided into two parts, Part-A containing 482 images and Part-B containing 716 images. Part-A is split into train and test subsets consisting of 300 and 182 images, respectively. Part-B is split into train and test subsets consisting of 400 and 316 images. Each person in a crowd image is annotated with one point close to the center of the head. In total, the dataset consists of 330,165 annotated people. Images from Part-A were collected from the Internet, while images from Part-B were collected on the busy streets of Shanghai.
Firstly required library such as numpy, pandas and os are imported. Then the dataset for the same is loaded.
Then listing of all the files is done, firstly we have done it for part A dataset
After this the image path and all is given and a particular image is selected. We have selected this particular image:
After that the density for the same image is calculated.
And then while using numpy sum function we will estimate the crownd.
The video for the detailed explanation is given here.






