Method and device for obtaining crowd information, and computer-readable storage medium
By acquiring the optical flow feature map of the target image and determining the position and size density maps using the prediction model, the problem of strong device dependence in the acquisition of high-density population information is solved, and population information detection with higher accuracy and wider applicability is achieved.
Patent Information
- Application Number
- CN202111407068.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-24
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2041-11-24
AI Technical Summary
When obtaining high-density information in the prior art, the performance of relying on equipment is relatively single, resulting in low detection accuracy and limited scenarios, which cannot meet user needs.
By obtaining the optical flow characteristic map of the target image, the target position density map and size density map are determined using the prediction model, and the population information is obtained by combining optical flow analysis.
It enriches the means of obtaining crowd information, improves detection accuracy and applicable scenarios, and meets the diverse needs of users.
Smart Images

Figure CN114092883B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a method for acquiring crowd information, a device thereof, and a computer-readable storage medium. Background Art
[0002] With the large number of cameras currently in use, features such as face detection and pedestrian detection are widely used on mobile cameras. Motion analysis of pedestrian groups typically involves analyzing individual targets to determine the group's status. For example, crowd density detection combines detection and tracking, using tracking to establish the trajectory of moving targets while simultaneously using detection to identify pedestrians for crowd motion analysis. Another example is the direct use of moving area to estimate the number of people, thereby determining crowd density.
[0003] However, combining detection and tracking has difficulty estimating distant targets, and tracking accuracy is difficult to maintain in crowded crowds. Furthermore, it relies heavily on detector performance and cannot handle smaller targets. Specifically, crowd density detection for small targets in a crowded crowd is ineffective. Using moving foreground regions to estimate small targets can easily lead to significant deviations in complex scenes due to their simple features and high number of false positives.
[0004] There are limitations in the methods of performing density movement analysis on crowds in the above-mentioned related technologies, which easily lead to large errors in the crowd density movement analysis results and low reliability. Currently, no effective solution has been proposed. Summary of the Invention
[0005] The embodiments of the present invention provide a method and device for obtaining crowd information, and a computer-readable storage medium, to at least solve the technical problem that the existing technology for obtaining high-density crowd information relies heavily on device performance and has a relatively single means, resulting in limited application scenarios and inability to meet user needs.
[0006] According to one aspect of an embodiment of the present invention, a method for obtaining crowd information is provided, comprising: obtaining a target image, wherein the target image is an image to be subjected to crowd information detection; obtaining a target optical flow feature map based on the target image; determining a target position density map and a target size density map corresponding to the target image and the target optical flow feature map through a prediction model, wherein the prediction model is obtained through machine learning training using multiple sets of training data, each set of training data in the multiple sets of training data comprises: a sample image, an optical flow feature map, and a position density map and a size density map corresponding to the sample image and the optical flow feature map; and obtaining crowd information in the target image based on the target position density map and the target size density map.
[0007] Optionally, obtaining a target optical flow feature map based on the target image includes: acquiring a projection value of an optical flow feature of the target image in a predetermined direction; and generating the target optical flow feature map based on the projection value.
[0008] Optionally, before determining the target position density map and the target size density map corresponding to the target image and the target optical flow feature map through the prediction model, the method also includes: collecting multiple historical original images within a historical time period; generating multiple optical flow feature maps of the historical original images to obtain multiple historical optical flow feature maps; obtaining multiple historical position density maps and multiple historical size density maps corresponding to the multiple historical original images and the multiple historical optical flow feature maps; training multiple groups of training data including multiple historical original images, multiple historical optical flow feature maps, and multiple historical position density maps and multiple historical size density maps to obtain the prediction model.
[0009] Optionally, obtaining multiple historical position density maps corresponding to multiple historical original images includes: obtaining a set of head feature information of multiple target objects in the historical original images; generating the historical position density map based on a first Gaussian kernel and the set of head feature information, wherein the first Gaussian kernel is a Gaussian kernel of fixed size.
[0010] Optionally, obtaining multiple historical size density maps corresponding to multiple historical original images includes: obtaining a set of head feature information of multiple target objects in the historical original images; generating the historical size density map based on a second Gaussian kernel and the set of head feature information, wherein the second Gaussian kernel is a Gaussian kernel that has a predetermined relationship with the head of the target object.
[0011] Optionally, obtaining crowd information in the target image based on the target position density map and the target size density map includes: extracting center position information of the target object from the target position density map; extracting size information of the target object from the target size density map; and obtaining crowd information in the target image based on the center position information and the size information.
[0012] Optionally, obtaining crowd information in the target image based on the center position information and the size information includes: determining motion vector information of a single target object in the target area corresponding to the center position information and the size information based on an optical flow analysis method; determining the predicted position of the single target object based on the motion vector information of the single target object and the current position information of the single target object; judging whether the single target object meets a predetermined condition based on the predicted position of the single target object and the current position information of the single target object to obtain a judgment result; determining statistical information of some target objects that meet the predetermined condition based on the judgment result, wherein the statistical information includes at least one of the following: quantity information, position information.
[0013] According to another aspect of an embodiment of the present invention, a device for acquiring crowd information is also provided, including: a first acquisition module, used to acquire a target image, wherein the target image is an image to be subjected to crowd information detection; a second acquisition module, used to obtain a target optical flow feature map based on the target image; a determination module, used to determine a target position density map and a target size density map corresponding to the target image and the target optical flow feature map through a prediction model, wherein the prediction model is obtained through machine learning training using multiple sets of training data, and each set of training data in the multiple sets of training data includes: a sample image, an optical flow feature map, and a position density map and a size density map corresponding to the sample image and the optical flow feature map; a third acquisition module, used to acquire crowd information in the target image based on the target position density map and the target size density map.
[0014] Optionally, the second acquisition module includes: a first acquisition unit, used to obtain the projection value of the optical flow feature of the target image in a predetermined direction; and a first generation unit, used to generate the target optical flow feature map based on the projection value.
[0015] Optionally, the crowd information acquisition device also includes: an acquisition module, which is used to acquire multiple historical original images within a historical time period before determining the target position density map and target size density map corresponding to the target image and the target optical flow feature map through the prediction model; a generation module, which is used to generate optical flow feature maps of multiple historical original images to obtain multiple historical optical flow feature maps; a fourth acquisition module, which is used to acquire multiple historical position density maps and multiple historical size density maps corresponding to the multiple historical original images and the multiple historical optical flow feature maps; a training module, which is used to train multiple groups of training data including multiple historical original images, multiple historical optical flow feature maps, and multiple historical position density maps and multiple historical size density maps to obtain the prediction model.
[0016] Optionally, the fourth acquisition module includes: a second acquisition unit, used to obtain a set of head feature information of multiple target objects in the historical original image; a second generation unit, used to generate the historical position density map based on a first Gaussian kernel and the head feature information set, wherein the first Gaussian kernel is a Gaussian kernel of fixed size.
[0017] Optionally, the fourth acquisition module includes: a third acquisition unit, used to obtain a set of head feature information of multiple target objects in the historical original image; a third generation unit, used to generate the historical size density map based on a second Gaussian kernel and the head feature information set, wherein the second Gaussian kernel is a Gaussian kernel that has a predetermined relationship with the head of the target object.
[0018] Optionally, the third acquisition module includes: a first extraction unit for extracting the center position information of the target object from the target position density map; a second extraction unit for extracting the size information of the target object from the target size density map; and a fourth acquisition unit for acquiring crowd information in the target image based on the center position information and the size information.
[0019] Optionally, the fourth acquisition unit includes: a first determination subunit, used to determine the motion vector information of a single target object in the target area corresponding to the center position information and the size information based on an optical flow analysis method; a second determination subunit, used to determine the predicted position of the single target object based on the motion vector information of the single target object and the current position information of the single target object; a judgment subunit, used to judge whether the single target object meets a predetermined condition based on the predicted position of the single target object and the current position information of the single target object, and obtain a judgment result; a third determination subunit, used to determine statistical information of some target objects that meet the predetermined condition based on the judgment result, wherein the statistical information includes at least one of the following: quantity information, position information.
[0020] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is executed by a processor, the device where the computer-readable storage medium is located is controlled to execute any of the above-mentioned methods for obtaining crowd information.
[0021] According to another aspect of an embodiment of the present invention, a processor is provided, which is configured to run a computer program. When the computer program is run, the method for obtaining crowd information described above is executed.
[0022] In an embodiment of the present invention, a target image is obtained, wherein the target image is an image to be subjected to crowd information detection; a target optical flow feature map is obtained based on the target image; a target position density map and a target size density map corresponding to the target image and the target optical flow feature map are determined through a prediction model, wherein the prediction model is obtained through machine learning training using multiple sets of training data, and each set of training data in the multiple sets of training data includes: a sample image, an optical flow feature map, and a position density map and a size density map corresponding to the sample image and the optical flow feature map; crowd information in the target image is obtained based on the target position density map and the target size density map. The method for obtaining crowd information in the embodiment of the present invention achieves the purpose of processing the image to be subjected to crowd information detection and obtaining crowd information in the target image through the target position density map and the target size density map of the prediction model, thereby achieving the technical effect of increasing the richness of means for obtaining crowd information to better meet user needs, thereby solving the technical problem that the prior art relies heavily on device performance and has a relatively single means for obtaining high-density crowd information, resulting in limited application scenarios and an inability to meet user needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0024] Figure 1 is a flow chart of a method for obtaining crowd information according to an embodiment of the present invention;
[0025] Figure 2 2 is a schematic diagram of a device for acquiring crowd information according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only 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 making creative efforts should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] Example 1
[0029] According to an embodiment of the present invention, a method embodiment of a method for obtaining crowd information is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] Figure 1 is a flow chart of a method for obtaining crowd information according to an embodiment of the present invention. Figure 1 As shown, the method for obtaining the crowd information includes the following steps:
[0031] Step S102 : acquiring a target image, wherein the target image is an image to be subjected to crowd information detection.
[0032] Optionally, in the above steps, a target image is captured by an image capture device, wherein the target image is an image of a crowd to be analyzed, and the captured image can be a static picture or an image that is first captured as a video and then decomposed into several frames.
[0033] Step S104: obtaining a target optical flow feature map based on the target image.
[0034] Optionally, in the above steps, the projection values of the target image in the X-axis direction and the Y-axis direction are used to form a target optical flow feature map.
[0035] Step S106: Determine a target position density map and a target size density map corresponding to the target image and the target optical flow feature map through a prediction model, wherein the prediction model is obtained through machine learning training using multiple sets of training data, and each set of training data in the multiple sets of training data includes: a sample image, an optical flow feature map, and a position density map and a size density map corresponding to the sample image and the optical flow feature map.
[0036] Step S108 : acquiring crowd information in the target image based on the target position density map and the target size density map.
[0037] As can be seen from the above, in an embodiment of the present invention, first, a target image can be obtained, wherein the target image is an image to be subjected to crowd information detection; then, a target optical flow feature map is obtained based on the target image; then, a target position density map and a target size density map corresponding to the target image and the target optical flow feature map can be determined through a prediction model, wherein the prediction model is obtained through machine learning training using multiple sets of training data, and each set of training data in the multiple sets of training data includes: a sample image, an optical flow feature map, and a position density map and a size density map corresponding to the sample image and the optical flow feature map; finally, crowd information in the target image is obtained based on the target position density map and the target size density map. Through the method for obtaining crowd information in an embodiment of the present invention, the purpose of processing the image to be subjected to crowd information detection and obtaining crowd information in the target image through the target position density map and the target size density map of the prediction model is achieved, thereby achieving the technical effect of increasing the richness of means for obtaining crowd information to better meet user needs, and thus solving the technical problem that the prior art relies more on device performance and has a relatively single means for obtaining high-density crowd information, resulting in limited application scenarios and inability to meet user needs.
[0038] As an optional embodiment, obtaining a target optical flow feature map based on a target image includes: obtaining projection values of optical flow features of the target image in a predetermined direction; and generating the target optical flow feature map based on the projection values.
[0039] In the above optional embodiment, the projection values of the optical flow features in the x-direction and the y-direction are recorded to form optical flow feature maps, which are respectively recorded as flow_x_map (i.e., the target optical flow feature map based on the projection values in the X-axis direction) and flow_y_map (i.e., the target optical flow feature map based on the projection values in the Y-axis direction).
[0040] As an optional embodiment, before determining the target position density map and target size density map corresponding to the target image and the target optical flow feature map through the prediction model, the method also includes: collecting multiple historical original images within a historical time period; generating optical flow feature maps of the multiple historical original images to obtain multiple historical optical flow feature maps; obtaining multiple historical position density maps and multiple historical size density maps corresponding to the multiple historical original images and the multiple historical optical flow feature maps; training multiple groups of training data including multiple historical original images, multiple historical optical flow feature maps, and multiple historical position density maps and multiple historical size density maps to obtain a prediction model.
[0041] In the above optional embodiment, the head area of the crowd target in the video is marked, and the marking format is the center coordinates and length and width dimensions (i.e. head feature information) of the head target p. It can be recorded as [x_cen p , y_cen p ,width p , height p ] Calculate the average width and height d of the head target p p , calculated as
[0042] Furthermore, the optical flow feature maps flow_x_map, flow_y_map and the original image (denoted as origin_map) can be used as samples to train the network for the prediction of position density maps and size density maps.
[0043] As an optional embodiment, obtaining multiple historical position density maps corresponding to multiple historical original images includes: obtaining a set of head feature information of multiple target objects in the historical original images; generating a historical position density map based on a first Gaussian kernel and the set of head feature information, wherein the first Gaussian kernel is a Gaussian kernel of fixed size.
[0044] In the above optional embodiment, a set of head feature information of multiple target objects in the historical original image is obtained and a historical position density map is generated based on the first Gaussian kernel.
[0045] As an optional embodiment, obtaining multiple historical size density maps corresponding to multiple historical original images includes: obtaining a set of head feature information of multiple target objects in the historical original images; generating a historical size density map based on a second Gaussian kernel and the set of head feature information, wherein the second Gaussian kernel is a Gaussian kernel that has a predetermined relationship with the head of the target object.
[0046] In the above optional embodiment, a density map (referred to as gt_location_density_map) can be generated by a Gaussian kernel of fixed size (i.e., the first Gaussian kernel) to determine the target location. First, a density map (referred to as gt_size_density_map) is generated by a Gaussian kernel (i.e., the second Gaussian kernel) that is proportional to the size of the human head to determine the target size. The location density map (referred to as gt_location_density_map) is generated as follows. Assume that the target set of the human head target in the image is R. Here, the location density map generation algorithm is: in Represents x p The standard deviation of the center is σ p The value of the Gaussian function at position x, where σ pUse a fixed value σ; secondly, the size density map (denoted as gt_size_density_map) is generated by assuming that the target set of human head targets in the image is R, where the above position density map generation algorithm is in, Represents x p The standard deviation of the center is σ p The value of the Gaussian function at position x, where σ p Use the value r*d p .
[0047] As an optional embodiment, crowd information in a target image is obtained based on a target position density map and a target size density map, including: extracting the center position information of the target object from the target position density map; extracting the size information of the target object from the target size density map; and obtaining crowd information in the target image based on the center position information and the size information.
[0048] As an optional embodiment, crowd information in a target image is obtained based on center position information and size information, including: determining motion vector information of a single target object in a target area corresponding to the center position information and size information based on an optical flow analysis method; determining a predicted position of the single target object based on the motion vector information of the single target object and the current position information of the single target object; judging whether the single target object meets predetermined conditions based on the predicted position of the single target object and the current position information of the single target object, and obtaining a judgment result; determining statistical information of some target objects that meet the predetermined conditions based on the judgment result, wherein the statistical information includes at least one of the following: quantity information and position information.
[0049] In the above optional embodiment, the optical flow feature map of the image to be inferred is calculated, and the predicted location density map predict_location_density_map and size density map predict_size_density_map are obtained based on the trained network. Next, the center position information of the target is extracted from the location density map predict_location_density_map. The center position coordinates can be obtained using a maximum value or Gaussian fitting method. A simple method for calculating the center position of a target is described below according to an embodiment of the present invention.
[0050] Step 1. On the predicted_location_density_map, find the maximum point within the neighborhood N1(q) of location q. If location q is a maximum point and its value is greater than a preset value, it can be considered the target center. Considering some dense targets, sum the predicted_location_density_map values within the neighborhood N1(q) of location q and use this sum as the number of targets at that location, count_q.
[0051] Step 2. For the size density map, extract the width and height information of the target from the size density map predict_size_density_map. You can consider the Gaussian fitting method to obtain the size information of the human head.
[0052] Step 3. Assume that position q satisfies the target center position condition in step 6, assume that the neighborhood range centered on q is N2(q), and the coordinates of position q are x q , according to the value of predict_size_density_map in N2(q), use Fitting to obtain σ q The value of , using the previously set r value, calculate d p The width and height of the target can be used.
[0053] Step 4. The rectangular range centered on the position q obtained in steps 2 and 3 is the target area range, d p The width and height of the rectangle are assumed to be O(q). The motion vector of a single target and the motion vector V(q) of target q are calculated based on the optical flow, V(q) = [Vx(q), Vy(q)], Where K is the number of pixels in O(q).
[0054] Step 5. Calculate the predicted position based on the target's motion vector and target position. The predicted position is x q +V(q).
[0055] Step 6. Determine whether the target has crossed the line based on its predicted and current positions. If so, mark it as a crossed-line target. Also, record the number of targets, thereby obtaining the position and number of crossed-line targets.
[0056] From the above, it can be seen that in an embodiment of the present invention, a method for estimating crowd density by combining optical flow with the method provided in the embodiment, a method for determining the position size information of the target using a size density map and a position density map, and a single target analysis and cross-line detection method combining optical flow and density maps are used to obtain the number of cross-line targets in the crowd information. Compared with the traditional "detection + tracking" scheme, the minimum target that can be detected by this scheme is also smaller. At the same time, the initial data features are increased by combining optical flow, which effectively increases the target detection accuracy.
[0057] Example 2
[0058] According to another aspect of the embodiments of the present invention, a device for acquiring crowd information is provided. Figure 2 is a schematic diagram of a device for acquiring crowd information according to an embodiment of the present invention. Figure 2 As shown, it includes: a first acquisition module 21, a second acquisition module 23, a determination module 25 and a third acquisition module 27. The device for acquiring crowd information is described below.
[0059] The first acquisition module 21 is used to acquire a target image, wherein the target image is an image to be subjected to crowd information detection.
[0060] The second acquisition module 23 is configured to obtain a target optical flow feature map based on the target image.
[0061] The determination module 25 is used to determine the target position density map and the target size density map corresponding to the target image and the target optical flow feature map through a prediction model, wherein the prediction model is obtained through machine learning training using multiple sets of training data, and each set of training data in the multiple sets of training data includes: a sample image, an optical flow feature map, and a position density map and a size density map corresponding to the sample image and the optical flow feature map.
[0062] The third acquisition module 27 is configured to acquire crowd information in the target image based on the target position density map and the target size density map.
[0063] It should be noted that the first acquisition module 21, the second acquisition module 23, the determination module 25, and the third acquisition module 27 correspond to steps S102 to S108 in Example 1. The examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above modules, as part of the apparatus, can be executed in a computer system, such as a set of computer-executable instructions.
[0064] As can be seen from the above, in the embodiment of the present invention, first, the first acquisition module 21 can be used to acquire the target image, wherein the target image is the image to be subjected to crowd information detection; then, the second acquisition module 23 is used to obtain the target optical flow feature map based on the target image; then, the determination module 25 is used to determine the target position density map and the target size density map corresponding to the target image and the target optical flow feature map through the prediction model, wherein the prediction model is obtained through machine learning training using multiple sets of training data, and each set of training data in the multiple sets of training data includes: a sample image, an optical flow feature map, and a position density map and a size density map corresponding to the sample image and the optical flow feature map; finally, the third acquisition module 27 is used to acquire the crowd information in the target image based on the target position density map and the target size density map. Through the crowd information acquisition device of the embodiment of the present invention, the purpose of processing the image to be subjected to crowd information detection and acquiring the crowd information in the target image through the target position density map and the target size density map of the prediction model is achieved, thereby achieving the technical effect of increasing the richness of the means for acquiring crowd information to better meet user needs, thereby solving the technical problem that the prior art relies heavily on device performance and has a relatively single means when acquiring high-density crowd information, resulting in limited application scenarios and inability to meet user needs.
[0065] Optionally, the second acquisition module includes: a first acquisition unit, used to obtain the projection value of the optical flow feature of the target image in a predetermined direction; and a first generation unit, used to generate a target optical flow feature map based on the projection value.
[0066] Optionally, the crowd information acquisition device also includes: an acquisition module, which is used to acquire multiple historical original images within a historical time period before determining the target position density map and target size density map corresponding to the target image and the target optical flow feature map through the prediction model; a generation module, which is used to generate optical flow feature maps of multiple historical original images to obtain multiple historical optical flow feature maps; a fourth acquisition module, which is used to acquire multiple historical position density maps and multiple historical size density maps corresponding to the multiple historical original images and the multiple historical optical flow feature maps; a training module, which is used to train multiple groups of training data including multiple historical original images, multiple historical optical flow feature maps, and multiple historical position density maps and multiple historical size density maps to obtain a prediction model.
[0067] Optionally, the fourth acquisition module includes: a second acquisition unit, used to obtain a set of head feature information of multiple target objects in the historical original image; a second generation unit, used to generate a historical position density map based on the first Gaussian kernel and the head feature information set, wherein the first Gaussian kernel is a Gaussian kernel of fixed size.
[0068] Optionally, the fourth acquisition module includes: a third acquisition unit, used to obtain a set of head feature information of multiple target objects in the historical original image; a third generation unit, used to generate a historical size density map based on the second Gaussian kernel and the head feature information set, wherein the second Gaussian kernel is a Gaussian kernel that has a predetermined relationship with the head of the target object.
[0069] Optionally, the third acquisition module includes: a first extraction unit for extracting the center position information of the target object from the target position density map; a second extraction unit for extracting the size information of the target object from the target size density map; and a fourth acquisition unit for acquiring crowd information in the target image based on the center position information and size information.
[0070] Optionally, the fourth acquisition unit includes: a first determination subunit, used to determine the motion vector information of a single target object in the target area corresponding to the center position information and size information based on an optical flow analysis method; a second determination subunit, used to determine the predicted position of the single target object based on the motion vector information of the single target object and the current position information of the single target object; a judgment subunit, used to judge whether the single target object meets predetermined conditions based on the predicted position of the single target object and the current position information of the single target object, and obtain a judgment result; a third determination subunit, used to determine statistical information of some target objects that meet the predetermined conditions based on the judgment result, wherein the statistical information includes at least one of the following: quantity information, position information.
[0071] Example 3
[0072] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided, which includes a stored computer program, wherein when the computer program is executed by a processor, the device where the computer-readable storage medium is located is controlled to execute any of the above-mentioned methods for obtaining crowd information.
[0073] Example 4
[0074] According to another aspect of an embodiment of the present invention, a processor is further provided, which is configured to run a computer program, wherein the computer program executes any of the above methods for obtaining crowd information when running.
[0075] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0076] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0077] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0078] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0079] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0080] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or 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, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program codes.
[0081] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A method for obtaining crowd information, characterized in that: include: Acquire a target image, wherein the target image is an image to be subjected to crowd information detection; Obtaining a target optical flow feature map based on the target image; Determining a target position density map and a target size density map corresponding to the target image and the target optical flow feature map through a prediction model, wherein the prediction model is obtained through machine learning training using multiple sets of training data, each set of training data including: a sample image, an optical flow feature map, and a position density map and a size density map corresponding to the sample image and the optical flow feature map; Acquire crowd information in the target image based on the target position density map and the target size density map; Acquiring crowd information in the target image based on the target position density map and the target size density map includes: extracting the center position information of the target object from the target position density map; extracting size information of the target object from the target size density map; Determine, based on an optical flow analysis method, motion vector information of a single target object in the target area corresponding to the center position information and the size information; determining a predicted position of the single target object based on the motion vector information of the single target object and the current position information of the single target object; Determining whether the single target object meets a predetermined condition based on the predicted position of the single target object and the current position information of the single target object, and obtaining a determination result; Statistical information of some target objects that meet the predetermined condition is determined based on the judgment result, wherein the statistical information includes at least one of the following: quantity information and location information.
2. The method according to claim 1, characterized in that Obtaining a target optical flow feature map based on the target image, including: Obtaining a projection value of the optical flow feature of the target image in a predetermined direction; The target optical flow feature map is generated based on the projection value.
3. The method according to claim 1, characterized in that Before determining the target position density map and the target size density map corresponding to the target image and the target optical flow feature map through the prediction model, the method further includes: Collect multiple historical original images within a historical time period; generating a plurality of optical flow feature maps of the historical original images to obtain a plurality of historical optical flow feature maps; Acquire a plurality of historical position density maps and a plurality of historical size density maps corresponding to the plurality of historical original images and the plurality of historical optical flow feature maps; The prediction model is obtained by training multiple groups of training data including multiple historical original images, multiple historical optical flow feature maps, multiple historical position density maps, and multiple historical size density maps.
4. The method according to claim 3, characterized in that Acquiring a plurality of historical location density maps corresponding to the plurality of historical original images, including: Acquire a set of head feature information of multiple target objects in the historical original image; The historical position density map is generated based on a first Gaussian kernel and the head feature information set, wherein the first Gaussian kernel is a Gaussian kernel of fixed size.
5. The method according to claim 3, characterized in that Acquiring a plurality of historical size density maps corresponding to the plurality of historical original images, including: Acquire a set of head feature information of multiple target objects in the historical original image; The historical size density map is generated based on a second Gaussian kernel and the head feature information set, wherein the second Gaussian kernel is a Gaussian kernel that has a predetermined relationship with the head of the target object.
6. A device for acquiring crowd information, characterized in that: include: A first acquisition module is used to acquire a target image, wherein the target image is an image to be subjected to crowd information detection; A second acquisition module is used to obtain a target optical flow feature map based on the target image; a determination module, configured to determine, by means of a prediction model, a target position density map and a target size density map corresponding to the target image and the target optical flow feature map, wherein the prediction model is obtained by machine learning training using multiple sets of training data, each set of training data including: a sample image, an optical flow feature map, and a position density map and a size density map corresponding to the sample image and the optical flow feature map; a third acquisition module, configured to acquire crowd information in the target image based on the target position density map and the target size density map; The third acquisition module includes: a first extraction unit, used to extract the center position information of the target object from the target position density map; a second extraction unit, used to extract the size information of the target object from the target size density map; a fourth acquisition unit, used to determine the center position information and the motion vector information of a single target object in the target area corresponding to the size information based on an optical flow analysis method; determine the predicted position of the single target object based on the motion vector information of the single target object and the current position information of the single target object; judge whether the single target object meets the predetermined conditions based on the predicted position of the single target object and the current position information of the single target object to obtain a judgment result; determine the statistical information of some target objects that meet the predetermined conditions based on the judgment result, wherein the statistical information includes at least one of the following: quantity information and position information.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed by a processor, the device where the computer-readable storage medium is located is controlled to execute the method for obtaining crowd information according to any one of claims 1 to 5.
8. A processor, characterized in that: The processor is configured to run a computer program, wherein the computer program, when running, executes the method for obtaining crowd information according to any one of claims 1 to 5.
Citation Information
Patent Citations
Crowd event identification method, device, electronic equipment and system
CN110390226A
Crowd density estimation method, apparatus and device, and storage medium
CN113486732A