The invention discloses a crowd counting method and system based on a spatial perception attention refinement framework. The method comprises the following steps: generating feature maps, initial crowd density maps and density grade information of all training images by utilizing a convolutional neural network; inputting the information into an iterative spatial perception refining module, carrying out dynamic localization on the crowd density map in a spatial perception mode by utilizing a spatial regression mapping network, generating a corrected local density map, and carrying out a dynamiclocalization updating strategy for next iteration by combining a long-short-term memory module; Encoding the density level information to generate a density level graph, integrating the local densitygraph with the density level graph to serve as local and global information of each round of iteration, and inputting the local and global information into a local refining network; the local refinement network adjusts the density distribution of the input area, performs reverse space regression mapping on the input area, and updates and generates a crowd density map in a residual error learningmode; and iteratively carrying out the training process for multiple times to obtain a refined crowd density map.
A crowd counting method and system based on a spatial perception attention refinement framework