Lightweight target detection method for monitoring video image

By improving the YOLOv5s network structure, including replacing modules and using pruning and knowledge distillation technologies, the problem of both accuracy and speed of target detection networks in the existing technology is solved, and efficient target detection of surveillance video images is achieved.

CN118628710APending Publication Date: 2024-09-10GUANGXI TEACHERS EDUCATION UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410582253.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-11
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

Existing target detection networks are difficult to balance between the pursuit of high accuracy and high inference speed. Although the YOLO series network has improved inference speed, its accuracy is low and it requires better computing equipment.

Method used

By improving the YOLOv5s network structure, including replacing the SPPF module with the SPPF-A module, inserting the CBAM module, replacing the C3 module with the DSF module, inserting the CARAFE module, using Decoupled Head, and performing model pruning and knowledge distillation, using Group-wise Pruning and FitNets method reduces model parameters and computational complexity.

Benefits of technology

It significantly improves the accuracy and detection speed of target detection in surveillance video images, reduces the amount of model calculations, and improves the detection speed and accuracy. It is suitable for perimeter and security monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118628710A
    Figure CN118628710A
Patent Text Reader

Abstract

The invention discloses a lightweight target detection method for monitoring a video image. The method comprises the following steps: acquiring a video image; preprocessing the video image; image target detection is carried out by using a lightweight image target detection model obtained based on YOLOv5s improvement; the method for obtaining the lightweight image target detection model based on YOLOv5s improvement comprises the steps that YOLOv5s is used as a basic network, an improved SPPF-A module is adopted to optimize the multi-scale feature extraction capacity, a DSF (residual feature extraction) module is adopted to reduce the model calculation amount, and Decouled Head and CARAFE modules are introduced to improve the image feature extraction and fusion capacity. And finally, pruning and knowledge distillation are introduced to lighten the model. According to the method, the accuracy and the detection speed of monitoring video image target detection can be remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition technology, and more specifically, to a lightweight target detection method for monitoring video images. Background Art

[0002] At present, there are two main types of target detection algorithms that are widely used in the industry, the RCNN series detection network and the YOLO series detection network. Among them, the YOLO series target detection network has greatly improved its reasoning speed compared to the RCNN series, which is a milestone in the field of security monitoring target detection, but there are still some problems, such as it is difficult to have high accuracy and high reasoning speed at the same time. Networks with high accuracy often have slower reasoning speeds and require better computing equipment; while networks with fast reasoning speeds generally have lower accuracy. How to design a lightweight network structure, reduce the number of model parameters and computational complexity, and improve the detection accuracy and real-time performance of the model is an urgent problem that needs to be solved. Summary of the invention

[0003] An object of the present invention is to solve at least the above problems and to provide at least the advantages which will be described hereinafter.

[0004] Another object of the present invention is to provide a lightweight target detection method for surveillance video images, which can significantly improve the accuracy and detection speed of target detection in surveillance video images.

[0005] In order to achieve these purposes and other advantages according to the present invention, a lightweight target detection method for monitoring video images is provided, comprising:

[0006] Acquire video images;

[0007] Preprocess the video image;

[0008] Image target detection is performed using a lightweight image target detection model improved based on YOLOv5s;

[0009] Among them, the method for improving the lightweight image target detection model based on YOLOv5s includes: replacing the SPPF module in the YOLOv5s backbone network with an SPPF-A module, and inserting a CBAM module before the SPPF-A module;

[0010] The SPPF-A module includes a Conv module, an MPC module and a Conv module connected in series. The MPC module includes: a first pooling layer, a second pooling layer and a third pooling layer connected in series, a first fusion layer for fusing features obtained from the first pooling layer and features obtained from the third pooling layer, a fourth pooling layer connected in series with the first fusion layer, and a second fusion layer for fusing features before the first pooling layer and features obtained from the first pooling layer to the fourth pooling layer.

[0011] Preferably, the method for improving the lightweight image target detection model based on YOLOv5s further includes: replacing the C3 module in the YOLOv5s backbone network with a DSF module;

[0012] The DSF module is a module obtained by replacing the Conv module in the C3 module with a DSConv module and replacing the bottleneck module in the C3 module with a FasterNet module.

[0013] Preferably, the method for improving the lightweight image target detection model based on YOLOv5s further includes: inserting a CARAFE module into the Neck part of YOLOv5s.

[0014] Preferably, the method for improving the lightweight image target detection model based on YOLOv5s further includes: using a Decoupled Head module in the head part of YOLOv5s.

[0015] Preferably, the method for improving the lightweight image target detection model based on YOLOv5s also includes: pruning the model and performing knowledge distillation processing.

[0016] Preferably, the pruning method used is the Group-wise Pruning method, and the knowledge distillation method used is the FitNets knowledge distillation method.

[0017] Preferably, the process of pruning and knowledge distilling the model includes: using the model before pruning as the teacher model, the model after pruning as the student model, and repeatedly adjusting the student model using the knowledge distillation method and the pruning method until the model converges.

[0018] Preferably, the method for preprocessing the video image includes: performing at least one of scaling, cropping, normalizing and labeling processing on the video image.

[0019] The present invention also provides a lightweight target detection device for monitoring video images, comprising:

[0020] Memory for storing computer programs;

[0021] A processor is used to implement the steps of the above-mentioned lightweight target detection method for monitoring video images when executing the computer program.

[0022] The present invention also provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned lightweight target detection method for monitoring video images are implemented.

[0023] The present invention has at least the following beneficial effects:

[0024] 1. Improved detection speed: The lightweight target detection method for surveillance video images proposed in this invention can effectively reduce the amount of model calculation and greatly improve the detection speed;

[0025] 2. Improved detection accuracy: The improved lightweight image target detection model of the present invention has better recognition ability for surveillance video images and improved detection accuracy.

[0026] Based on the above two points, the lightweight target detection method for surveillance video images described in the present invention can provide better technical support for perimeter monitoring, patrol monitoring, and security monitoring.

[0027] Other advantages, objectives and features of the present invention will be embodied in part through the following description, and in part will be understood by those skilled in the art through study and practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 A flowchart of a lightweight target detection method for surveillance video images according to an embodiment of the present invention;

[0029] Figure 2 It is a structural diagram of the SPPF-A module according to an embodiment of the present invention;

[0030] Figure 3 It is a structural schematic diagram of the DSF module according to an embodiment of the present invention;

[0031] Figure 4 Schematic diagram of the structure of the PConv module according to an embodiment of the present invention;

[0032] Figure 5 It is a structural schematic diagram of the lightweight image target detection model according to an embodiment of the present invention;

[0033] Figure 6 A schematic diagram of the FitNets knowledge distillation process according to an embodiment of the present invention;

[0034] Figure 7 Schematic diagram of the Group-wise Pruning + FitNets knowledge distillation process described in an embodiment of the present invention;

[0035] Figure 8 This is a schematic diagram of detection results of the lightweight image object detection model described in an embodiment of the present invention. DETAILED DESCRIPTION

[0036] The present invention is further described in detail below in conjunction with the accompanying drawings so that those skilled in the art can implement the invention with reference to the description.

[0037] It should be noted that the experimental methods described in the following embodiments are conventional methods unless otherwise specified, and the reagents and materials are commercially available unless otherwise specified; in the description of the present invention, the terms "lateral", "longitudinal", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0038] like Figure 1 As shown, the present invention provides a lightweight target detection method for monitoring video images, comprising:

[0039] S1, obtaining video images;

[0040] Specifically, OpenCV is used for computer vision processing, multi-threading is designed, VideoCapture is used to open the remote monitoring video device, the RTSP stream is read, the RGB image in the queue is obtained, and the monitoring video image is saved.

[0041] S2, preprocessing the video image;

[0042] Specifically, the preprocessing method for surveillance video images mainly includes at least one method such as image scaling and cropping, normalization and label processing to ensure that the input data matches the requirements of the model and improve the training effect and generalization ability of the model. In the preprocessing stage, the image is converted from the original format to the format required by the model (such as numpy array or Tensor), and then the image is scaled to the specified size and center cropped or padded to adapt to the input size of the model. In order to improve the training stability and convergence speed of the model, the image is usually normalized, which means converting the pixel value of the image to a fixed range, such as [0,1] or [-1,1]. After these preprocessing steps, it can be ensured that the input data matches the requirements of the model and improve the training effect and generalization ability of the model.

[0043] S3. Use the lightweight image target detection model improved based on YOLOv5s to perform image target detection;

[0044] Specifically, the method for improving the lightweight image target detection model based on YOLOv5s includes: replacing the SPPF module in the YOLOv5s backbone network with an SPPF-A module, and inserting a CBAM module before the SPPF-A module;

[0045] The SPPF-A module includes a Conv module, an MPC module and a Conv module connected in series. The MPC module includes: a first pooling layer, a second pooling layer and a third pooling layer connected in series, a first fusion layer for fusing features obtained from the first pooling layer and features obtained from the third pooling layer, a fourth pooling layer connected in series with the first fusion layer, and a second fusion layer for fusing features before the first pooling layer and features obtained from the first pooling layer to the fourth pooling layer.

[0046] In the above steps, in order to improve the matching degree between the model and the dataset, the CBAM attention mechanism is added. The attention map is calculated through two independent dimensions, space and channel, to enhance the ability to express fine-grained features.

[0047] CBAM (Convolutional Block Attention Module) is an attention mechanism module used to enhance the performance of convolutional neural networks (CNNs). It mainly improves the perception ability of the model by introducing channel attention and spatial attention in CNN without increasing the complexity of the network.

[0048] In addition, in order to improve the problem that feature detection is limited by the pooling and splicing of the field of view, the SPPF_A module is proposed.

[0049] In conventional yolo models, the pooling module of the backbone network often uses the SPP module. The SPP structure is also called spatial pyramid pooling, which has the characteristics of multiple windows and fixed output size of a single window. SPP will not distort the original image while zooming in and out, so the output of multiple sizes can reduce overfitting and enable the network to converge better. In addition, the SPP structure replaces the original pooling layer, and the output does not affect the structure of the network. However, the training time of the SPP module is long and the detection speed is slow.

[0050] As an improvement of SPP, SPPF is faster when the output is the same. Spatial pyramid pooling can convert feature maps with non-fixed scales into feature vectors of uniform scale. However, according to the source code, in YOLOv5, SPP and SPPF actually perform same pooling (average pooling) through padding, and the sizes of the feature maps before and after are equal. The main function of SPPF in yolov5 is to fuse multi-scale features. Concat (fuse) the feature representations of the same feature map at different scales together. However, the resolution accuracy of the SPPF module for small targets is low.

[0051] Therefore, this application proposes a SPPF_A module, whose structure is as follows Figure 2As shown. Four MaxPools (maximum pooling layers) with a kernel size of 5*5 are used to obtain features of different scales in disguise. This application proposes the SPPF_A module, which fuses the concat of the first MaxPool and the third MaxPool, with the aim of focusing more on large and small targets. The reason is that the range of portrait images is not fixed. When there are only a few people, the labeled area is very small, and in crowded areas, the labeled area is easily confused with other objects. Therefore, the model needs to pay more attention to the variable field of view, and smaller feature maps can better retain feature textures. The spatial pyramid structure of SPPF_A is compatible with image outputs of different scales and sizes. Features of corresponding appropriate scales can be extracted according to images of different scales. By combining features of different scales, the edge pixels of the target can be better distinguished, thereby improving the recognition accuracy.

[0052] More specifically, the method for improving the lightweight image target detection model based on YOLOv5s also includes: replacing the C3 module in the YOLOv5s backbone network with a DSF module;

[0053] The DSF module is a module obtained by replacing the Conv module in the C3 module with a DSConv module and replacing the bottleneck module in the C3 module with a FasterNet module.

[0054] The C3 module is an important feature extraction module in the YOLO model, which consists of 3 Conv modules and 1 Bottleneck module. The original C3 module has a large number of parameters, and the model is prone to slow detection speed in actual complex scenes and on mobile devices, such as real-time detection of pedestrians through cameras. Therefore, this application designs a residual feature extraction module based on the original C3 module, the DSF module.

[0055] The DSF module structure is as follows Figure 3 As shown, the DSF module consists of a convolutional network and a residual network. This application chooses to replace the ordinary convolution (Conv) with the depth-separable convolution (DSConv), which can greatly reduce the convolution parameters and reduce the size of the model.

[0056] The number of parameters of the depthwise separable convolution under the same input is only about one-third of that of the ordinary convolution. Although the depthwise separable convolution module reduces the number of parameters for each run, it also increases the number of memory reads. More frequent memory reads will lead to a decrease in floating-point operations FLOPs. Therefore, this application uses FasterNet to replace the original bottleneck module.

[0057] FasterNet module uses PConv (PConv module such as Figure 4 As shown in the figure, the convolution block is different from the ordinary convolution in that it divides the input channels, keeps the remaining channels unchanged each time the features are extracted, and only applies the conventional Conv to this part for spatial feature extraction.

[0058] Compared with ordinary convolution, PConv's FLOPs (floating-point operations per second) is only 1 / 16 of the original size, which greatly optimizes the memory usage efficiency and increases the detection speed of the model.

[0059] More specifically, the method for improving the lightweight image target detection model based on YOLOv5s also includes: inserting a CARAFE module into the Neck part of YOLOv5s.

[0060] The CARAFE upsampling module can effectively improve the model's ability to extract dense features for complex images. It has the advantages of small size and large receptive field. The reason is that CARAFE can predict a reorganization kernel for each content, which can better preserve its feature information. CARAFE is divided into two main modules, namely the upsampling kernel prediction module and the feature reorganization module. Assuming the upsampling ratio is σ, given an input feature map of shape H×W×C (where H×W is the length and width of the upsampling kernel, and C is the number of channels), we first use the upsampling kernel prediction module to predict the upsampling kernel, and then use the feature reorganization module to complete the upsampling, and obtain an output feature map of shape σH×σW×C.

[0061] More specifically, the method for improving the lightweight image target detection model based on YOLOv5s also includes: using a Decoupled Head module in the head part of YOLOv5s.

[0062] Decoupled Head is different from the traditional image segmentation network. It processes feature extraction and pixel prediction separately to better handle features of different scales and granularities. Decoupled Head constructs multiple branch networks for pixel-level prediction, separates the focus of classification and positioning, and has better effects on target texture features and edge positioning.

[0063] After the above improvements, the structure of the lightweight image target detection model is as follows: Figure 5As shown. This application inserts the CBAM attention module into the Backbone part of YOLOv5s, and uses the improved spatial pyramid structure SPPF-A to replace the original SPPF module. CARAFE is inserted into the Neck part, and the Decoupled Head (Content-Aware ReAssembly of FEatures) module is used in the detection head part of YOLOv5s. The above model can increase the weight ratio of the target feature by constructing a multi-level receptive field, allowing the model to locate a more comprehensive target.

[0064] In another embodiment, the method for improving a lightweight image target detection model based on YOLOv5s also includes: pruning and performing knowledge distillation on the model.

[0065] Specifically, the pruning method used is the Group-wise Pruning method, and the knowledge distillation method used is the FitNets knowledge distillation method.

[0066] Existing pruning methods include: Group-wise Pruning, Global Pruning, Magnitude Pruning and Channel Pruning.

[0067] Global Pruning is a simple and direct pruning method that performs pruning based on the absolute value of the parameters. However, Global Pruning can easily lead to irregular structure of the pruned model, and the performance of the pruned model may be greatly affected; Magnitude Pruning is a pruning method based on parameter amplitude, which directly prunes the weights with smaller parameter amplitudes. Although Magnitude Pruning is relatively simple, it may cause the sparsity of the model to be insufficient after pruning, and has a greater impact on model performance; Channel Pruning is a pruning method based on channel importance, which performs pruning by evaluating the contribution of each channel to model performance. Although Channel Pruning can maintain the integrity of the model structure to a certain extent, its pruning accuracy for the model is low, which can easily lead to a decrease in model performance after pruning.

[0068] This application selects Group-wise Pruning as the specific method of pruning. This is because compared with other pruning methods, Group-wise Pruning comprehensively considers the advantages of global pruning and channel pruning, and can more accurately prune the parameters of the model while maintaining the integrity of the model structure. Since Group-wise Pruning can prune each convolution kernel group, it can more effectively reduce the amount of calculation and parameters of the model while maintaining the stability of the model performance. Therefore, compared with other pruning methods, Group-wise Pruning is more suitable for the compression and acceleration of the above-mentioned lightweight image target detection model.

[0069] The Group-wise Pruning method can be represented by the following pseudo code (as shown in Table 1). In this pseudo code, each convolutional layer is traversed, and then the importance score of each filter is calculated, and finally some filters with the lowest importance scores are pruned.

[0070] Table 1

[0071]

[0072] More specifically, the pruning ratio is first determined with the goal of reducing the computational workload of the model while maintaining the detection performance of the model. Then, according to the convolutional layer structure and channel characteristics of the model, the appropriate pruning position is selected to ensure that the pruned model still has high detection performance. This application uses an iterative pruning algorithm to prune each layer of the model to gradually reduce the computational workload of the model. The iterative pruning algorithm is a method that implements step-by-step pruning through multiple iterative cycles. The algorithm first performs a pruning on the original model and then retrains on the pruned model to restore or improve model performance. In each iteration, the pruning strategy may be adjusted according to model performance and indicators to achieve better pruning effects. The iterative pruning algorithm usually performs multiple rounds of iterations until the preset pruning target is reached or the performance requirements are met. This algorithm can effectively reduce the complexity of the model and improve the lightweight and computational efficiency of the model.

[0073] During the pruning process, the soft labels of the teacher model are used to guide the pruning operation to ensure that the pruned model can maintain the characteristics and performance of the original model. To this end, we introduced the knowledge distillation method to introduce the knowledge of the teacher model into the pruned student model. Specifically, we used the soft labels of the teacher model to guide the pruning operation and introduced the knowledge of the teacher model into the pruned model. This combination strategy can further reduce the amount of computation and parameters of the model while maintaining the performance of the model, achieving effective compression and acceleration of the above-mentioned lightweight image object detection model.

[0074] Existing knowledge distillation methods include FitNets, Self-Knowledge Distillation, Attention Transfer, etc. The Self-Knowledge Distillation method is a simple and direct knowledge distillation method that uses the output of the student model itself as a soft target to train the student model. Although this method is simple and easy to implement, it cannot fully tap the rich knowledge of the teacher model due to the limited expressive power of the student model; the Attention Transfer method uses the attention mechanism to transfer knowledge between the teacher model and the student model. This method enables the student model to learn important information of the teacher model in the spatial and channel dimensions, but it is not effective when dealing with complex data and models.

[0075] This application selects FitNets as a specific method for knowledge distillation. FitNets is a method for deep neural network distillation, originally used for image classification tasks. Its main idea is to learn the mapping relationship of the teacher model by training a deeper student model, rather than directly learning the output of the teacher model. This method can improve the generalization ability of the model and maintain high performance when the model is lightweight. The FitNets method is suitable for knowledge transfer from large models to small models, which is consistent with the pruning and lightweight goals of the above-mentioned lightweight image object detection model. In addition, the FitNets method is also able to maintain the accuracy of the model at a smaller model size, which is very important for deploying models in resource-constrained environments.

[0076] Specifically, the specific ideas and processes of FitNets knowledge distillation method are introduced below. The process of pruning and knowledge distillation of the model includes: using the model before pruning as the teacher model, and the model after pruning as the student model, and using the knowledge distillation method and pruning method to repeatedly adjust the student model until the model converges.

[0077] More specifically, when using FitNets for knowledge distillation, five steps are usually followed: teacher model training, student model design, feature alignment, distillation loss design, and joint training. The teacher model training phase uses a large "teacher" model (usually a more complex deep neural network) to train on a large-scale dataset. The goal of the teacher model is to learn effective feature representations and complex decision boundaries to achieve higher performance. The student model design phase designs a smaller and lighter "student" model, usually with fewer parameters and computational complexity. The goal of the student model is to achieve lightweight and accelerated model while maintaining the highest possible performance. Feature alignment phase In the knowledge distillation phase, feature alignment is performed by comparing the intermediate features of the teacher model and the student model. Usually some intermediate layers or feature maps are selected for alignment to ensure that the student model can learn similar feature representations as the teacher model.

[0078] The distillation loss design stage usually designs a loss function that combines supervised learning and feature alignment to balance the trade-off between the model fitting the training data and utilizing the teacher model knowledge. The general form of this loss function can be expressed as formula (1):

[0079] L=αL supervised +(1-α)L distilati on (1)

[0080] Among them, L supervised is the traditional supervised learning loss, used to ensure that the student model performs well on the training data; L distilation is the feature alignment loss, which is used to ensure that the student model can learn feature representations similar to those of the teacher model; α is a hyperparameter that weighs the two parts of the loss, usually between 0 and 1, indicating the weight of the supervised learning loss.

[0081] L supervised and L distilation The form of L will vary depending on the specific task and model structure. supervised It can be a cross entropy loss or other supervised learning loss, which measures the difference between the student model’s predictions on the training data and the true labels. distilation It can be a loss based on feature alignment, such as Mean Squared Error or Correlation Loss, which is used to measure the similarity of features between the student model and the teacher model.

[0082] In the classification problem, the model will have a Softmax layer, which will output the probability of each category. Knowledge distillation allows the student model to fit the probability of each category output by the teacher model. The category probability output by the teacher model is also called "Soft-target", and the true value is called "Hard-target". Hard-target is like a binary distribution, with only 1 and 0, while Soft-target outputs a probability distribution. Soft-target can obtain more label category information than Hard-target, which allows the model to not only know the correct label information, but also learn other label information. Knowledge distillation is the Soft-target of the teacher model to guide the student model that uses Hard-target to learn, so that it can learn more information from Soft-target, thereby improving the model's expressiveness.

[0083] The student model needs to learn other label information from the soft label of the teacher model, but the predicted label result of the teacher model is not 100% correct. Therefore, the loss function of knowledge distillation is composed of the weighted loss function of the soft-target and the hard-target loss function, as shown in formula (2).

[0084] L=αL soft +βL hard (2)

[0085] In the above knowledge distillation loss function formula, the weights α and β range between 0 and 1. soft represents the discreteness between the probability distributions output by the teacher and student models, L hard Represents the cross entropy of the input image label and the probability distribution of the network output, that is, the loss between the probability distribution of the softmax output and the label.

[0086] The knowledge distillation process is as follows Figure 6 As shown in the figure, the trained model before pruning uses a higher "temperature" T value to construct Soft-labels, while the pruned model uses a higher "temperature" T value to construct Soft predictions and uses T = 1 to construct Hard predictions. Finally, different loss function values ​​are obtained by calculation with different labels, and then the final loss function is obtained by formula (2).

[0087] Usually, the accuracy of deep neural networks tends to decrease after pruning. Fine-tuning can restore the accuracy of the pruned model to a certain extent, but when too many parameters are pruned, the capacity of the pruned model will drop so much that it cannot be restored to its original accuracy. This application prunes the teacher model to construct a student model with a similar structure, and uses knowledge distillation instead of the fine-tuning process to make up for the accuracy loss caused by pruning, thereby achieving a complementary combination of pruning and knowledge distillation methods. Therefore, this application uses the pruned model as the student model and the pre-pruning model as the teacher model to achieve better knowledge transfer effects. The pruning + knowledge distillation process of this application is as follows: Figure 7 shown.

[0088] The following is a specific experiment to illustrate the effect of the lightweight target detection method for surveillance video images described in this application on improving the accuracy and detection speed of target detection in surveillance video images.

[0089] The detection experiment uses the Face Mask Detection YOLO Darknet Format public dataset, which contains 6,900 images in total. This dataset contains background buildings of various styles from different countries, as well as travel, shopping, interviews and other situations, and is highly robust. Each photo has a txt file with the same name as the photo that records its annotated coordinates and annotated category (0: no mask, 1: with mask). Some images have dynamic blur or grayscale images, which increases the difficulty of detection.

[0090] The evaluation indicators used in the experiment are precision, recall, average precision (mAP) and GFLOPs (Giga Floating-point Operations Per Second). Among them, mAP is the average of the AP values ​​of all categories, and AP is the average of the PR curve composed of precision and recall. mAP@0.5 sets the IoU value to 0.5, calculates the AP value of all images in each category, and then averages the AP values ​​of these categories. mAP@0.5:0.95 represents the average mAP at different IoU thresholds (from 0.5 to 0.95, step size 0.05) (0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95).

[0091] Before the experiment, the Face Mask Detection YOLO Darknet Format dataset was preprocessed. The preprocessed dataset was passed to each model for experiment. The experimental results are shown in Table 2:

[0092] Table 2

[0093]

[0094]

[0095] As can be seen from Table 2, the method of the present invention is superior to the original YOLOv5s in comprehensive detection performance and GFLOPs, and mAP50 is improved by 1.6%. This shows that the Decoupled Head detection head, CARAFE, SPPF-A and CBAM attention do have an improvement effect in detection, proving that the method of the present invention is effective.

[0096] Figure 8 The detection results of the monitoring video images, where the left column is the image with the original annotation information, the middle column is the image obtained by the detection of YOLOv5s, and the right column is the image obtained by the detection method of the present application. It can be seen that YOLOv5s has false detections in complex backgrounds and high concurrent detections, and the detection accuracy is low. The robustness of the method of the present application is significantly better, and the recognition accuracy is higher for backlight, side and head-down situations.

[0097] In order to verify that the improved part can improve the model performance, an ablation experiment is conducted. The ablation experiment will remove one of the improved modules one by one, restore the improved structure to the original YOLOv5 module, and test the influence of different structures on the results by comparing the mAP results. The results are shown in Table 3:

[0098] Table 3

[0099]

[0100] It is not difficult to see from Table 3 that when the Decoupled Head is not used, the average precision mAP50 decreases by about 0.5%, indicating that the Decoupled Head can pay more attention to the edge and texture information in the picture; when DSF is not used, the average precision mAP50 decreases by about 1.2%, indicating that the DSF residual feature extraction module can better retain feature information; when CBAM is not used, the average precision mAP50 decreases by about 0.8%, indicating that the attention module can extract more accurate feature information for images with blurred backgrounds; when SPPF_A is not used, the average precision mAP50 decreases by about 0.3%, indicating that feature extraction has a greater impact on recognition.

[0101] Table 4 below lists the performance indicators after replacing FasterNet. It can be seen that after YOLOv5s integrates FasterNet, the mAP is significantly improved compared with the default backbone network of YOLOv5s, from 70.7 to 74.1. At the same time, the number of images processed per second has also improved, from 151 images to 168 images, which shows the high efficiency of DSF in target detection.

[0102] Table 4

[0103]

[0104] Based on the same inventive concept, the present invention also provides a lightweight target detection device for monitoring video images, and the lightweight target detection device can be a personal computer, a server, or other devices that implement the aforementioned lightweight target detection method.

[0105] Specifically, the lightweight target detection device for monitoring video images includes:

[0106] Memory for storing computer programs;

[0107] A processor is used to implement the steps of the above-mentioned lightweight target detection method for monitoring video images when executing the computer program.

[0108] The lightweight target detection device can be any terminal device including a mobile phone, a laptop computer, a desktop computer, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, etc.

[0109] Based on the same inventive concept, the present invention also provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned lightweight target detection method for monitoring video images are implemented.

[0110] Through the description of the above implementation mode, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present invention, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0111] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and the implementation modes, and they can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.

Claims

1. A lightweight target detection method for surveillance video images, characterized in that: include: Acquire video images; Preprocess the video image; Image target detection is performed using a lightweight image target detection model improved based on YOLOv5s; Among them, the method for improving the lightweight image target detection model based on YOLOv5s includes: replacing the SPPF module in the YOLOv5s backbone network with an SPPF-A module, and inserting a CBAM module before the SPPF-A module; The SPPF-A module includes a Conv module, an MPC module and a Conv module connected in series. The MPC module includes: a first pooling layer, a second pooling layer and a third pooling layer connected in series, a first fusion layer for fusing features obtained from the first pooling layer and features obtained from the third pooling layer, a fourth pooling layer connected in series with the first fusion layer, and a second fusion layer for fusing features before the first pooling layer and features obtained from the first pooling layer to the fourth pooling layer.

2. The lightweight target detection method for surveillance video images according to claim 1, characterized in that: The method for improving the lightweight image target detection model based on YOLOv5s also includes: replacing the C3 module in the YOLOv5s backbone network with a DSF module; The DSF module is a module obtained by replacing the Conv module in the C3 module with a DSConv module and replacing the bottleneck module in the C3 module with a FasterNet module.

3. The lightweight target detection method for surveillance video images according to claim 1, characterized in that: The method for improving the lightweight image target detection model based on YOLOv5s also includes: inserting a CARAFE module into the Neck part of YOLOv5s.

4. The lightweight target detection method for surveillance video images according to claim 1, characterized in that: The method for improving the lightweight image target detection model based on YOLOv5s also includes: using a Decoupled Head module in the head part of YOLOv5s.

5. The lightweight target detection method for surveillance video images according to any one of claims 1 to 4, characterized in that: The method for improving the lightweight image target detection model based on YOLOv5s also includes: pruning the model and performing knowledge distillation processing.

6. The lightweight target detection method for surveillance video images according to claim 5, characterized in that: The pruning method used is the Group-wise Pruning method, and the knowledge distillation method used is the FitNets knowledge distillation method.

7. The lightweight target detection method for surveillance video images according to claim 6, characterized in that: The process of pruning and knowledge distilling the model includes: using the model before pruning as the teacher model, the model after pruning as the student model, and repeatedly adjusting the student model using the knowledge distillation method and the pruning method until the model converges.

8. The lightweight target detection method for surveillance video images according to claim 1, characterized in that: The method for preprocessing the video image includes: performing at least one of scaling, cropping, normalizing and labeling processing on the video image.

9. A lightweight target detection device for monitoring video images, characterized in that: include: Memory for storing computer programs; A processor, used to implement the steps of the lightweight target detection method for monitoring video images as described in any one of claims 1 to 8 when executing the computer program.

10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the lightweight target detection method for monitoring video images according to any one of claims 1 to 8 are implemented.

Citation Information

Cited By

  • Lightweight target detection method based on content awareness

    CN119579864A