Perimeter intrusion person detection method and system based on optimized downsampling scale
By obtaining multiple down-sampling scale data sets in perimeter intrusion detection, optimizing the loss function of the PointRCNN network and selecting the optimal down-sampling scale, the problem of down-sampling scale selection is solved, detection accuracy and efficiency are improved, and point detection is achieved. Efficient detection of clouds.
Patent Information
- Application Number
- CN202411010624.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-07-26
AI Technical Summary
In the existing technology, the down-sampling scale is too large, which results in the input point cloud targets being too sparse and the recognition rate is reduced; the down-sampling scale is too small, which requires a large amount of calculation and is time-consuming. No effective solution has been proposed yet.
By obtaining the original data set, perform downsampling at multiple preset downsampling scales, label and divide the training set and test set, use the PointRCNN network for multiple rounds of training, optimize the loss function, and select the optimal downsampling scale to weigh accuracy and computational efficiency. , introduce the downsampling scale factor and the average confidence loss of the candidate target frame, and automatically select the optimal downsampling scale.
It realizes the automatic selection of the optimal down-sampling scale in perimeter intrusion detection, improves detection accuracy and calculation efficiency, and ensures that the model has better detection performance for down-sampled point clouds.
Smart Images

Figure CN118552907A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of perimeter intrusion detection, and in particular to a perimeter intruder detection method and system based on an optimal downsampling scale. Background Art
[0002] The target detection algorithm based on deep learning has the advantage of high detection accuracy, but it is difficult to apply in most scenarios with high real-time requirements. For example, the PointRCNN target detection architecture uses PointNet++ as the backbone network to extract features. Due to the need to perform the farthest point sampling operation, when the number of input point cloud points is large, the amount of calculation and time consumption will also increase greatly, making it difficult to directly apply it in scenarios such as perimeter intrusion where there are hundreds of thousands or even millions of points in a single frame. Therefore, it is very necessary to pre-process the input point cloud by voxel downsampling before entering the network. However, how to choose the size of voxel downsampling is a difficult point. If the downsampling scale is too large, the target of the input point cloud may be too sparse, thereby reducing the recognition rate. If the downsampling scale is too small, the number of point cloud points after downsampling is still large, which will not reduce the amount of calculation and time consumption.
[0003] In the existing technology, the downsampling scale is too large, resulting in the input point cloud targets being too sparse and the recognition rate being reduced; the downsampling scale is too small, the number of points in the point cloud after downsampling is still large, and the calculation is large and time-consuming. No effective solution has been proposed so far. Summary of the invention
[0004] In the embodiments of the present invention, a perimeter intruder detection method and system based on an optimal downsampling scale are provided to solve the problems in the prior art that the downsampling scale is too large, resulting in the input point cloud targets being too sparse and the recognition rate being reduced; and the downsampling scale is too small, the number of point clouds after downsampling is still large, the calculation amount is large, and it is time-consuming.
[0005] To achieve the above-mentioned purpose, on the one hand, the present invention provides a perimeter intruder detection method based on an optimal downsampling scale, the method comprising: S1, obtaining an original data set, downsampling the original data set through a plurality of preset downsampling scales to obtain a downsampling data set; annotating the original data set and the downsampling data set with target detection frames and downsampling scales; S2, dividing the original data set into an original training set and an original test set; dividing the downsampling data set into a downsampling training set and a downsampling test set accordingly; S3, training the original training set through an original PointRCNN network for multiple rounds to obtain a plurality of models, predicting the results of the plurality of models through the original test set respectively, selecting the model corresponding to the best prediction result and naming it Ma; changing the loss function in the original PointRCNN network to obtain a corrected PointRCNN network; S4, randomly extracting a sample from the downsampling training set as an iterative downsampling sample, and extracting the corresponding non-downsampled sample from the original training set as an iterative original sample; inputting the iterative original sample into the model Ma for forward propagation prediction to obtain the original candidate target frame and the original The confidence of the initial candidate target frame; input the iterative downsampled samples into the corrected PointRCNN network for training and obtain the foreground point segmentation loss value, classification loss value, regression loss value, and average confidence loss value according to the confidence of the original candidate target frame; sum up all loss values to obtain the iterative total loss value, and update the corrected PointRCNN network according to the iterative total loss value by back propagation; S5, repeat S4 until all samples in the downsampled training set are trained and multiple rounds of training are performed to obtain multiple models, and the multiple models are respectively predicted by the downsampled test set, and the most accurate one is obtained. The model corresponding to the good prediction result is selected and named Mb; S6, the downsampled test set is divided into test sets of different downsampled scales; the test sets of different downsampled scales are predicted and calculated by model Mb respectively to obtain the total score of the test set of each downsampled scale; the downsampled scale corresponding to the test set with the largest total score is taken as the optimal downsampled scale; S7, the original point cloud to be detected is obtained, the point cloud to be detected is voxel downsampled according to the optimal downsampled scale to obtain the downsampled point cloud to be detected, and the downsampled point cloud to be detected is input into the model Mb for prediction to obtain the intrusion target information.
[0006] Optionally, S2 includes: randomly selecting a preset percentage of data from the original data set as the original training set, and using the remaining data in the original data set as the original test set; using the downsampled samples of multiple downsampled scales generated corresponding to each original sample in the original training set as the downsampled training set; and using the downsampled samples of multiple downsampled scales generated corresponding to each original sample in the original test set as the downsampled test set.
[0007] Optionally, S6 includes: dividing the downsampling test set into test sets of different downsampling scales according to the downsampling scale annotated by each sample; predicting the test sets of different downsampling scales through the model Mb respectively to obtain the average accuracy and average reasoning time of the test set of each downsampling scale; taking the test set of each downsampling scale as the test set of the current downsampling scale in turn; calculating the total score of the test set of the current downsampling scale according to the average accuracy, average reasoning time, preset average accuracy weight, and preset average reasoning time weight of the test set of the current downsampling scale; and taking the downsampling scale corresponding to the test set with the largest total score as the optimal downsampling scale.
[0008] Optionally, the iterative down-sampled samples are input into the corrected PointRCNN network for training and according to the confidence of the original candidate target box, a foreground point segmentation loss value, a classification loss value, a regression loss value, and an average confidence loss value are obtained; summing up all loss values to obtain the iterative total loss value includes: inputting the iterative down-sampled samples into the corrected PointRCNN network for training to obtain the foreground point segmentation loss value, the classification loss value, the regression loss value, the down-sampled candidate target box and the confidence of the down-sampled candidate target box, and calculating the average confidence loss value according to the confidence of the original candidate target box and the confidence of the down-sampled candidate target box; summing up the foreground point segmentation loss value, the classification loss value, the regression loss value, and the average confidence loss value to obtain the iterative total loss value.
[0009] Optionally, the average confidence loss value is calculated according to the following formula: ; in, is the number of original candidate target boxes, Represents the confidence of the i-th original candidate target box; is the average confidence of all original candidate target boxes; is the number of downsampled candidate target boxes, Represents the confidence of the i-th downsampled candidate target box; is the average confidence of all downsampled candidate target boxes; is the downsampling scale corresponding to the iterative downsampling samples, is the average confidence loss value.
[0010] Optionally, the foreground point segmentation loss value is calculated according to the following formula: ; in, The value is {1,0}, where 1 represents the downsampled candidate target box is a positive sample, and 0 represents the downsampled candidate target box is a negative sample. is the probability that the downsampled candidate target box predicted by the model is a positive sample, represents the downsampling scale corresponding to the iterative downsampling samples, is the preset weight for controlling positive and negative samples, is the preset hyperparameter for adjusting the weight factor, is the foreground point segmentation loss value.
[0011] On the other hand, the present invention provides a perimeter intruder detection system based on a preferred downsampling scale, the system comprising: a downsampling and labeling unit, used to obtain an original data set, downsample the original data set through a plurality of preset downsampling scales to obtain a downsampled data set; label the original data set and the downsampled data set with target detection frames and downsampling scales; a division unit, used to divide the original data set into an original training set and an original test set; the downsampled data set is correspondingly divided into a downsampled training set and a downsampled test set; an original training set training unit, used to perform multiple rounds of training on the original training set through an original PointRCNN network to obtain multiple models, predict the results of the multiple models through the original test set respectively, select the model corresponding to the best prediction result and name it Ma; modify the loss function in the original PointRCNN network to obtain a corrected PointRCNN network; a downsampled training set iterative training unit, used to randomly extract a sample from the downsampled training set as an iterative downsampled sample, and extract the corresponding non-downsampled sample from the original training set as an iterative original sample; the iterative original sample is input into the model Ma for forward propagation prediction to obtain the original candidate target frame and the original candidate The confidence of the target box; the iterative down-sampled samples are input into the corrected PointRCNN network for training and the foreground point segmentation loss value, classification loss value, regression loss value and average confidence loss value are obtained according to the confidence of the original candidate target box; all loss values are summed up to obtain the iterative total loss value, and the corrected PointRCNN network is updated by back propagation according to the iterative total loss value; a repeating training unit is used to repeat the iterative training unit of the down-sampled training set until all samples in the down-sampled training set are trained and multiple rounds of training are performed to obtain multiple models, and the multiple models are respectively predicted by the down-sampled test set, and the best one is selected. The model corresponding to the prediction result is selected and named Mb; the optimal downsampling scale selection unit is used to divide the downsampling test set into test sets of different downsampling scales; the test sets of different downsampling scales are predicted and calculated by the model Mb respectively to obtain the total score of the test set of each downsampling scale; the downsampling scale corresponding to the test set with the largest total score is taken as the optimal downsampling scale; the detection unit is used to obtain the original point cloud to be detected, perform voxel downsampling on the point cloud to be detected according to the optimal downsampling scale to obtain the downsampling point cloud to be detected, and input the downsampling point cloud to be detected into the model Mb for prediction to obtain the intrusion target information.
[0012] Optionally, the partitioning unit includes: an original data set partitioning subunit, used to randomly select a preset percentage of data from the original data set as an original training set, and use the remaining data in the original data set as an original test set; a down-sampling training set selection subunit, used to use the down-sampling samples of multiple down-sampling scales generated corresponding to each original sample in the original training set as a down-sampling training set; a down-sampling test set selection subunit, used to use the down-sampling samples of multiple down-sampling scales generated corresponding to each original sample in the original test set as a down-sampling test set.
[0013] Optionally, the optimal downsampling scale selection unit includes: a downsampling test set division subunit, used to divide the downsampling test set into test sets of different downsampling scales according to the downsampling scale annotated by each sample; a downsampling test set prediction subunit, used to predict the test sets of different downsampling scales through the model Mb respectively, to obtain the average accuracy and average reasoning time of the test set of each downsampling scale; and to use the test set of each downsampling scale as the test set of the current downsampling scale in turn; a calculation subunit, used to calculate the total score of the test set of the current downsampling scale according to the average accuracy, average reasoning time, preset average accuracy weight, and preset average reasoning time weight of the test set of the current downsampling scale; and an optimal downsampling scale selection subunit, used to use the downsampling scale corresponding to the test set with the largest total score as the optimal downsampling scale.
[0014] Optionally, the iterative down-sampled samples are input into the corrected PointRCNN network for training and according to the confidence of the original candidate target box, a foreground point segmentation loss value, a classification loss value, a regression loss value, and an average confidence loss value are obtained; summing up all loss values to obtain the iterative total loss value includes: inputting the iterative down-sampled samples into the corrected PointRCNN network for training to obtain the foreground point segmentation loss value, the classification loss value, the regression loss value, the down-sampled candidate target box and the confidence of the down-sampled candidate target box, and calculating the average confidence loss value according to the confidence of the original candidate target box and the confidence of the down-sampled candidate target box; summing up the foreground point segmentation loss value, the classification loss value, the regression loss value, and the average confidence loss value to obtain the iterative total loss value.
[0015] Beneficial effects of the present invention: The present invention provides a perimeter intruder detection method and system based on an optimal downsampling scale, wherein the method automatically selects an optimal downsampling scale from various preset downsampling scales through a quantified performance analysis index, and the optimal downsampling scale simultaneously balances accuracy and computational efficiency; at the same time, the loss function of network training is improved by introducing a downsampling scale factor and an average confidence loss of a candidate target box combined with the downsampling scale factor, thereby enabling the trained model to have better detection accuracy for the downsampled point cloud. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a flow chart of a perimeter intruder detection method based on an optimal downsampling scale provided by an embodiment of the present invention; Figure 2 is a flowchart of constructing a training set and a test set provided by an embodiment of the present invention; Figure 3 is a flowchart of selecting an optimal downsampling scale provided by an embodiment of the present invention; Figure 4 It is a structural schematic diagram of a perimeter intruder detection system based on an optimal downsampling scale provided by an embodiment of the present invention; Figure 5 is a schematic diagram of the structure of a division unit provided in an embodiment of the present invention; Figure 6 It is a schematic diagram of the structure of the optimal downsampling scale selection unit provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] Figure 1 is a flow chart of a perimeter intruder detection method based on an optimal downsampling scale provided by an embodiment of the present invention, such as Figure 1 As shown, the method includes: S1. Obtain an original data set, and downsample the original data set through a plurality of preset downsampling scales to obtain a downsampled data set; annotate the original data set and the downsampled data set with target detection frames and downsampled scales; Specifically, the laser radar is placed at a suitable position to obtain a point cloud sequence of a target scene. Assuming that there are t point clouds in the sequence, the original data set is recorded as { }, and record it as S0, indicating that each sample in the original data set is an original point cloud without downsampling.
[0019] Annotate each sample in the original dataset S0 with a target detection box to obtain the labeled box of each target. The information of the labeled box includes (x, y, z, h, w, l, θ). (x, y, z) is the center position of the labeled box, (h, w, l) is the size of the labeled box, i.e., height, width, and length, and θ is the direction of the target detection box from a bird's-eye view. Annotate each sample in the original dataset S0 with a target detection box. At the same time, add a downsampling scale label to each sample. Since the original dataset is not downsampled, the label values of the downsampling scale are all 0.
[0020] For the preset multiple downsampling scales, for example, the present invention presets three voxel downsampling scales, which are 0.03, 0.06, and 0.10, respectively. The number of voxel downsampling scales set in actual use and the size of each downsampling scale are not limited. For example, five voxel downsampling scales can be set, which are 0.01, 0.03, 0.05, 0.07, and 0.09, respectively.
[0021] For acquiring the downsampled data set, the present invention adopts voxel downsampling to downsample the original data set, wherein the downsampled voxel size is Vx*Vy*Vz, where Vx, Vy, and Vz represent the sizes of the voxel in the X, Y, and Z directions, respectively.
[0022] Each sample in the original data set S0 is downsampled according to the preset downsampling scale. For example, if the downsampling scale is 0.03, each sample in the original data set S0 is downsampled with a voxel size of 0.03*0.03*0.03 in the X, Y, and Z directions respectively. The data set composed of all the downsampled data is recorded as S 0.03 , indicating that all samples in this dataset are generated from the original samples after downsampling with a voxel scale of 0.03.
[0023] The same method as above is used to generate a data set S with a downsampling scale of 0.06 0.06 and the dataset S with a downsampling scale of 0.10 0.10 ; The data set S 0.03 , Dataset S 0.06 , Dataset S 0.10 Construct a downsampled dataset.
[0024] At the same time, in the dataset S 0.03 , Dataset S 0.06 , Dataset S 0.10 Add a downsampling scale label to each sample, such as the dataset S with a downsampling scale of 0.030.03 The downsampling scale label value is increased by 0.03 for each sample.
[0025] At this time, the annotation information of each sample in our downsampled dataset includes the annotation box information of each target (x, y, z, w, h, l, θ) and the downsampled scale label value. Among them, the annotation box information of each sample in the downsampled dataset directly uses the annotation box information of its corresponding original sample, and no re-annotation is required.
[0026] S2, dividing the original data set into an original training set and an original test set; and correspondingly dividing the downsampled data set into a downsampled training set and a downsampled test set; Specifically, Figure 2 is a flowchart of constructing a training set and a test set provided by an embodiment of the present invention, such as Figure 2 As shown, the S2 includes: S21, randomly selecting a preset percentage of data from the original data set as an original training set, and using the remaining data in the original data set as an original test set; Specifically, first randomly select 90% of the data from the original data set S0 as the original training set , the remaining 10% of the data is used as the original test set .
[0027] S22, taking the downsampled samples of multiple downsampled scales generated corresponding to each original sample in the original training set as the downsampled training set; Specifically, for example: the original data set S0 has a sample , was randomly selected and assigned to the original training set , then in the downsampled data set S 0.03 Corresponding to the sample The sample generated by downsampling the voxel with a scale of 0.03 is then selected and added to the downsampled training set. In the downsampled dataset S 0.06 And the downsampled dataset S 0.10 The same method as above is used to select the corresponding samples and add them to the down-sampling training set middle.
[0028] S23, taking the downsampled samples of multiple downsampled scales generated corresponding to each original sample in the original test set as the downsampled test set.
[0029] Specifically, for example: the original data set S0 has a sample , was randomly selected and assigned to the original test set , then in the downsampled data set S 0.03 Corresponding to the sample The sample generated by downsampling the voxel with a scale of 0.03 is then selected and added to the downsampled test set. In the downsampled dataset S 0.06 And the downsampled dataset S 0.10 The same method as above is used to select the corresponding samples and add them to the down-sampled test set. middle.
[0030] S3, the original training set is trained for multiple rounds through the original PointRCNN network to obtain multiple models, the multiple models are respectively predicted by the original test set, the model corresponding to the best prediction result is selected and named Ma; the loss function in the original PointRCNN network is changed to obtain a corrected PointRCNN network; Specifically, the original PointRCNN network and the corrected PointRCNN network use the same architecture. The model structures of the original PointRCNN network and the corrected PointRCNN network are exactly the same, and only the loss functions used in training are different. PointRCNN divides the target detection task into two stages. The first stage uses point cloud segmentation to obtain foreground points and corresponding candidate target frames, and the second stage optimizes and adjusts the candidate target frames. PointNet++ is used as the backbone network to extract the feature vector of each point.
[0031] The original PointRCNN network uses the original training set During the network training, no loss function or model structure of the network is changed, and only the original PointRCNN detection framework is used. Then, according to the original test set The prediction results are obtained by selecting the best model from all the models and naming it Ma.
[0032] S4. Randomly extract a sample from the downsampled training set as an iterative downsampled sample, and extract the corresponding non-downsampled sample from the original training set as an iterative original sample; input the iterative original sample into the model Ma for forward propagation prediction to obtain the original candidate target frame and the confidence of the original candidate target frame; input the iterative downsampled sample into the corrected PointRCNN network for training and obtain the foreground point segmentation loss value, classification loss value, regression loss value, and average confidence loss value according to the confidence of the original candidate target frame; sum up all loss values to obtain the iterative total loss value, and update the corrected PointRCNN network according to the iterative total loss value by backpropagation; For example, suppose is the downsampled training set When training the PointRCNN network, we need to simultaneously extract a training sample from the original training set and then input it into the corrected PointRCNN network. Select the corresponding original sample .in, yes It is generated by downsampling at the downsampling scale preset in S1. The optimal model Ma in S3 is input for forward propagation calculation to obtain the original candidate target frame of the first stage and the average confidence of the original candidate target frame.
[0033] The iterative downsampled samples are input into the corrected PointRCNN network for training and the foreground point segmentation loss value, classification loss value, regression loss value, and average confidence loss value are obtained according to the confidence of the original candidate target box; all loss values are summed up to obtain the iterative total loss value, including: The iterative downsampled samples are input into the corrected PointRCNN network for training to obtain the foreground point segmentation loss value, classification loss value, regression loss value, downsampled candidate target frame and the confidence of the downsampled candidate target frame. The average confidence loss value is calculated according to the confidence of the original candidate target frame and the confidence of the downsampled candidate target frame; the foreground point segmentation loss value, classification loss value, regression loss value and average confidence loss value are summed to obtain the iterative total loss value.
[0034] Specifically, The input is input into the corrected PointRCNN network for training to obtain the downsampled candidate target box and the confidence of the downsampled candidate target box; in the corrected PointRCNN network, the loss function of the original PointRCNN detection framework is optimized to a certain extent, including: foreground point segmentation loss function optimization, increase the average confidence loss of the candidate target box combined with the downsampling scale factor; while the original classification loss function and regression loss function are not optimized.
[0035] For the optimization of the foreground point segmentation loss function, when training the corrected PointRCNN network, a segmentation branch is used to estimate the foreground point on the feature vector of each point extracted by the previous backbone network; the segmentation branch uses the points in the annotated annotation box as the foreground point during training. The original algorithm takes into account the large difference in the number of foreground points and background points in the point cloud data, so the loss function of the segmentation branch uses Focal Loss.
[0036] The present invention optimizes the loss function to a certain extent and adds a downsampling scale factor to the original loss function. The formula is as follows: ; in, The value is {1,0}, where 1 represents the downsampled candidate target box is a positive sample, and 0 represents the downsampled candidate target box is a negative sample. is the probability that the downsampled candidate target box predicted by the model is a positive sample, represents the downsampling scale corresponding to the iterative downsampling samples, is the downsampling scale factor, is the preset weight for controlling positive and negative samples, is the preset hyperparameter for adjusting the weight factor, is the foreground point segmentation loss value; in this application, and They are set to 0.25 and 2 in the original algorithm respectively; by adding the downsampling scale factor The samples with larger downsampling scales get more weights, so the network model is more conducive to the foreground point segmentation effect of these samples.
[0037] The specific formula for the average confidence loss of the candidate target box combined with the downsampling scale factor is as follows: ; in, is the number of original candidate target boxes, Represents the confidence of the i-th original candidate target box; is the average confidence of all original candidate target boxes; is the number of downsampled candidate target boxes, Represents the confidence of the i-th downsampled candidate target box; is the average confidence of all downsampled candidate target boxes; is the downsampling scale corresponding to the iterative downsampling samples, is the average confidence loss value.
[0038] in, and The difference is that It is predicted by the optimal model Ma in S3. It is predicted by the model being trained in each round.
[0039] In this application, The larger the value, the greater the loss. The purpose is to make the model more conducive to the training of samples with large downsampling scales. Generally speaking, To be greater than , this loss function hopes that the two values are as close as possible during training, that is, the prediction accuracy of the downsampled candidate target box of the downsampled sample is close to the prediction accuracy of the original candidate target box of the original unsampled sample.
[0040] In this application, the foreground point segmentation loss value is generated in the first stage of correcting the PointRCNN network training, and the classification loss value, regression loss value, and average confidence loss value are generated in the second stage of correcting the PointRCNN network training.
[0041] The sum of all the loss values in the second stage is: ; Among them, the first item is the classification loss of whether the candidate target box is a positive sample or a negative sample, the second item is the positive sample bounding box regression loss, the first and second items are the original loss functions in the PointRCNN framework; the third item is the average confidence loss of the candidate target box combined with the downsampling scale factor proposed in this invention.
[0042] It is a set of downsampled candidate target boxes generated by the first stage of the corrected PointRCNN network. is the confidence of the i-th downsampled candidate target box, is the label of the corresponding downsampled candidate target box. represents the cross entropy loss. Stores the positive sample downsampled candidate target boxes for regression. represents the bin regression loss, represents the residual regression loss. is the average confidence loss value of the candidate target box combined with the downsampling scale factor.
[0043] Will and The total iterative loss value is obtained by summing up, and the corrected PointRCNN network is updated by back propagation according to the total iterative loss value.
[0044] S5, repeat S4 until all samples in the downsampled training set are trained and multiple rounds of training are performed to obtain multiple models, and the multiple models are respectively used to predict results through the downsampled test set, and the model corresponding to the best prediction result is selected and named Mb; S6, dividing the downsampled test set into test sets of different downsampled scales; predicting and calculating the test sets of different downsampled scales through the model Mb respectively, and obtaining the total score of the test set of each downsampled scale; taking the downsampled scale corresponding to the test set with the largest total score as the optimal downsampled scale; Figure 3 is a flowchart of selecting the optimal downsampling scale provided by an embodiment of the present invention, such as Figure 3 As shown, the S6 includes: S61, dividing the downsampling test set into test sets of different downsampling scales according to the downsampling scale annotated by each sample; Specifically, for example: downsample the test set All samples with a downsampling scale label of 0.03 are selected to construct a test set, denoted as The same method is used to obtain the test set with a downsampling scale of 0.06 and the test set with a downsampling scale of 0.10 .
[0045] S62, predicting the test sets of different downsampling scales through the model Mb respectively, and obtaining the average accuracy and average inference time of the test set of each downsampling scale; and taking the test set of each downsampling scale as the test set of the current downsampling scale in turn; Specifically, in terms of model accuracy, we use the average accuracy (ap) of the test set at each downsampling scale as the evaluation indicator. In terms of model inference efficiency, we use the average inference time (at) of the test set at each downsampling scale, that is, the total inference time of all samples in a test set divided by the number of samples.
[0046] S63, calculating the total score of the test set of the current downsampling scale according to the average accuracy, average reasoning time, preset average accuracy weight, and preset average reasoning time weight of the test set of the current downsampling scale; The present invention makes a balanced choice between model accuracy and model inference efficiency. For example, if the average accuracy of test sets of several downsampling scales is equal, we will tend to choose the downsampling scale corresponding to the test set with less average inference time as our optimal downsampling scale.
[0047] Therefore, the present invention uses the following formula to quantify the performance of a model in a test set of a certain downsampling scale: ; in Represents the total score of a model on the test set of the current downsampling scale, represents the average accuracy weight, Represents the average reasoning time weight. ap represents the average accuracy of the test set of the current downsampling scale, and at represents the average reasoning time of the test set of the current downsampling scale. The higher the average accuracy, the shorter the average reasoning time, and the greater the total score.
[0048] S64. The downsampling scale corresponding to the test set with the largest total score is taken as the optimal downsampling scale.
[0049] S7, obtaining the original point cloud to be detected, performing voxel downsampling on the point cloud to be detected according to the optimal downsampling scale to obtain the downsampled point cloud to be detected, inputting the downsampled point cloud to be detected into the model Mb for prediction, and obtaining the intrusion target information.
[0050] In the present invention, the comprehensive performance of the model on the test sets of different downsampling scales is quantified by weighting the average accuracy and the average inference time, so that an optimal downsampling scale can be accurately selected; the downsampling scale factor is introduced in the foreground point segmentation of the PointRCNN-based detection framework, and the average confidence loss of the candidate target box combined with the downsampling scale factor is added to the loss function of the two-stage training, so that the network has better detection accuracy for samples with larger downsampling scales.
[0051] Figure 4 is a structural diagram of a perimeter intruder detection system based on an optimal downsampling scale provided by an embodiment of the present invention, such as Figure 4 As shown, the system includes: The downsampling and labeling unit 201 is used to obtain an original data set, downsample the original data set through a plurality of preset downsampling scales to obtain a downsampled data set; and label the original data set and the downsampled data set with target detection frames and downsampling scales; A division unit 202 is used to divide the original data set into an original training set and an original test set; and to divide the downsampled data set into a downsampled training set and a downsampled test set accordingly; Figure 5 is a schematic diagram of the structure of a division unit provided in an embodiment of the present invention, such as Figure 5 As shown, the division unit 202 includes: The original data set division subunit 2021 is used to randomly select a preset percentage of data from the original data set as an original training set, and use the remaining data in the original data set as an original test set; The down-sampling training set selection subunit 2022 is used to use the down-sampling samples of multiple down-sampling scales generated corresponding to each original sample in the original training set as the down-sampling training set; The down-sampled test set selection subunit 2023 is used to use the down-sampled samples of multiple down-sampled scales generated corresponding to each original sample in the original test set as the down-sampled test set.
[0052] The original training set training unit 203 is used to perform multiple rounds of training on the original training set through the original PointRCNN network to obtain multiple models, respectively predict the results of the multiple models through the original test set, select the model corresponding to the best prediction result and name it Ma; modify the loss function in the original PointRCNN network to obtain a corrected PointRCNN network; The down-sampled training set iterative training unit 204 is used to randomly extract a sample from the down-sampled training set as an iterative down-sampled sample, and extract the corresponding non-down-sampled sample from the original training set as an iterative original sample; input the iterative original sample into the model Ma for forward propagation prediction to obtain the original candidate target frame and the confidence of the original candidate target frame; input the iterative down-sampled sample into the corrected PointRCNN network for training and obtain the foreground point segmentation loss value, classification loss value, regression loss value, and average confidence loss value according to the confidence of the original candidate target frame; sum up all loss values to obtain the iterative total loss value, and update the corrected PointRCNN network by back propagation according to the iterative total loss value; A repeated training unit 205 is used to repeat the down-sampling training set iterative training unit until all samples in the down-sampling training set are trained and multiple rounds of training are performed to obtain multiple models, and the multiple models are respectively predicted by the down-sampling test set, and the model corresponding to the best prediction result is selected and named Mb; The optimal downsampling scale selection unit 206 is used to divide the downsampling test set into test sets of different downsampling scales; predict and calculate the test sets of different downsampling scales through the model Mb respectively to obtain the total score of the test set of each downsampling scale; and take the downsampling scale corresponding to the test set with the largest total score as the optimal downsampling scale; Figure 6 is a schematic diagram of the structure of the optimal downsampling scale selection unit provided in an embodiment of the present invention, such as Figure 6 As shown, the optimal downsampling scale selection unit 206 includes: The down-sampling test set division subunit 2061 is used to divide the down-sampling test set into test sets of different down-sampling scales according to the down-sampling scale marked on each sample; The down-sampling test set prediction subunit 2062 is used to predict the test sets of different down-sampling scales through the model Mb respectively, and obtain the average accuracy and average inference time of the test set of each down-sampling scale; and sequentially use the test set of each down-sampling scale as the test set of the current down-sampling scale; A calculation subunit 2063 is used to calculate the total score of the test set of the current downsampling scale according to the average accuracy, average reasoning time, preset average accuracy weight, and preset average reasoning time weight of the test set of the current downsampling scale; The optimal downsampling scale selection subunit 2064 is used to take the downsampling scale corresponding to the test set with the largest total score as the optimal downsampling scale.
[0053] The detection unit 207 is used to obtain the original point cloud to be detected, perform voxel downsampling on the point cloud to be detected according to the optimal downsampling scale to obtain the downsampled point cloud to be detected, input the downsampled point cloud to be detected into the model Mb for prediction, and obtain the intrusion target information.
[0054] It can be understood that the above system corresponds to the method of the present invention, and the details of the system processing method will not be repeated here.
[0055] Beneficial effects of the present invention: The present invention provides a perimeter intruder detection method and system based on an optimal downsampling scale, wherein the method automatically selects an optimal downsampling scale from various preset downsampling scales through a quantified performance analysis index, and the optimal downsampling scale simultaneously balances accuracy and computational efficiency; at the same time, the loss function of network training is improved by introducing a downsampling scale factor and an average confidence loss of a candidate target box combined with the downsampling scale factor, thereby enabling the trained model to have better detection accuracy for the downsampled point cloud.
[0056] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A perimeter intruder detection method based on optimal downsampling scale, characterized in that: include: S1. Acquire an original data set, and downsample the original data set using a plurality of preset downsampling scales to obtain a downsampled data set; Performing object detection frame annotation and downsampling scale annotation on the original data set and the downsampled data set; S2, dividing the original data set into an original training set and an original test set; and correspondingly dividing the downsampled data set into a downsampled training set and a downsampled test set; S3, the original training set is trained for multiple rounds through the original PointRCNN network to obtain multiple models, the multiple models are respectively predicted by the original test set, the model corresponding to the best prediction result is selected and named Ma; the loss function in the original PointRCNN network is changed to obtain a corrected PointRCNN network; S4. Randomly extract a sample from the downsampled training set as an iterative downsampled sample, and extract the corresponding non-downsampled sample from the original training set as an iterative original sample; input the iterative original sample into the model Ma for forward propagation prediction to obtain the original candidate target frame and the confidence of the original candidate target frame; input the iterative downsampled sample into the corrected PointRCNN network for training and obtain the foreground point segmentation loss value, classification loss value, regression loss value, and average confidence loss value according to the confidence of the original candidate target frame; sum up all loss values to obtain the iterative total loss value, and update the corrected PointRCNN network according to the iterative total loss value by backpropagation; S5, repeat S4 until all samples in the downsampled training set are trained and multiple rounds of training are performed to obtain multiple models, and the multiple models are respectively used to predict results through the downsampled test set, and the model corresponding to the best prediction result is selected and named Mb; S6, dividing the downsampled test set into test sets of different downsampled scales; predicting and calculating the test sets of different downsampled scales through the model Mb respectively, and obtaining the total score of the test set of each downsampled scale; The downsampling scale corresponding to the test set with the largest total score is taken as the optimal downsampling scale; S7, obtaining the original point cloud to be detected, performing voxel downsampling on the point cloud to be detected according to the optimal downsampling scale to obtain the downsampled point cloud to be detected, inputting the downsampled point cloud to be detected into the model Mb for prediction, and obtaining the intrusion target information.
2. The method according to claim 1, characterized in that: The S2 includes: Randomly select a preset percentage of data from the original data set as an original training set, and use the remaining data in the original data set as an original test set; The downsampled samples of multiple downsampled scales generated corresponding to each original sample in the original training set are used as the downsampled training set; The downsampled samples of multiple downsampled scales generated corresponding to each original sample in the original test set are used as the downsampled test set.
3. The method according to claim 1, characterized in that The S6 includes: The downsampled test set is divided into test sets of different downsampled scales according to the downsampled scale annotated on each sample; The test sets of different downsampling scales are predicted by the model Mb respectively to obtain the average accuracy and average inference time of the test sets of each downsampling scale; the test sets of each downsampling scale are used as the test sets of the current downsampling scale in turn; The total score of the test set of the current downsampling scale is calculated according to the average accuracy, average inference time, preset average accuracy weight, and preset average inference time weight of the test set of the current downsampling scale; The downsampling scale corresponding to the test set with the largest total score is taken as the optimal downsampling scale.
4. The method according to claim 1, characterized in that: Input the iterative down-sampled samples into the corrected PointRCNN network for training and obtain the foreground point segmentation loss value, classification loss value, regression loss value, and average confidence loss value according to the confidence of the original candidate target box; The total loss value of the iteration is obtained by summing up all the loss values: The iterative downsampled samples are input into the corrected PointRCNN network for training to obtain the foreground point segmentation loss value, classification loss value, regression loss value, downsampled candidate target frame and the confidence of the downsampled candidate target frame. The average confidence loss value is calculated according to the confidence of the original candidate target frame and the confidence of the downsampled candidate target frame; the foreground point segmentation loss value, classification loss value, regression loss value and average confidence loss value are summed to obtain the iterative total loss value.
5. The method according to claim 4, characterized in that The average confidence loss value is calculated according to the following formula: ; in, is the number of original candidate target boxes, Represents the confidence of the i-th original candidate target box; is the average confidence of all original candidate target boxes; is the number of downsampled candidate target boxes, Represents the confidence of the i-th downsampled candidate target box; is the average confidence of all downsampled candidate target boxes; is the downsampling scale corresponding to the iterative downsampling samples, is the average confidence loss value.
6. The method according to claim 4, characterized in that The foreground point segmentation loss value is calculated according to the following formula: ; in, The value is {1,0}, where 1 represents the downsampled candidate target box is a positive sample, and 0 represents the downsampled candidate target box is a negative sample. is the probability that the downsampled candidate target box predicted by the model is a positive sample, represents the downsampling scale corresponding to the iterative downsampling samples, is the preset weight for controlling positive and negative samples, is the preset hyperparameter for adjusting the weight factor, is the foreground point segmentation loss value.
7. A perimeter intruder detection system based on optimal downsampling scale, characterized in that: include: A downsampling and labeling unit, used to obtain an original data set, and downsample the original data set through a plurality of preset downsampling scales to obtain a downsampled data set; Performing object detection frame annotation and downsampling scale annotation on the original data set and the downsampled data set; A division unit, used for dividing the original data set into an original training set and an original test set; Dividing the downsampled data set into a downsampled training set and a downsampled test set respectively; The original training set training unit is used to perform multiple rounds of training on the original training set through the original PointRCNN network to obtain multiple models, respectively predict the results of the multiple models through the original test set, select the model corresponding to the best prediction result and name it Ma; modify the loss function in the original PointRCNN network to obtain a corrected PointRCNN network; A down-sampled training set iterative training unit is used to randomly extract a sample from the down-sampled training set as an iterative down-sampled sample, and extract a corresponding non-down-sampled sample from the original training set as an iterative original sample; input the iterative original sample into the model Ma for forward propagation prediction to obtain the original candidate target frame and the confidence of the original candidate target frame; input the iterative down-sampled sample into the corrected PointRCNN network for training and obtain the foreground point segmentation loss value, classification loss value, regression loss value, and average confidence loss value according to the confidence of the original candidate target frame; sum up all loss values to obtain the iterative total loss value, and update the corrected PointRCNN network according to the iterative total loss value by back propagation; A repeated training unit is used to repeatedly perform the down-sampling training set iterative training unit until all samples in the down-sampling training set are trained and multiple rounds of training are performed to obtain multiple models. The multiple models are respectively used to predict results through the down-sampling test set, and the model corresponding to the best prediction result is selected and named Mb; The optimal downsampling scale selection unit is used to divide the downsampling test set into test sets of different downsampling scales; the test sets of different downsampling scales are predicted and calculated by the model Mb respectively to obtain the total score of the test set of each downsampling scale; The downsampling scale corresponding to the test set with the largest total score is taken as the optimal downsampling scale; The detection unit is used to obtain the original point cloud to be detected, perform voxel downsampling on the point cloud to be detected according to the optimal downsampling scale to obtain the downsampled point cloud to be detected, input the downsampled point cloud to be detected into the model Mb for prediction, and obtain the intrusion target information.
8. The system according to claim 7, characterized in that The division unit comprises: The original data set division subunit is used to randomly select a preset percentage of data from the original data set as an original training set, and use the remaining data in the original data set as an original test set; A down-sampling training set selection subunit is used to use down-sampled samples of multiple down-sampling scales generated corresponding to each original sample in the original training set as the down-sampling training set; The down-sampling test set selection subunit is used to use the down-sampled samples of multiple down-sampling scales generated corresponding to each original sample in the original test set as the down-sampling test set.
9. The system according to claim 7, characterized in that The optimal downsampling scale selection unit comprises: A downsampling test set division subunit is used to divide the downsampling test set into test sets of different downsampling scales according to the downsampling scale annotated by each sample; The down-sampling test set prediction subunit is used to predict the test sets of different down-sampling scales through the model Mb respectively, and obtain the average accuracy and average inference time of the test set of each down-sampling scale; and sequentially use the test set of each down-sampling scale as the test set of the current down-sampling scale; A calculation subunit, used to calculate the total score of the test set of the current downsampling scale according to the average accuracy, average reasoning time, preset average accuracy weight, and preset average reasoning time weight of the test set of the current downsampling scale; The optimal downsampling scale selection subunit is used to take the downsampling scale corresponding to the test set with the largest total score as the optimal downsampling scale.
10. The system according to claim 7, characterized in that Input the iterative down-sampled samples into the corrected PointRCNN network for training and obtain the foreground point segmentation loss value, classification loss value, regression loss value, and average confidence loss value according to the confidence of the original candidate target box; The total loss value of the iteration is obtained by summing up all the loss values: The iterative downsampled samples are input into the corrected PointRCNN network for training to obtain the foreground point segmentation loss value, classification loss value, regression loss value, downsampled candidate target frame and the confidence of the downsampled candidate target frame. The average confidence loss value is calculated according to the confidence of the original candidate target frame and the confidence of the downsampled candidate target frame; the foreground point segmentation loss value, classification loss value, regression loss value and average confidence loss value are summed to obtain the iterative total loss value.
Citation Information
Patent Citations
Target processing method and device based on cross-level, cross-scale and cross-attention mechanism
CN113177555A
Three-dimensional target detection method based on sparse multi-scale voxel feature fusion
CN113379709A
Weed detection method and system based on multi-scale fusion
CN114972301A
Three-dimensional target detection method based on point cloud structure perception
CN116778468A
Far small target point cloud data feature enhancement method based on attention mechanism
CN116824533A
