Person number determination method and apparatus, device, and storage medium
By obtaining the current frame image of the target area in the crowd counting and determining the motion clusters, combined with the spatial position weights, the problem of missing obscured pedestrians is solved, and more accurate crowd counting is achieved.
Patent Information
- Application Number
- CN202411243905.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2025-10-14
- Estimated Expiration
- 2044-09-05
AI Technical Summary
In the prior art, when there are obscured persons, it is impossible to accurately count the number of people, resulting in inaccurate number of people determined.
By obtaining the current frame image of the target area, the motion clusters corresponding to each pedestrian are determined. When the number of motion clusters decreases, the spatial position weights of the target pedestrians are obtained. Based on the number of motion clusters 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.
The accuracy of headcount determination and statistical precision are improved, obscured pedestrians are avoided from being missed, and the integrity of headcount is ensured.
Smart Images

Figure CN119380262B_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 increasingly important in ensuring public safety and maintaining social stability. Crowd counting is a crucial component of video surveillance. Real-time and effective crowd counting provides fundamental data for crowd behavior analysis and plays a crucial role in preventing crowd congestion and illegal gatherings.
[0003] Currently, people counting is typically performed by training deep neural network models based on computer vision and deep learning technologies. Specifically, large amounts of image and video data containing people are collected, preprocessed, and annotated. This annotated data is then used to train the deep neural network model. Once trained, the collected images or videos are fed into the deep neural network model, enabling the recognition and counting of people in the images or videos, thus achieving the goal 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:
[0007] Get the current frame image of the target area;
[0008] Determine the motion blob corresponding to each pedestrian in the current frame image;
[0009] When the number of motion blobs in the current frame image is less than the actual number of people in the target area at the previous moment, a spatial position weight of a 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 that has the smallest difference in acquisition time with the current frame image among multiple frames of 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;
[0010] 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.
[0011] According to a method for determining the number of people provided by the present invention, obtaining the spatial position weight of the target pedestrian includes:
[0012] For each target pedestrian, determining the number of occluded pixels of the target pedestrian in the target frame image that are occluded by each static element;
[0013] For each of the static elements, determining an occlusion weight corresponding to the target pedestrian relative to the static element based on the number of occluded pixels corresponding to the static element and the number of pixels corresponding to the target pedestrian;
[0014] 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.
[0015] 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:
[0016] 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.
[0017] According to a method for determining the number of people provided by the present invention, determining the motion blob corresponding to each pedestrian in the current frame image includes:
[0018] Acquire a background frame image of the target area;
[0019] Determining initial motion clumps based on the current frame image and the background frame image;
[0020] Based on the motion trajectories of the initial motion clumps, determining motion clumps to be split from all the initial motion clumps;
[0021] Splitting the motion cluster to be split based on the motion trajectory of the motion cluster to be split, to obtain split clusters;
[0022] Based on the split clusters and other clusters in the initial motion clusters except the motion cluster to be split, the motion cluster corresponding to each pedestrian is determined.
[0023] According to a method for determining the number of people provided by the present invention, determining the motion bloc corresponding to each pedestrian based on the split blocs and other blocs in the initial motion blocs except the motion bloc to be split, includes:
[0024] Determining an area adjustment weight corresponding to each target blob based on a position of each target blob in the current frame image; the target blob includes the split blob and / or the other blob;
[0025] Adjusting the area of the target blob based on the area adjustment weight;
[0026] The target clusters whose adjusted areas are larger than the preset areas are split to obtain motion clusters corresponding to the pedestrians.
[0027] According to a method for determining the number of people provided by the present invention, the method further includes:
[0028] Determining 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;
[0029] A pedestrian in the blocked area is determined as the target pedestrian.
[0030] The present invention also provides a device for determining the number of people, comprising:
[0031] An acquisition module is used to acquire a current frame image of a target area;
[0032] A determination module, configured to determine a motion blob corresponding to each pedestrian in the current frame image;
[0033] The acquisition module is further configured to, when the number of motion blobs in the current frame image is less than the actual number of people in the target area at the previous moment, acquire a spatial position weight of a target pedestrian; 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 that has the smallest difference in acquisition time with the current frame image among multiple frames of images that include the target pedestrian before the current frame image; the spatial position weight is used to characterize an occlusion relationship between the target pedestrian and static elements in the target area;
[0034] The determination module is further configured to 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] 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-described methods for determining the number of people is implemented.
[0036] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described methods for determining the number of people.
[0037] The present application also provides a computer program product comprising a computer program which, when executed by a processor, implements any of the above-mentioned person number determination methods.
[0038] The present application provides a person number determination method, device, equipment and storage medium, by acquiring a current frame image for a target area, and determining each corresponding motion blob of each pedestrian in the current frame image, in the case that the number of motion blobs in the current frame image is less than the actual number of people of the target area at the previous time, acquiring a spatial position weight of a target pedestrian, the target pedestrian being a pedestrian existing in a previous target frame image but not existing in the current frame image, the spatial position weight representing an occlusion relationship between the target pedestrian and static elements in the target area, so as to 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 weight is greater than a preset weight. Since when the number of pedestrians decreases, whether the pedestrian is occluded can be determined based on the spatial position weight of the pedestrian, and if it is determined that the pedestrian is occluded, the pedestrian will also be counted into 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 occluded pedestrian will not be missed, thereby improving the accuracy and statistical precision of the number of people determination. BRIEF DESCRIPTION OF DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without any creative effort.
[0040] Figure 1 The flowchart of the person number determination method provided by the embodiment of the present application.
[0041] Figure 2 The structural diagram of the person number determination device provided by the embodiment of the present application.
[0042] Figure 3 The physical structure diagram of the electronic equipment provided by the embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present application more clear, the technical solutions in the present application will be described clearly and completely in the following with reference to the drawings in the present application. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative effort are within the protection scope of the present application.
[0044] At present, when counting the number of pedestrians, a plurality of image samples or video samples containing pedestrians are usually collected in advance, and the pedestrians in the image samples or video samples are labeled to train a neural network model for counting the number of pedestrians. When the number of people in a region of interest (ROI) is determined, an image in the ROI is collected, the image is input into the trained neural network model, and the number of people output by the neural network model is obtained. When the number of people in the ROI monitored in real time exceeds a set number threshold, an alarm information will be sent.
[0045] In the above manner, when the number of people is counted based on the trained deep neural network model, it is counted by extracting the pixel features of the image. In this manner, the influence of object occlusion is large. When a pedestrian is occluded, the pixel features of the pedestrian cannot be accurately extracted, so that the pedestrian cannot be counted into the total number of people, resulting in low accuracy of the finally determined number of people.
[0046] In the embodiment of the present application, the above problems are considered, and a number determination method is proposed. In the method, the occlusion relationship of each static element in the target region to the pedestrian is considered. After the number of people is determined through adjacent frame images, it is determined whether the reduced pedestrian is occluded by a static element based on the above occlusion relationship. If it is determined that the pedestrian is occluded by a static element, the pedestrian is also counted. Through the above manner, although the pedestrian is occluded, the pedestrian is not missed when the final number of pedestrians is counted, so that the accuracy of the number of pedestrians can be improved.
[0047] The number determination method provided by the embodiment of the present application will be described below. Figure 1 The number determination method provided by the embodiment of the present application can be applied to the number counting in any scene, for example, in the scene of counting the number of people in real time in subway stations, museums or exhibition halls. The execution subject of the method can be an intelligent camera, a computer, a server, a server cluster or a specially designed number determination device, etc. electronic device, or a number determination device provided in the electronic device. The number determination device can be realized by software, hardware or a combination of both.
[0048] Figure 1 The flowchart of the number determination method provided by the embodiment of the present application is shown in Figure 1 The method comprises the following steps:
[0049] Step 101: acquiring a current frame image for a target region.
[0050] In this step, the target region can be understood as a region in which the number of people needs to be counted, such as a pre-labeled ROI region or a pre-set region. An image acquisition device is arranged in the target region, and the target region can be imaged or video monitored by the image acquisition device. The image acquired or the video frame monitored at the current time is taken as a current frame image.
[0051] Step 102: Determine the motion blob corresponding to each pedestrian in the current frame image.
[0052] In this step, each pedestrian in the current frame image is detected by a pedestrian detection algorithm, and background mask processing is performed based on the detected pedestrians, so as to obtain the motion blob corresponding to each pedestrian. For example, the color value of the pixels other than the pixels occupied by each pedestrian in the current frame image can be set to black, and the color value of the pixels occupied by each pedestrian can be set to white, so that the motion blob corresponding to each pedestrian is displayed in the current frame image.
[0053] Step 103: In the case where the number of motion blobs in the current frame image is less than the actual number of people in the target region at the previous time, obtain the spatial position weight of the target pedestrian; the target pedestrian is a pedestrian present in the target frame image and not present in the current frame image, and the target frame image is the image with the smallest difference from the acquisition time of the current frame image among a plurality of images including the target pedestrian and before the current frame image; the spatial position weight is used to represent the occlusion relationship between the target pedestrian and the static element in the target region.
[0054] In this step, the number of motion blobs can be used to represent the number of people in the target region. When the number of motion blobs in the current frame image is less than the actual number of people determined at the previous time in the target region, it is indicated that a pedestrian can be occluded or a pedestrian can have walked out of the field of view of the image acquisition device. When a certain pedestrian is occluded, although the current frame image acquired does not capture the pedestrian, the pedestrian is still in the target region, and the occluded pedestrian needs to be counted when counting the number of people. Therefore, in actual application, it is necessary to accurately determine whether the reduced pedestrian is an occluded pedestrian.
[0055] Since each pedestrian can be tracked by determining the motion trajectory of each pedestrian, a target pedestrian can be determined according to the tracking information, wherein the target pedestrian is a pedestrian existing in a target frame image but not existing in a current frame image, and the target frame image is an image photographed before the current frame image and closest to the current frame image in time. For example, if user A does not exist in the current frame image but exists in a previous frame image, the previous frame image is the target frame image. Or, if user A does not exist in the current frame image and the previous frame image but exists in a frame image before the previous frame image, the frame image before the previous frame image is the target frame image.
[0056] After the target pedestrian is determined, a spatial position weight of the target pedestrian can be determined, and the spatial position weight can be used to represent the occlusion relationship between the target pedestrian and a static element in the target region, wherein the static element includes a stationary object in the target region, such as a column, a fence, a table, or a security gate, etc. The greater the spatial position weight, the higher the probability that the target pedestrian is occluded by the static element in the target region, and the smaller the spatial position weight, the lower the probability that the target pedestrian is occluded by the static element in the target region.
[0057] Step 104: determining the number of people in the target region based on the number of motion blobs and the number of target pedestrians with a spatial position weight greater than a preset weight.
[0058] In this step, after the spatial position weight is determined, the number of target pedestrians with a spatial position weight greater than a preset weight can be determined, wherein the target pedestrian with a spatial position weight greater than the preset weight can be understood as a pedestrian occluded by a static element in the target region, and the preset weight can be set according to actual conditions or experience, for example, 0.9 or 0.95, etc. Therefore, when counting the number of people in the target region, the number of target pedestrians with a spatial position weight greater than the preset weight can be added to the number of motion blobs determined, so as to obtain the final statistical number of people.
[0059] The person number determination method provided by the embodiment of the present application comprises the following steps: acquiring a current frame image corresponding to a target area; determining motion blobs corresponding to each pedestrian in the current frame image; acquiring a spatial position weight of a target pedestrian in a case that a number of the motion blobs in the current frame image is less than an actual number of people in the target area at a previous time; the target pedestrian is a pedestrian existing in a previous target frame image but not existing in the current frame image; the spatial position weight represents an occlusion relationship between the target pedestrian and a static element in the target area; and determining the number of people in the target area based on the number of the motion blobs and a number of the target pedestrians whose spatial position weights are greater than a preset weight. Since the spatial position weight of the pedestrian can be used to determine whether the pedestrian is occluded when the number of pedestrians decreases, and the pedestrian is counted into the final number of people in the target area if it is determined that the pedestrian is occluded, the spatial occlusion influence can be eliminated when the number of people is determined, and the occluded pedestrian is not missed, so that the accuracy and statistical precision of the number of people determination can be improved.
[0060] For example, based on the above embodiment, the spatial position weight of the target pedestrian can be acquired in the following manner: determining, for each target pedestrian, a number of occluded pixels of the target pedestrian occluded by each static element in the target frame image; determining, for each static element, an occlusion weight of the target pedestrian corresponding to the static element based on the number of occluded pixels of the static element and a number of pixels corresponding to the target pedestrian; and determining the spatial position weight of the target pedestrian based on the occlusion weight of each static element and a target influence factor corresponding to each static element.
[0061] Specifically, for each target pedestrian disappearing in the current frame image, the target pedestrian exists in the target frame image, so the number of occluded pixels of the target pedestrian occluded by each static element in the target frame image can be determined. In a specific implementation process, the target pedestrian can be traced back in each frame image before the target frame image by using a tracking algorithm, and a number of pixels occupied by the target pedestrian when not occluded can be determined. Since the size of the target pedestrian is fixed, the number of pixels occupied by the target pedestrian when not occluded can be used as the number of pixels corresponding to the target pedestrian. 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.
[0062] In addition, it is assumed that the target pedestrian is partially occluded in the target frame image, so the number of pixels occupied by the part of the target pedestrian not occluded in the target frame image can be determined. The number of occluded pixels of the target pedestrian occluded by each static element in the target frame image can be obtained by subtracting the number of pixels occupied by the part of the target pedestrian not occluded in the target frame image from the number of pixels corresponding to the target pedestrian.
[0063] Furthermore, 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 used to determine 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 degree of coincidence or overlap between the target pedestrian and the static element.
[0064] Furthermore, based on the preset correspondence between static elements and impact factors, the target impact factor corresponding to each static element in the target area can be determined. The target impact factor is the impact of the static element on the pedestrian occlusion. For example, a tall column may completely block the pedestrian, so the impact factor of such a column can be set to 1. A table may only block the pedestrian's legs, so the impact factor of the table can be set to 0.5. Similarly, the impact factor of a fence can be set to 0.1, and the impact factor of a security gate can be set to 0.3, and so on.
[0065] 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):
[0066] (1)
[0067] 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.
[0068] 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 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 the static elements and the occlusion influence factors of the static elements on the pedestrian, the dimensions considered are more comprehensive, thereby making the determined spatial position weight more accurate.
[0069] 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.
[0070] Specifically, the number of moving blocks can be used to represent the number of pedestrians currently captured. For target pedestrians whose spatial position weight is greater than a preset weight, this indicates that the target pedestrian is currently occluded. Therefore, when counting the number of people within the target area, the number of currently captured pedestrians is added to the number of occluded target pedestrians. This sum is then used to determine the number of people within the target area. Because this approach takes occluded pedestrians into account, it improves the accuracy of the final determination of the number of people within the target area.
[0071] Exemplarily, based on the above 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 based on the current frame image and the background frame image, determine each initial motion cluster, based on the motion trajectory of each initial motion cluster, determine the motion cluster to be split among all the initial motion clusters, based on the motion trajectory of the motion cluster to be split, split the motion cluster to be split to obtain split clusters, and based on the split clusters and other clusters in the initial motion clusters except the motion cluster to be split, determine the motion cluster corresponding to each pedestrian.
[0072] Specifically, the background frame image of the target area can be understood as an image that does not contain pedestrians. It can be pre-captured without pedestrians, or it can be a background frame image segmented from an image captured of the target area using a foreground or background segmentation algorithm. In addition, the background frame image can be processed based on lighting information and active objects to reduce interference caused by the background frame image in subsequent image processing.
[0073] After obtaining 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, the pixels whose difference values between the pixels are greater than the preset difference are determined as the pixels that have undergone significant changes, and the pixels that have undergone significant changes are determined as the pixels belonging to the pedestrians. By combining these pixels, at least one initial motion cluster can be obtained.
[0074] By analyzing the position changes of each initial motion cluster in consecutive 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 trajectory of the motion clusters to be split, and the resulting split clusters can more accurately represent the actual pedestrians.
[0075] Furthermore, the resulting split clusters and the other clusters in the initial motion clusters, excluding the motion cluster to be split, can be screened to determine the motion clusters corresponding to each pedestrian. For example, motion clusters that clearly do not conform to pedestrian characteristics can be screened out, such as those that are too small or have irregular shapes.
[0076] 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.
[0077] 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.
[0078] Specifically, for the scene of subway or high-speed rail, the motion posture of pedestrians is usually uniform, such as multiple pedestrians walking towards the exit, so multiple pedestrians will appear to be occluded in front of or side by side with each other, and the cluster adhesion caused by this situation cannot be accurately split according to the motion trajectory of the pedestrians. To solve this problem, in the embodiment of the present application, the distance between the target cluster and the image acquisition device can be determined based on the position of each target cluster in the current frame image, so as to determine the area adjustment weight corresponding to the target cluster based on the corresponding relationship between the pre-set distance and the weight. The farther the distance between the target cluster and the image acquisition device, the greater the area adjustment weight. The closer the distance between the target cluster and the image acquisition device, the smaller the area adjustment weight. The target cluster includes split clusters that have been split and / or other clusters that have not been split.
[0079] After determining the area adjustment weight corresponding to each target cluster, the area of the target cluster can be adjusted based on the area adjustment weight, so as to adjust the area of the motion cluster corresponding to the pedestrian at different positions to the same size.
[0080] 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 value of the preset area range, that is, greater than the preset area, it means that the target cluster is a cluster in which multiple motion clusters corresponding to multiple pedestrians are adhered together, therefore, the target cluster needs to be split to obtain the motion clusters corresponding to each single pedestrian.
[0081] Further, after obtaining the motion clusters corresponding to each pedestrian, the motion clusters can be encoded, such as Y1, Y2, …, Y n The encoding can be used to represent the pedestrian, therefore, the number of encodings is the number of pedestrians.
[0082] In the 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, so as to determine whether to split the target cluster based on the adjusted area. If the adjusted area is greater than the preset area, the target cluster is split, so that the clusters corresponding to the pedestrians with front and rear occlusion or side-by-side occlusion can be split, so that the final obtained motion clusters are all the motion clusters corresponding to single pedestrians, and the accuracy of the finally counted number of pedestrians is improved.
[0083] For example, based on the above embodiments, whether each pedestrian in the target frame image is in the occlusion area can be determined based on the occlusion area of each static element labeled in the background frame image of the target area, and the pedestrian in the occlusion area is determined as the target pedestrian.
[0084] 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 pre-marked. 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.
[0085] 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.
[0086] 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 occluded at all can be excluded, thereby reducing the amount of calculation and saving computing power.
[0087] The following describes the number of people determining device provided by the present invention. The number of people determining device described below and the number of people determining method described above can refer to each other.
[0088] Figure 2 A schematic diagram of the structure of the 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:
[0089] An acquisition module 11 is used to acquire a current frame image of a target area;
[0090] A determination module 12 is configured to determine a motion blob corresponding to each pedestrian in the current frame image;
[0091] The acquisition module 11 is further configured to acquire a spatial position weight of a target pedestrian when the number of motion blobs 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 but does not exist in the current frame image, and the target frame image is an image that has the smallest difference in acquisition time with the current frame image among multiple frames of images that include the target pedestrian before the current frame image; the spatial position weight is used to characterize an occlusion relationship between the target pedestrian and static elements in the target area;
[0092] The determination module 12 is further configured to 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.
[0093] In an exemplary embodiment, the acquisition module 11 is specifically configured to:
[0094] For each target pedestrian, determining the number of occluded pixels of the target pedestrian in the target frame image that are occluded by each static element;
[0095] For each of the static elements, determining an occlusion weight corresponding to the target pedestrian relative to the static element based on the number of occluded pixels corresponding to the static element and the number of pixels corresponding to the target pedestrian;
[0096] 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.
[0097] In an exemplary embodiment, the determination module 12 is specifically configured to:
[0098] 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.
[0099] In an exemplary embodiment, the determination module 12 is specifically configured to:
[0100] Acquire a background frame image of the target area;
[0101] Determining initial motion clumps based on the current frame image and the background frame image;
[0102] Based on the motion trajectories of the initial motion clumps, determining motion clumps to be split from all the initial motion clumps;
[0103] Splitting the motion cluster to be split based on the motion trajectory of the motion cluster to be split, to obtain split clusters;
[0104] Based on the split clusters and other clusters in the initial motion clusters except the motion cluster to be split, the motion cluster corresponding to each pedestrian is determined.
[0105] In an exemplary embodiment, the determination module 12 is specifically configured to:
[0106] Determining an area adjustment weight corresponding to each target blob based on a position of each target blob in the current frame image; the target blob includes the split blob and / or the other blob;
[0107] Adjusting the area of the target blob based on the area adjustment weight;
[0108] The target clusters whose adjusted areas are larger than the preset areas are split to obtain motion clusters corresponding to the pedestrians.
[0109] In an exemplary embodiment, the determining module 12 is further configured to:
[0110] Determining 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;
[0111] A pedestrian in the blocked area is determined as the target pedestrian.
[0112] 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.
[0113] Figure 3 A schematic diagram of the physical structure of an electronic device provided in an embodiment of the present invention is shown in FIG. 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 the 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 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; 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.
[0114] Furthermore, the logic instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product, stored in a storage medium, includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0115] 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 number determination method provided by the above methods, which includes: obtaining a current frame image for the target area; determining 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, 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 the 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; based on the number of motion clusters and the number of target pedestrians whose spatial position weight is greater than the preset weight, the number of people in the target area is determined.
[0116] In yet another aspect, the present application also provides a non-transitory computer readable storage medium having stored thereon a computer program, which, when executed by a processor, implements the person number determination method provided by any of the above methods, and the method comprises: acquiring a current frame image of a target area; determining respective motion blobs corresponding to each pedestrian in the current frame image; in a case where a number of the motion blobs in the current frame image is less than an actual number of people of the target area at a previous time, acquiring a spatial position weight of a target pedestrian, the target pedestrian being a pedestrian present in a target frame image and not present in the current frame image, the target frame image being an image having a smallest difference in acquisition time from the current frame image among a plurality of images including the target pedestrian and before the current frame image, and the spatial position weight being used to represent an occlusion relationship between the target pedestrian and a static element in the target area; and determining the number of people in the target area based on the number of the motion blobs and a number of target pedestrians having a spatial position weight greater than a preset weight.
[0117] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0118] From the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be realized by means of software and a necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0119] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for determining the number of people, characterized in that: include: Get the current frame image of the target area; Determine the motion blob corresponding to each pedestrian in the current frame image; 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, 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 frames of images that include the target pedestrian before the current frame image. The spatial position weight is used to represent the occlusion relationship between the target pedestrian and the static elements in the target area. Determining the number of people in the target area based on the number of the motion clumps and the number of target pedestrians whose spatial position weights are greater than a preset weight; The step of obtaining the spatial position weight of the target pedestrian includes: For each target pedestrian, determining the number of occluded pixels of the target pedestrian in the target frame image that are occluded by each static element; For each of the static elements, determining an occlusion weight corresponding to the target pedestrian relative to the static element based on the number of occluded pixels corresponding to the static element and the number of pixels corresponding to the target pedestrian; 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, where the target influence factor is the influence of the static element on the occluded pedestrian.
2. The method for determining the number of people according to claim 1, wherein: The 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.
3. The method for determining the number of people according to claim 1, wherein: The determining of the motion blob corresponding to each pedestrian in the current frame image includes: Acquire a background frame image of the target area; Determining initial motion clumps based on the current frame image and the background frame image; Based on the motion trajectories of the initial motion clumps, determining motion clumps to be split from all the initial motion clumps; Splitting the motion cluster to be split based on the motion trajectory of the motion cluster to be split, to obtain split clusters; Based on the split clusters and other clusters in the initial motion clusters except the motion cluster to be split, the motion cluster corresponding to each pedestrian is determined.
4. The method for determining the number of people according to claim 3, wherein: 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: Determining an area adjustment weight corresponding to each target blob based on a position of each target blob in the current frame image; the target blob includes the split blob and / or the other blob; Adjusting the area of the target blob 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.
5. The method for determining the number of people according to any one of claims 1 to 4, characterized in that: The method further comprises: Determining 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; A pedestrian in the blocked area is determined as the target pedestrian.
6. A device for determining the number of people, characterized in that: include: An acquisition module is used to acquire a current frame image of a target area; A determination module, configured to determine a motion blob corresponding to each pedestrian in the current frame image; The acquisition module is further configured to acquire 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 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 frames of images that include the target pedestrian before the current frame image. The spatial position weight is used to represent 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 motion blobs and the number of target pedestrians whose spatial position weights are greater than a preset weight; The acquisition module is specifically used to: For each target pedestrian, determining the number of occluded pixels of the target pedestrian in the target frame image that are occluded by each static element; For each of the static elements, determining an occlusion weight corresponding to the target pedestrian relative to the static element based on the number of occluded pixels corresponding to the static element and the number of pixels corresponding to the target pedestrian; 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, where the target influence factor is the influence of the static element on the occluded pedestrian.
7. 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 5 is implemented.
8. 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 according to any one of claims 1 to 5 is implemented.
9. 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 according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Object quantity estimation method and device
CN105096292A
Device for counting people
CN107274396A