People number determination method and device, equipment and storage medium
By obtaining and analyzing the weight of the sports group blocks and space position weights in the number of people, the problem of being unable to accurately statistics in the existing technology has been solved, and the accuracy and accuracy of the number of people can be improved.
Patent Information
- Application Number
- CN202411243905.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-09-05
AI Technical Summary
In the prior art, when counting the number of people, it is impossible to accurately count the blocked person, resulting in inaccurate number of people determined.
By obtaining the current frame image of the target area, determine the sports groups corresponding to each pedestrian in the current frame image. When the number of sports groups is less than the actual number of people in the previous moment, obtain the space position weight of the target pedestrian. The obstruction relationship between static elements is based on the number of sports groups and the number of spatial position rights than the number of target pedestrians with preset weights, and determines the number of people in the target area.
Improve the accuracy and statistical accuracy of the number of people, avoid omitted pedestrians, and eliminate the impact of space cover.
Smart Images

Figure CN119380262A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method, device, equipment and storage medium for determining the number of people. Background Art
[0002] With the development of computer vision, video surveillance technology is becoming more and more important in ensuring public safety and maintaining social stability. Among them, crowd counting is an important part of the video surveillance field. Real-time and effective crowd counting provides basic data for crowd behavior analysis and plays an important role in preventing crowd congestion and illegal gatherings.
[0003] At present, people counting is usually performed by training deep neural network models based on computer vision and deep learning technology. Specifically, a large amount of image and video data containing people can be collected for preprocessing and annotation, and these annotated data will be used to train the deep neural network model. After the training is completed, the collected images or videos are input into the deep neural network model, so that the purpose of identifying and counting the people in the images or videos can be achieved, realizing the function of people counting.
[0004] However, in the above method, when there are obscured persons, the obscured persons cannot be counted, so that the determined number of people is inaccurate. Summary of the invention
[0005] The present invention provides a method, device, equipment and storage medium for determining the number of people, which are used to solve the defect of inaccurate number of people determined in the prior art and improve the accuracy of determining the number of people in an area.
[0006] The present invention provides a method for determining the number of people, comprising: Get the current frame image for the target area; Determine the motion blob corresponding to each pedestrian in the current frame image; When the number of moving blocks in the current frame image is less than the actual number of people in the target area at the previous moment, the spatial position weight of the target pedestrian is obtained; the target pedestrian is a pedestrian that exists in the target frame image but does not exist in the current frame image, and the target frame image is an image with the smallest difference in acquisition time with the current frame image among multiple frame images that include the target pedestrian before the current frame image; the spatial position weight is used to characterize the occlusion relationship between the target pedestrian and the static elements in the target area; The number of people in the target area is determined based on the number of the motion blobs and the number of target pedestrians whose spatial position weights are greater than a preset weight.
[0007] According to a method for determining the number of people provided by the present invention, the step of obtaining the spatial position weight of the target pedestrian includes: For each of the target pedestrians, determining the number of occluded pixels of the target pedestrian in the target frame image that are occluded by each of the static elements; For each of the static elements, based on the number of occluded pixels corresponding to the static element and the number of pixels corresponding to the target pedestrian, determining an occlusion weight corresponding to the target pedestrian relative to the static element; The spatial position weight of the target pedestrian is determined based on the occlusion weight corresponding to each of the static elements and the target influence factor corresponding to each of the static elements.
[0008] According to a method for determining the number of people provided by the present invention, the method for determining the number of people in the target area based on the number of motion blobs and the number of target pedestrians whose spatial position weights are greater than a preset weight includes: The sum of the number of the motion blobs and the number of target pedestrians whose spatial position weights are greater than a preset weight is determined, and the sum is determined as the number of people in the target area.
[0009] According to a method for determining the number of people provided by the present invention, determining the motion mass corresponding to each pedestrian in the current frame image includes: Acquire a background frame image of the target area; Based on the current frame image and the background frame image, determining each initial motion mass; Based on the motion trajectories of the initial motion clumps, determining the motion clumps to be split among all the initial motion clumps; Based on the motion trajectory of the motion mass to be split, the motion mass to be split is split to obtain split masses; Based on the split clusters and other clusters in the initial motion clusters except the motion cluster to be split, the motion clusters corresponding to the pedestrians are determined.
[0010] According to a method for determining the number of people provided by the present invention, the method of determining the motion clusters corresponding to the pedestrians based on the split clusters and other clusters in the initial motion clusters except the motion cluster to be split includes: Based on the position of each target blob in the current frame image, determining the area adjustment weight corresponding to each target blob; the target blob includes the split blob and / or the other blob; Adjusting the area of the target mass based on the area adjustment weight; The target clusters whose adjusted areas are larger than the preset areas are split to obtain motion clusters corresponding to the pedestrians.
[0011] According to a method for determining the number of people provided by the present invention, the method further includes: Based on the occlusion areas of the static elements pre-marked in the background frame image of the target area, determining whether each pedestrian in the target frame image is in the occlusion area; A pedestrian in the blocked area is determined as the target pedestrian.
[0012] The present invention also provides a device for determining the number of people, comprising: An acquisition module, used for acquiring a current frame image of a target area; A determination module, used to determine the motion mass corresponding to each pedestrian in the current frame image; The acquisition module is further used to acquire the spatial position weight of the target pedestrian when the number of motion blocks in the current frame image is less than the actual number of people in the target area at the previous moment; the target pedestrian is a pedestrian who exists in the target frame image but does not exist in the current frame image, and the target frame image is an image with the smallest difference in acquisition time with the current frame image among multiple frame images including the target pedestrian before the current frame image; the spatial position weight is used to characterize the occlusion relationship between the target pedestrian and the static elements in the target area; The determination module is further configured to determine the number of people in the target area based on the number of the motion blobs and the number of target pedestrians whose spatial position weights are greater than a preset weight.
[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned methods for determining the number of people is implemented.
[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for determining the number of people as described above is implemented.
[0015] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned methods for determining the number of people.
[0016] The method, device, equipment and storage medium for determining the number of people provided by the present invention obtain the current frame image for the target area, and determine the motion clusters corresponding to each pedestrian in the current frame image. When the number of motion clusters in the current frame image is less than the actual number of people in the target area at the previous moment, the spatial position weight of the target pedestrian is obtained. The target pedestrian is a pedestrian that exists in the previous target frame image but does not exist in the current frame image. The spatial position weight characterizes the occlusion relationship between the target pedestrian and the static elements in the target area, so that the number of people in the target area can be determined based on the number of motion clusters and the number of target pedestrians whose spatial position weight is greater than the preset weight. Since when the number of pedestrians decreases, it can be determined whether the pedestrian is blocked based on the spatial position weight of the pedestrian. If it is determined that the pedestrian is blocked, the pedestrian will also be counted in the final number of people in the target area. Therefore, when determining the number of people, the influence of spatial occlusion can be eliminated, and the blocked pedestrian will not be missed, thereby improving the accuracy and statistical precision of the number determination. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 A schematic diagram of a flow chart of a method for determining the number of people provided in an embodiment of the present invention.
[0019] Figure 2 A schematic diagram of the structure of a device for determining the number of people provided in an embodiment of the present invention.
[0020] Figure 3 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0022] At present, when counting pedestrians, it is usually necessary to collect multiple image samples or video samples containing pedestrians in advance, and annotate the pedestrians in the image samples or video samples to train the neural network model for counting pedestrians. When determining the number of people in the region of interest (ROI), collect the image in the ROI, input the image into the trained neural network model, and obtain the number of people output by the neural network model. When the number of people in the ROI exceeds the set threshold in real-time monitoring, an alarm message will be issued.
[0023] In the above method, when counting people based on the training of a deep neural network model, the method is performed by extracting pixel features of the image, which is greatly affected by object occlusion. When a pedestrian is occluded, the pixel features of the pedestrian cannot be accurately extracted, resulting in the pedestrian not being counted in the total number of people, resulting in low accuracy of the final number of people.
[0024] In consideration of the above problems, an embodiment of the present invention proposes a method for determining the number of people. In this method, the occlusion relationship between the static elements in the target area and the pedestrians is taken into account. After the number of people is determined to be reduced through adjacent frame images, it can be determined based on the above occlusion relationship whether the reduced pedestrians are blocked by the static elements. If it is determined that the pedestrian is blocked by the static elements, the pedestrian will also be counted. In the above manner, although the pedestrian is blocked, the pedestrian is not omitted when the final number of pedestrians is counted, thereby improving the accuracy of pedestrian counting.
[0025] Combine the following Figure 1 The method for determining the number of people provided by an embodiment of the present invention is described. The embodiment of the present invention can be applied to the counting of people in any scenario, for example, in a scenario where real-time counting of people is required, such as a subway station, a museum or an exhibition hall. The execution subject of the method can be an electronic device such as an intelligent camera, a computer, a server, a server cluster or a specially designed number determination device, or a number determination device set in the electronic device, and the number determination device can be implemented by software, hardware or a combination of the two.
[0026] Figure 1 A flow chart of a method for determining the number of people provided in an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes the following: Step 101: Obtain a current frame image for a target area.
[0027] In this step, the target area can be understood as an area where people need to be counted, such as a pre-marked ROI area, or a pre-set area, etc. An image acquisition device is set in the target area, and the image acquisition device can be used to acquire images or perform video monitoring on the target area, and the image acquired at the current moment or the monitored video frame is used as the current frame image.
[0028] Step 102: Determine the motion blob corresponding to each pedestrian in the current frame image.
[0029] In this step, pedestrians in the current frame image are detected by a pedestrian detection algorithm, and background mask processing is performed based on the detected pedestrians, thereby obtaining motion clumps corresponding to each pedestrian. For example, the color values of other pixels in the current frame image except for the pixels occupied by each pedestrian can be set to black, and the color values of the pixels occupied by each pedestrian can be set to white, thereby displaying the motion clumps corresponding to each pedestrian in the current frame image.
[0030] Step 103: When the number of moving blocks in the current frame image is less than the actual number of people in the target area at the previous moment, obtain the spatial position weight of the target pedestrian; the target pedestrian is a pedestrian who exists in the target frame image and does not exist in the current frame image, and the target frame image is an image with the smallest difference between the acquisition time of the current frame image and the multiple frame images including the target pedestrian before the current frame image; the spatial position weight is used to characterize the occlusion relationship between the target pedestrian and the static elements in the target area.
[0031] In this step, the number of moving blocks can be used to characterize the number of people in the target area. When the number of moving blocks in the current frame image is less than the actual number of people determined in the target area at the previous moment, it means that a pedestrian may be blocked, or a pedestrian may have walked out of the field of view of the image acquisition device. When a pedestrian is blocked, although the pedestrian is not captured in the current frame image collected, the pedestrian is still in the target area. When counting the number of people, the blocked pedestrians need to be counted. Therefore, in practical applications, it is necessary to accurately determine whether the reduced pedestrians are blocked pedestrians.
[0032] Since each pedestrian can be tracked by determining the motion trajectory of each pedestrian, the target pedestrian who disappears in the current frame image can be determined based on the tracking information. The target pedestrian is a pedestrian who exists in the target frame image but does not exist in the current frame image, wherein the target frame image is an image taken before the current frame image and is the image that is closest to the acquisition time of the current frame image among all images including the target pedestrian. For example, if user A does not exist in the current frame image, but exists in the previous frame image, then the previous frame image is the target frame image. Alternatively, if user A does not exist in both the current frame image and the previous frame image, and exists in the previous frame image of the previous frame image, then the previous frame image of the previous frame image is the target frame image.
[0033] After the target pedestrian is determined, the spatial position weight of the target pedestrian can be determined. The spatial position weight can be used to characterize the occlusion relationship between the target pedestrian and the static elements in the target area, wherein the static elements include stationary objects in the target area, such as pillars, fences, tables or security gates, etc. The larger the spatial position weight, the higher the probability that the target pedestrian is occluded by the static elements in the target area, and the smaller the spatial position weight, the lower the probability that the target pedestrian is occluded by the static elements in the target area.
[0034] Step 104: Determine the number of people in the target area based on the number of motion blobs and the number of target pedestrians whose spatial position weights are greater than a preset weight.
[0035] In this step, after determining the spatial position weight, the number of target pedestrians whose spatial position weight is greater than the preset weight can be determined, wherein the target pedestrians whose spatial position weight is greater than the preset weight can be understood as pedestrians blocked by static elements in the target area, wherein the preset weight can be set according to actual conditions or experience, for example, it can be 0.9 or 0.95, etc. Therefore, when counting the number of people in the target area, the number of target pedestrians whose spatial position weight is greater than the preset weight can be added to the number of the determined motion blocks, so as to obtain the final number of people counted.
[0036] The method for determining the number of people provided by the embodiment of the present invention obtains the current frame image for the target area, and determines the motion mass corresponding to each pedestrian in the current frame image. When the number of motion mass in the current frame image is less than the actual number of people in the target area at the previous moment, the spatial position weight of the target pedestrian is obtained. The target pedestrian is a pedestrian that exists in the previous target frame image but does not exist in the current frame image. The spatial position weight characterizes the occlusion relationship between the target pedestrian and the static elements in the target area, so that the number of people in the target area can be determined based on the number of motion mass and the number of target pedestrians whose spatial position weight is greater than the preset weight. Since when the number of pedestrians decreases, it can be determined whether the pedestrian is blocked based on the spatial position weight of the pedestrian. If it is determined that the pedestrian is blocked, the pedestrian will also be counted in the final number of people in the target area. Therefore, when determining the number of people, the influence of spatial occlusion can be eliminated, and the blocked pedestrian will not be missed, thereby improving the accuracy and statistical precision of the number determination.
[0037] Exemplarily, based on the above embodiments, the spatial position weight of the target pedestrian can be obtained in the following manner: for each target pedestrian, determine the number of occluded pixels of the target pedestrian occluded by each static element in the target frame image; for each static element, based on the number of occluded pixels corresponding to the static element and the number of pixels corresponding to the target pedestrian, determine the occlusion weight of the target pedestrian relative to the static element; based on the occlusion weight corresponding to each static element and the target influence factor corresponding to each static element, determine the spatial position weight of the target pedestrian.
[0038] Specifically, for each target pedestrian that disappears in the current frame image, the target pedestrian exists in the target frame image, so the number of occluded pixels of the target pedestrian in the target frame image that are blocked by the static elements in the target area can be determined. In the specific implementation process, the tracking algorithm can be used to trace the target pedestrian in each frame image taken before the target frame image, and determine the number of pixels occupied by the target pedestrian when it is not blocked. Since the size of the same target pedestrian is fixed, the number of pixels occupied by the target pedestrian when it is not blocked can be used as the number of pixels corresponding to the target pedestrian. Among them, the number of pixels corresponding to the target pedestrian can also be understood as the number of pixels occupied by the complete target pedestrian in the image.
[0039] In addition, assuming that the target pedestrian is partially obscured in the target frame image, the number of pixels occupied by the unobstructed portion of the target pedestrian in the target frame image can be determined. The number of pixels corresponding to the target pedestrian minus the number of pixels occupied by the unobstructed portion of the target pedestrian in the target frame image can be obtained to obtain the number of obscured pixels of the target pedestrian obscured by each static element in the target frame image.
[0040] In addition, for each static element, the ratio of the number of occluded pixels corresponding to the static element to the number of pixels corresponding to the target pedestrian is determined as the occlusion weight of the target pedestrian relative to the static element. The occlusion weight of the target pedestrian relative to the static element can also be understood as the coincidence or overlap between the target pedestrian and the static element.
[0041] Furthermore, the target impact factor corresponding to each static element in the target area can be determined based on the correspondence between the preset static elements and the impact factor. The target impact factor is the impact of the static element on the pedestrian occlusion. For example, for a relatively high column, it may completely block the pedestrian, so the impact factor of such a column can be set to 1. For a table, it may only block the legs of the pedestrian, so the impact factor of the table can be set to 0.5. Similarly, the impact factor of the fence can be set to 0.1, the impact factor of the security gate can be set to 0.3, and so on.
[0042] After obtaining the target influence factors corresponding to each static element, the spatial position weight of the target pedestrian can be determined based on the following formula (1): (1)
[0043] in, represents the spatial position weight of the target pedestrian, represents the occlusion weight of the target pedestrian relative to the i-th static element, represents the target impact factor of the i-th static element, and m represents the number of static elements pre-annotated in the target area.
[0044] In this embodiment, the occlusion weight of the target pedestrian relative to the static elements can be determined based on the number of occluded pixels of the target pedestrian in the target frame image occluded by each static element and the number of pixels occupied by the target pedestrian, and the spatial position weight of the target pedestrian can be determined based on the occlusion weight and the target influence factor corresponding to the static element. Since the determination of the spatial position weight takes into account the occlusion of the target pedestrian by each static element and the occlusion influence factors of each static element on the pedestrian, the dimensions considered are more comprehensive, thereby making the determined spatial position weight more accurate.
[0045] Exemplarily, based on the above embodiments, when determining the number of people in the target area based on the number of motion clumps and the number of target pedestrians whose spatial position weights are greater than the preset weights, the sum of the number of motion clumps and the number of target pedestrians whose spatial position weights are greater than the preset weights can be determined, and the sum can be determined as the number of people in the target area.
[0046] Specifically, the number of moving blocks can be used to characterize the number of pedestrians currently photographed. For target pedestrians whose spatial position weight is greater than the preset weight, it means that the target pedestrian is currently in an obscured state. Therefore, when counting the number of people in the target area, it is necessary to add the number of obscured target pedestrians to the number of pedestrians currently photographed, so as to determine the sum as the number of people in the target area. Since obscured pedestrians are taken into account in this method, the accuracy of the number of people in the target area finally determined is improved.
[0047] Exemplarily, on the basis of the above-mentioned embodiments, when determining the motion clusters corresponding to each pedestrian in the current frame image, it is necessary to obtain the background frame image of the target area, and determine each initial motion cluster based on the current frame image and the background frame image, determine the motion clusters to be split among all the initial motion clusters based on the motion trajectory of each initial motion cluster, split the motion clusters to be split based on the motion trajectory of the motion clusters to be split to obtain split clusters, and determine the motion clusters corresponding to each pedestrian based on the split clusters and other clusters in the initial motion clusters except the motion clusters to be split.
[0048] Specifically, the background frame image of the target area can be understood as an image that does not contain pedestrians, which can be pre-photographed without pedestrians, or can be a background frame image segmented from an image shot for the target area using a foreground or background segmentation algorithm. In addition, the background frame image can also be processed based on lighting information and active objects, thereby reducing interference caused by the background frame image in subsequent image processing.
[0049] After acquiring the background frame image of the target area, by comparing the difference between the current frame image and the background frame image, it is possible to determine which pixels have undergone significant changes, that is, pixels whose difference values between the pixels are greater than the preset difference are determined as pixels that have undergone significant changes, and the pixels that have undergone significant changes are determined as pixels belonging to pedestrians. By combining these pixels, at least one initial motion cluster can be obtained.
[0050] By analyzing the position change of each initial motion cluster in continuous frames, the motion trajectory of each initial motion cluster can be obtained, and the motion trajectory of each initial motion cluster is normalized using the frame difference method, so that the motion cluster to be split can be determined from all the initial motion clusters based on the normalized motion trajectory. Among them, when there is an occlusion relationship between multiple pedestrians, the motion clusters of these pedestrians may be adhered, and the initial motion clusters pasted together are the motion clusters to be split. Therefore, in order to accurately count the number of people, it is necessary to split these adhered motion clusters to be split. For example, when the walking routes of pedestrians are different, the motion clusters to be split can be split based on the motion trajectories of the motion clusters to be split, and the resulting split clusters can more accurately represent the actual pedestrians.
[0051] Furthermore, the obtained split clusters and other clusters in the initial motion clusters except the motion cluster to be split can be screened to determine the motion clusters corresponding to each pedestrian. For example, motion clusters that obviously do not meet the characteristics of pedestrians can be screened out, such as motion clusters that are too small or irregular in shape.
[0052] In this embodiment, after determining each initial motion cluster based on the background frame image, the motion cluster to be split can be split based on the motion trajectory of the motion cluster, thereby avoiding counting the number of multiple motion clusters with adhesion when counting the number of people, that is, counting the motion clusters with adhesion corresponding to multiple pedestrians as one pedestrian, thereby improving the accuracy of the number counting.
[0053] Exemplarily, on the basis of the above embodiments, when determining the motion clusters corresponding to each pedestrian based on the split clusters and other clusters in the initial motion clusters except the motion cluster to be split, the area adjustment weight corresponding to each target cluster can be determined based on the position of each target cluster in the current frame image; the target cluster includes the split cluster and / or other clusters, and the area of the target cluster is adjusted based on the area adjustment weight; the target cluster whose adjusted area is larger than the preset area is split to obtain the motion cluster corresponding to each pedestrian.
[0054] Specifically, in scenes such as subways or high-speed railways, the movement postures of pedestrians are usually relatively uniform. For example, multiple pedestrians are walking towards the exit. In this way, there will be a situation where multiple pedestrians are blocked from front to back or side by side. In this case, the clusters are adhered, and it will be impossible to accurately split them according to the movement trajectory of the pedestrians. In response to this problem, in an embodiment of the present invention, based on the position of each target cluster in the current frame image, the distance between the pedestrian corresponding to the target cluster and the image acquisition device can be determined, so as to determine the area adjustment weight corresponding to the target cluster based on the correspondence between the pre-set distance and weight. Among them, the farther the distance between the target cluster and the image acquisition device, the greater the area adjustment weight, and the closer the distance between the target cluster and the image acquisition device, the smaller the area adjustment weight. Among them, the target cluster includes split clusters that have been split and / or other clusters that have not been split.
[0055] After the area adjustment weights corresponding to the target clusters are determined, the areas of the target clusters may be adjusted based on the area adjustment weights, so that the areas of the moving clusters corresponding to pedestrians at different positions are adjusted to the same size.
[0056] It should be understood that for a single pedestrian, the area of the corresponding motion cluster should be within the preset area range. Therefore, if the adjusted area of a target cluster is greater than the upper limit of the preset area range, that is, greater than the preset area, it means that the target cluster may be a cluster of motion clusters corresponding to multiple pedestrians stuck together. Therefore, the target cluster needs to be split to obtain motion clusters that represent each individual pedestrian.
[0057] Furthermore, after obtaining the motion blocks corresponding to each pedestrian, these motion blocks can be encoded, such as encoding as Y1, Y2, ..., Y n , these codes can be used to represent pedestrians, so the number of codes is the number of pedestrians.
[0058] In this embodiment, after determining the area adjustment weight corresponding to the target cluster, the area of the target cluster is adjusted based on the area adjustment weight, and then it is determined whether to split the target cluster based on the adjusted area. If the adjusted area is larger than the preset area, the target cluster is split, so that the clusters corresponding to pedestrians with front and back occlusions or side by side occlusions can be split, so that the final moving clusters are all running clusters corresponding to a single pedestrian, thereby improving the accuracy of the final number of people counted.
[0059] Exemplarily, on the basis of the above-mentioned embodiments, it is also possible to determine whether each pedestrian in the target frame image is in the occlusion area based on the occlusion area of each static element pre-marked in the background frame image of the target area, and determine the pedestrian in the occlusion area as the target pedestrian.
[0060] Specifically, after determining the background frame image of the target area, the positions of the static elements in the background frame image and the possible occlusion areas can be marked in advance. For example, if there are pillars in the background frame image, the positions of the pillars and the possible occlusion areas of the pillars can be marked in the background frame image based on the location of the image acquisition device. The occlusion areas are usually areas that cannot be captured by the image acquisition device.
[0061] By detecting the position of the pedestrian in the target frame image, it is determined based on the position whether the pedestrian is in the occlusion area of a static element. When the pedestrian is in the occlusion area, the pedestrian is determined as the target pedestrian.
[0062] In this embodiment, by pre-marking the positions of each static element in the target area and the occlusion area, pedestrians in the occlusion area can be identified as target pedestrians. In this way, pedestrians who will not be completely occluded can be excluded, thereby reducing the amount of calculation and saving computing power.
[0063] The number determination device provided by the present invention is described below. The number determination device described below and the number determination method described above can be referenced to each other.
[0064] Figure 2 A schematic diagram of the structure of a device for determining the number of people provided in an embodiment of the present invention, referring to Figure 2 As shown, the number determination device 200 includes: An acquisition module 11 is used to acquire a current frame image of a target area; A determination module 12, configured to determine a motion mass corresponding to each pedestrian in the current frame image; The acquisition module 11 is further used to acquire the spatial position weight of the target pedestrian when the number of motion blocks in the current frame image is less than the actual number of people in the target area at the previous moment; the target pedestrian is a pedestrian who exists in the target frame image but does not exist in the current frame image, and the target frame image is an image with the smallest difference between the acquisition time of the current frame image and the multiple frame images including the target pedestrian before the current frame image; the spatial position weight is used to characterize the occlusion relationship between the target pedestrian and the static elements in the target area; The determination module 12 is further configured to determine the number of people in the target area based on the number of the motion blobs and the number of target pedestrians whose spatial position weights are greater than a preset weight.
[0065] In an exemplary embodiment, the acquisition module 11 is specifically configured to: For each of the target pedestrians, determining the number of occluded pixels of the target pedestrian in the target frame image that are occluded by each of the static elements; For each of the static elements, based on the number of occluded pixels corresponding to the static element and the number of pixels corresponding to the target pedestrian, determining an occlusion weight corresponding to the target pedestrian relative to the static element; The spatial position weight of the target pedestrian is determined based on the occlusion weight corresponding to each of the static elements and the target influence factor corresponding to each of the static elements.
[0066] In an exemplary embodiment, the determination module 12 is specifically configured to: The sum of the number of the motion blobs and the number of target pedestrians whose spatial position weights are greater than a preset weight is determined, and the sum is determined as the number of people in the target area.
[0067] In an exemplary embodiment, the determination module 12 is specifically configured to: Acquire a background frame image of the target area; Based on the current frame image and the background frame image, determining each initial motion mass; Based on the motion trajectories of the initial motion clumps, determining the motion clumps to be split among all the initial motion clumps; Based on the motion trajectory of the motion mass to be split, the motion mass to be split is split to obtain split masses; Based on the split clusters and other clusters in the initial motion clusters except the motion cluster to be split, the motion clusters corresponding to the pedestrians are determined.
[0068] In an exemplary embodiment, the determination module 12 is specifically configured to: Based on the position of each target blob in the current frame image, determining the area adjustment weight corresponding to each target blob; the target blob includes the split blob and / or the other blob; Adjusting the area of the target mass based on the area adjustment weight; The target clusters whose adjusted areas are larger than the preset areas are split to obtain motion clusters corresponding to the pedestrians.
[0069] In an exemplary embodiment, the determining module 12 is further configured to: Based on the occlusion areas of the static elements pre-marked in the background frame image of the target area, determining whether each pedestrian in the target frame image is in the occlusion area; A pedestrian in the blocked area is determined as the target pedestrian.
[0070] The device of this embodiment can be used to execute the method of any embodiment in the embodiment of the method for determining the number of people. Its specific implementation process and technical effects are similar to those in the embodiment of the method for determining the number of people. For details, please refer to the detailed description in the embodiment of the method for determining the number of people, which will not be repeated here.
[0071] Figure 3 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention, such as Figure 3 As shown, the electronic device may include: a processor 310 , a communications interface 320 , a memory 330 and a communication bus 340 , wherein the processor 310 , the communications interface 320 , and the memory 330 communicate with each other via the communication bus 340 . The processor 310 can call the logic instructions in the memory 330 to execute a method for determining the number of people, which includes: obtaining a current frame image for a target area; determining the motion clumps corresponding to each pedestrian in the current frame image; obtaining the spatial position weight of the target pedestrian when the number of motion clumps in the current frame image is less than the actual number of people in the target area at the previous moment; the target pedestrian is a pedestrian who exists in the target frame image but does not exist in the current frame image, and the target frame image is an image with the smallest difference in acquisition time with the current frame image among multiple frame images that include the target pedestrian before the current frame image; the spatial position weight is used to characterize the occlusion relationship between the target pedestrian and the static elements in the target area; based on the number of motion clumps and the number of target pedestrians whose spatial position weight is greater than the preset weight, determine the number of people in the target area.
[0072] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0073] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the method for determining the number of people provided by the above methods, which includes: obtaining a current frame image for a target area; determining the motion clumps corresponding to each pedestrian in the current frame image; when the number of motion clumps in the current frame image is less than the actual number of people in the target area at the previous moment, obtaining the spatial position weight of the target pedestrian; the target pedestrian is a pedestrian who exists in the target frame image and does not exist in the current frame image, and the target frame image is an image with the smallest difference in acquisition time with the current frame image among multiple frame images including the target pedestrian before the current frame image; the spatial position weight is used to characterize the occlusion relationship between the target pedestrian and the static elements in the target area; based on the number of motion clumps and the number of target pedestrians whose spatial position weights are greater than the preset weights, the number of people in the target area is determined.
[0074] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the method for determining the number of people provided by the above-mentioned methods, the method comprising: obtaining a current frame image for a target area; determining the motion clumps corresponding to each pedestrian in the current frame image; obtaining the spatial position weight of the target pedestrian when the number of motion clumps in the current frame image is less than the actual number of people in the target area at the previous moment; the target pedestrian is a pedestrian who exists in the target frame image and does not exist in the current frame image, and the target frame image is an image with the smallest difference in acquisition time with the current frame image among multiple frame images including the target pedestrian before the current frame image; the spatial position weight is used to characterize the occlusion relationship between the target pedestrian and the static elements in the target area; and the number of people in the target area is determined based on the number of motion clumps and the number of target pedestrians whose spatial position weights are greater than the preset weights.
[0075] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0076] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0077] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for determining the number of people, characterized in that: include: Get the current frame image for the target area; Determine the motion blob corresponding to each pedestrian in the current frame image; When the number of moving blocks in the current frame image is less than the actual number of people in the target area at the previous moment, obtaining the spatial position weight of the target pedestrian; The target pedestrian is a pedestrian that exists in the target frame image and does not exist in the current frame image. The target frame image is an image that has the smallest difference in acquisition time with the current frame image among multiple frame images that include the target pedestrian before the current frame image. The spatial position weight is used to characterize the occlusion relationship between the target pedestrian and the static elements in the target area. The number of people in the target area is determined based on the number of the motion blobs and the number of target pedestrians whose spatial position weights are greater than a preset weight.
2. The method for determining the number of people according to claim 1, characterized in that: The step of obtaining the spatial position weight of the target pedestrian includes: For each of the target pedestrians, determining the number of occluded pixels of the target pedestrian in the target frame image that are occluded by each of the static elements; For each of the static elements, based on the number of occluded pixels corresponding to the static element and the number of pixels corresponding to the target pedestrian, determining an occlusion weight corresponding to the target pedestrian relative to the static element; The spatial position weight of the target pedestrian is determined based on the occlusion weight corresponding to each of the static elements and the target influence factor corresponding to each of the static elements.
3. The method for determining the number of people according to claim 1, characterized in that: The determining the number of people in the target area based on the number of the motion blobs and the number of target pedestrians whose spatial position weights are greater than a preset weight includes: The sum of the number of the motion blobs and the number of target pedestrians whose spatial position weights are greater than a preset weight is determined, and the sum is determined as the number of people in the target area.
4. The method for determining the number of people according to claim 1, characterized in that: The determining of the motion blocks corresponding to the pedestrians in the current frame image includes: Acquire a background frame image of the target area; Based on the current frame image and the background frame image, determining each initial motion mass; Based on the motion trajectories of the initial motion clumps, determining the motion clumps to be split among all the initial motion clumps; Based on the motion trajectory of the motion mass to be split, the motion mass to be split is split to obtain split masses; Based on the split clusters and other clusters in the initial motion clusters except the motion cluster to be split, the motion clusters corresponding to the pedestrians are determined.
5. The method for determining the number of people according to claim 4, characterized in that: The determining of the motion clusters corresponding to the pedestrians based on the split clusters and other clusters in the initial motion clusters except the motion cluster to be split includes: Based on the position of each target blob in the current frame image, determining the area adjustment weight corresponding to each target blob; the target blob includes the split blob and / or the other blob; Adjusting the area of the target mass based on the area adjustment weight; The target clusters whose adjusted areas are larger than the preset areas are split to obtain motion clusters corresponding to the pedestrians.
6. The method for determining the number of people according to any one of claims 1 to 5, characterized in that: The method further comprises: Based on the occlusion areas of the static elements pre-marked in the background frame image of the target area, determining whether each pedestrian in the target frame image is in the occlusion area; A pedestrian in the blocked area is determined as the target pedestrian.
7. A device for determining the number of people, characterized in that: include: An acquisition module, used for acquiring a current frame image of a target area; A determination module, used to determine the motion mass corresponding to each pedestrian in the current frame image; The acquisition module is further used to acquire the spatial position weight of the target pedestrian when the number of motion blocks in the current frame image is less than the actual number of people in the target area at the previous moment; The target pedestrian is a pedestrian that exists in the target frame image and does not exist in the current frame image. The target frame image is an image that has the smallest difference in acquisition time with the current frame image among multiple frame images that include the target pedestrian before the current frame image. The spatial position weight is used to characterize the occlusion relationship between the target pedestrian and the static elements in the target area. The determination module is further configured to determine the number of people in the target area based on the number of the motion blobs and the number of target pedestrians whose spatial position weights are greater than a preset weight.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for determining the number of people according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for determining the number of people as claimed in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for determining the number of people as claimed in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Pedestrian counting method based on multiple features
CN103279791A
Object quantity estimation method and device
CN105096292A
Device for counting people
CN107274396A
Pedestrian number statistics method and device
CN110033430A
Image processing method, apparatus and device
WO2023208154A1