Activity site crowding detection method, device, electronic device and storage medium
Acquire videos through monitoring equipment and use convolutional neural networks to identify people's activity areas. Combined with pre-trained models to calculate congestion, this solves the problems of high manual participation and low accuracy in the existing technology, and achieves efficient and intelligent congestion management. degree detection.
Patent Information
- Application Number
- CN202111189608.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-13
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-10-13
AI Technical Summary
When the existing technology calculates the crowding degree at an event site, manual participation is high, the calculation accuracy is low, and it lacks intelligence.
Acquire videos through monitoring equipment, extract key frames, identify people's activity areas, use pre-trained crowding recognition models to perform digital image processing, calculate crowding degrees, and combine convolutional neural networks and preset formulas to achieve automated calculations.
It improves the accuracy and intelligence of congestion calculation, reduces manual participation, reduces the waste of computing resources, and enhances the accuracy of calculation results.
Smart Images

Figure CN113869269B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and in particular to a method, device, electronic device and computer-readable storage medium for detecting crowding at an activity site. Background Art
[0002] Using offline activities to attract traffic is an important marketing method. For example, a shopping mall holds a large-scale promotional event in a vacant venue to attract more traffic and stimulate consumption. Although offline activities have certain practicality, they also have safety hazards. For example, when a large number of people emerge in the venue in a short period of time, it is very easy to cause safety problems. Therefore, it is extremely important to judge the congestion of the venue efficiently and timely.
[0003] At present, the mainstream method for calculating venue congestion is to first obtain a venue map, manually divide the activity range of people on the venue map, shoot the venue map with monitoring equipment, and then roughly calculate the congestion using the personnel information fed back by the venue map.
[0004] Although this method can realize the calculation of congestion, on the one hand, it requires too much manpower to participate in the calculation and the degree of intelligence is not high. On the other hand, the accuracy of its congestion calculation is low. Summary of the invention
[0005] The present invention provides a method, device, electronic device and computer-readable storage medium for detecting crowding at an activity site, the main purpose of which is to improve the accuracy and intelligence of crowding calculation.
[0006] To achieve the above object, the present invention provides a method for detecting crowding at an activity site, comprising:
[0007] Use monitoring equipment to monitor the activity site within a preset time period to obtain on-site monitoring video;
[0008] Extract key frames from the on-site monitoring video to obtain an on-site monitoring image;
[0009] Identify the personnel activity area from the on-site monitoring map to obtain a personnel activity map;
[0010] Performing digital image processing on the personnel activity graph to obtain a crowding degree to-be-identified graph;
[0011] The pre-trained crowding recognition model is used to detect the crowding map to be recognized, and a human body detection frame set is obtained. The number of detection frames in the human body detection frame set is calculated, and the number of detection frames is input into a pre-built crowding calculation formula to calculate the crowding of the event site.
[0012] Optionally, extracting key frames from the on-site monitoring video to obtain an on-site monitoring image includes:
[0013] Taking the center point of the on-site monitoring video as the key location point;
[0014] Sequentially extract the pixel value of each frame in the on-site monitoring video at the key position to obtain a key pixel value;
[0015] According to the key pixel value of each frame, an average pixel value is obtained by solving;
[0016] The frames whose pixel difference between the key position point and the average pixel value is within a preset error range are selected from the on-site monitoring video to obtain the on-site monitoring map.
[0017] Optionally, identifying the personnel activity area from the on-site monitoring map to obtain the personnel activity map includes:
[0018] Obtain the scene training set and the real label set that records the activity area of people in each scene training picture;
[0019] Using a pre-built convolutional neural network to perform convolution and pooling on each scene training image in the scene training set to obtain a scene feature set;
[0020] Calculate the predicted label of each scene feature in the scene feature set using a preset activation function to obtain a predicted label set;
[0021] Calculating the loss value between the true label set and the predicted label set using a preset loss function;
[0022] Optimizing the parameters of the convolutional neural network according to the loss value, and returning to the convolution and pooling steps until the loss value is less than a preset loss threshold, and determining that the convolutional neural network is a scene recognition model;
[0023] The on-site monitoring map is input into the scene recognition model to obtain the personnel activity map.
[0024] Optionally, the pre-built convolutional neural network is used to perform convolution and pooling on each scene training image in the scene training set to obtain a scene feature set, including:
[0025] Inputting each scene training picture in the scene training set into the convolutional neural network in sequence, wherein the convolutional neural network includes a convolution layer and a pooling layer;
[0026] Using the convolution kernel in the convolution layer, a convolution operation is performed on the scene training graph according to a preset step size to obtain a convolution feature set;
[0027] According to the maximum pooling principle, a pooling operation is performed on the convolution feature set in the pooling layer to obtain the scene feature set.
[0028] Optionally, performing digital image processing on the personnel activity graph to obtain a congestion degree to-be-identified graph includes:
[0029] Performing image inversion on the personnel activity graph to obtain an inverted activity graph;
[0030] According to a pre-constructed power change function, performing a power change on the inversion activity diagram to obtain a power activity diagram;
[0031] Performing contrast stretching and histogram equalization on the power activity map to obtain an activity map to be filtered;
[0032] A filtering operation is performed on the activity graph to be filtered to obtain the congestion degree graph to be identified.
[0033] Optionally, the pre-training of the pre-trained congestion recognition model includes:
[0034] Construct a crowding recognition model to be trained including a large target feature extraction layer, a small target feature extraction layer and a detection frame generation layer;
[0035] Receive a large target population training set, a medium target population training set, and a true target frame;
[0036] Using the large target feature extraction layer to perform convolution extraction on the large target population training set to obtain a large target convolution feature set;
[0037] Using the small target feature extraction layer to perform convolution extraction on the medium target population training set to obtain a medium target convolution feature set;
[0038] According to the detection frame generation layer, respectively calculating the target prediction frame of the large target convolution feature set and the target prediction frame of the medium target convolution feature set;
[0039] Calculate the error value between the target prediction frame and the real target frame;
[0040] Determining whether the error value is greater than a preset error threshold;
[0041] When the error value is greater than the error threshold, adjusting the internal parameters of the to-be-trained crowding recognition model, and returning to the above convolution extraction step;
[0042] When the error value is less than or equal to the error threshold, the training of the to-be-trained congestion recognition model is completed, and the congestion recognition model is obtained.
[0043] Optionally, inputting the number of detection frames into a pre-built crowding degree calculation formula to calculate the crowding degree of the activity site includes:
[0044] The following calculation formula is used to calculate the crowding degree of the activity site:
[0045]
[0046] Where d represents the degree of crowding, n is the number of detection boxes, and s m Represents the activity area of personnel activities in the personnel activity diagram.
[0047] In order to solve the above problems, the present invention further provides a device for detecting crowding at an activity site, the device comprising:
[0048] A monitoring video acquisition module is used to monitor the activity site using monitoring equipment within a preset time period to obtain on-site monitoring video;
[0049] A key frame extraction module, used to extract key frames from the on-site monitoring video to obtain an on-site monitoring image;
[0050] A personnel activity area identification module, used to identify the personnel activity area from the on-site monitoring map to obtain a personnel activity map;
[0051] A digital image processing module, used for performing digital image processing on the personnel activity graph to obtain a crowding degree to be identified graph;
[0052] The crowding recognition module is used to use the pre-trained crowding recognition model to detect the crowding to be recognized image, obtain a human detection frame set, calculate the number of detection frames in the human detection frame set, input the number of detection frames into a pre-built crowding calculation formula, and calculate the crowding of the event site.
[0053] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0054] at least one processor; and,
[0055] a memory communicatively connected to the at least one processor; wherein,
[0056] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to implement the above-mentioned method for detecting crowding at an activity site.
[0057] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned method for detecting crowding at an event site.
[0058] The embodiment of the present invention first extracts the video of the monitoring activity scene from the monitoring device. In addition, considering that directly performing congestion detection on each frame in the on-site monitoring video will greatly waste computing resources, key frames are extracted from the on-site monitoring video to obtain an on-site monitoring map, and congestion detection is performed only on the on-site monitoring map to save resources; secondly, the personnel activity area is identified from the on-site monitoring map to obtain a personnel activity map. Since the congestion is mainly calculated by the personnel activity area, the personnel activity area is identified from the on-site monitoring map, and the congestion can be calculated more accurately; thereafter, in order to further improve the calculation accuracy of the congestion, digital image processing is performed on the personnel activity map to obtain a congestion to be identified map; finally, the congestion to be identified map is identified using a pre-trained congestion recognition model to obtain the congestion of the activity scene. Compared with the background technology, it can be seen that the congestion calculation of the embodiment of the present invention does not require manual participation. Secondly, the non-personnel activity area is removed by identifying the personnel activity area, the influence of the non-personnel activity area on the calculation of the congestion is reduced, the influence of the image noise on the accuracy of the congestion is reduced by using digital image processing, and the congestion accuracy is improved by using the pre-trained congestion recognition model. Therefore, the method, device, electronic device and computer-readable storage medium for detecting crowding at an activity site proposed in the present invention can improve the accuracy and intelligence of crowding calculation. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 A schematic diagram of a flow chart of a method for detecting crowding at an activity site provided by an embodiment of the present invention;
[0060] Figure 2 A schematic diagram of the process of S2 in the method for detecting crowding at an activity site provided by an embodiment of the present invention;
[0061] Figure 3 A schematic diagram of the process of S3 in the method for detecting crowding at an activity site provided by an embodiment of the present invention;
[0062] Figure 4 A schematic diagram of the process of S4 in the method for detecting crowding at an activity site provided by an embodiment of the present invention;
[0063] Figure 5 A schematic diagram of the process of S5 in the method for detecting crowding at an activity site provided by an embodiment of the present invention;
[0064] Figure 6 A schematic diagram of a module of an activity site crowd detection device provided by an embodiment of the present invention;
[0065] Figure 7 A schematic diagram of the internal structure of an electronic device for implementing a method for detecting crowding at an activity site provided by an embodiment of the present invention;
[0066] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0067] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0068] The embodiment of the present application provides a method for detecting the degree of crowding at an event site. The execution subject of the method for detecting the degree of crowding at an event site includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the method for detecting the degree of crowding at an event site can be executed by software or hardware installed in a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
[0069] Reference Figure 1 FIG. 1 is a flow chart of a method for detecting crowding at an activity site according to an embodiment of the present invention. In an embodiment of the present invention, the method for detecting crowding at an activity site includes:
[0070] S1. Use monitoring equipment to monitor the activity site within a preset time period to obtain on-site monitoring video.
[0071] It should be understood that the monitoring equipment described in the present invention can be pre-installed at an activity site, wherein the activity site includes a job fair, an amusement park, an outdoor exhibition, etc.
[0072] For example, job fairs usually have the most job seekers in the morning. To ensure that the number of people on site is controlled within a reasonable range, monitoring equipment is activated to monitor the job fair site from 9:00 to 12:00 in the morning to obtain on-site monitoring video.
[0073] S2. Extract key frames from the on-site monitoring video to obtain an on-site monitoring image.
[0074] It is conceivable that if congestion detection is directly performed on each frame in the on-site monitoring video, it will greatly waste computing resources. Therefore, it is necessary to extract key frames from the on-site monitoring video and perform congestion detection only on the key frames to save resources.
[0075] One embodiment of the present invention, see Figure 2 As shown, the S2 includes:
[0076] S21, selecting key locations from the on-site monitoring video;
[0077] Optionally, the center point of the on-site monitoring video may be selected as the key location point.
[0078] S22, sequentially extracting the pixel value of each frame in the on-site monitoring video at the key position point to obtain a key pixel value;
[0079] S23, obtaining an average pixel value according to the key pixel value of each frame;
[0080] For example, if there are five thousand frames in total, the pixel value of each frame is added and divided by five thousand to obtain the average pixel value.
[0081] S24, selecting frames whose pixel difference between the key position point and the average pixel value is within a preset error range from the on-site monitoring video to obtain the on-site monitoring map.
[0082] In the embodiment of the present invention, the error range can be set to [-10, +10].
[0083] In another embodiment of the present invention, a method such as histogram frame averaging may be used to extract key frames from the on-site monitoring video to obtain an on-site monitoring image.
[0084] S3. Identify the personnel activity area from the on-site monitoring map to obtain a personnel activity map.
[0085] In the embodiment of the present invention, since the on-site monitoring map may contain personnel activity areas and non-personnel activity areas, and the congestion degree is calculated only based on the personnel activity areas, Figure 3 As shown, the personnel activity area is identified from the on-site monitoring map to obtain the personnel activity map, including:
[0086] S31, obtaining a scene training set and a real label set recording the activity area of personnel in each scene training image;
[0087] It should be noted that the embodiment of the present invention identifies the area where people are active based on the scene recognition model of the convolutional neural network. Since the convolutional neural network model needs to be trained before performing recognition, it is necessary to obtain a scene training set and a real label set.
[0088] The scene training set may be collected and organized in advance by a user, and mainly includes a set of pictures of personnel activity areas and non-personnel activity areas at different activity sites.
[0089] In addition, the real labels mainly record the personnel activity areas and non-personnel activity areas in each activity scene picture.
[0090] S32, using a pre-built convolutional neural network to perform convolution and pooling on each scene training image in the scene training set to obtain a scene feature set;
[0091] In detail, the S32 includes:
[0092] Inputting each scene training picture in the scene training set into the convolutional neural network in sequence, wherein the convolutional neural network includes a convolution layer and a pooling layer;
[0093] Using the convolution kernel in the convolution layer, a convolution operation is performed on the scene training graph according to a preset step size to obtain a convolution feature set;
[0094] According to the maximum pooling principle, a pooling operation is performed on the convolution feature set in the pooling layer to obtain the scene feature set.
[0095] In the embodiment of the present invention, the convolution kernel includes 5*5 and 6*6, and the step size can be set to 1 or 2. In addition, the number of convolution layers and pooling layers can be 6, 8, 10, 15, etc., respectively.
[0096] S33, using a preset activation function to calculate the predicted label of each scene feature in the scene feature set to obtain a predicted label set;
[0097] The activation function includes but is not limited to a softmax activation function and a Relu activation function.
[0098] S34, using a preset loss function to calculate the loss value between the true label set and the predicted label set;
[0099] The loss function includes but is not limited to a cross entropy loss function and a square error loss function.
[0100] S35, performing parameter optimization on the convolutional neural network according to the loss value, and returning to the convolution and pooling steps until the loss value is less than a preset loss threshold, and determining that the convolutional neural network is a scene recognition model;
[0101] It should be understood that the embodiment of the present invention uses a gradient descent algorithm in combination with the loss value to update the parameters in the convolutional neural network until the loss value is less than the preset loss threshold. The gradient descent algorithm includes but is not limited to a mini-batch gradient descent algorithm and a stochastic gradient descent algorithm.
[0102] S36: Input the on-site monitoring diagram into the scene recognition model to obtain the personnel activity diagram.
[0103] It can be known that when the convolutional neural network completes training, it has the ability to detect scenes. For example, by inputting the on-site monitoring map of the above-mentioned job fair into the scene recognition model, a map including only personnel activities and non-personnel activities can be obtained.
[0104] S4. Perform digital image processing on the personnel activity diagram to obtain a crowding degree map to be identified.
[0105] It should be understood that in order to improve the accuracy of crowding recognition, digital image processing is performed on the personnel activity diagram to improve the image quality.
[0106] For details, see Figure 4 As shown, the S4 includes:
[0107] S41, performing image inversion on the personnel activity diagram to obtain an inverted activity diagram;
[0108] It should be understood that image inversion is suitable for enhancing white or gray details in dark areas of the image, especially when black areas dominate the image. It is also important to perform image inversion because the white or gray details are sometimes lost due to monitoring lighting problems in personnel activity maps.
[0109] In the embodiment of the present invention, the following inversion formula is used to perform image inversion on the personnel activity graph:
[0110] s=L-1-r
[0111] Among them, s is the pixel value of the inverted activity map, L is the gray level, and r is the pixel value of the personnel activity map.
[0112] S42, performing a power change on the inversion activity diagram according to a pre-constructed power change function to obtain a power activity diagram;
[0113] It should be noted that the main purpose of the power change is to expand the low grayscale range and compress the high grayscale range. Since the crowding is mainly calculated by the density of people in the picture, and the personnel information generally exists in low grayscale, the personnel information can be appropriately amplified through the power change to improve the accuracy of subsequent crowding calculations.
[0114] In detail, the power change function is:
[0115] t=cs y
[0116] Wherein, t is the pixel value in the power activity map, c and y are preset positive constants, and s is the pixel value of the inverse activity map.
[0117] S43, performing contrast stretching and histogram equalization on the power activity graph to obtain an activity graph to be filtered;
[0118] S44: Perform a filtering operation on the activity graph to be filtered to obtain the congestion degree graph to be identified.
[0119] In the embodiment of the present invention, the filtering operation includes median filtering and mean filtering operations.
[0120] S5. Use the pre-trained crowding recognition model to detect the crowding image to be recognized, obtain a human detection frame set, calculate the number of detection frames in the human detection frame set, input the number of detection frames into a pre-built crowding calculation formula, and calculate the crowding of the event site.
[0121] See also Figure 5 As shown, the pre-training of the congestion recognition model completed by the pre-training includes:
[0122] S51, constructing a crowding recognition model to be trained including a large target feature extraction layer, a small target feature extraction layer and a detection frame generation layer;
[0123] The monitored equipment is prone to distortion during the monitoring process, which results in different sizes of different people in the crowding map to be identified being different. Therefore, in the embodiment of the present invention, a large target feature extraction layer and a small target feature extraction layer are constructed.
[0124] Among them, the large target feature extraction layer is mainly used to identify the target population with larger volume in the crowded image to be identified, and the small target feature extraction layer is mainly used to identify the target population with smaller volume in the crowded image to be identified.
[0125] Furthermore, in an embodiment of the present invention, the large target feature extraction layer is composed of 12 convolutional layers and pooling layers, wherein there are 6 convolutional layers and 6 pooling layers, and among the 6 convolutional layers, the convolution kernel size of the first 2 layers is 5*5, and the convolution kernel size of the last 4 layers is 3*3.
[0126] In addition, the small target feature extraction layer is composed of 8 convolutional layers and pooling layers, of which there are 4 convolutional layers and 4 pooling layers respectively. In the 4 convolutional layers, the size of the convolution kernel of each layer is 3*3.
[0127] S52, receiving a large target population training set, a medium target population training set, and a true target frame;
[0128] In the embodiment of the present invention, the volume of the persons included in each picture in the large target population training set is greater than 4 centimeters in length, and the length of the persons included in each picture in the medium target population training set is less than or equal to 4 centimeters.
[0129] In addition, the real target frame mainly records the position of the person in each training picture.
[0130] S53, using the large target feature extraction layer to perform convolution extraction on the large target population training set to obtain a large target convolution feature set;
[0131] S54, using the small target feature extraction layer to perform convolution extraction on the medium target population training set to obtain a medium target convolution feature set;
[0132] In the embodiment of the present invention, the convolution and pooling process of the large target feature extraction layer and the small target feature extraction layer are the same as the above-mentioned step S3, which will not be repeated here.
[0133] S55, according to the detection frame generation layer, respectively calculating the target prediction frame of the large target convolution feature set and the target prediction frame of the medium target convolution feature set;
[0134] Furthermore, the detection frame generation layer mainly calculates the upper left corner coordinates and the lower right corner coordinates of the target prediction frame according to the activation function, and draws the target prediction frame according to the upper left corner coordinates and the lower right corner coordinates. The activation function includes a linear activation function, a nonlinear activation function, etc.
[0135] S56, calculating the error value between the target prediction frame and the real target frame;
[0136] In an embodiment of the present invention, the error value is calculated according to a loss function, and the loss function includes but is not limited to a cross entropy loss function, a square difference loss function, and the like.
[0137] S57, determining whether the error value is greater than a preset error threshold;
[0138] S58, when the error value is greater than the error threshold, adjusting the internal parameters of the to-be-trained congestion recognition model, and returning to S53;
[0139] It should be understood that when the error value is greater than the error threshold, the parameters such as the convolution kernel step size, the pooling strategy, and the number of convolution kernel convolutions of the crowding recognition model to be trained can be adjusted.
[0140] S59: When the error value is less than or equal to the error threshold, the training of the to-be-trained congestion recognition model is completed, and the congestion recognition model is obtained.
[0141] Furthermore, after the trained congestion recognition model is obtained, the congestion map to be recognized can be directly input into the congestion recognition model to obtain the congestion of the activity site.
[0142] It can be known that the above-mentioned crowding recognition model can identify the number of human bodies in the crowding map to be recognized, and select the position of each human body in the crowding map to be recognized to obtain a human body detection frame.
[0143] Furthermore, the inputting the number of detection frames into a pre-built crowding degree calculation formula to calculate the crowding degree of the activity site includes:
[0144] The following crowding calculation formula is used to calculate the crowding degree of the activity site:
[0145]
[0146] Where d represents the degree of crowding, n is the number of detection boxes, and s m Represents the activity area of personnel activities in the personnel activity diagram.
[0147] The embodiment of the present invention first extracts the video of the monitoring activity scene from the monitoring device. In addition, considering that directly performing congestion detection on each frame in the on-site monitoring video will greatly waste computing resources, key frames are extracted from the on-site monitoring video to obtain an on-site monitoring map, and congestion detection is performed only on the on-site monitoring map to save resources; secondly, the personnel activity area is identified from the on-site monitoring map to obtain a personnel activity map. Since the congestion is mainly calculated by the personnel activity area, the personnel activity area is identified from the on-site monitoring map, and the congestion can be calculated more accurately; thereafter, in order to further improve the calculation accuracy of the congestion, digital image processing is performed on the personnel activity map to obtain a congestion to be identified map; finally, the congestion to be identified map is identified using a pre-trained congestion recognition model to obtain the congestion of the activity scene. Compared with the background technology, it can be seen that the congestion calculation of the embodiment of the present invention does not require manual participation. Secondly, the non-personnel activity area is removed by identifying the personnel activity area, the influence of the non-personnel activity area on the calculation of the congestion is reduced, the influence of the image noise on the accuracy of the congestion is reduced by using digital image processing, and the congestion accuracy is improved by using the pre-trained congestion recognition model. Therefore, the method, device, electronic device and computer-readable storage medium for detecting crowding at an activity site proposed in the present invention can improve the accuracy and intelligence of crowding calculation.
[0148] like Figure 6 The figure shows a functional module diagram of the activity site crowd detection device of the present invention.
[0149] The activity scene crowd detection device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the activity scene crowd detection device can include a monitoring video acquisition module 101, a key frame extraction module 102, a personnel activity area identification module 103, a digital image processing module 104 and a crowd identification module 105. The module described in the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by a processor of an electronic device and can complete fixed functions, which are stored in the memory of the electronic device.
[0150] In this embodiment, the functions of each module / unit are as follows:
[0151] The monitoring video acquisition module 101 is used to monitor the activity site using monitoring equipment within a preset time period to obtain the on-site monitoring video;
[0152] The key frame extraction module 102 is used to extract key frames from the on-site monitoring video to obtain an on-site monitoring image;
[0153] The personnel activity area identification module 103 is used to identify the personnel activity area from the on-site monitoring map to obtain a personnel activity map;
[0154] The digital image processing module 104 is used to perform digital image processing on the personnel activity graph to obtain a crowding degree to be identified graph;
[0155] The crowding recognition module 105 is used to use the pre-trained crowding recognition model to detect the crowding to be recognized image, obtain a human detection frame set, calculate the number of detection frames in the human detection frame set, input the number of detection frames into a pre-built crowding calculation formula, and calculate the crowding of the event site.
[0156] In detail, each module in the activity scene crowd detection device 100 in the embodiment of the present invention is used in the same manner as described above. Figure 1 The same technical means are used as the method for detecting crowding at the activity site described in , and can produce the same technical effects, so they will not be repeated here.
[0157] like Figure 7 FIG. 1 is a schematic diagram of the structure of an electronic device 1 for implementing a method for detecting crowding at an activity site according to the present invention.
[0158] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as an activity site crowd detection program.
[0159] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device 1, and uses various interfaces and lines to connect various components of the entire electronic device 1, and executes or executes programs or modules stored in the memory 11 (for example, executing a crowd detection program for an event site, etc.), and calls data stored in the memory 11 to execute various functions of the electronic device 1 and process data.
[0160] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 1, such as a mobile hard disk of the electronic device 1. In other embodiments, the memory 11 can also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. Further, the memory 11 can also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 11 can not only be used to store application software and various types of data installed in the electronic device 1, such as the code of the activity site crowd detection program, etc., but also can be used to temporarily store data that has been output or is to be output.
[0161] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.
[0162] The communication interface 13 is used for communication between the above-mentioned electronic device 1 and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices 1. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.
[0163] Figure 7 Only the electronic device 1 having components is shown, and those skilled in the art can understand that Figure 7The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0164] For example, although not shown, the electronic device 1 may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, etc. The electronic device 1 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0165] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0166] The activity scene crowd detection program stored in the memory 11 of the electronic device 1 is a combination of multiple computer programs. When running in the processor 10, it can achieve:
[0167] Use monitoring equipment to monitor the activity site within a preset time period to obtain on-site monitoring video;
[0168] Extract key frames from the on-site monitoring video to obtain an on-site monitoring image;
[0169] Identify the personnel activity area from the on-site monitoring map to obtain a personnel activity map;
[0170] Performing digital image processing on the personnel activity graph to obtain a crowding degree to-be-identified graph;
[0171] The pre-trained crowding recognition model is used to detect the crowding map to be recognized, and a human body detection frame set is obtained. The number of detection frames in the human body detection frame set is calculated, and the number of detection frames is input into a pre-built crowding calculation formula to calculate the crowding of the event site.
[0172] Specifically, the specific implementation method of the processor 10 for the above computer program can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0173] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0174] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of the electronic device 1, the computer program can implement:
[0175] Use monitoring equipment to monitor the activity site within a preset time period to obtain on-site monitoring video;
[0176] Extract key frames from the on-site monitoring video to obtain an on-site monitoring image;
[0177] Identify the personnel activity area from the on-site monitoring map to obtain a personnel activity map;
[0178] Performing digital image processing on the personnel activity graph to obtain a crowding degree to-be-identified graph;
[0179] The pre-trained crowding recognition model is used to detect the crowding map to be recognized, and a human body detection frame set is obtained. The number of detection frames in the human body detection frame set is calculated, and the number of detection frames is input into a pre-built crowding calculation formula to calculate the crowding of the event site.
[0180] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0181] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0182] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0183] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0184] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0185] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0186] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.
[0187] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for detecting crowding at an activity site, It is characterized in that The method comprises: Use monitoring equipment to monitor the activity site within a preset time period to obtain on-site monitoring video; Taking the center point of the on-site monitoring video as the key position point, sequentially extracting the pixel value of each frame in the on-site monitoring video at the key position point to obtain the key pixel value, solving the average pixel value according to the key pixel value of each frame, and selecting the frame whose pixel difference between the key position point and the average pixel value is within a preset error range from the on-site monitoring video to obtain the on-site monitoring map; Identify the personnel activity area from the on-site monitoring map to obtain a personnel activity map; Performing digital image processing on the personnel activity graph to obtain a crowding degree to-be-identified graph; The congestion recognition model including a large target feature extraction layer, a small target feature extraction layer and a detection frame generation layer is used to detect the congestion map to be recognized. The target population with a larger volume in the congestion map to be recognized is identified through the large target feature extraction layer to obtain a large target convolution feature set. The target population with a smaller volume in the congestion map to be recognized is identified through the small target feature extraction layer to obtain a medium target convolution feature set. The target prediction frame of the large target convolution feature set and the target prediction frame of the medium target convolution feature set are respectively calculated according to the detection frame generation layer to obtain a human body detection frame set. The number of detection frames of the human body detection frame set is calculated, and the number of detection frames is input into a pre-constructed crowding calculation formula to calculate the crowding of the event site.
2. The method for detecting crowding at an activity site according to claim 1, It is characterized in that The step of identifying the personnel activity area from the on-site monitoring map to obtain the personnel activity map includes: Obtain the scene training set and the real label set that records the activity area of people in each scene training picture; Using a pre-built convolutional neural network to perform convolution and pooling on each scene training image in the scene training set to obtain a scene feature set; Calculate the predicted label of each scene feature in the scene feature set using a preset activation function to obtain a predicted label set; Calculating the loss value between the true label set and the predicted label set using a preset loss function; Optimizing the parameters of the convolutional neural network according to the loss value, and returning to the convolution and pooling steps until the loss value is less than a preset loss threshold, and determining that the convolutional neural network is a scene recognition model; The on-site monitoring map is input into the scene recognition model to obtain the personnel activity map.
3. The method for detecting crowding at an activity site according to claim 2, It is characterized in that The pre-built convolutional neural network is used to perform convolution and pooling on each scene training image in the scene training set to obtain a scene feature set, including: Inputting each scene training picture in the scene training set into the convolutional neural network in sequence, wherein the convolutional neural network includes a convolution layer and a pooling layer; Using the convolution kernel in the convolution layer, a convolution operation is performed on the scene training graph according to a preset step size to obtain a convolution feature set; According to the maximum pooling principle, a pooling operation is performed on the convolution feature set in the pooling layer to obtain the scene feature set.
4. The method for detecting crowding at an activity site according to claim 1, It is characterized in that The performing of digital image processing on the personnel activity graph to obtain a crowding degree to-be-identified graph comprises: Performing image inversion on the personnel activity graph to obtain an inverted activity graph; According to a pre-constructed power change function, performing a power change on the inversion activity diagram to obtain a power activity diagram; Performing contrast stretching and histogram equalization on the power activity map to obtain an activity map to be filtered; A filtering operation is performed on the activity graph to be filtered to obtain the congestion degree graph to be identified.
5. The method for detecting crowding at an activity site according to claim 1, It is characterized in that The pre-training of the congestion recognition model completed by the pre-training includes: Construct a crowding recognition model to be trained including a large target feature extraction layer, a small target feature extraction layer and a detection frame generation layer; Receive a large target population training set, a medium target population training set, and a true target frame; Using the large target feature extraction layer to perform convolution extraction on the large target population training set to obtain a large target convolution feature set; Using the small target feature extraction layer to perform convolution extraction on the medium target population training set to obtain a medium target convolution feature set; According to the detection frame generation layer, respectively calculating the target prediction frame of the large target convolution feature set and the target prediction frame of the medium target convolution feature set; Calculate the error value between the target prediction frame and the real target frame; Determining whether the error value is greater than a preset error threshold; When the error value is greater than the error threshold, adjusting the internal parameters of the to-be-trained crowding recognition model, and returning to the above convolution extraction step; When the error value is less than or equal to the error threshold, the training of the to-be-trained congestion recognition model is completed, and the congestion recognition model is obtained.
6. The method for detecting crowding at an activity site according to claim 1, It is characterized in that Inputting the number of detection frames into a pre-built crowding degree calculation formula to calculate the crowding degree of the activity site includes: The following calculation formula is used to calculate the crowding degree of the activity site: in, represents the congestion degree, is the number of detection frames, Represents the activity area of personnel activities in the personnel activity diagram.
7. A device for detecting crowding at an activity site, It is characterized in that The device comprises: A monitoring video acquisition module is used to monitor the activity site using monitoring equipment within a preset time period to obtain on-site monitoring video; A key frame extraction module is used to take the center point of the on-site monitoring video as the key position point, sequentially extract the pixel value of each frame in the on-site monitoring video at the key position point, obtain the key pixel value, solve the average pixel value according to the key pixel value of each frame, and select the frame whose pixel difference between the key position point and the average pixel value is within a preset error range from the on-site monitoring video to obtain the on-site monitoring map; A personnel activity area identification module, used to identify the personnel activity area from the on-site monitoring map to obtain a personnel activity map; A digital image processing module, used for performing digital image processing on the personnel activity graph to obtain a crowding degree to be identified graph; The congestion recognition module is used to detect the congestion image to be recognized by using a pre-trained congestion recognition model including a large target feature extraction layer, a small target feature extraction layer and a detection frame generation layer, identify a target group with a larger volume in the congestion image to be recognized by using the large target feature extraction layer to obtain a large target convolution feature set, identify a target group with a smaller volume in the congestion image to be recognized by using the small target feature extraction layer to obtain a medium target convolution feature set, calculate a target prediction frame of the large target convolution feature set and a target prediction frame of the medium target convolution feature set according to the detection frame generation layer to obtain a human detection frame set, calculate the number of detection frames of the human detection frame set, input the number of detection frames into a pre-constructed congestion calculation formula, and calculate the congestion of the event site.
8. An electronic device, It is characterized in that The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for detecting crowding at an event site as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is executed by a processor, the method for detecting crowding at an event site as claimed in any one of claims 1 to 6 is implemented.
