A method for detecting dense pedestrians in highway service areas
Through feature map segmentation and loss function optimization, the problem of poor performance of the FCOS algorithm in dense pedestrian detection in high-speed service areas is solved, the detection accuracy and anti-occlusion ability are improved, and more accurate pedestrian detection is achieved.
Patent Information
- Application Number
- CN202110311663.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-24
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-03-24
AI Technical Summary
The FCOS algorithm is not effective in detecting dense pedestrians in high-speed service areas. It is especially difficult to identify overlapping objects of similar sizes, and the detection accuracy is insufficient in complex scenes.
Using the feature map segmentation idea, the feature map is divided into four parts, the feature block area is enlarged and upsampled, the network is trained with the maxout unit, and the optimized loss function is changed from IoU Loss to GIoU Loss to improve detection accuracy.
It enhances the anti-occlusion capability of target detection, improves the accuracy and credibility of pedestrian detection in service areas, and can better handle dense pedestrian detection in complex scenes.
Smart Images

Figure CN113111732B
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image recognition and computer vision, and relates to a method for detecting dense pedestrians in a high-speed service area. Background Art
[0002] Pedestrian detection is a research hotspot in the field of computer vision. It is often combined with technologies such as pedestrian tracking and pedestrian re-identification, and is applied to many fields such as unmanned driving systems, human behavior analysis, intelligent video surveillance, and passenger flow statistics systems. With the rapid development of deep learning technology, pedestrian detection algorithms have also shifted from traditional algorithms based on manual features to detection technologies based on deep neural networks. This technology can better extract features, use multi-layer computing models to learn abstract data representations, discover complex structures in big data, and thus find all objects of interest in the image and determine the category and location of the objects. In order to strengthen the management of highway service areas and promote the construction of smart service areas, pedestrian detection technology is applied to the highway service area supervision system, so as to efficiently and accurately complete the real-time release and alarm of pedestrian flow information, public order violations, and vehicle flow information in the service area, which can improve the service quality and intelligent management level of the service area and reduce the consumption of a large amount of human capital, and has important practical significance.
[0003] Since the human body has various postures and shapes, its appearance is greatly affected by viewing angle, posture, clothing, imaging distance, etc., and in highway service areas, pedestrians are very densely distributed, resulting in severe occlusion of the target. This makes pedestrian detection an extremely challenging topic in the field of computer vision.
[0004] Features extracted based on deep learning usually have strong hierarchical expression capabilities, so deep convolutional neural networks are widely used in pedestrian detection to solve some visual problems. At present, the mainstream detection algorithms are mainly divided into two directions: one-stage target detection and two-stage target detection. The main difference between the two is that the two-stage detection algorithm needs to generate candidate boxes first and then perform fine-grained object detection. This type of algorithm is represented by FasterR-CNN, Mask R-CNN, etc., and has performed very well in terms of detection accuracy. The one-stage detection algorithm directly extracts features in the network to detect the location and category of the target. Represented by SSD, Yolo, FCOS, etc., this type of algorithm generally has a faster detection speed while ensuring accuracy. FCOS (FCOS: Fully Convolutional One-Stage Object Detection) is a fully convolutional one-stage target detection algorithm that solves the target detection problem in a pixel-by-pixel prediction manner. It introduces three strategies: pixel-by-pixel regression prediction, multi-scale features, and Center-ness. While simplifying the calculation process and improving the processing speed, it also ensures detection accuracy. However, although the FCOS algorithm uses the FPN multi-scale strategy to improve the problem of frequent occlusion and overlap of pedestrians in real scenes, it can only identify overlapping objects with large size differences. In complex scenes, such as dense pedestrian detection in highway service areas, the effect is still not ideal. Summary of the invention
[0005] The present invention aims to overcome the shortcoming that the FCOS algorithm model has a poor effect on pedestrian detection in highway service areas, and provides a method for dense pedestrian detection in highway service areas.
[0006] The present invention includes improving the anti-occlusion capability of the model by adopting the idea of segmenting feature maps, and optimizing the loss function to improve the recognition accuracy of the model.
[0007] The FCOS algorithm uses a multi-scale detection strategy based on FPN, dividing the feature layer into five feature intervals according to different sizes. When there are overlapping objects in the same interval, the smallest area is directly selected as the regression target to distinguish overlapping objects with large size differences. Although this approach improves the detection speed, it also brings a problem that cannot be ignored, that is, it is difficult to detect overlapping objects of similar sizes.
[0008] Therefore, the present invention proposes a method for dense pedestrian detection in high-speed service areas based on the idea of feature map segmentation. The method uses the distance from the target center point to the four sides of the bounding box to divide the feature map into four parts, and randomly selects part of the feature map, enlarges the feature block area, and upsamples it to the original feature map size, and then combines another part of the feature block in the form of upper left-lower left, upper left-upper right, etc. Finally, all the processed feature block images are sent to the maxout unit together, and the training network can take into account global information while not losing local information. Since the target object is often blocked by another target object in complex scenes, the features screened out after segmentation will be more in line with the real scene, and the selected candidate area will be more credible. Finally, the loss function is optimized to improve the detection accuracy of the model.
[0009] A method for detecting dense pedestrians in a high-speed service area of the present invention comprises the following steps:
[0010] Step 1: Construct a dense pedestrian dataset in COCO format for highway service areas. According to the requirements of dense pedestrian detection, prepare a pedestrian training set M and the corresponding mask file that meet the requirements, import the pycococreate-master toolkit, and add data information in COCO format. The compiled JSON file contains the coordinates of all targets in the training set M, which meets the training requirements. The verification dataset V is created in the same way.
[0011] Step 2: Use the feature map segmentation idea to * , t * , r * , b * The four parameters divide the feature map into four parts, l * , t * , r * , b * The four parameters represent the distances from the center point to the four edges, top, bottom, left and right, respectively. The calculation formula is as follows.
[0012]
[0013]
[0014] Among them, (x, y) represents the coordinates of the center point of the target, (x0, y0) represents the coordinates of the boundary point at the lower left corner of the detection box, and (x1, y1) represents the coordinates of the boundary point at the upper right corner of the detection box. After completing the feature map segmentation, the images of these four parts are randomly combined to complete the target information integration. The integration process is as follows.
[0015]
[0016] P represents the image after segmentation or combination, such as left-right (l / r), bottom-up (b / u) and comb (combination of l / r and b / u), and * is the convolution operation. The combined image information is then sent to the maxout unit. Since the function is nonlinear, the network can approximate any function. Taking max can fuse and of information, thereby generating the same size The formula is as follows.
[0017]
[0018] This method of segmenting feature maps takes advantage of the spatial invariance in the horizontal space to reveal semantic relationships in different directions. When detecting dense pedestrians in a highway service area, it is often the case that the target object is occluded by another target object. In this case, the segmented features will be more consistent with the real scene and can enhance the anti-occlusion capability of target tracking.
[0019] Step 3: Adopt a multi-scale detection strategy based on FPN and limit the regression interval at each feature layer. The specific approach is: i As the maximum distance of feature layer i, only when a position (x, y) satisfies max(l * , t * , r * , b * )<m i and max(l * , t * , r * , b * )>m i-1 When the two conditions are met, it is regarded as a positive sample of feature layer i and sent to the network structure for regression.
[0020] Then take m i The values are 0, 64, 128, 256, 512, +∞, forming 5 intervals, and the size is restricted on the 5 feature layers. When there are overlapping targets in the same interval, the smallest area is selected as the regression target. The five feature layers correspond to P3, P4, P5, P6, and P7, respectively. P3, P4, and P5 are obtained by a 1*1 convolution of the feature layers C3, C4, and C5 of the backbone CNNs network, while P6 and P7 are obtained by a convolution operation with a step size of 2 after P5. Finally, pixel-by-pixel regression is performed on these five scales.
[0021] Step 4: Optimize the loss function used by the FCOS algorithm. The original loss function includes classification loss and regression loss, and the formula is as follows.
[0022]
[0023]
[0024] Among them, cls represents classification Loss, and Focal Loss is used. The formula is as follows.
[0025] FL(p t )=-α t (1-p t ) γ log(p t ),
[0026]
[0027] L reg Represents regression Loss. The original algorithm uses IoU Loss.
[0028]
[0029] However, the IoU function only focuses on the overlap between two objects. When the two objects do not intersect, that is, when A∩B=0, the value of IoU is always equal to 0, which cannot reflect the change in the distance between the two objects. Based on the above conclusions, IoU Loss is optimized to GIoU Loss, and the formula is as follows.
[0030]
[0031]
[0032]
[0033]
[0034] L reg =L GIoU =1-GIoU (4-7)
[0035] in, Represents the coordinates of the lower left corner boundary point of the detection box of target 1, Represents the coordinates of the upper right corner boundary point of the detection box of target p. Similarly, Represents the coordinates of the lower left corner boundary point of the detection box of target g, Represents the coordinates of the upper right corner boundary point of the detection box of target 2. c Represents the minimum closure area of target p and target g.
[0036] After optimization, L regThe value of will decrease as the distance between the two targets increases, which can better reflect the overlap between the two targets. Through feature map segmentation and loss function optimization, the problem of poor detection effect of FCOS algorithm for dense targets is solved to a large extent, and the accuracy of pedestrian detection in service areas is improved.
[0037] The invention has the advantages of: solving the problem that the FCOS algorithm has a poor detection effect on dense targets and improving the accuracy of pedestrian detection in service areas. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a feature map segmentation flow chart of the present invention.
[0039] Figure 2 It is a structural diagram of the loss function in the convolutional neural network of the present invention.
[0040] Figure 3 It is a deployment flow chart of the detection method provided by the present invention. DETAILED DESCRIPTION
[0041] In order to better illustrate the technical solution of the present invention, the present invention is further described below by means of an implementation example in conjunction with the accompanying drawings.
[0042] A method for detecting dense pedestrians in a highway service area based on feature map segmentation includes the following steps:
[0043] Step 1: According to the needs of dense pedestrian detection, a dense pedestrian training set containing many overlapping targets is made. Since the FCOS algorithm natively supports the COCO dataset and the Pascal VOC dataset format, it is necessary to convert the homemade dense pedestrian dataset into the COCO dataset format. The number of dense pedestrian datasets constructed is 47,234, including 33,251 training datasets and 13,983 validation datasets. Set the learning rate to 0.00001, the weight decay coefficient to 0.00001, the step size to (60000, 80000), the maximum number of iterations to 90,000, and the number of batches to 8.
[0044] Step 2: Set different scaling factors, such as S = 1.2, S = 0.7, etc. to scale the candidate regions at different ratios to improve their diversity. Since the candidate regions after scaling will have the problem of local images being larger than the original images, and a large number of invalid images are generated, it is necessary to add another layer of RoI sampling layer to screen the prediction boxes and filter out the prediction boxes with low confidence scores. Then, the feature maps obtained at each layer are segmented using the feature map segmentation idea. * , t * , r * , b * The four parameters divide the feature map into four parts, l* , t * , r * , b * The four parameters represent the distances from the center point to the four edges of the top, bottom, left and right, respectively. The calculation formula is shown in (2-1).
[0045] After the feature map segmentation is completed, some feature maps are selected from them, the feature block area is enlarged, and it is upsampled to the original feature map size. Then, another part of the feature blocks are randomly combined in the manner of upper left-lower left, upper left-upper right, etc. to complete the target information integration. The segmentation process is shown in Figure 1 .
[0046] Step 3: Adopt a multi-scale detection strategy based on FPN, and limit the regression interval at each feature layer. Set the screening size of the P3 layer to 100×128 / 8, the step size to 1, and the regression interval to (0, 64); set the screening size of the P4 layer to 50×64 / 16, the step size to 1, and the regression interval to (64, 128); set the screening size of the P5 layer to 25×32 / 32, the step size to 1, and the regression interval to (128, 256); set the screening size of the P6 layer to 13×16 / 64, the step size to 2, and the regression interval to (256, 512); set the screening size of the P7 layer to 7×8 / 128, the step size to 2, and the regression interval to (256, +∞). Finally, perform pixel-by-pixel regression on these five scales.
[0047] Step 4: Optimize the loss function used by the FCOS algorithm. The optimized loss function is shown in Figure 2 . The original loss function includes classification loss and regression loss, and the formula is shown in (4-1).
[0048] Since the IoU function only focuses on the degree of overlap between two targets, when the two targets do not intersect, the IoU function cannot reflect the change in the distance between the two targets. Based on the above conclusions, a loss function that focuses on the distance between the targets and can move in the direction of increasing overlapping areas during training is introduced, and the IoU Loss is optimized to the GIoU Loss to improve the algorithm's detection accuracy for overlapping objects. The formulas are shown in (4-4)(4-5)(4-6)(4-7).
[0049] After optimization, L reg The value of will decrease as the distance between the two targets increases, which can better reflect the overlap between the two targets. Through feature map segmentation and loss function optimization, the problem of poor detection effect of FCOS algorithm for dense targets is solved to a large extent, and the accuracy of pedestrian detection in service areas is improved.
[0050] The above describes the excellent optimization effect shown by an embodiment of the present invention. Obviously, the present invention is not limited to the above embodiment, and various modifications can be made to it without departing from the basic spirit of the present invention and without exceeding the scope of the essential content of the present invention.
Claims
1. A method for detecting dense pedestrians in a highway service area, comprising the following steps: Step 1: Construct a dense pedestrian dataset in the highway service area in COCO format; According to the requirements of dense pedestrian detection, prepare a pedestrian training set M and the corresponding mask file that meet the requirements, import the pycococreate-master toolkit, and add data information in COCO format. The compiled JSON file contains the coordinates of all targets in the training set M, which meets the training requirements. The verification data set V is made in the same way. Step 2: Use the feature map segmentation idea to * ,t * ,r * ,b * The four parameters divide the feature map into four parts, l * ,t * ,r * ,b * The four parameters represent the distances from the center point to the four edges, top, bottom, left and right, respectively. The calculation formula is as follows; Among them, (x, y) represents the coordinates of the center point of the target, (x0, y0) represents the coordinates of the boundary point of the lower left corner of the detection box, and (x1, y1) represents the coordinates of the boundary point of the upper right corner of the detection box. After completing the feature map segmentation, the images of these four parts are randomly combined to complete the target information integration. The integration process is as follows; P represents the segmented or combined part of the image, such as left-right (l / r), bottom-up (b / u) and comb (combination of l / r and b / u), * is the convolution operation; the combined image information is then sent to the maxout unit to make the network approximate an arbitrary function; taking max can fuse and of information, thereby generating the same size The formula is as follows; This method of segmenting feature maps utilizes the spatial invariance in the horizontal space to reveal semantic relationships in different directions. In complex scenes, especially when detecting pedestrians, it is often the case that the target object is occluded by another target object. In this case, the features selected by the left, right, top and bottom templates will be more consistent with the real scene, the selected candidate areas will be more credible, and the anti-occlusion ability of target tracking can be enhanced. Step 3: Adopt a multi-scale detection strategy based on FPN and limit the regression interval at each feature layer; the specific approach is: use the parameter m i As the maximum distance of feature layer i, only when a position (x, y) satisfies max(l * ,t * ,r * ,b * ) <m i and max(l * ,t * ,r * ,b * )>m i-1 When the two conditions are met, it is regarded as a positive sample of feature layer i and sent to the network structure for regression; Then take m i The values of are 0, 64, 128, 256, 512, +∞, forming 5 intervals, and the size is restricted on the 5 feature layers; when there are overlapping targets in the same interval, the smallest area is selected as the regression target; the five feature layers correspond to P3, P4, P5, P6, and P7 respectively, among which P3, P4, and P5 are obtained by a 1*1 convolution of the feature layers C3, C4, and C5 of the backbone CNNs network, while P6 and P7 are obtained by a convolution operation with a step size of 2 after P5; finally, pixel-by-pixel regression is performed on these five scales; Step 4: Optimize the loss function used by the FCOS algorithm; the original loss function includes classification loss and regression loss, and the formula is as follows; Among them, L cls Represents classification Loss, using Focal Loss, the formula is as follows; FL(p t )=-a t (1-p t ) γ log(p t ), L reg Represents regression Loss, using GIoU Loss; the formula is as follows; L reg =L GIoU =1-GIoU (4-7) in, Represents the coordinates of the lower left corner boundary point of the detection box of target 1, Represents the coordinates of the upper right corner boundary point of the detection box of target p; similarly, Represents the coordinates of the lower left corner boundary point of the detection box of target g, Represents the coordinates of the upper right corner boundary point of the detection box of target 2; A c Represents the minimum enclosed area of target p and target g; After optimization, L reg The value of will decrease as the distance between the two targets increases, which can better reflect the overlap between the two targets. Through feature map segmentation and loss function optimization, the problem of poor detection effect of FCOS algorithm for dense targets is solved to a large extent, and the accuracy of pedestrian detection in service areas is improved.
