Method, device, equipment and medium for object detection in video images

By improving YOLOv5 and using multiple feature extraction and feature fusion methods, the accuracy shortcomings of YOLOv5 are solved and the accuracy of target detection in video images is significantly improved.

CN114359789BActive Publication Date: 2024-09-17SHENZHEN ZTE NETVIEW TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111532255.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-15
Publication Date
2024-09-17
Estimated Expiration
2041-12-15

AI Technical Summary

Technical Problem

The current target detection algorithm based on YOLOv5 has insufficient accuracy, resulting in low accuracy in target detection.

Method used

By improving YOLOv5, multiple feature extraction and feature fusion methods are adopted, including multiple feature extraction and pixel-by-pixel fusion operations, to fuse high-level and low-level features together, generate multiple detection results and perform post-processing to improve detection accuracy. .

Benefits of technology

It significantly improves the accuracy of target detection in video images, avoids the loss of information in feature maps, and improves the target detection performance of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114359789B
    Figure CN114359789B
Patent Text Reader

Abstract

The present application discloses a method, device, equipment and medium for object detection in video images, which obtains an image to be detected and inputs it into an object detection network improved based on YOLOv5; extracts a first feature from the image to be detected to obtain a first feature map; performs first feature fusion, second feature fusion and third feature fusion based on the first feature map to obtain a first fused feature map, a second fused feature map and a third fused feature map; extracts a second feature from the first fused feature map, the second fused feature map and the third fused feature map to obtain a first target feature map, a second target feature map and a third target feature map; generates a first detection result, a second detection result and a third detection result based on the first target feature map, the second target feature map and the third target feature map; and performs post-processing on the first detection result, the second detection result and the third detection result to obtain a target detection result. The present application can improve the accuracy of object detection in video images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computer vision target detection, and in particular to a method, device, equipment and medium for detecting a target in a video image. Background Art

[0002] Object detection is a very popular direction in the field of computer vision and digital image processing. It is widely used in many fields such as robot cruising, autonomous driving, industrial monitoring, and smart security, which can reduce certain labor costs for companies. At present, the research hotspots of object detection technology based on deep learning mainly focus on two-stage object detection based on FasterRCNN; one-stage object detection based on YOLO (You Only Look Once) series, SSD series, and RetinaNet; AnchorFree ideas based on CenterNet and attention ideas based on Swin Transformer. Considering the algorithm deployment cost, one-stage object detection algorithms are often more popular in the industry and have been widely used. The latest YOLOv5 algorithm has reached the SOTA level in both accuracy and speed, and has been unanimously praised in the field of object detection in the industry. However, research has found that even the latest YOLOv5 algorithm still has insufficient accuracy in its algorithm model, resulting in low accuracy in the current object detection based on YOLOv5. Summary of the invention

[0003] The main purpose of the present application is to provide a method, device, equipment and medium for object detection in video images, aiming to solve the technical problem of low accuracy in current object detection.

[0004] To achieve the above object, an embodiment of the present application provides a method for detecting an object in a video image, the method comprising:

[0005] Obtain an image to be detected, and input the image to be detected into an object detection network improved based on YOLOv5;

[0006] Performing a first feature extraction on the image to be detected based on the target detection network to obtain a first feature map;

[0007] Performing a first feature fusion based on the first feature map to obtain a first fused feature map, performing a second feature extraction on the first fused feature map to obtain a first target feature map, and generating a first detection result based on the first target feature map;

[0008] Performing a second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map, performing the second feature extraction on the second fused feature map to obtain a second target feature map, and generating a second detection result based on the second target feature map;

[0009] Performing a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map, performing the second feature extraction on the third fused feature map to obtain a third target feature map, and generating a third detection result based on the third target feature map;

[0010] The first detection result, the second detection result, and the third detection result are post-processed to obtain a target detection result.

[0011] Preferably, the step of performing second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map includes:

[0012] Performing a third feature extraction on the first feature map to obtain a second feature map;

[0013] Performing a fourth feature extraction on the first target feature map to obtain a third feature map;

[0014] A second feature fusion is performed on the second feature map, the third feature map and the first target feature map to obtain a second fused feature map.

[0015] Preferably, the step of performing first feature fusion based on the first feature map to obtain a first fused feature map includes:

[0016] Performing a fifth feature extraction on the first feature map to obtain a fourth feature map;

[0017] A first feature fusion is performed on the first feature map and the fourth feature map to obtain a first fused feature map.

[0018] Preferably, the step of extracting the fifth feature from the first feature map to obtain the fourth feature map includes:

[0019] Performing a third feature extraction on the first feature map to obtain a fifth feature map;

[0020] Performing a sixth feature extraction on the fifth feature map to obtain a sixth feature map;

[0021] Performing a fourth feature fusion on the fifth feature map and the sixth feature map to obtain a fourth fused feature map;

[0022] Perform a seventh feature extraction on the fourth fused feature map to obtain a fourth feature map.

[0023] Preferably, the step of performing a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map comprises:

[0024] Performing a fourth feature extraction on the second target feature map to obtain a seventh feature map;

[0025] Performing an eighth feature extraction on the first feature map to obtain an eighth feature map;

[0026] A third feature fusion is performed on the seventh feature map and the eighth feature map to obtain a third fused feature map.

[0027] Preferably, the first feature extraction, the second feature extraction, the third feature extraction, the fourth feature extraction, the fifth feature extraction, the sixth feature extraction, the seventh feature extraction and the eighth feature extraction respectively include different feature extraction operations.

[0028] Preferably, before the step of inputting the image to be detected into the target detection network improved based on YOLOv5, it also includes:

[0029] Obtaining initial video images as training data;

[0030] For the initial detection network improved based on YOLOv5, pre-training based on motion blur is performed through the training data to obtain a target detection network.

[0031] To achieve the above-mentioned purpose, the present application further provides a device for detecting an object in a video image, the device comprising:

[0032] An acquisition module is used to acquire an image to be detected and input the image to be detected into an object detection network improved based on YOLOv5;

[0033] A feature extraction module, used for performing a first feature extraction on the image to be detected based on the target detection network to obtain a first feature map;

[0034] A first feature fusion module, configured to perform first feature fusion based on the first feature map to obtain a first fused feature map, perform second feature extraction on the first fused feature map to obtain a first target feature map, and generate a first detection result based on the first target feature map;

[0035] A second feature fusion module, configured to perform a second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map, perform the second feature extraction on the second fused feature map to obtain a second target feature map, and generate a second detection result based on the second target feature map;

[0036] A third feature fusion module, configured to perform a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map, perform the second feature extraction on the third fused feature map to obtain a third target feature map, and generate a third detection result based on the third target feature map;

[0037] A post-processing module is used to post-process the first detection result, the second detection result, and the third detection result to obtain a target detection result.

[0038] Furthermore, to achieve the above-mentioned purpose, the present application also provides a target detection device for video images, which includes a memory, a processor, and a target detection program for video images stored in the memory and executable on the processor, and the target detection program for video images implements the steps of the above-mentioned target detection method for video images when executed by the processor.

[0039] Furthermore, to achieve the above-mentioned purpose, the present application also provides a medium, which is a computer-readable storage medium, on which a target detection program for video images is stored, and when the target detection program for video images is executed by a processor, the steps of the above-mentioned target detection method for video images are implemented.

[0040] Furthermore, to achieve the above-mentioned purpose, the present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned object detection method for video images when executed by a processor.

[0041] The embodiment of the present application provides a method, apparatus, device and medium for target detection of video images, which obtain a video image to be detected, input the video image to be detected into a target detection network improved based on YOLOv5; perform a first feature extraction on the image to be detected based on the target detection network to obtain a first feature map; perform a first feature fusion based on the first feature map to obtain a first fused feature map, perform a second feature extraction on the first fused feature map to obtain a first target feature map, and generate a first detection result based on the first target feature map; perform a second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map, perform the second feature extraction on the second fused feature map to obtain a second target feature map, and generate a second detection result based on the second target feature map; perform a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map, perform the second feature extraction on the third fused feature map to obtain a third target feature map, and generate a third detection result based on the third target feature map; post-process the first detection result, the second detection result and the third detection result to obtain a target detection result. The present application can extract features of the video image to be detected through the target detection network improved based on YOLOv5, and perform feature fusion on each feature map of feature extraction, fuse high-level and low-level features together to obtain a fused feature map, and after extracting features from each fused feature map, generate multiple detection results based on the obtained target feature maps, generate the final detection result from the multiple detection results, avoid the loss of information in the feature map, and greatly improve the accuracy of target detection in the video image. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 A schematic diagram of the structure of the hardware operating environment involved in the embodiment of the method for object detection in video images of the present application;

[0043] Figure 2 A schematic diagram of the flow chart of the first embodiment of the object detection method of video images of the present application;

[0044] Figure 3 A schematic diagram of a flow chart of a second embodiment of a method for object detection in video images of the present application;

[0045] Figure 4 This is a schematic diagram of feature fusion in the second embodiment of the present application;

[0046] Figure 5 This is a schematic diagram of splicing feature maps in the original YOLOv5;

[0047] Figure 6 A schematic diagram of the overall detection process of video image detection in this application;

[0048] Figure 7 Schematic diagram of functional modules of a preferred embodiment of the object detection device for video images of the present application.

[0049] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0050] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0051] The embodiment of the present application provides a method, apparatus, device and medium for target detection of video images, which obtain a video image to be detected, input the video image to be detected into a target detection network improved based on YOLOv5; perform a first feature extraction on the image to be detected based on the target detection network to obtain a first feature map; perform a first feature fusion based on the first feature map to obtain a first fused feature map, perform a second feature extraction on the first fused feature map to obtain a first target feature map, and generate a first detection result based on the first target feature map; perform a second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map, perform the second feature extraction on the second fused feature map to obtain a second target feature map, and generate a second detection result based on the second target feature map; perform a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map, perform the second feature extraction on the third fused feature map to obtain a third target feature map, and generate a third detection result based on the third target feature map; post-process the first detection result, the second detection result and the third detection result to obtain a target detection result. The present application can extract features of the video image to be detected through the target detection network improved based on YOLOv5, and perform feature fusion on each feature map of feature extraction, fuse high-level and low-level features together to obtain a fused feature map, and after extracting features from each fused feature map, generate multiple detection results based on the obtained target feature maps, generate the final detection result from the multiple detection results, avoid the loss of information in the feature map, and greatly improve the accuracy of target detection in the video image.

[0052] like Figure 1 As shown, Figure 1 It is a schematic diagram of the structure of a target detection device for video images in a hardware operating environment involved in an embodiment of the present application.

[0053] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.

[0054] The target detection device of the video image in the embodiment of the present application can be a PC, or a portable terminal device such as a tablet computer or a portable computer.

[0055] like Figure 1 As shown, the target detection device of the video image may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0056] Those skilled in the art will understand that Figure 1 The structure of the object detection device for video images shown in the figure does not constitute a limitation on the object detection device for video images, and may include more or less components than those shown in the figure, or combine certain components, or arrange the components differently.

[0057] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a target detection program for video images.

[0058] exist Figure 1 In the device shown, the network interface 1004 is mainly used to connect to the backend server and perform data communication with the backend server; the user interface 1003 is mainly used to connect to the client (user end) and perform data communication with the client; and the processor 1001 can be used to call the target detection program of the video image stored in the memory 1005, and perform the following operations:

[0059] Obtain an image to be detected, and input the image to be detected into an object detection network improved based on YOLOv5;

[0060] Performing a first feature extraction on the image to be detected based on the target detection network to obtain a first feature map;

[0061] Performing a first feature fusion based on the first feature map to obtain a first fused feature map, performing a second feature extraction on the first fused feature map to obtain a first target feature map, and generating a first detection result based on the first target feature map;

[0062] Performing a second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map, performing the second feature extraction on the second fused feature map to obtain a second target feature map, and generating a second detection result based on the second target feature map;

[0063] Performing a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map, performing the second feature extraction on the third fused feature map to obtain a third target feature map, and generating a third detection result based on the third target feature map;

[0064] The first detection result, the second detection result, and the third detection result are post-processed to obtain a target detection result.

[0065] Furthermore, the step of performing second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map includes:

[0066] Performing a third feature extraction on the first feature map to obtain a second feature map;

[0067] Performing a fourth feature extraction on the first target feature map to obtain a third feature map;

[0068] A second feature fusion is performed on the second feature map, the third feature map and the first target feature map to obtain a second fused feature map.

[0069] Furthermore, the step of performing first feature fusion based on the first feature map to obtain a first fused feature map includes:

[0070] Performing a fifth feature extraction on the first feature map to obtain a fourth feature map;

[0071] A first feature fusion is performed on the first feature map and the fourth feature map to obtain a first fused feature map.

[0072] Furthermore, the step of extracting the fifth feature from the first feature map to obtain the fourth feature map includes:

[0073] Performing a third feature extraction on the first feature map to obtain a fifth feature map;

[0074] Performing a sixth feature extraction on the fifth feature map to obtain a sixth feature map;

[0075] Performing a fourth feature fusion on the fifth feature map and the sixth feature map to obtain a fourth fused feature map;

[0076] Perform a seventh feature extraction on the fourth fused feature map to obtain a fourth feature map.

[0077] Furthermore, the step of performing a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map includes:

[0078] Performing a fourth feature extraction on the second target feature map to obtain a seventh feature map;

[0079] Performing an eighth feature extraction on the first feature map to obtain an eighth feature map;

[0080] A third feature fusion is performed on the seventh feature map and the eighth feature map to obtain a third fused feature map.

[0081] Further, the first feature extraction, the second feature extraction, the third feature extraction, the fourth feature extraction, the fifth feature extraction, the sixth feature extraction, the seventh feature extraction and the eighth feature extraction respectively include different feature extraction operations.

[0082] Furthermore, before the step of inputting the image to be detected into the target detection network improved based on YOLOv5, the processor 1001 can be used to call the target detection program of the video image stored in the memory 1005, and perform the following operations:

[0083] Obtaining initial video images as training data;

[0084] For the initial detection network improved based on YOLOv5, pre-training based on motion blur is performed through the training data to obtain a target detection network.

[0085] In order to better understand the above technical solution, exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0086] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0087] Reference Figure 2 , Figure 2 The following is a flow chart of a method for detecting an object in a video image provided in the first embodiment of the present application. In this embodiment, the method for detecting an object in a video image includes the following steps:

[0088] Step S10, obtaining an image to be detected, and inputting the image to be detected into an object detection network improved based on YOLOv5;

[0089] The target detection method of video images in this embodiment can be applied to the target detection system of video images, and the target detection method of video images can be performed by the target detection system of video images. It can be understood that for the convenience of description, the target detection system of video images will be referred to as the system in the future. It should be noted that while the field of deep learning images is growing and developing, many vision-based deep learning algorithms have been implemented. For general algorithm models, when the training data is sufficient, the higher the model complexity, the better the model prediction effect. The increase in model complexity is often accompanied by the model reasoning speed (that is, the longer it takes to input a picture into the model to predict the result), and the video memory occupied by the model is gradually increased. Due to the global chip shortage, GPU resources are more precious, so small models and high precision have also become problems that must be solved. As a target detection algorithm with excellent performance and reasoning speed at the moment, YOLOv5 has been unanimously recognized by everyone in industrial implementation, so this embodiment is improved based on YOLOv5, wherein YOLOv5 (You Only Look Once) is a single-stage target detection algorithm released by Uitralytics LLC. The feature fusion module improvement and motion blur strategy proposed in this embodiment can significantly improve the model performance while hardly affecting the model reasoning speed, and significantly improve the target detection algorithm effect under video surveillance. The target detection method of video images in this embodiment can be specifically combined with video surveillance for non-motor vehicle detection, and can also be used for target detection in scenes such as robot cruising, autonomous driving, industrial monitoring, and smart security.

[0090] It can be understood that before the step of inputting the image to be detected into the target detection network improved based on YOLOv5, it also includes:

[0091] Step A1, obtaining an initial video image as training data;

[0092] Step A2, for the initial detection network improved based on YOLOv5, pre-training based on motion blur is performed through the training data to obtain a target detection network.

[0093] Before step S10, after improving yolov5, this embodiment needs to train the improved initial detection network so that the network has better detection performance. Specifically, first obtain the initial video image as training data, wherein the initial video image includes a video image with normal clarity and a video image with motion blur, and motion blur is a static scene or a series of pictures like a movie or a fast-moving object in an animation that causes obvious blurred dragging marks. Because in the implementation of industrial security and smart city projects, the use of deep learning to detect non-motor vehicles under relevant cameras is a relatively common task. However, due to the current popular video codecs (such as H264, etc.), the original video will be encoded and decoded (reducing storage and network bandwidth operations. If this operation is not performed, video storage requires a large amount of memory, disk space and network bandwidth). Due to the incompleteness of the current codec, motion blur often occurs. For neural networks, there is a strong sensitivity to data, and the state distribution, quality distribution, and scene distribution of the data will have a certain impact on the performance of the model. Considering the good quality of most open source data and training data, it does not match the motion blur in actual applications. Therefore, in the process of training the model, this embodiment randomly probabilistically selects (sets a probability value, such as 0.5, and generates a random number each time the dataloader is built, and compares it with 0.5. If it is larger than it, a motion blurred image is generated, otherwise it is not generated) to add motion blur to the image, so as to train the improved initial detection network by including video images with normal clarity and video images with motion blur as training data, increase the model's ability to understand images under the motion model, and obtain the target detection network. The specific training process can refer to the existing model training, and will not be elaborated in detail in this embodiment.

[0094] In step S10, the system can obtain the image to be detected through video surveillance. If the target detection method of the video image in this embodiment is applied to non-motor vehicle detection, the video frame in the surveillance video uploaded by the video surveillance can be obtained as the image to be detected. Further, the acquired image to be detected is input into the target detection network improved and pre-trained based on YOLOv5, so as to facilitate the subsequent feature extraction and feature fusion of the image to be detected through the target detection network to obtain the final detection result. It can be understood that the original YOLOv5 contains an operation of splicing features of two feature maps in the channel dimension, namely the Concat operation. In this embodiment, the operation of feature splicing is improved to a feature fusion operation, namely the Addfpn operation, which adds multiple feature maps pixel by pixel in a pixel-by-pixel fusion manner. The original YOLOv5 directly splices the two feature maps, but in fact, the amount of feature information contained in each feature map is different. Directly adding them rigidly will reduce the accuracy. Therefore, in this embodiment, a trainable scale parameter will be initialized during model training, and it will be updated during network training back propagation until the model iteration is optimal. At the same time, this embodiment takes into account that the convolutional network is a process of continuous convolution and continuous downsampling. As the network deepens, the receptive field of each layer of feature maps continues to increase, but at the same time, some key information may be discarded. Therefore, this embodiment also adds shallow feature maps to make up for it. At the same time, it also adds shallow texture information (the shallow layer of the neural network learns texture information, and the high layer learns global information), which is beneficial to the network's detection of small targets. Therefore, the input feature map of the third feature fusion is increased from two to three after improvement. It should be noted that, after experimental verification, the improved feature fusion module of this embodiment significantly improves the target detection accuracy of the model.

[0095] Step S20, extracting a first feature of the image to be detected based on the target detection network to obtain a first feature map;

[0096] After the image to be detected is input into the target detection network improved based on YOLOv5, the system performs the first feature extraction on the image to be detected through the target detection network. Specifically, the image to be detected is processed through the deep learning image common kit CBL to obtain a feature map. In this embodiment, the deep learning image common kit includes conv, BN and Relu, wherein Conv is used to extract image features. Generally, the size of the feature map output by the current layer can be controlled by the step size in conv; BN is used for batch normalization; Relu is an activation function used to improve the nonlinearity of the model; therefore, CBL can be used to perform convolution, normalization and activation processing on the image to be detected. Further, the feature map obtained is extracted again through the deep learning image common kit CBL to obtain a new feature map; further, the new feature map is processed through the CSP block, which can be specifically convolution residual processing on the new feature map, wherein the CSP block can refer to the CSPNet network structure, and is composed of a convolution layer and X Res unint modules Concate. Furthermore, the feature map obtained by residual processing is processed by the common deep learning image suite CBL, and then the processed feature map is processed by the CSP block to complete the first feature extraction and obtain the first feature map, that is, the first feature extraction process in this embodiment includes the processing of CBL, CBL, CSP, CBL, and CSP. In order to facilitate subsequent feature extraction and feature fusion based on the first feature map, the high-level and low-level features are fused together to obtain a fused feature map, and the detection result is generated by the fused feature map, avoiding the loss of information in the feature map, which can greatly improve the accuracy of target detection in video images.

[0097] It should be noted that the first feature extraction and the subsequent second feature extraction, third feature extraction, fourth feature extraction, fifth feature extraction, sixth feature extraction, seventh feature extraction, and eighth feature extraction in each embodiment of the present application include different feature extraction operations. Specifically, in the present embodiment, the process of the first feature extraction includes operations such as CBL, CBL, CSP, CBL, and CSP; the process of the second feature extraction includes the CSP operation; the process of the third feature extraction includes operations such as CBL and CSP; the process of the fourth feature extraction includes the CBL operation; the process of the fifth feature extraction includes the third feature extraction and the sixth feature extraction; the process of the sixth feature extraction includes operations such as CBL, CSP, SPPF, CBL, and Upsample; the process of the seventh feature extraction includes operations such as CSP, CBL, and Upsample; the process of the eighth feature extraction includes operations such as CBL, CSP, CBL, CSP, SPPF, and CBL.

[0098] Step S30, performing a first feature fusion based on the first feature map to obtain a first fused feature map, performing a second feature extraction on the first fused feature map to obtain a first target feature map, and generating a first detection result based on the first target feature map;

[0099] After performing the first feature extraction on the image to be detected based on the target detection network and obtaining the first feature map, the fifth feature extraction is performed on the first feature map to obtain the fourth feature map; the first feature map and the fourth feature map are subjected to feature fusion, i.e., the first feature fusion, to obtain the first fused feature map. Further, the second feature extraction is performed on the first fused feature map, which can be specifically processed by the CSP block to obtain the first target feature map. Further, the first target feature map is processed by the YOLO head detection head, which can be specifically convolution processing on the first target feature map to obtain the first detection result, wherein the first detection result is essentially a feature map in the form of a vector, and contains the number and position information of the target in the image to be detected, and the second feature extraction is a feature extraction process including the CSP operation. This embodiment can obtain the first layer of detection results, and at the same time, further deep detection can be performed according to the first target feature map to obtain a deeper detection result, so that the final output detection result is more accurate.

[0100] Step S40, performing a second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map, performing the second feature extraction on the second fused feature map to obtain a second target feature map, and generating a second detection result based on the second target feature map;

[0101] After obtaining the first feature map and the first target feature map, the third feature extraction is performed on the first feature map to obtain the second feature map; and the fourth feature extraction is performed on the first target feature map to obtain the third feature map; and the second feature map, the third feature map and the first target feature map are further subjected to feature fusion, that is, second feature fusion, to obtain the second fused feature map. Further, the second fused feature map is subjected to second feature extraction, specifically, the second fused feature map is processed by the CSP block to obtain the second target feature map. Further, the second target feature map is processed by the YOLO head detection head, specifically, the second target feature map is subjected to convolution processing to obtain the second detection result, wherein the second detection result is essentially a feature map in the form of a vector, and contains the number and position information of the target in the image to be detected. This embodiment can obtain the second layer of detection results, and at the same time, a deeper detection can be further performed according to the second target feature map to obtain a deeper detection result, so that the final output detection result is more accurate.

[0102] Step S50, performing a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map, performing the second feature extraction on the third fused feature map to obtain a third target feature map, and generating a third detection result based on the third target feature map;

[0103] After obtaining the first feature map and the second target feature map, the fourth feature extraction is performed on the second target feature map to obtain the seventh feature map; and the seventh feature extraction is performed on the first feature map to obtain the eighth feature map; and the seventh feature map and the eighth feature map are further subjected to feature fusion, that is, the third feature fusion, to obtain the third fused feature map. Further, the second feature extraction is performed on the third fused feature map, which can be specifically processed by the CSP block to obtain the third target feature map. Further, the third target feature map is processed by the YOLO head detection head, which can be specifically convolution processing on the third target feature map to obtain the third detection result, wherein the third detection result is essentially a feature map in the form of a vector, and contains the number and position information of the target in the image to be detected. This embodiment can obtain the third layer of detection results, so as to determine a higher accuracy detection result as the target detection result based on the third detection result combined with the aforementioned first detection result and the second detection result, so that the final output detection result is more accurate.

[0104] Step S60, post-processing the first detection result, the second detection result, and the third detection result to obtain a target detection result.

[0105] After obtaining the first detection result, the second detection result and the third detection result respectively, the first detection result, the second detection result and the third detection result are post-processed. Specifically, the number of targets in the first detection result, the second detection result and the third detection result is counted, and repeated targets are further filtered out. More specifically, targets with the same position information can be filtered out to obtain the number of remaining targets and the position information of each target as the target detection result. The target detection network improved based on YOLOv5 is used to extract features of the video image to be detected, and the feature map of the feature extraction is fused. The high-level and low-level features are fused together to obtain a fused feature map, and the detection result is generated by the fused feature map to avoid the loss of information in the feature map, which can greatly improve the accuracy of target detection in the video image.

[0106] The present embodiment provides a method for object detection of a video image, which comprises the following steps: obtaining a video image to be detected, inputting the video image to be detected into an object detection network improved based on YOLOv5; performing a first feature extraction on the image to be detected based on the object detection network to obtain a first feature map; performing a first feature fusion based on the first feature map to obtain a first fused feature map, performing a second feature extraction on the first fused feature map to obtain a first target feature map, and generating a first detection result based on the first target feature map; performing a second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map, performing the second feature extraction on the second fused feature map to obtain a second target feature map, and generating a second detection result based on the second target feature map; performing a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map, performing the second feature extraction on the third fused feature map to obtain a third target feature map, and generating a third detection result based on the third target feature map; and performing post-processing on the first detection result, the second detection result, and the third detection result to obtain an object detection result. The present application can extract features of the video image to be detected through the target detection network improved based on YOLOv5, and perform feature fusion on each feature map of feature extraction, fuse high-level and low-level features together to obtain a fused feature map, and after extracting features from each fused feature map, generate multiple detection results based on the obtained target feature maps, generate the final detection result from the multiple detection results, avoid the loss of information in the feature map, and greatly improve the accuracy of target detection in the video image.

[0107] Further, refer to Figure 3 Based on the first embodiment of the target detection method for video images of the present application, a second embodiment of the target detection method for video images of the present application is proposed. In the second embodiment, the step of performing first feature fusion based on the first feature map to obtain a first fused feature map includes:

[0108] Step S31, extracting a fifth feature from the first feature map to obtain a fourth feature map;

[0109] Step S32: performing a first feature fusion on the first feature map and the fourth feature map to obtain a first fused feature map.

[0110] After performing the first feature extraction on the image to be detected and obtaining the first feature map, the fifth feature extraction is performed on the first feature map, wherein the process of the fifth feature extraction can be further divided into the process of the third feature extraction, the sixth feature extraction and the feature fusion process, and the fourth feature map is obtained after completing the fifth feature extraction. Further, the first feature fusion is performed on the first feature map and the fourth feature map, specifically, the first feature map and the fourth feature map are added pixel by pixel by pixel through the addfpn module, and the first fused feature map is obtained after completing the pixel-by-pixel addition of the two feature maps, so that the first detection result can be obtained according to the first fused feature map, and a deeper detection can be performed based on the first target feature map obtained based on the first fused feature map to obtain the second detection result and the third detection result, and the first detection result, the second detection result and the third detection result form the final detection result, by performing feature fusion on the feature map of feature extraction, the high-level and low-level features are fused together to obtain the fused feature map, and the detection result is generated by the fused feature map, so as to avoid the loss of information in the feature map, and can greatly improve the accuracy of target detection in the video image. The feature fusion principle in this embodiment can refer to Figure 4 , Figure 4 FIG. 1 is a schematic diagram of feature fusion in the second embodiment of the present application; and FIG. Figure 5 , Figure 5 The figure is a schematic diagram of splicing feature maps in the original YOLOv5. The original version directly splices two feature maps, but each feature map contains different amounts of feature information, and directly adding them together will reduce the accuracy. However, this embodiment adds multiple feature maps pixel by pixel to avoid the above problems, improve the accuracy of the feature maps, and make the result of target detection based on the feature map obtained by feature fusion more accurate.

[0111] Furthermore, the step of extracting the fifth feature from the first feature map to obtain the fourth feature map includes:

[0112] Step S311, extracting a third feature from the first feature map to obtain a fifth feature map;

[0113] Step S312, extracting a sixth feature from the fifth feature map to obtain a sixth feature map;

[0114] Step S313, performing a fourth feature fusion on the fifth feature map and the sixth feature map to obtain a fourth fused feature map;

[0115] Step S314, extracting the seventh feature from the fourth fused feature map to obtain a fourth feature map.

[0116] Specifically, when the fifth feature is extracted from the first feature map, the third feature is first extracted from the first feature map. In this embodiment, the third feature extraction process includes CBL and CSP, that is, the first feature map needs to be convolved, normalized and activated by CBL, and then the obtained feature map is processed by CSP block to obtain the fifth feature map. Further, the sixth feature is extracted from the fifth feature map. In this embodiment, the sixth feature extraction process includes CBL, CSP, SPPF, CBL, Upsample and other operations. Specifically, the first feature map is first convolved, normalized and activated by CBL, and then processed by CSP block, and then the obtained feature map is multi-scale fused (SPPF is multi-scale fusion) to increase the receptive field, and the multi-scale fused feature map is convolved, normalized and activated by CBL, and the processed feature map is upsampled to expand the image resolution to obtain the sixth feature map. After obtaining the fifth feature map and the sixth feature map, the fifth feature map and the sixth feature map are added pixel by pixel by pixel through the addfpn module, and the fourth fused feature map is obtained after the pixel-by-pixel addition of the two feature maps. Further, the seventh feature extraction is performed on the fourth fused feature map. In this embodiment, the seventh feature extraction process includes operations such as CSP, CBL, and Upsample, that is, the fourth fused feature map is processed by the CSP block, and then the processed feature map is convolved, normalized, and activated by CBL, and the processed feature map is further upsampled to obtain the fourth feature map.

[0117] Furthermore, the step of performing second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map includes:

[0118] Step S41, extracting a third feature from the first feature map to obtain a second feature map;

[0119] Step S42, performing a fourth feature extraction on the first target feature map to obtain a third feature map;

[0120] Step S43: performing a second feature fusion on the second feature map, the third feature map and the first target feature map to obtain a second fused feature map.

[0121] After obtaining the first feature map and the first target feature map, the third feature extraction is first performed on the first feature map. In this embodiment, the third feature extraction process includes CBL and CSP, that is, the first feature map needs to be convolved, normalized, and activated by CBL, and then the obtained feature map is processed by CSP block to obtain the second feature map. At the same time, the fourth feature extraction is performed on the feature map of the first target feature map. In this embodiment, the fourth feature extraction process includes CBL operation, that is, the first target feature map is convolved, normalized, and activated by CBL to obtain the third feature map. Furthermore, a second feature fusion is performed on the second feature map, the third feature map and the first target feature map. Specifically, the feature maps of the second feature map, the third feature map and the first target feature map are added pixel by pixel by pixel through the addfpn module. After completing the pixel-by-pixel addition of the three feature maps, a second fused feature map is obtained, which is convenient for subsequent obtaining of the second target feature map based on the second fused feature map and performing a deeper detection to obtain a third detection result, and the final detection result is formed by the first detection result, the second detection result and the third detection result. By performing feature fusion on the feature maps of feature extraction, high-level and low-level features are fused together to obtain a fused feature map, and the detection result is generated by the fused feature map, so as to avoid the loss of information in the feature map, and can greatly improve the accuracy of target detection in video images.

[0122] It should be noted that this embodiment takes into account that the convolutional network is a process of continuous convolution and continuous downsampling. As the network deepens, the receptive field of each layer of feature maps continues to increase, but at the same time, some key information may be discarded. Therefore, the previous shallow feature maps are also added to make up for it. In this way, the shallow texture information (the shallow layer of the neural network learns texture information, and the high layer learns global information) is also added, which is beneficial to the network's detection of small targets. Therefore, in this feature fusion, that is, the second feature fusion operation, the input is increased to three, while all feature splicing in the original YOLOv5 uses two feature maps as input.

[0123] Furthermore, the step of performing a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map includes:

[0124] Step S51, performing a fourth feature extraction on the second target feature map to obtain a seventh feature map;

[0125] Step S52, extracting an eighth feature from the first feature map to obtain an eighth feature map;

[0126] Step S53, performing a third feature fusion on the seventh feature map and the eighth feature map to obtain a third fused feature map.

[0127] After obtaining the first feature map and the second target feature map, the fourth feature extraction is performed on the second target feature map. In this embodiment, the fourth feature extraction process includes a CBL operation, that is, the second target feature map is convolved, normalized, and activated by CBL to obtain a seventh feature map. At the same time, the eighth feature extraction is performed on the first feature map. In this embodiment, the eighth feature extraction process includes CBL, CSP, CBL, CSP, SPPF, CBL and other operations, that is, the second target feature map is convolved, normalized, and activated by CBL, the obtained feature map is processed by CSP block, and then the processed feature map is convolved, normalized, and activated by CBL, and the processed feature map is further multi-scale fused and then convolved, normalized, and activated by CBL to obtain the eighth feature map. Furthermore, the third feature fusion is performed on the seventh feature map and the eighth feature map, specifically, the seventh feature map and the eighth feature map are added pixel by pixel by the addfpn module in a pixel-by-pixel fusion manner. After completing the pixel-by-pixel addition of the two feature maps, a third fused feature map is obtained, which is convenient for subsequent third detection results based on the third fused feature map, and the final detection result is formed by the first detection result, the second detection result and the third detection result. By performing feature fusion on the feature map of feature extraction, high-level and low-level features are fused together to obtain a fused feature map, and the detection result is generated by the fused feature map, so as to avoid the loss of information in the feature map, and can greatly improve the accuracy of target detection in video images.

[0128] This embodiment performs feature fusion on the feature map obtained by feature extraction, and fuses high-level and low-level features together to obtain a fused feature map, so as to facilitate the generation of detection results from the fused feature map, avoid the loss of information in the feature map, and greatly improve the accuracy of target detection in video images.

[0129] In a specific embodiment of the present application, refer to Figure 6 , Figure 6The schematic diagram of the scene of the overall detection process of the video image detection of the present application; in this embodiment, the input video image to be detected (i.e., the input data) is received, and the data is first subjected to CBL, CBL, C3 (i.e., CSP), CBL, and C3 operations in sequence to obtain the first feature map. The first feature map is further subjected to CBL and C3 operations to obtain the second feature map and the fifth feature map, i.e., the fifth feature map is essentially the same feature map as the second feature map. The fifth feature map is then subjected to CBL, CSP, SPPF, CBL, Upsample and other operations to obtain the sixth feature map, and the fourth feature map and the sixth feature map are subjected to the fourth feature fusion (addfpn) to obtain the fourth fused feature map. The fourth fused feature map is subjected to C3, CBL, Upsample and other operations to obtain the fourth feature map. The first feature map and the fourth feature map are subjected to the first feature fusion (addfpn) to obtain the first fused feature map, the first fused feature map is subjected to the C3 operation to obtain the first target feature map, and the first target feature map is processed by the YOLO head detection head to obtain the first detection result pred1. Further, the first target feature map is subjected to a CBL operation to obtain a third feature map; the second feature map, the third feature map and the first target feature map are subjected to a second feature fusion (addfpn) to obtain a second fused feature map; the second fused feature map is subjected to a C3 operation to obtain a second target feature map; the second target feature map is processed by the YOLO head detection head to obtain a second detection result pred2. Further, the second target feature map is subjected to a CBL operation to obtain a seventh feature map; the first feature map is subjected to CBL, CSP, CBL, CSP, SPPF, CBL and other operations to obtain an eighth feature map; the seventh feature map and the eighth feature map are subjected to a third feature fusion (addfpn) to obtain a third fused feature map; the third fused feature map is subjected to a C3 operation to obtain a third target feature map; the third target feature map is processed by the YOLO head detection head to obtain a third detection result. Subsequently, the first detection result, the second detection result and the third detection result can be subjected to target addition and deduplication operations to obtain the final target detection result, which may specifically include the number of targets and the location information of the targets. Among them, Backbone is a feature extractor used to extract image texture and semantic information. Commonly used ones are resnet, vgg, etc.; Neck is the neck of the network, which will perform feature screening, feature fusion and other operations; Head is the head information of the network, that is, the output of the model.

[0130] Furthermore, the present application also provides a device for detecting an object in a video image.

[0131] Reference Figure 7 , Figure 7This is a schematic diagram of the functional modules of the first embodiment of the object detection device for video images of the present application.

[0132] The object detection device of the video image comprises:

[0133] An acquisition module 10 is used to acquire an image to be detected and input the image to be detected into a target detection network improved based on YOLOv5;

[0134] A feature extraction module 20 is used to extract a first feature of the image to be detected based on the target detection network to obtain a first feature map;

[0135] A first feature fusion module 30, configured to perform first feature fusion based on the first feature map to obtain a first fused feature map, perform second feature extraction on the first fused feature map to obtain a first target feature map, and generate a first detection result based on the first target feature map;

[0136] A second feature fusion module 40 is used to perform a second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map, perform the second feature extraction on the second fused feature map to obtain a second target feature map, and generate a second detection result based on the second target feature map;

[0137] A third feature fusion module 50 is used to perform a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map, perform the second feature extraction on the third fused feature map to obtain a third target feature map, and generate a third detection result based on the third target feature map;

[0138] The post-processing module 60 is used to post-process the first detection result, the second detection result, and the third detection result to obtain a target detection result.

[0139] In addition, the present application also provides a medium, which is preferably a computer-readable storage medium, on which a target detection program for video images is stored. When the target detection program for video images is executed by a processor, the steps of each embodiment of the target detection method for video images described above are implemented.

[0140] In addition, the present application also provides a computer program product, including a computer program, which implements the steps of each embodiment of the above-mentioned object detection method for video images when executed by a processor.

[0141] In the embodiments of the target detection device, computer-readable storage medium and computer program product of the video image of the present application, all the technical features of the embodiments of the target detection method for video images mentioned above are included, and the descriptions and explanations are basically the same as those of the embodiments of the target detection method for video images mentioned above, and will not be repeated here.

[0142] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0143] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes several instructions to enable a terminal device (which can be a fixed terminal, such as an IoT smart device, including smart air conditioners, smart lights, smart power supplies, smart routers and other smart homes; it can also be a mobile terminal, including smart phones, wearable networked AR / VR devices, smart speakers, self-driving cars and many other networked devices) to execute the methods described in the various embodiments of the present application.

[0145] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for object detection in video images, It is characterized in that The object detection method of the video image comprises: Obtain an image to be detected, and input the image to be detected into an object detection network improved based on YOLOv5; Performing a first feature extraction on the image to be detected based on the target detection network to obtain a first feature map; Performing a first feature fusion based on the first feature map to obtain a first fused feature map, performing a second feature extraction on the first fused feature map to obtain a first target feature map, and generating a first detection result based on the first target feature map; Performing a second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map, performing the second feature extraction on the second fused feature map to obtain a second target feature map, and generating a second detection result based on the second target feature map; Performing a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map, performing the second feature extraction on the third fused feature map to obtain a third target feature map, and generating a third detection result based on the third target feature map; Post-processing the first detection result, the second detection result, and the third detection result to obtain a target detection result; The step of performing second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map comprises: Performing a third feature extraction on the first feature map to obtain a second feature map; Performing a fourth feature extraction on the first target feature map to obtain a third feature map; Performing a second feature fusion on the second feature map, the third feature map, and the first target feature map to obtain a second fused feature map; The step of performing first feature fusion based on the first feature map to obtain a first fused feature map includes: Performing a fifth feature extraction on the first feature map to obtain a fourth feature map; Performing a first feature fusion on the first feature map and the fourth feature map to obtain a first fused feature map; The step of extracting the fifth feature from the first feature map to obtain the fourth feature map comprises: Performing a third feature extraction on the first feature map to obtain a fifth feature map; Performing a sixth feature extraction on the fifth feature map to obtain a sixth feature map; Performing a fourth feature fusion on the fifth feature map and the sixth feature map to obtain a fourth fused feature map; Performing a seventh feature extraction on the fourth fused feature map to obtain a fourth feature map; The step of performing a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map comprises: Performing a fourth feature extraction on the second target feature map to obtain a seventh feature map; Performing an eighth feature extraction on the first feature map to obtain an eighth feature map; Performing a third feature fusion on the seventh feature map and the eighth feature map to obtain a third fused feature map; The first feature extraction, the second feature extraction, the third feature extraction, the fourth feature extraction, the fifth feature extraction, the sixth feature extraction, the seventh feature extraction and the eighth feature extraction respectively include different feature extraction operations; The first feature extraction process includes CBL, CBL, CSP, CBL, CSP; the second feature extraction process includes CSP; the third feature extraction process includes CBL and CSP; the fourth feature extraction process includes CBL; the fifth feature extraction process includes the third feature extraction and the sixth feature extraction; the sixth feature extraction process includes CBL, CSP, SPPF, CBL, Upsample; the seventh feature extraction process includes CSP, CBL, Upsample; the eighth feature extraction process includes CBL, CSP, CBL, CSP, SPPF, CBL.

2. The object detection method of video image according to claim 1, It is characterized in that Before the step of inputting the image to be detected into the target detection network improved based on YOLOv5, the method further includes: Obtaining initial video images as training data; For the initial detection network improved based on YOLOv5, pre-training based on motion blur is performed through the training data to obtain a target detection network.

3. A device for detecting an object in a video image, the device being used to implement the method according to claim 1, It is characterized in that The object detection device of the video image comprises: An acquisition module is used to acquire an image to be detected and input the image to be detected into an object detection network improved based on YOLOv5; A feature extraction module, used for performing a first feature extraction on the image to be detected based on the target detection network to obtain a first feature map; A first feature fusion module, configured to perform first feature fusion based on the first feature map to obtain a first fused feature map, perform second feature extraction on the first fused feature map to obtain a first target feature map, and generate a first detection result based on the first target feature map; A second feature fusion module, configured to perform a second feature fusion based on the first feature map and the first target feature map to obtain a second fused feature map, perform the second feature extraction on the second fused feature map to obtain a second target feature map, and generate a second detection result based on the second target feature map; A third feature fusion module, configured to perform a third feature fusion based on the first feature map and the second target feature map to obtain a third fused feature map, perform the second feature extraction on the third fused feature map to obtain a third target feature map, and generate a third detection result based on the third target feature map; A post-processing module is used to post-process the first detection result, the second detection result, and the third detection result to obtain a target detection result.

4. A device for detecting objects in video images, It is characterized in that The target detection device for video images includes a memory, a processor, and a target detection program for video images stored in the memory and executable on the processor. When the target detection program for video images is executed by the processor, the steps of the target detection method for video images as described in any one of claims 1-2 are implemented.

5. A medium, the medium being a computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a target detection program for video images, and when the target detection program for video images is executed by a processor, the steps of the target detection method for video images according to any one of claims 1 to 2 are implemented.