Object detection method and device, electronic equipment and computer storage medium

By introducing the enhanced feature extraction module into the YOLO model, the problem of insufficient feature extraction capabilities of the YOLO model in mask wearing detection is solved, the accuracy and adaptability of detection are improved, and more efficient mask wearing detection is achieved.

CN118799607APending Publication Date: 2024-10-18CHINA MOBILE GROUP ANHUI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311465840.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-02
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

In the existing technology, when the YOLO model is used for mask wearing detection, the detection accuracy is not high enough. This is mainly due to its insufficient feature extraction capability, which leads to a decrease in detection accuracy in different environments.

Method used

By introducing the first sub-module and the second sub-module into the YOLO model, the target space features, channel features, and receptive fields are respectively enhanced to extract richer feature information and improve detection accuracy. The first sub-module enhances the spatial and channel features of the feature map through the kmeans clustering algorithm and CBAM module, and the second sub-module enhances the receptive field through the spatial pyramid pooling module to obtain richer local feature information.

Benefits of technology

It significantly improves the accuracy of mask wearing detection, enhances the model's adaptability and detection performance in different environments, and improves the ability to identify the location of small objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118799607A_ABST
    Figure CN118799607A_ABST
Patent Text Reader

Abstract

The invention discloses an object detection method and device, electronic equipment and a computer storage medium. Inputting the first image into a first model to obtain an object detection result of the first image; wherein the first model is used for acquiring a first feature map and a second feature map of a first image; enhancing a target spatial feature and a target channel feature of the first feature map through a first sub-module to obtain a third feature map; enhancing the receptive field of the second feature map through a second sub-module to obtain a fourth feature map; and determining a detection result of the first image according to the third feature map and the fourth feature map. According to the embodiment of the invention, more features can be extracted, and the detection accuracy is increased along with the increase of the features, so that a better detection effect is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of image technology, and in particular relates to object detection methods, devices, electronic devices and computer storage media. Background Art

[0002] When people gather in public places, if some people do not wear masks accurately as required, they will face serious risks of transmission. We can obtain the on-site situation of public places in real time through monitoring, and use algorithms to identify and judge the videos or photos obtained by monitoring to detect whether people are wearing masks. However, in the existing technology, due to the weak ability of the YOLO model to extract features, the detection accuracy of using the YOLO model for mask wearing is not high enough. Summary of the invention

[0003] The embodiments of the present application provide an object detection method, device, electronic device and computer storage medium, which can optimize the model and improve the accuracy of detecting mask wearing.

[0004] On the one hand, an embodiment of the present application provides an object detection method, the method comprising:

[0005] Inputting the first image into the first model to obtain an object detection result of the first image;

[0006] Among them, the first model is used for:

[0007] Acquire a first feature map and a second feature map of the first image;

[0008] Enhance the target spatial features and the target channel features of the first feature map by the first submodule to obtain a third feature map;

[0009] The receptive field of the second feature map is enhanced by the second submodule to obtain a fourth feature map;

[0010] An object detection result of the first image is determined according to the third feature map and the fourth feature map.

[0011] In another aspect, an object detection apparatus comprises:

[0012] An acquisition module: inputs a first image into a first model to obtain an object detection result of the first image;

[0013] Wherein, the first model is used for:

[0014] Acquire a first feature map and a second feature map of the first image;

[0015] Enhance the target spatial features and the target channel features of the first feature map by the first submodule to obtain a third feature map;

[0016] Enhance the receptive field of the second feature map by the second submodule to obtain a fourth feature map;

[0017] An object detection result of the first image is determined according to the third feature map and the fourth feature map.

[0018] On the other hand, an embodiment of the present application provides an electronic device, comprising: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the object detection method as described above is implemented.

[0019] On the other hand, an embodiment of the present application provides a computer storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the object detection method as described above is implemented.

[0020] The object detection method, device, equipment and computer storage medium of the embodiment of the present application, on the one hand, can enhance the target space features and target channel features of the first feature map through the first submodule, so as to better perceive the size and position features of the first feature map, so as to more accurately identify the object in the first feature map and determine the position of the object. On the other hand, the receptive field of the second feature map can be enhanced by the second submodule, and richer local feature information in the second feature map can be obtained, thereby enhancing the expression ability of the feature information of the second feature map. It can be seen that the embodiment of the present application can extract more features, and as the number of features increases, the accuracy of detection also increases, thereby achieving better detection effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0022] Figure 1 is a flowchart of an object detection method provided by an embodiment of the present application;

[0023] Figure 2 is a structural schematic diagram of a first model of an embodiment of the present application;

[0024] Figure 3 is a schematic diagram of a lightweight processing structure of an embodiment of the present application;

[0025] Figure 4 is a schematic diagram of the structure of a first submodule provided by an embodiment of the present application;

[0026] Figure 5 is a schematic diagram of the structure of a second submodule provided by an embodiment of the present application;

[0027] Figure 6 is a schematic diagram of the structure of an object detection device provided by an embodiment of the present application;

[0028] Figure 7 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0029] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0030] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants 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, the elements defined by the statement "include..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0031] In order to solve the problems in the prior art, the embodiments of the present application provide an object detection method, device, electronic device and computer storage medium. The object detection method provided by the embodiments of the present application is first introduced below.

[0032] The method can be implemented by a first model, which can be a YOLO model, and the first image is input into the first model to obtain an object detection result of the first image. In some embodiments, the first image is obtained by intercepting a video.

[0033] In one example, a computer host with a GTX1060 graphics card and 6GB of video memory can be used to load the first model and a high-definition camera to be responsible for the collection of early images and the real-time video detection of later personnel, wherein the images collected in the early stage are used to train the first model, and the videos collected in the later stage are used to detect objects. The video of the target area is collected by the camera. After the collection is completed, the video is divided into frames to obtain JPG format images. For example, the screen of the video shot once every 35 frames is intercepted by a cross-platform computer vision and machine learning software library, and the obtained images will be used as training samples, wherein the intercepted images include photos of people wearing masks effectively, photos of people not wearing masks, and photos of people not wearing masks effectively. By avoiding the use of frame-by-frame interception, the sample volume can be enriched while avoiding too many similar images, thereby improving the training quality.

[0034] In the process of training the first model, after obtaining the first image, the first image needs to be data enhanced to simulate different environments, which can be environments under different light and weather, such as daytime environment, nighttime environment, sunny environment, rainy environment, etc. After the first model is trained, if images under different environments are obtained, the accuracy of image detection may decrease. For example, in an image obtained during the day, the detection result may be that the person in the image is effectively wearing a mask, but in an image obtained at night, the detection result may be that the person in the image is not effectively wearing a mask. In order to prevent the detection accuracy of the first model from changing with the environment, before training the first model, the first image is data enhanced to imitate images obtained in different environments, improve the fitness of the first model, and effectively increase the randomness and richness of the data. The specific process of data enhancement can be as follows: first set a threshold of 0.5, and generate a random number p between 0 and 1. If the random number p is less than 0.5, mosaic enhancement is selected; if the random number p is greater than or equal to 0.5, Gaussian noise, Gaussian blur, contrast or brightness are randomly added for data enhancement.

[0035] Figure 1 FIG. 1 is a flow chart of an object detection method provided by an embodiment of the present application. Figure 1 As shown, the execution steps of this method are as follows:

[0036] S101: Acquire a first feature map and a second feature map of a first image.

[0037] A feature is an information expression of an intermediate or final product of an expected result. A feature map is composed of features. A feature map can be measured by length, bandwidth and channel. A new feature map can be obtained by extracting features from a feature map. Features may include color features, texture features, shape features, spatial features and channel features. In some embodiments, the first image is subjected to feature extraction by using convolution processing, pooling processing, connection, etc. to obtain a first feature map and a second feature map. In some embodiments, the length and width of the first feature map and the second feature map may be 13×13, 26×26 or 52×52.

[0038] S102: Enhance the target spatial features and the target channel features of the first feature map through the first submodule to obtain a third feature map.

[0039] In some embodiments, the spatial features and channel features of the first feature map are extracted by the first submodule to obtain the third feature map. For example, the spatial features of the first feature map can be obtained by clustering K adjacent channels in the first feature map using a kmeans clustering algorithm.

[0040] S103: Enhance the receptive field of the second feature map through the second sub-module to obtain a fourth feature map.

[0041] In a convolutional neural network, the definition of the receptive field is the size of the area mapped on the input image by the pixel points on the feature map output by each layer of the convolutional neural network. That is, a point on the feature map corresponds to an area on the map, and the size of the receptive field should be greater than or equal to the size of the input image, which is conducive to improving subsequent detection performance. In some embodiments, the receptive field of the second feature map can be improved by the second submodule, so that the receptive field of the obtained fourth feature map is larger than the second feature map.

[0042] S104: Determine an object detection result of the first image according to the third feature map and the fourth feature map.

[0043] In some embodiments, the third feature map can detect medium-sized objects and obtain object detection results, and the fourth feature map can detect small objects and obtain object detection results; or the third feature map can detect large objects and obtain object detection results, and the fourth feature map can detect medium-sized objects and obtain object detection results. Large objects may refer to objects that account for a large proportion of the image, such as trucks and houses, medium-sized objects may refer to objects that account for a medium proportion of the image, such as pedestrians and electric vehicles, and small objects may refer to objects that account for a small proportion of the image, such as masks, work badges, and hats.

[0044] In the embodiments of the present application, the object detection method, apparatus, device and computer storage medium of the embodiments of the present application, on the one hand, can enhance the target space features and target channel features of the first feature map through the first submodule, thereby better perceiving the size and position features of the first feature map, so as to more accurately identify the object in the first feature map and determine the position of the object. On the other hand, the receptive field of the second feature map can be enhanced by the second submodule, and richer local feature information can be obtained in the second feature map, thereby enhancing the expressive power of the feature information of the second feature map. It can be seen that the embodiments of the present application can extract more features, and as the number of features increases, the accuracy of detection also increases, thereby achieving better detection effects.

[0045] In some embodiments, the detection objects in the present application may be: detecting whether a person is wearing a mask effectively, detecting whether a person is wearing an ID card, detecting whether a person is wearing a hat, detecting how many pedestrians, cars, and electric bicycles are on the road, etc. In the present application, there are no excessive restrictions on the detection objects.

[0046] Figure 2 A schematic diagram showing the structure of a first model of an embodiment of the present application is shown as follows: Figure 2 As shown, the first model includes: a CSPDarknet53 module, an FPN module and a YOLOHead module, wherein the CSPDarknet53 module includes: lightweight processing, enhancement processing and deep feature cross-fusion processing; the FPN module includes a first submodule and a second submodule; and the YOLOHead module includes a deep separable convolution processing.

[0047] In some embodiments of the present application, before the data-enhanced first image is input into the first model, it is first subjected to convolution processing to obtain a feature map with a length of 416, a width of 416, and a channel of 3, and this feature map is used as the input data of the first model. The feature map is first passed through the CSPDarknet53 module to obtain the first feature map and the second feature map. The first feature map and the second feature map are then passed through the FPN module and the YOLOHead module to output a feature map with a length of 26 and a width of 26 and a feature map with a length of 13 and a width of 13.

[0048] In some embodiments of the present application, a feature map with a length of 416, a width of 416, and a channel of 3 is input into the CSPDarknet53 module, and a first feature map is obtained by lightweight processing and enhancement processing. Specifically, before obtaining the first feature map and the second feature map of the first image, the following steps are included:

[0049] Performing a second convolution process on the first image to obtain a sixteenth feature map;

[0050] Performing lightweight processing on the sixteenth feature map to obtain a seventeenth feature map, wherein the lightweight processing is used to reduce the number of parameters of the sixteenth feature map;

[0051] Perform the third pooling process on the seventeenth feature map to obtain an eighteenth feature map;

[0052] Performing enhancement processing on the eighteenth feature map to obtain a nineteenth feature map, wherein the enhancement processing is used to fuse and extract features of the eighteenth feature map;

[0053] The fourth pooling process is performed on the nineteenth feature map to obtain the first feature map.

[0054] In one example, before the first image after data enhancement is input into the first model, it is first subjected to convolution processing to obtain a feature map with a length of 416, a width of 416, and a channel of 3. The feature map with a length of 416, a width of 416, and a channel of 3 first enters the CSPDarknet53 module, and first passes through two CBS layers in the CSPDarknet53 module. The CBS layer includes: a convolution layer, a BN layer, and a SiLU. Specifically, the feature map first passes through the convolution layer of the first CBS layer, which has 32 3×3 convolution kernels and a step size of 2, and then passes through the BN layer and SiLU to obtain a feature map with a length of 208, a width of 208, and a channel of 32. Similarly, the feature map with a length of 208, a width of 208, and a channel of 32 passes through the second CBS layer, where the convolution layer of the second CBS layer has 64 3×3 convolution kernels and a step size of 2, to obtain the sixteenth feature map with a length of 104, a width of 104, and a channel of 64. The sixteenth feature map is then subjected to lightweight processing to obtain a seventeenth feature map with a length of 104, a width of 104, and a channel of 128. The seventeenth feature map is then subjected to pooling processing, the kernel size of the pooling processing may be 2×2, the step size may be 2, and the eighteenth feature map with a length of 52, a width of 52, and a channel of 128 is obtained. The eighteenth feature map is then subjected to enhancement processing to obtain a nineteenth feature map with a length of 52, a width of 52, and a channel of 256. The nineteenth feature map is then subjected to pooling processing, the kernel size of the pooling processing may be 2×2, the step size may be 2, and the first feature map with a length of 26, a width of 26, and a channel of 256 is obtained. Lightweight processing and enhancement processing do not change the length and width of the feature map, but double the number of channels of the feature map, while pooling processing halves the length and width of the feature map, but does not change the number of channels. Therefore, the length and width of the eighteenth feature map are half the length and width of the sixteenth feature map, and the number of channels of the eighteenth feature map is twice the number of channels of the sixteenth feature map. The length and width of the first feature map are half the length and width of the eighteenth feature map, and the number of channels of the first feature map is twice the number of channels of the eighteenth feature map.

[0055] In this embodiment, in order to overcome the problem of insufficient feature extraction capability of the 3×3 convolutional layer of the original CSPBlock model, the present application improves the residual module. The improvements are divided into enhanced processing and lightweight processing. In order to achieve multi-scale changes in channels, the present application sets a lightweight processing and two enhanced processing in the CSPDarknet53 module of the first model. Figure 3 A schematic diagram of the structure of lightweight processing of an embodiment of the present application is shown as follows: Figure 3 As shown in the figure, the first 3×3 convolutional layer of CSPBlock is replaced with 1×1 and 3×3 convolutional layers to reduce the number of parameters of the convolution operation. The enhanced processing is to use 1×1 convolutional layers and 3×3 convolutional layers to fully fuse and extract feature maps before the first 3×3 convolutional layer in CSPBlock is split. The enhanced processing can extract more features and amplify local features, thereby improving the detection performance of small and medium-sized objects in the feature map.

[0056] In some embodiments of the present application, lightweight processing is performed on the sixteenth feature map to obtain a seventeenth feature map, including:

[0057] Performing a third convolution process on the sixteenth feature map to obtain a twenty-second feature map;

[0058] Split the twenty-second feature map to obtain a twenty-third feature map and a twenty-fourth feature map;

[0059] Perform a fourth convolution process on the twenty-third feature map to obtain a twenty-fifth feature map;

[0060] Perform a fifth convolution process on the twenty-fifth feature map to obtain a twenty-sixth feature map;

[0061] According to the twenty-fifth characteristic map and the twenty-sixth characteristic map, a twenty-seventh characteristic map is obtained;

[0062] Performing a sixth convolution process on the twenty-seventh feature map to obtain a twenty-eighth feature map;

[0063] According to the twenty-fourth characteristic map and the twenty-eighth characteristic map, the seventeenth characteristic map is obtained.

[0064] In this embodiment, if Figure 3As shown, the 16th feature map with a length of 104, a width of 104, and a channel of 64 passes through the CBS layer twice, wherein the 16th feature map first passes through the CBS layer with a convolution of 1×1 and a step size of 1, and then passes through the CBS layer with a convolution of 3×3 and a step size of 1, to obtain the 22nd feature map. The 22nd feature map is split into the 23rd feature map and the 24th feature map, that is, the 23rd feature map and the 24th feature map have the same length and width, the 23rd feature map and the 24th feature map have the same number of channels, and the channels of the 23rd feature map and the 24th feature map can be added to form the 22nd feature map. The 23rd feature map passes through the CBS layer twice to obtain the 25th feature map and the 26th feature map, wherein the CBS layer is a CBS layer with a convolution of 3×3 and a step size of 1. The 25th feature map and the 26th feature map are connected to obtain the 27th feature map, and the 27th feature map is then passed through the CBS layer with a convolution of 1×1 and a step size of 1 to obtain the 28th feature map, and the 24th feature map and the 28th feature map are connected to obtain the 17th feature map.

[0065] It can be understood that in this embodiment, a deeper convolution processing is performed on the twenty-third feature map to obtain more detailed and local feature information, and the seventeenth feature map obtained by connecting the twenty-fourth feature map and the twenty-eighth feature map includes both global feature information and local feature information. In the obtained seventeenth feature map, the extracted feature information is richer.

[0066] In some other embodiments of the present application, the eighteenth feature map is enhanced to obtain a nineteenth feature map. In one example, the eighteenth feature map first passes through three CBS layers, wherein the first layer passes through a CBS layer with a convolution of 3×3 and a step size of 1, and then passes through a CBS layer with a convolution of 1×1 and a step size of 1 and a CBS layer with a convolution of 3×3 and a step size of 1 to obtain a feature map, and the steps of obtaining the nineteenth feature map from the feature map are the same as the steps of obtaining the seventeenth feature map from the twenty-second feature map, and no further details are given here.

[0067] In some embodiments of the present application, in the CSPDarknet53 module, the specific steps of obtaining the second feature map by the first feature map through enhancement processing and deep feature cross fusion processing are as follows: Figure 2 As shown, before obtaining the first feature map and the second feature map of the first image, the process includes:

[0068] Performing enhancement processing on the first feature map to obtain a twentieth feature map;

[0069] Performing a fifth pooling process on the twentieth feature map to obtain a twenty-first feature map, wherein the length and width of the twenty-first feature map are half of the length and width of the first feature map, and the number of channels of the twenty-first feature map is twice the number of channels of the first feature map;

[0070] The first feature map and the twenty-first feature map are subjected to a deep feature cross-fusion process to obtain a second feature map, wherein the deep feature cross-fusion process is used to extract global and local context information of the first feature map and the twenty-first feature map.

[0071] In this embodiment, the first feature map with a length of 26, a width of 26, and a channel of 256 is enhanced to obtain a twentieth feature map with a length of 26, a width of 26, and a channel of 512. The twentieth feature map is pooled to obtain a twenty-first feature map with a length of 13, a width of 13, and a channel of 512, wherein the kernel size of the pooling process may be 2×2 and the step size may be 2. The first feature map and the twenty-first feature map are subjected to a deep feature cross fusion process to obtain a second feature map with a length of 13, a width of 13, and a channel of 512.

[0072] In this embodiment, the length and width of the second feature map are half the length and width of the first feature map, and the number of channels of the second feature map is twice the number of channels of the first feature map. After the first feature map and the second feature map are input into the FPN model and the YOLOHead model, feature maps of two sizes can be output, namely: a feature map with a resolution of 26×26 and a feature map with a resolution of 13×13. Medium-sized objects can be detected by the feature map with a resolution of 13×13, and small objects can be detected by the feature map with a resolution of 26×26. Through the present application, both medium-sized objects and small objects can be detected, thereby increasing the detection range.

[0073] In some other embodiments of the present application, deep feature cross-fusion processing is performed on the first feature map and the twenty-first feature map to obtain a second feature map, including:

[0074] Performing the seventh convolution process on the first feature map to obtain a twenty-ninth feature map, wherein the length, width, and number of channels of the twenty-ninth feature map are half of the length, width, and number of channels of the first feature map;

[0075] Connect the twenty-ninth feature map and the twenty-first feature map to obtain the thirtieth feature map;

[0076] The eighth convolution process is performed on the 30th feature map to obtain the second feature map.

[0077] In one example, the first feature map is passed through a CBS layer again, in which the number of convolution kernels is 128, the convolution size is 3×3, and the step size is 2, to obtain a feature map with a length of 13, a width of 13, and a channel of 128. The feature map is connected to the twenty-first feature map to obtain a feature map with a length of 13, a width of 13, and a channel of 640. The feature map with a length of 13, a width of 13, and a channel of 640 is passed through a CBS layer, in which the number of convolution kernels is 512, the convolution size is 1×1, and the step size is 1, to obtain a second feature map with a length of 13, a width of 13, and a channel of 512.

[0078] In the prior art, the deepest feature map of a general network only contains a single layer of semantic information. This is because feature maps of different sizes contain different feature information. The existing deep convolutional network only extracts features from large-sized feature maps, thereby losing the key position information of small objects in small-sized feature maps. Therefore, when the shallow feature map information is obtained by reverse deduction through the deep feature map, the shallow feature map obtains less semantic information, which is not conducive to the detection of small objects in the feature map. In order to enhance the expressive power of the deep feature map, the present application adds deep feature cross-fusion processing to the existing YOLO model. While obtaining the feature map information of the first feature map with a length of 26, a width of 26, and a channel of 256, the feature information of the twenty-first feature map with a length of 13, a width of 13, and a channel of 512 is also obtained. Therefore, in the embodiment of the present application, a parallel path is used to extract the features of the small-sized feature map for determining the exact position of the small object and better solving the local blur problem, and also extract the features of the large-sized feature map. By extracting global and local context information of deep feature maps of different sizes, the semantic information of the deep feature maps is fused. As the feature information of the deep feature maps increases, when the shallow feature map information is obtained by reverse deduction through the deep feature maps, the feature information of the shallow feature maps also increases. At the same time, the FPN module can also input a second feature map with richer semantic information. And in this embodiment, the 3×3 convolution that occupies the most computational amount and parameters in the prior art is replaced. Therefore, in terms of the number of parameters, the deep feature cross-fusion processing is greatly reduced to (622,592), which is 26.39% of the original 3×3 convolution (2,359,296).

[0079] In some embodiments of the present application, after the first feature map is input into the FPN module, it first passes through the first submodule in the FPN module. Figure 4 A schematic diagram of the structure of the first submodule provided by an embodiment of the present application is shown as follows: Figure 4 As shown, the first submodule includes a channel unit and a space unit. The target spatial features and the target channel features of the first feature map are enhanced by the first submodule to obtain a third feature map, including:

[0080] Aggregating features in K target channels of the first feature map through the channel unit to obtain a fifth feature map, where K is a positive integer;

[0081] Performing a first pooling process on the first feature map to obtain a sixth feature map;

[0082] The pixels of the fifth feature map and the sixth feature map are superimposed and activated to obtain a seventh feature map;

[0083] Multiply the first feature map and the seventh feature map to obtain an eighth feature map;

[0084] Enhance the target spatial features of the eighth feature map by using the spatial unit to obtain a ninth feature map;

[0085] According to the eighth characteristic map and the ninth characteristic map, a third characteristic map is obtained.

[0086] In one example, the first feature map enters the channel unit, and the K adjacent channels in the first feature map are clustered by the kmeans clustering algorithm to obtain the fifth feature map. At the same time, the first feature map is also subjected to two pooling processes, that is, the first feature map is first subjected to global average pooling, and then subjected to maximum pooling, to extract richer features in the first feature map to obtain the sixth feature map. Then, the pixels of the fifth feature map and the sixth feature map are superimposed, and activated by sigmoid to obtain the seventh feature map, and then the elements in the seventh feature map are multiplied by the elements in the first feature map to obtain the eighth feature map. Then, the eighth feature map is input into the spatial unit, and the spatial features of the eighth feature map are extracted to obtain the ninth feature map. At the same time, the eighth feature map is also subjected to two pooling processes, that is, the eighth feature map is first subjected to global average pooling, and then subjected to maximum pooling, to extract richer features in the eighth feature map to obtain the feature map, and then the elements in the obtained feature map are multiplied by the elements in the ninth feature map to obtain the third feature map.

[0087] In the prior art, the Convolutional Block Attention Module (CBAM) is an attention module that combines space and channels, which can effectively improve the information transmission capacity in the convolutional network, enhance the useful features in the feature map, and suppress the useless features, so as to achieve better results in practical applications. The Effective Channel Attention (ECA) is an improvement based on the Squeeze-and-Excitation Networks (SENet), which can use only a small number of parameters and adopt the method of adaptively selecting the size of the one-dimensional convolution kernel to achieve performance improvement. The present invention combines CBAM and ECA to propose a new effective dual attention module: EDAM, i.e., the first submodule, which is composed of channel units and spatial units. By enhancing the important spatial features and channel features in the feature map, the first model can grasp the main target features for learning during the training process. And the first submodule combines the advantages of CBAM and ECA, enhances the ability of the model to extract features, can not only capture information across channels, but also perceive the size and position features of the object, so that the first model can more accurately identify the object and lock the object position.

[0088] In some embodiments of the present application, after the second feature map is input into the FPN module, it first passes through the second submodule in the FPN module. Figure 5 A schematic diagram of the structure of the second submodule provided by an embodiment of the present application is shown as follows: Figure 5 As shown, the receptive field of the second feature map is enhanced by the second submodule, and the fourth feature map is obtained including:

[0089] Perform P second pooling processes on the second feature map to obtain P tenth feature maps, wherein the P second pooling processes correspond to P pooling kernels, and the P pooling kernels are different, the receptive fields of the P tenth feature maps are larger than the receptive field of the second feature map, and P is a positive integer;

[0090] According to the second feature map and all the tenth feature maps, a fourth feature map is obtained.

[0091] In one example, the second pooling process may be a maximum pooling process, and P may be 3, and the pooling kernels may be 3×3, 5×5, and 7×7, respectively, and the pooling step size may be 1. The second feature map is subjected to three maximum pooling processes, and finally three tenth feature maps are obtained. Before the second feature map is subjected to the pooling process, the second feature map is adaptively padded around different pooling kernels, so that the length and width of the second feature map are the same as those of the tenth feature map, and the tenth feature map obtained after the pooling process has a local receptive field. The three tenth feature maps are connected to the second feature map, and a new feature map is obtained through a 1×1 convolution and the first submodule, wherein the number of channels of the feature map is four times that of the second feature map, and then the feature map is subjected to a conv+BN+hardswis convolution layer, the number of convolution kernels of the convolution layer is 512, the convolution size is 3×3, and the step size is 1, and a fourth feature map with a length of 13, a width of 13, and a channel of 512 is obtained.

[0092] In this embodiment, an improved spatial pyramid pooling dual attention module based on spatial pyramid pooling (SPP), i.e., a second submodule, is proposed to enhance the receptive field of deep semantic features. When the detection object is whether a person wears a mask, the image area of ​​each person wearing a mask in the acquired image is large or small. In order to adapt to the size change of the image area of ​​the person wearing a mask, the smaller the image pooling kernel of the image area of ​​the person wearing a mask is, the larger the image pooling kernel of the image area of ​​the person wearing a mask is. Therefore, pooling kernels of different sizes are set in the second submodule to match the feature maps of people wearing masks of different sizes, and more abundant local feature information in the feature map is obtained to enhance the expressiveness of the feature information in the feature map and achieve better detection effect.

[0093] In some other embodiments of the present application, the detection result is outputted by the YOLOHead module. Specifically, the object detection result of the first image is determined according to the third feature map and the fourth feature map, including:

[0094] Processing the fourth feature map processed by the first convolution through the first submodule to obtain an eleventh feature map;

[0095] According to the eleventh characteristic map and the third characteristic map, a twelfth characteristic map is obtained;

[0096] Performing a depth-separable convolution process on the twelfth feature map to obtain first position information, first category confidence information, and a thirteenth feature map, wherein the first position information is used to determine a first image region where the object in the thirteenth feature map is located, and the first category confidence information is used to determine the confidence of the first image region;

[0097] Performing a depth-separable convolution process on the fourth feature map to obtain second position information, second category confidence information, and a fourteenth feature map, wherein the second position information is used to determine a second image region where the object in the fourteenth feature map is located, and the second category confidence information is used to determine the confidence of the second image region;

[0098] An object detection result of the first image is determined according to a fifteenth feature map, wherein the fifteenth feature map is an image region with the highest confidence in the thirteenth feature map and the fourteenth feature map.

[0099] In this embodiment, the fourth feature map passes through a convolution layer of conv+BN+hardswis, the number of convolution kernels of the convolution layer is 128, the convolution size is 1×1, and the step size is 1, and a feature map with a length of 26, a width of 26, and a channel of 128 is obtained. This feature map is upsampled, and the upsampled feature map is input into the first submodule to obtain the eleventh feature map, wherein the length of the eleventh feature map is 26, the width is 26, and the channel is 128. The eleventh feature map is then connected to the third feature map to obtain a twelfth feature map with a length of 26, a width of 26, and a channel of 384. The twelfth feature map is subjected to depthwise separable convolution processing. Specifically, the twelfth feature map first undergoes depthwise convolution with 256 convolution kernels, 3×3 convolution size, and 1 step size, and then undergoes pointwise convolution with 256 convolution kernels, 1×1 convolution size, and 1 step size, and then undergoes depthwise convolution to obtain a feature map with a length of 26, a width of 26, and a channel of 256. At the same time, the fourth feature map is also subjected to depthwise separable convolution processing to obtain a feature map with a length of 26, a width of 26, and a channel of 512. The process is the same as the depthwise separable convolution processing for the twelfth feature map, and no further details are given here. The feature map with a length of 26, a width of 26, and a channel of 256 is convolved with 75 convolution kernels, a convolution size of 1×1, and a stride of 1 to obtain a thirteenth feature map with a length and width of 26. The feature map with a length of 26, a width of 26, and a channel of 512 is also convolved with 75 convolution kernels, a convolution size of 1×1, and a stride of 1 to obtain a fourteenth feature map with a length and width of 13.

[0100] In this embodiment, using the position information, during the first model training process, the image area of ​​the detected object in the feature map is determined from the thirteenth feature map and the fourteenth feature map, and the confidence of the image area where the object is located is determined, and the image area where the object is located is labeled. When the first model training is completed, the picture is input into the first model to obtain a feature map with a resolution of 26×26 and a feature map with a resolution of 13×13, and the image area with the highest confidence in the two feature maps where the object is located is found, and the label corresponding to the image area is determined, thereby determining the result of the object detection. For example: using the first model to detect whether a person wears a mask, when the model is trained, the training image is labeled, and the categories of the label can be: Good_mask, Poor_mask, No_mask. After the model is trained, the image is input into the first model. If the object detection result is Good_mask, it means that the person wears a mask effectively. If the object detection result is Poor_mask, it means that the person does not wear a mask effectively. If the object detection result is No_mask, it means that the person does not wear a mask. When the object detection result is not Good_mask, the camera's built-in sound and light system will be triggered to sound an alarm, and automatically capture images in the background for management personnel to verify the judgment and remind relevant personnel to wear masks.

[0101] In this embodiment, in order to filter non-object information such as background and environment and improve the accuracy of object detection, the present invention replaces the 3×3 conventional convolution in the YOLOHead model with a depthwise separable convolution, thereby outputting position information and category confidence information. The parameters of the improved depthwise separable convolution are less than 1 / 8 of the parameters of the 3×3 convolution, reducing a large number of parameters.

[0102] It should be noted that the various optional embodiments introduced in the embodiments of the present application can be implemented in combination with each other or can be implemented separately if they do not conflict with each other, and the embodiments of the present application are not limited to this.

[0103] Figure 6 FIG. 1 shows a schematic diagram of the structure of an object detection device provided by an embodiment of the present application. Figure 6 As shown, the device comprises:

[0104] Acquisition module 601: inputting a first image into a first model to obtain an object detection result of the first image;

[0105] Among them, the first model is used for:

[0106] Acquire a first feature map and a second feature map of the first image;

[0107] Enhance the target spatial features and the target channel features of the first feature map by the first submodule to obtain a third feature map;

[0108] The receptive field of the second feature map is enhanced by the second submodule to obtain a fourth feature map;

[0109] An object detection result of the first image is determined according to the third feature map and the fourth feature map.

[0110] Figure 7 A schematic structural diagram of an electronic device provided by an embodiment of the present application is shown.

[0111] The electronic device may include a processor 701 and a memory 702 storing computer program instructions.

[0112] Specifically, the processor 701 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0113] The memory 702 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 702 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 702 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 702 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 702 is a non-volatile solid-state memory.

[0114] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.

[0115] The processor 701 implements any one of the object detection methods in the above embodiments by reading and executing computer program instructions stored in the memory 702 .

[0116] In one example, the electronic device may further include a communication interface 703 and a bus 710. Figure 3As shown, the processor 701, the memory 702, and the communication interface 703 are connected via a bus 710 and communicate with each other.

[0117] The communication interface 703 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0118] Bus 710 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 710 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.

[0119] In addition, in combination with the object detection method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the object detection methods in the above embodiment is implemented.

[0120] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0121] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0122] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0123] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0124] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. An object detection method, characterized in that: include: Inputting a first image into a first model to obtain an object detection result of the first image; Wherein, the first model is used for: Acquire a first feature map and a second feature map of the first image; Enhance the target spatial features and the target channel features of the first feature map by the first submodule to obtain a third feature map; Enhance the receptive field of the second feature map by the second submodule to obtain a fourth feature map; An object detection result of the first image is determined according to the third feature map and the fourth feature map.

2. The method according to claim 1, characterized in that: The first submodule includes a channel unit and a space unit, and the step of enhancing the target spatial features and the target channel features of the first feature map by the first submodule to obtain a third feature map includes: Aggregating features in K target channels of the first feature map through the channel unit to obtain a fifth feature map, where K is a positive integer; Performing a first pooling process on the first feature map to obtain a sixth feature map; Superimposing and activating pixels of the fifth feature map and the sixth feature map to obtain a seventh feature map; Multiplying the first feature map and the seventh feature map to obtain an eighth feature map; Enhance the target spatial features of the eighth feature map by using the spatial unit to obtain the ninth feature map; The third characteristic map is obtained according to the eighth characteristic map and the ninth characteristic map.

3. The method according to claim 1, characterized in that: The step of enhancing the receptive field of the second feature map by the second submodule to obtain a fourth feature map comprises: Performing P second pooling processes on the second feature map to obtain P tenth feature maps, wherein the P second pooling processes correspond to P pooling kernels, and the P pooling kernels are different, the receptive fields of the P tenth feature maps are greater than the receptive field of the second feature map, and P is a positive integer; The fourth feature map is obtained according to the second feature map and all the tenth feature maps.

4. The method according to claim 1, characterized in that: The determining, according to the third feature map and the fourth feature map, an object detection result of the first image includes: Processing the fourth feature map after the first convolution processing by the first submodule to obtain an eleventh feature map; Obtaining a twelfth characteristic map according to the eleventh characteristic map and the third characteristic map; Performing a depth-separable convolution process on the twelfth feature map to obtain first position information, first category confidence information, and a thirteenth feature map, wherein the first position information is used to determine a first image region where an object in the thirteenth feature map is located, and the first category confidence information is used to determine a confidence of the first image region; Performing the depthwise separable convolution process on the fourth feature map to obtain second position information, second category confidence information, and a fourteenth feature map, wherein the second position information is used to determine a second image region where the object in the fourteenth feature map is located, and the second category confidence information is used to determine the confidence of the second image region; The object detection result of the first image is determined according to a fifteenth feature map, wherein the fifteenth feature map is an image region with the highest confidence in the thirteenth feature map and the fourteenth feature map.

5. The method according to claim 1, characterized in that Before acquiring the first feature map and the second feature map of the first image, the method includes: Performing a second convolution process on the first image to obtain a sixteenth feature map; Performing lightweight processing on the sixteenth feature map to obtain a seventeenth feature map, wherein the lightweight processing is used to reduce the number of parameters of the sixteenth feature map; Performing a third pooling process on the seventeenth feature map to obtain an eighteenth feature map, wherein the length and width of the eighteenth feature map are half of the length and width of the sixteenth feature map, and the number of channels of the eighteenth feature map is twice the number of channels of the sixteenth feature map; Performing enhancement processing on the eighteenth feature map to obtain a nineteenth feature map, wherein the enhancement processing is used to fuse and extract features of the eighteenth feature map; Performing a fourth pooling process on the nineteenth feature map to obtain the first feature map, wherein the length and width of the first feature map are half of the length and width of the eighteenth feature map, and the number of channels of the first feature map is twice the number of channels of the eighteenth feature map.

6. The method according to claim 5, characterized in that Before acquiring the first feature map and the second feature map of the first image, the method includes: Performing enhancement processing on the first feature map to obtain a twentieth feature map; Performing a fifth pooling process on the 20th feature map to obtain a 21st feature map, wherein the length and width of the 21st feature map are half of the length and width of the first feature map, and the number of channels of the 21st feature map is twice the number of channels of the first feature map; Perform deep feature cross-fusion processing on the first feature map and the twenty-first feature map to obtain the second feature map, wherein the deep feature cross-fusion processing is used to extract global and local context information of the first feature map and the twenty-first feature map.

7. The method according to claim 5, wherein the step of performing lightweight processing on the sixteenth characteristic map to obtain the seventeenth characteristic map comprises: Performing a third convolution process on the sixteenth feature map to obtain a twenty-second feature map; Splitting the twenty-second feature map to obtain a twenty-third feature map and a twenty-fourth feature map; Performing a fourth convolution process on the twenty-third feature map to obtain a twenty-fifth feature map; Performing a fifth convolution process on the twenty-fifth feature map to obtain a twenty-sixth feature map; A twenty-seventh characteristic map is obtained according to the twenty-fifth characteristic map and the twenty-sixth characteristic map; Performing a sixth convolution process on the twenty-seventh feature map to obtain a twenty-eighth feature map; The seventeenth feature map is obtained according to the twenty-third feature map and the twenty-eighth feature map.

8. The method according to claim 6, characterized in that The performing deep feature cross-fusion processing on the first feature map and the twenty-first feature map to obtain the second feature map includes: Performing a seventh convolution process on the first feature map to obtain a twenty-ninth feature map, wherein the length, width, and number of channels of the twenty-ninth feature map are half the length, width, and number of channels of the first feature map; Connect the twenty-ninth feature map and the twenty-first feature map to obtain a thirtieth feature map; Perform an eighth convolution process on the thirtieth feature map to obtain the second feature map.

9. An object detection device, characterized in that: The device comprises: An acquisition module: inputs a first image into a first model to obtain an object detection result of the first image; Wherein, the first model is used for: Acquire a first feature map and a second feature map of the first image; Enhance the target spatial features and the target channel features of the first feature map by the first submodule to obtain a third feature map; Enhance the receptive field of the second feature map by the second submodule to obtain a fourth feature map; An object detection result of the first image is determined according to the third feature map and the fourth feature map.

10. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the object detection method according to any one of claims 1 to 8 is implemented.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the object detection method according to any one of claims 1 to 8 is implemented.