Image processing method, access control method and device
By using the object detection model of the fused convolutional layer in image processing, the problem of low image processing efficiency and difficult to guarantee is solved, and efficient and accurate image processing is achieved.
Patent Information
- Application Number
- CN202411828956.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-08
AI Technical Summary
In the prior art, image processing efficiency is low and the accuracy of image processing results is difficult to guarantee, especially when the inference complexity and data scale of deep learning models increase.
By using an object detection model, the model includes at least one fusion convolution layer obtained by integrating the group of network layers to be fused in the initial detection model, which includes at least two fusion network layers to be fused. This model directly processes the image to be detected through the fusion convolution layer, avoiding the steps of sequential processing through each fusion network layer.
The processing efficiency of image processing is improved and the accuracy of image processing results is ensured, because the use of the fused convolution layer does not change the structure of the initial detection model, so the detection results will not be affected.
Smart Images

Figure CN119785000A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image processing method and an access control method. The present invention also relates to an image processing device and an access control device, a computing device, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the widespread application of deep learning in all walks of life, especially the development of generative AI (Artificial Intelligence) technology, the quality of image generation has also been qualitatively improved, but the reasoning complexity of its theoretical model and the scale of data required to be processed are also increasing. In this context, in order to meet the accuracy and real-time requirements of image processing using models, in current practical applications, most of them change the model structure by means of model distillation, model pruning, etc., or by adjusting the hardware equipment and the deployment platform of the running model to achieve the above purpose. Since changing the model structure may cause the image processing results to change, the image processing results output by the model with the changed model structure cannot guarantee accuracy. In addition, since the actual project operating environment of the model is relatively complex, the hardware equipment and deployment platform are difficult to adjust to a better state, and the accuracy of the image processing results cannot be guaranteed. Therefore, there is an urgent need for a method to solve the above-mentioned technical problems of low image processing efficiency and difficulty in ensuring the accuracy of image processing results. Summary of the invention
[0003] In view of this, the embodiments of this specification provide an image processing method and an access control method. One or more embodiments of this specification also relate to an image processing device and an access control device, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.
[0004] According to a first aspect of an embodiment of this specification, there is provided an image processing method, including:
[0005] Acquire the image to be detected;
[0006] The image to be detected is input into a target detection model to obtain a target detection result of the image to be detected, wherein the target detection model includes at least one fused convolutional layer, the fused convolutional layer is obtained by fusing a network layer group to be fused in the initial detection model, and the network layer group to be fused includes at least two network layers to be fused.
[0007] According to a second aspect of the embodiments of this specification, there is provided an image processing apparatus, including:
[0008] An acquisition module is configured to acquire an image to be detected;
[0009] The input module is configured to input the image to be detected into the target detection model to obtain the target detection result of the image to be detected, wherein the target detection model includes at least one fused convolutional layer, and the fused convolutional layer is obtained by fusing the network layer group to be fused in the initial detection model, and the network layer group to be fused includes at least two network layers to be fused.
[0010] According to a third aspect of an embodiment of this specification, a door access control method is provided, which is applied to a server, and includes:
[0011] Receive access control request sent by target access control device;
[0012] In response to the access control request, obtaining an image of the person to be detected;
[0013] Inputting the image of the person to be detected into a target detection model to obtain a target detection result of the image of the person to be detected, wherein the target detection model includes at least one fused convolutional layer, the fused convolutional layer is obtained by fusing the network layer group to be fused in the initial detection model, and the network layer group to be fused includes at least two network layers to be fused;
[0014] Retrieving a detection result matching the target detection result in a preset search library, and generating a target matching result of the target detection result;
[0015] When the target matching result is a successful match, a door opening instruction is sent to the target access control device to open the target access control device.
[0016] According to a fourth aspect of the embodiments of this specification, there is provided an access control device, which is applied to a server, and includes:
[0017] A receiving module, configured to receive an access control request sent by a target access control device;
[0018] A response module is configured to obtain a person image of a person to be detected in response to the access control request;
[0019] The detection module is configured to input the image of the person to be detected into a target detection model to obtain a target detection result of the image of the person to be detected, wherein the target detection model includes at least one fused convolutional layer, the fused convolutional layer is obtained by fusing the network layer group to be fused in the initial detection model, and the network layer group to be fused includes at least two network layers to be fused;
[0020] A retrieval module is configured to retrieve a detection result matching the target detection result in a preset retrieval library, and generate a target matching result of the target detection result;
[0021] The sending module is configured to send a door opening instruction to the target access control device to open the target access control device when the target matching result is a successful match.
[0022] According to a fifth aspect of an embodiment of this specification, a computing device is provided, including:
[0023] Memory and processor;
[0024] The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned image processing method or access control method are implemented.
[0025] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the above-mentioned image processing method or access control method are implemented.
[0026] According to a seventh aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which implements the steps of the above-mentioned image processing method or access control method when executed by a processor.
[0027] An embodiment of the present specification realizes that image processing is performed on an image to be detected through a target detection model, and a target detection result of the image to be detected is obtained. Since the target detection model includes multiple fused convolutional layers, the fused convolutional layer is obtained by fusing a group of network layers to be fused consisting of at least two network layers to be fused in the initial detection model. Therefore, in the process of using the target detection model to process the image to be detected, the image to be detected can be directly processed through the fused convolutional layer, and there is no need to process the image to be detected in sequence through each network layer to be fused, thereby improving the processing efficiency of the image processing of the image to be detected; and since the target detection model is obtained by fusing each group of network layers to be fused in the initial detection model, the model structure of the initial detection model is not changed in this process. Therefore, using the target detection model to process the image to be detected will not affect the detection result of the image to be detected, thereby ensuring the accuracy of the image processing of the image to be detected. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is a flow chart of an image processing method provided by an embodiment of this specification;
[0029] Figure 2 It is a schematic diagram of fusing various network layers to be merged provided by an embodiment of this specification;
[0030] Figure 3is a schematic diagram of filling the second convolutional layer provided by an embodiment of this specification;
[0031] Figure 4 is a processing flow chart of an image processing method provided by an embodiment of this specification;
[0032] Figure 5 is a structural schematic diagram of an image processing device provided by an embodiment of this specification;
[0033] Figure 6 This is a schematic diagram of an application scenario of a door access control method provided by an embodiment of this specification;
[0034] Figure 7 is a flow chart of a door access control method provided by an embodiment of this specification;
[0035] Figure 8 It is a structural schematic diagram of an access control device provided by an embodiment of this specification;
[0036] Fig. 9 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0037] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0038] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0039] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0040] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0041] First, the terms involved in one or more embodiments of this specification are explained.
[0042] Feature map: In the convolution layer, the convolution kernel can be regarded as extracting a specific type of features from the input image, and the output of the convolution kernel is the feature map. The feature map captures the important features of the input data (such as an image).
[0043] Convolutional Layers: Convolutional Layers, referred to as Conv, are mainly used to process data with grid structures, such as images.
[0044] Normalization layer: Batch Normalization Layer, referred to as BN layer, is a commonly used method in deep learning. It is usually used in combination with the convolutional layer to accelerate the convergence speed of the neural network, reduce the model's dependence on the initial parameters, and improve the robustness of the model.
[0045] Residual layer: ResNet (Residual Network) usually contains one or more convolution operations (such as 1*1 convolution, 3*3 convolution, etc., and the BN layer calculation is added by default after the convolution layer calculation) and skip connection. The skip connection allows the input feature map to be passed directly to the next layer, which helps to alleviate the gradient vanishing problem and improve the training effect of deep networks.
[0046] With the widespread application of deep learning in all walks of life, especially the development of generative AI (Artificial Intelligence) technology, the quality of image generation has also been qualitatively improved, but the reasoning complexity of its theoretical model and the scale of data required to be processed are also increasing. In this context, in order to meet the accuracy and real-time requirements of image processing using models, in current practical applications, most of them change the model structure through model distillation, model pruning, etc., or adjust the hardware equipment and the deployment platform of the running model to achieve the above purpose. Since changing the model structure may cause changes in the image processing results, the image processing results output by the model with the changed model structure cannot guarantee accuracy. In addition, since the actual project operating environment of the model is relatively complex, it is difficult to adjust the hardware equipment and deployment platform to a better state, and the accuracy of the image processing results cannot be guaranteed.
[0047] In this specification, an image processing method and an access control method are provided. This specification also relates to an image processing device and an access control device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0048] See also Figure 1 , Figure 1 A flowchart of an image processing method provided according to an embodiment of the present specification is shown, which specifically includes the following steps:
[0049] Step 102: Acquire an image to be detected.
[0050] In practical applications, various application fields involve image processing, such as target detection of objects in images, conversion of object postures in images, transformation of image styles, etc. In pursuit of efficiency and accuracy of image processing, more and more individuals or companies are beginning to use models to process images, such as target detection models, image processing models, etc.
[0051] In one or more embodiments provided in this specification, the image to be detected refers to an image that needs to be detected. The image to be detected can be determined according to the actual application scenario. For example, in a face recognition scenario, the image to be detected can be a person's face image; in an e-commerce commodity sales scenario, the image to be detected can be a sales commodity image; in a target tracking scenario, the image to be detected can be the overall image of the tracking target, etc.
[0052] Step 104: Input the image to be detected into the target detection model to obtain the target detection result of the image to be detected, wherein the target detection model includes at least one fused convolutional layer, and the fused convolutional layer is obtained by fusing the network layer group to be fused in the initial detection model, and the network layer group to be fused includes at least two network layers to be fused.
[0053] After obtaining the image to be detected, the image to be detected is input into the target detection model to obtain the target detection result of the image to be detected output by the target detection model. Among them, the target detection model and the initial detection model can be used to perform image processing on the image to be detected to generate the detection result of the image to be detected. The target detection model is obtained by fusing the network layer groups to be fused in the trained initial detection model; the initial detection model includes multiple network layer groups to be fused, and the network layer group to be fused includes at least two network layers to be fused; the target detection model includes multiple fused convolutional layers, and the fused convolutional layers are obtained by fusing the network layer groups to be fused in the initial detection model. The target detection result refers to the detection result obtained after target detection is performed on the image to be detected, which can specifically be the object identification, location information, object category, etc. of the object in the image to be detected.
[0054] Since the initial detection model is the basis for generating the target detection model, it is necessary to train the initial detection model in advance before using the target detection model to detect the target on the image to be detected, so as to ensure the accuracy of generating the target detection model based on the initial detection model and using the target detection model to detect the target. The following explains the training process of the initial detection model.
[0055] In a specific implementation manner provided in this specification, the initial detection model is trained according to the following method:
[0056] Acquire sample training data, wherein the sample training data includes a sample training image and a sample detection result corresponding to the sample training image;
[0057] Inputting the sample training image into the initial detection model to obtain a predicted detection result output by the initial detection model;
[0058] Calculating a model loss value of the initial detection model according to the predicted detection result and the sample detection result;
[0059] The model parameters of the initial detection model are adjusted according to the model loss value, and the initial detection model is continuously trained until a model training stop condition is reached.
[0060] The sample training data refers to the sample data used to train the initial detection model, and the sample training data includes sample training images and sample detection results of the sample training images. The sample training images are images that require the initial detection model to perform target detection during the training of the initial detection model; the sample detection results are the actual detection results corresponding to the sample training images.
[0061] The sample training data may be sample data (including sample training images and sample detection results) obtained in a sample training data set, and the sample detection results may be obtained by manual data annotation; the sample training data set refers to a set consisting of sample training images and sample detection results; the predicted detection result refers to the detection result output by inputting the sample training image into the initial detection model; the model loss value refers to the difference between the sample detection result and the predicted detection result, which is used to measure the difference between the sample detection result and the predicted detection result.
[0062] Specifically, obtain the sample training image and the sample detection result corresponding to the sample training image, input the sample training image into the initial detection model, and obtain the predicted detection result. At this time, the initial detection model is a model that has not been trained yet. There will be a deviation between the determined predicted detection result and the actual sample detection result. The model parameters of the initial detection model need to be adjusted accordingly. Specifically, the model loss value of the initial detection model is calculated according to the output predicted detection result and the sample detection result. The loss function for calculating the model loss value can be a 0-1 loss function, a square loss function, a cross entropy loss function, etc. in actual applications. In this specification, preferably, a cross entropy loss function or a square loss function is selected as the loss function for calculating the model loss value, and the model parameters of the initial detection model are adjusted according to the model loss value. The initial detection model is continued to be trained based on the adjusted model parameters for the next batch of sample training data until the stop condition of the model training is reached.
[0063] Specifically, the model training stopping conditions include that the model loss value is less than a preset threshold and / or the training rounds reach a preset round.
[0064] In a specific implementation provided in this specification, taking the training stop condition of the model loss value being less than a preset threshold as an example, the preset threshold is 0.2. When the model loss value is less than 0.2, it is considered that the initial detection model training is completed.
[0065] In another specific implementation provided in the present specification, taking the preset number of training rounds as the training stop condition as an example, the preset number of training rounds is 30 rounds. When the number of training rounds of the training sample training data reaches 30 rounds, the initial detection model training is considered completed.
[0066] In another specific implementation provided in the present specification, two training stop conditions, namely a preset threshold and a preset training round, are set, and the model loss value and the training round are determined at the same time. When either the model loss value or the training round meets the training stop condition, the initial detection model training is considered to be completed.
[0067] By training the initial detection model, a trained initial detection model is obtained to ensure the accuracy of the fusion process in the subsequent fusion of the network layer groups to be fused in the initial detection model, further improve the accuracy of the generated target detection model, and the efficiency and accuracy of subsequent processing of the image to be detected.
[0068] In addition to considering the efficiency and accuracy of image processing, one or more embodiments provided in this specification also consider the computing resources consumed by the initial detection model in actual applications. Since the initial detection model consumes more computing resources when the model scale is large and the number of model parameters is large, the computing resources consumed by each network layer group in the initial detection model can be combined to determine the network layer group to be fused in the initial detection model. After the network layer group to be fused is fused, the target detection model can be obtained.
[0069] In a specific implementation provided in this specification, the method further includes:
[0070] Obtain computing resource parameters for each network layer group in the initial detection model;
[0071] Determine at least one network layer group to be merged in each network layer group according to computing resource parameters of each network layer group;
[0072] Fuse each network layer group to be fused separately to obtain the target detection model.
[0073] The computing resource parameter is used to characterize the amount of computing resources consumed by each network layer group in the initial detection model. The computing resources may specifically include CPU (Central Processing Unit) resources, GPU (Graphics Processing Unit) resources, memory resources, etc.
[0074] Specifically, the computing resource parameters of each network layer group when running the initial detection model can be obtained, and the network layer groups to be fused that need to be fused are determined in each network layer group according to the computing resource parameters of each network layer group, and the determined network layer groups to be fused are fused respectively to obtain the target detection model. Fusion of the network layer groups to be fused specifically involves fusing each network layer in the network layer groups to be fused into one network layer.
[0075] In one or more embodiments provided in this specification, the network layer group to be fused may include a network layer group to be fused consisting of a first convolutional layer and a first normalization layer, a network layer group to be fused consisting of a second convolutional layer and a second normalization layer, and a residual convolutional layer group. Among them, the residual convolutional layer group specifically includes a first network layer subgroup to be fused, a second network layer subgroup to be fused, and a jump connection layer. The network structure of the first network layer subgroup to be fused is the same as the network structure of the network layer group to be fused consisting of the first convolutional layer and the first normalization layer, and the network structure of the second network layer subgroup to be fused is the same as the network structure of the network layer group to be fused consisting of the second convolutional layer and the second normalization layer. The convolution kernel of the first convolutional layer is larger than the convolution kernel of the second convolutional layer. For example, the first convolutional layer can be a 3*3 convolutional layer, and the second convolutional layer can be a 1*1 convolutional layer.
[0076] Further, see Figure 2 , Figure 2 FIG. 2 shows a schematic diagram of fusing various network layers to be fused according to an embodiment of the present specification. Figure 2 As shown, the first convolution layer is fused with the first normalization layer to obtain the first fused convolution layer, the second convolution layer is fused with the second normalization layer to obtain the second fused convolution layer, and the residual convolution layer group is fused to obtain the third fused convolution layer. The first fused convolution layer, the second fused convolution layer, and the third fused convolution layer obtained by the fusion process are specifically convolution layers with the same network structure but different model parameters. For example, the first fused convolution layer, the second fused convolution layer, and the third fused convolution layer can all be 3*3 convolution layers, but with different model parameters.
[0077] In one embodiment provided in the present specification, the network layer groups to be fused can be determined in each network layer group according to the computing resource parameters of each network layer group, and the determined network layer groups to be fused can be fused to obtain a fused convolutional layer and a target detection model after fusion, thereby reducing the amount of calculation for the image to be detected and improving the processing efficiency of the image to be detected when applying the target detection model.
[0078] The following explains how to determine the network layer groups to be merged based on computing resource parameters, and how to merge the network layer groups to be merged.
[0079] In a specific implementation manner provided in this specification, at least one network layer group to be merged is determined in each network layer group according to the computing resource parameters of each network layer group, including:
[0080] Obtain computing resource information of the target hardware device;
[0081] Sort the computing resource parameters of each network layer group to obtain the computing resource parameter sorting results of each network layer group;
[0082] According to the computing resource parameter sorting result and the computing resource information, at least one network layer group to be merged is determined in each network layer group in descending order of computing resource parameters.
[0083] In actual applications, the hardware devices running the initial detection model and the target detection model may be the same device or different devices. Before determining how to obtain the target detection model based on the initial detection model, the computing resource information of the target hardware device can be obtained first, so that the target detection model can run based on the computing resource information available on the target hardware device.
[0084] The target hardware device refers to any hardware device used to deploy the target detection model. The computing resource information refers to the computing resource information available for running the target detection model in the target hardware device.
[0085] Specifically, after determining the target hardware device, obtain the computing resource information available for running the target detection model in the target hardware device, and after obtaining the computing resource parameters of each network layer group in the initial detection model, sort the computing resource parameters of each network layer group to obtain the computing resource parameter sorting result. According to the computing resource parameter sorting result and the computing resource information, in the order of computing resource parameters from large to small, determine the network layer group to be fused in each network layer group of the initial detection model.
[0086] Taking the network layer group in the initial detection model including the network layer group consisting of 3*3 convolutional layer and BN layer, the network layer group consisting of 1*1 convolutional layer and BN layer, and the residual convolutional layer group as an example, the computing resource information of the hardware device A and the computing resource parameters of each network layer group are obtained, and the computing resource parameters of each network layer group are sorted as the residual convolutional layer group>3*3 convolutional layer and BN layer>1*1 convolutional layer and BN layer. According to the order of computing resource parameters from large to small, the residual convolutional layer group is first determined as the network layer group to be fused, and the residual convolutional layer group is fused to obtain the detection model 1, and it is determined whether the computing resources used by the detection model 1 (only the residual convolutional layer group is fused) at this time exceed the computing resource information of the hardware device A. If not, it means that the computing resource information provided by the hardware device A is sufficient to run the detection model 1. At this time, the detection model 1 is the target detection model; if it exceeds, it means that the computing resource information provided by the hardware device A is insufficient to run the detection model 1 at this time. Then, the 3*3 convolution layer and the BN layer are determined as the network layer group to be fused, and the 3*3 convolution layer and the BN layer are fused to obtain detection model 2. It is determined whether the computing resources used by detection model 2 exceed the computing resource information of hardware device A. If not, it means that the computing resource information provided by hardware device A is sufficient to run detection model 2. At this time, detection model 2 is the target detection model; if it exceeds, it means that the computing resource information provided by hardware device A is insufficient to run detection model 2. The 1*1 convolution layer and the BN layer are further determined as the network layer group to be fused, and the 1*1 convolution layer and the BN layer are fused to obtain detection model 3. It is determined whether the computing resources used by detection model 3 exceed the computing resource information of hardware device A. If not, it means that the computing resource information provided by hardware device A is sufficient to run detection model 3. At this time, detection model 3 is the target detection model; if it exceeds, it means that the computing resource information provided by hardware device A is insufficient to run detection model 3. Then, the network layer group to be fused is determined in the initial detection model until the computing resource information of hardware device A can run the target detection model.
[0087] An embodiment provided in this specification can combine the computing resource parameters of each network layer group in the initial detection model and the computing resource information of the target hardware device to determine the network layer groups to be fused in each network layer group of the initial detection model, thereby improving the success rate of the hardware device running the target detection model and the generalization of the target detection model.
[0088] As described above, the network layer group to be fused includes a network layer group to be fused consisting of a first convolutional layer and a first normalization layer, a network layer group to be fused consisting of a second convolutional layer and a second normalization layer, and a residual convolutional layer group. The following explains the fusion process of the three types of network layer groups to be fused.
[0089] In a specific implementation provided in this specification, the network layer group to be fused includes a first convolutional layer and a first normalization layer;
[0090] Fuse each network layer group to be fused separately to obtain the target detection model, including:
[0091] Fusing the first convolutional layer and the first normalization layer to generate a first fused convolutional layer;
[0092] The detection model including the first fused convolutional layer is determined as the target detection model.
[0093] The first fused convolutional layer refers to a convolutional layer obtained by fusing the first convolutional layer and the first normalization layer; the first fused convolutional layer can specifically be a network layer with a 3*3 convolutional kernel, that is, a 3*3 convolutional layer.
[0094] Specifically, when the network layer group to be fused includes the first convolution layer and the first normalization layer, the first convolution layer and the first normalization layer are fused to generate the first fused convolution layer. At this time, the detection model including the first fused convolution layer is the target detection model. Furthermore, the first convolution layer is specifically a 3*3 convolution layer, the first normalization layer is specifically a BN layer, and the 3*3 convolution layer and the BN layer are fused into a fused convolution layer with a network structure of a 3*3 convolution kernel.
[0095] In a specific implementation provided in this specification, the first convolutional layer and the first normalization layer are fused to generate a first fused convolutional layer, including:
[0096] Acquire first convolution information of the first convolution layer and first normalization information of the first normalization layer, wherein the first convolution information includes a first convolution parameter, and the first normalization information includes a first normalization parameter;
[0097] The first convolution information and the first normalization information are fused to generate first fused convolution information of the first fused convolution layer, wherein the first fused convolution information includes first fused convolution parameters, and the first fused convolution parameters are determined according to the first convolution parameters and the first normalization parameters.
[0098] Among them, the first convolution information refers to the information used by the first convolution layer to perform convolution calculation on the input data, and specifically can be the calculation formula used by the first convolution layer to calculate the feature map. The first convolution parameter refers to the convolution parameter of the first convolution layer, including the first convolution weight parameter and the first convolution bias parameter. The first normalization information refers to the information used by the first normalization layer to perform normalization calculation on the input data, and specifically can be the calculation formula of the normalization layer. The first normalization parameter refers to the normalization parameter of the first normalization layer, including the first normalization weight parameter and the first normalization bias parameter. The first fused convolution information refers to the information used by the first fused convolution layer to calculate the input data, and specifically can be the calculation formula of the first fused convolution layer. The first fused convolution parameter refers to the fused convolution parameter of the first fused convolution layer, including the first fused convolution weight parameter and the first fused convolution bias parameter.
[0099] Specifically, after the initial detection model training is completed, the first convolution information of the first convolution layer and the first normalization information of the first normalization layer are obtained, and the first convolution information and the first normalization information are fused to generate the first fused convolution information of the first fused convolution layer.
[0100] Further explanation is given by assuming that the first convolution layer is a 3*3 convolution layer and the first normalization layer is a BN layer. After the initial detection model training is completed, the first convolution information of the 3*3 convolution layer is obtained. For details, please refer to the following formula 1:
[0101]
[0102] in, is the output data of the first convolutional layer, f i,j is the input data of the first convolutional layer, W conv1 is the first convolution weight parameter, b conv1 is the first convolution bias parameter. conv1 and b conv1 It can be directly obtained after the initial detection model training is completed.
[0103] Get the first normalization information of the BN layer. For details, see the following formula 2:
[0104]
[0105] in, is the output data of the first normalization layer, F ij is the input data of the first normalization layer, γ is the scaling factor of the first normalization layer, μ is the mean of the input data, σ 2 is the variance of the input data, and β is the offset factor of the first normalization layer. γ and β can be directly obtained after the initial detection model training is completed, and μ and σ 2It is calculated by calculating the mean and variance of the input data.
[0106] Expanding the above formula 2 can obtain the following formula 3:
[0107]
[0108] According to the above formula 3, it can be known that the calculation formula of the first normalization layer is similar to the calculation formula of the first convolutional layer in calculation form, and both can be regarded as the form of y=w·x+b. Since the output data of the first convolutional layer is the input data of the first normalization layer, the calculation formula of the first convolutional layer can be combined with the calculation formula of the first normalization layer to achieve the fusion of the first convolutional layer and the first normalization layer, and obtain the first fused convolutional layer. After the calculation formula of the first convolutional layer is combined with the calculation formula of the first normalization layer, refer to the following formula 4:
[0109]
[0110] Among them, W BN1 is the first normalized weight parameter, b BN1 is the first normalized bias parameter. Expanding the above formula 4 can obtain the calculation formula of the first fused convolution layer, see the following formula 5 for details:
[0111]
[0112] The above formula 5 is the first fused convolution information of the first fused convolution layer. According to the above formula 5, the first fused convolution weight parameter and the first fused convolution bias parameter of the first fused convolution layer can be determined.
[0113] Based on this, in a specific implementation provided in this specification, the first convolution parameter includes a first convolution weight parameter and a first convolution bias parameter, and the first normalization parameter includes a first normalization weight parameter and a first normalization bias parameter;
[0114] The method further comprises:
[0115] Determining a first fused convolution weight parameter of the first fused convolution layer according to the first convolution weight parameter and the first normalized weight parameter;
[0116] Determine a first fused convolution bias parameter of the first fused convolution layer according to the first normalized weight parameter, the first convolution bias parameter and the first normalized bias parameter.
[0117] Specifically, the first fused convolution weight parameter and the first fused convolution bias parameter can be determined according to the above formula 5, and specifically refer to the following formula 6 and formula 7:
[0118] W1=W BN1 ·W conv1 Formula 6
[0119] b1=W BN1 b conv1 +b BN1 Formula 7
[0120] Among them, W1 is the first fused convolution weight parameter, and b1 is the first fused convolution bias parameter.
[0121] By fusing the first convolution layer and the first normalization layer into a first fused convolution layer through the above method, the computational complexity and memory resource occupation of the model can be reduced when the target detection model including the first fused convolution layer is actually applied.
[0122] In a specific implementation provided in this specification, the network layer group to be fused includes a second convolutional layer and a second normalization layer;
[0123] Fuse each network layer group to be fused separately to obtain the target detection model, including:
[0124] Fusing the second convolutional layer and the second normalization layer to generate a second fused convolutional layer;
[0125] The detection model including the second fused convolutional layer is determined as the target detection model.
[0126] Among them, the second fused convolution layer refers to a convolution layer obtained by fusing the second convolution layer and the second normalization layer; the second fused convolution layer can also specifically be a network layer with a 3*3 convolution kernel, that is, a 3*3 convolution layer, but the model parameters of the second fused convolution layer are different from the model parameters of the first fused convolution layer in numerical value.
[0127] Specifically, when the network layer group to be fused includes the second convolution layer and the second normalization layer, the second convolution layer and the second normalization layer are fused to generate a second fused convolution layer. At this time, the detection model including the second fused convolution layer is the target detection model. Furthermore, the second convolution layer is specifically a 1*1 convolution layer, and the second normalization layer is specifically a BN layer. The 1*1 convolution layer and the BN layer are fused into a fused convolution layer with a network structure of a 3*3 convolution kernel.
[0128] Before fusing the second convolutional layer with the second normalization layer, it is necessary to convert the second convolutional layer (i.e., 1*1 convolutional layer) into a convolutional layer to be fused. The network structure of the convolutional layer to be fused is a convolutional layer with a 3*3 convolution kernel. The conversion method is as follows:
[0129] In a specific implementation provided in this specification, fusing the second convolutional layer and the second normalization layer to generate a second fused convolutional layer includes:
[0130] Convert the second convolutional layer to a convolutional layer to be fused;
[0131] The to-be-fused convolutional layer and the second normalization layer are fused to generate a second fused convolutional layer.
[0132] Specifically, since the second convolutional layer and the second normalization layer need to be fused into a second fused convolutional layer with a network structure of 3*3 convolutional kernels, the second convolutional layer needs to be converted so that the network structure of the converted convolutional layer is also 3*3 convolutional kernels. Based on this, the second convolutional layer is converted into a convolutional layer to be fused with a network structure of 3*3 convolutional kernels, and the convolutional layer to be fused is fused with the second normalization layer to obtain the second fused convolutional layer.
[0133] Based on this, in a specific implementation manner provided in this specification, converting the second convolutional layer into a convolutional layer to be fused includes:
[0134] Get preset filling parameters;
[0135] According to the preset filling parameter, the second convolutional layer is filled to obtain the convolutional layer to be fused.
[0136] Since the second convolutional layer is specifically a 1*1 convolutional layer, and its convolution kernel is smaller than that of the 3*3 convolutional layer, the second convolutional layer can be padded, wherein a preset padding parameter is used to pad the second convolutional layer to generate the convolutional layer to be fused. In order to make the calculation result of the padded convolutional layer to be fused consistent with the calculation result of the second convolutional layer, the preset padding parameter can be set to 0.
[0137] Specifically, after determining that the network layer group consisting of the second convolutional layer and the second normalization layer is the network layer group to be fused, a preset filling parameter is obtained, and the preset filling parameter is used to fill the second convolutional layer to obtain the convolutional layer to be fused. Figure 3 , Figure 3 FIG. 4 shows a schematic diagram of filling the second convolutional layer according to an embodiment of the present specification. Figure 3 As shown, Figure 3 The shaded part is the second convolutional layer, that is, the 1*1 convolutional layer. The default padding parameter with a value of 0 is used to fill the area around the second convolutional layer, and the following can be obtained: Figure 3 The network structure shown is a convolutional layer to be fused with a 3*3 convolution kernel. After obtaining the convolutional layer to be fused, the convolutional layer to be fused is fused with the second normalization layer to obtain the second fused convolutional layer.
[0138] Based on this, in a specific implementation manner provided in this specification, the convolutional layer to be fused and the second normalization layer are fused to generate a second fused convolutional layer, including:
[0139] Acquire the to-be-fused convolution information of the to-be-fused convolution layer and the second normalization information of the second normalization layer, wherein the to-be-fused convolution information includes the to-be-fused convolution parameters, and the second normalization information includes the second normalization parameters;
[0140] The convolution parameters to be fused and the second normalization parameters are fused to generate second fused convolution information of the second fused convolution layer, wherein the second fused convolution information includes second fused convolution parameters, and the second fused convolution parameters are determined according to the convolution parameters to be fused and the second normalization parameters.
[0141] Among them, the convolution information to be fused refers to the information used by the convolution layer to be fused to perform convolution calculation on the input data, and can be specifically the calculation formula used by the convolution layer to be fused to calculate the feature map. The convolution parameters to be fused refer to the convolution parameters of the convolution layer to be fused, including the convolution weight parameters to be fused and the convolution bias parameters to be fused. Since the preset padding parameter is 0, the calculation result of the convolution layer to be fused after padding is consistent with the calculation result of the second convolution layer. Therefore, the convolution information to be fused is the second convolution information of the second convolution layer, and the convolution parameters to be fused are the second convolution parameters of the second convolution layer. The second normalization information refers to the information used by the second normalization layer to perform normalization calculation on the input data, and can be specifically the calculation formula of the normalization layer. The second normalization parameter refers to the normalization parameter of the second normalization layer, including the second normalization weight parameter and the second normalization bias parameter. The second fused convolution information refers to the information used by the second fused convolution layer to calculate the input data, and can be specifically the calculation formula of the second fused convolution layer. The second fused convolution parameters refer to the fused convolution parameters of the second fused convolution layer, including the second fused convolution weight parameters and the second fused convolution bias parameters.
[0142] Specifically, after obtaining the convolutional layer to be fused, obtain the convolutional information to be fused of the convolutional layer to be fused and the second normalized information of the second normalized layer, fuse the convolutional information to be fused and the second normalized information to generate the second fused convolutional information of the second fused convolutional layer. It should be noted that the network structure of the padded convolutional layer to be fused is the same as that of the first convolutional layer, both of which are 3*3 convolutional layers. The implementation method of fusing the convolutional layer to be fused with the second normalized layer to generate the second fused convolutional layer is the same as the implementation method of fusing the first convolutional layer with the first normalized layer to generate the first fused convolutional layer, and this specification will not repeat it here. The second fused convolutional information of the second fused convolutional layer can be found in the following formula 8:
[0143]
[0144] Among them, W conv2 is the convolution weight parameter of the convolution layer to be fused, that is, the second convolution weight parameter of the second convolution layer, b conv2is the bias parameter of the convolution layer to be fused, that is, the second convolution bias parameter of the second convolution layer, W BN2 is the second normalized weight parameter of the second normalized layer, b BN2 is the second normalized bias parameter of the second normalized layer. Accordingly, the second fused convolution weight parameter and the second fused convolution bias parameter of the second fused convolution layer can be determined according to the above formula 8.
[0145] In a specific implementation provided in this specification, the convolution parameters to be fused include convolution weight parameters to be fused and convolution bias parameters to be fused, and the second normalization parameters include second normalization weight parameters and second normalization bias parameters;
[0146] The method further comprises:
[0147] Determining a second fused convolution weight parameter of the second fused convolution layer according to the to-be-fused convolution weight parameter and the second normalized weight parameter;
[0148] Determine a second fused convolution bias parameter of the second fused convolution layer according to the second normalized weight parameter, the to-be-fused convolution bias parameter and the second normalized bias parameter.
[0149] Specifically, according to the above formula 8, the second fused convolution weight parameter and the second fused convolution bias parameter can be determined, and specifically refer to the following formula 9 and formula 10:
[0150] W2=W BN2 ·W conv2 Formula 9
[0151] b2=W BN2 b conv2 +b BN2 Formula 10
[0152] Among them, W2 is the second fused convolution weight parameter, and b2 is the second fused convolution bias parameter.
[0153] By obtaining the preset filling parameter with a value of 0 to fill the second convolution layer with a network structure of 1*1 convolution kernel, the convolution layer to be fused with a network structure of 3*3 convolution kernel is obtained, and the convolution layer to be fused is fused with the second normalization layer to generate a second fused convolution layer with a network structure of 3*3 convolution kernel, thereby improving the convergence speed of the model and ensuring the consistency of the model calculation results.
[0154] Further, in a specific implementation provided in this specification, the network layer group to be fused includes a residual convolution layer group;
[0155] Fuse each network layer group to be fused separately to obtain the target detection model, including:
[0156] Determining a first network layer subgroup to be fused, a second network layer subgroup to be fused, and a skip connection layer in the residual convolutional layer group;
[0157] Fusing the first to-be-fused network layer subgroups to obtain a first fused convolutional sublayer;
[0158] Fusing the second to-be-fused network layer subgroup to obtain a second fused convolutional sublayer;
[0159] Converting the skip connection layer into a third fused convolutional sublayer;
[0160] The first fused convolution sublayer, the second fused convolution sublayer and the third fused convolution sublayer are fused to generate a third fused convolution layer, and the detection model including the third fused convolution layer is determined as a target detection model.
[0161] In practical applications, the residual convolution layer group often includes multiple branch network layers, such as 1*1 convolution layer, 3*3 convolution layer, jump connection layer, etc. When using the residual convolution layer group to calculate the input data, multiple branch networks are required to calculate separately, resulting in a large amount of model calculation and low processing efficiency. Therefore, the branch network layers in the residual convolution layer group can be fused to reduce the amount of model calculation and improve the processing efficiency of the model.
[0162] Among them, the residual convolution layer group includes the first network layer subgroup to be fused, the second network layer subgroup to be fused and the jump connection layer. The first network layer subgroup to be fused includes a branch 3*3 convolution layer and a BN layer, and the second network layer subgroup to be fused includes a branch 1*1 convolution layer and a BN layer. The first fused convolution sublayer is a network layer obtained by fusing the branch 3*3 convolution layer and the BN layer, and the second fused convolution sublayer is a network layer obtained by fusing the branch 1*1 convolution layer and the BN layer. The third fused convolution sublayer refers to the network layer after the jump connection layer is converted. The third fused convolution layer refers to the convolution layer obtained by fusing the first fused convolution sublayer, the second fused convolution sublayer and the third fused convolution sublayer; the third fused convolution layer can also be a network layer with a 3*3 convolution kernel, that is, a 3*3 convolution layer.
[0163] Specifically, after the initial detection model training is completed, the model parameters of each network layer in the residual convolution layer group are obtained, and fusion processing is performed according to the model parameters of each network layer. The first network layer subgroup to be fused is determined in the residual convolution layer group, that is, the branch 3*3 convolution layer and the BN layer, the second network layer subgroup to be fused is determined, that is, the branch 1*1 convolution layer and the BN layer, and the jump connection layer. The branch 3*3 convolution layer and the BN layer are fused to obtain the first fused convolution sublayer, the branch 1*1 convolution layer and the BN layer are fused to obtain the second fused convolution sublayer, and the jump connection layer is converted into a third fused convolution sublayer. After obtaining the first fused convolution sublayer, the second fused convolution sublayer and the third fused convolution sublayer, the first fused convolution sublayer, the second fused convolution sublayer and the third fused convolution sublayer are fused to generate a third fused convolution layer. At this time, the detection model including the third fused convolution layer is the target detection model. It should be noted that the implementation method of fusing the first subgroup of network layers to be fused, that is, the branch 3*3 convolutional layer and the BN layer, is the same as the implementation method of fusing the first convolutional layer and the first normalization layer to generate the first fused convolutional layer. The implementation method of fusing the second subgroup of network layers to be fused, that is, the branch 1*1 convolutional layer and the BN layer, is the same as the implementation method of fusing the second convolutional layer and the second normalization layer to generate the second fused convolutional layer. This specification will not go into details here.
[0164] By fusing the network layers in the residual convolution layer group to generate a third fused convolution layer with a network structure of 3*3 convolution kernel, the number of parameters and the amount of calculation of the residual convolution layer group are reduced, thereby improving the computing processing efficiency.
[0165] Furthermore, in a specific implementation manner provided in this specification, converting the jump connection layer into a third fused convolutional sublayer includes:
[0166] Obtaining a jump weight parameter and a jump bias parameter of the jump connection layer;
[0167] Replacing the jump weight parameter with a preset weight parameter, and replacing the jump bias parameter with a preset bias parameter;
[0168] A jump connection layer including the preset weight parameters and the preset bias parameters is determined as a third fused convolution sublayer.
[0169] Among them, the jump weight parameter refers to the weight parameter of the jump connection layer obtained after the initial detection model training is completed. The jump bias parameter refers to the bias parameter of the jump connection layer obtained after the initial detection model training is completed. The preset weight parameter is used to replace the jump weight parameter; the preset bias parameter is used to replace the jump bias parameter. Since in actual applications, the jump connection layer does not process the input, but allows the input data to be directly passed to the next layer, the preset weight parameter can be set to the unit matrix and the preset bias parameter can be set to the zero matrix, so that the calculation result of the output data can be unchanged during the calculation process.
[0170] Specifically, after the initial detection model training is completed, the jump weight parameter and jump bias parameter of the jump connection layer can be obtained, and the jump weight parameter is replaced by a preset weight parameter, specifically replaced by a unit matrix, and the jump bias parameter is replaced by a preset bias parameter, specifically replaced by a zero matrix, so that a jump connection layer in which the jump weight parameter is the unit matrix and the jump bias parameter is the zero matrix can be obtained. In practical applications, after the input data is multiplied by the unit matrix and then added to the zero matrix, the calculation result of the output data will not change, thereby ensuring the accuracy of the output data.
[0171] Furthermore, in a specific implementation manner provided in this specification, the first fused convolution sublayer, the second fused convolution sublayer and the third fused convolution sublayer are fused to generate a third fused convolution layer, including:
[0172] Acquire first fusion sublayer information of the first fusion convolution sublayer, second fusion sublayer information of the second fusion convolution sublayer, and third fusion sublayer information of the third fusion convolution sublayer, wherein the first fusion sublayer information includes first fusion sublayer parameters, the second fusion sublayer information includes second fusion sublayer parameters, and the third fusion sublayer information includes third fusion sublayer parameters;
[0173] The first fusion sublayer information, the second fusion sublayer information and the third fusion sublayer information are fused to generate third fusion convolution information of the third fusion convolution layer, wherein the third fusion convolution information includes third fusion convolution parameters, and the third fusion convolution parameters are determined according to the first fusion sublayer parameters, the second fusion sublayer parameters and the third fusion sublayer parameters.
[0174] Among them, the first fusion sublayer information refers to the information used by the first fusion convolution sublayer to perform convolution calculation on the input data, which can be specifically the calculation formula used by the first fusion convolution sublayer to calculate the feature map. The first fusion sublayer parameters refer to the convolution parameters of the first fusion convolution sublayer, including the first fusion sublayer weight parameters and the first fusion sublayer bias parameters. The second fusion sublayer information refers to the information used by the second fusion convolution sublayer to perform convolution calculation on the input data, which can be specifically the calculation formula used by the second fusion convolution sublayer to calculate the feature map. The second fusion sublayer parameters refer to the convolution parameters of the second fusion convolution sublayer, including the second fusion sublayer weight parameters and the second fusion sublayer bias parameters. The third fusion sublayer information refers to the information used by the third fusion convolution sublayer to perform convolution calculation on the input data, which can be specifically the calculation formula used by the third fusion convolution sublayer to calculate the feature map. The third fusion sublayer parameters refer to the convolution parameters of the third fusion convolution sublayer, including the third fusion sublayer weight parameters and the third fusion sublayer bias parameters.
[0175] The third fused convolution information refers to the information used by the third fused convolution layer to calculate the input data, and specifically can be the calculation formula of the third fused convolution layer. The third fused convolution parameters refer to the fused convolution parameters of the third fused convolution layer, including the third fused convolution weight parameters and the third fused convolution bias parameters.
[0176] Specifically, after the first fused convolution sublayer and the second fused convolution sublayer are obtained by fusion, and the jump connection layer is converted to the third fused convolution sublayer, the first fused sublayer information of the first fused convolution sublayer, the second fused sublayer information of the second fused convolution sublayer, and the third fused sublayer information of the third fused convolution sublayer are obtained respectively, and the first fused sublayer information, the second fused sublayer information, and the third fused sublayer information are fused to generate the third fused convolution information of the third fused convolution layer. The calculation formula for fusing the first fused sublayer information, the second fused sublayer information, and the third fused sublayer information can be specifically referred to the following formula 11:
[0177]
[0178] in, is the output data of the third fused convolutional layer, x i is the input data of the third fused convolutional layer, is the weight parameter of the first fused convolutional sublayer, is the first fusion sublayer bias parameter of the first fusion convolution sublayer, is the second fusion sublayer weight parameter of the second fusion convolution sublayer, is the second fusion sublayer bias parameter of the second fusion convolution sublayer, is the weight parameter of the third fusion sublayer of the third fusion convolution sublayer, is the third fusion sublayer bias parameter of the third fusion convolution sublayer. After expanding the above formula 11, the calculation formula of the third fusion convolution layer can be obtained. For details, refer to the following formula 12:
[0179]
[0180] The above formula 12 is the third fused convolution information of the third fused convolution layer. According to the above formula 12, the third fused convolution weight parameter and the third fused convolution bias parameter of the third fused convolution layer can be determined.
[0181] Based on this, in a specific implementation manner provided in this specification, the first fusion sublayer parameter includes a first fusion sublayer weight parameter and a first fusion sublayer bias parameter, the second fusion sublayer parameter includes a second fusion sublayer weight parameter and a second fusion sublayer bias parameter, and the third fusion sublayer parameter includes a third fusion sublayer weight parameter and a third fusion sublayer bias parameter;
[0182] The method further comprises:
[0183] Determining a third fused convolution weight parameter of the third fused convolution layer according to the first fused sublayer weight parameter, the second fused sublayer weight parameter and the third fused sublayer weight parameter;
[0184] Determine a third fused convolution bias parameter of the third fused convolution layer according to the first fused sublayer bias parameter, the second fused sublayer bias parameter and the third fused sublayer bias parameter.
[0185] Specifically, according to the above formula 12, the third fused convolution weight parameter and the third fused convolution bias parameter can be determined, and specifically refer to the following formula 13 and formula 14:
[0186]
[0187] Among them, W3 is the third fused convolution weight parameter, and b3 is the third fused convolution bias parameter.
[0188] By using the above method, the branch network layers in the residual convolution layer group are fused to obtain the third fused convolution layer. There is no need for multiple branch networks to calculate the input data separately, which reduces the amount of model calculation and improves the processing efficiency of the model.
[0189] The image processing method provided in this specification includes: obtaining an image to be detected; inputting the image to be detected into a target detection model to obtain a target detection result of the image to be detected, wherein the target detection model includes at least one fused convolutional layer, and the fused convolutional layer is obtained by fusing a network layer group to be fused in an initial detection model, and the network layer group to be fused includes at least two network layers to be fused.
[0190] One or more embodiments of the present specification realize that image processing is performed on an image to be detected through a target detection model, and a target detection result of the image to be detected is obtained. Since the target detection model includes multiple fused convolutional layers, the fused convolutional layer is obtained by fusing a group of network layers to be fused consisting of at least two network layers to be fused in the initial detection model. Therefore, in the process of using the target detection model to perform image processing on the image to be detected, the image to be detected can be directly processed through the fused convolutional layer, and there is no need to process the image to be detected in sequence through each network layer to be fused, thereby improving the processing efficiency of the image processing of the image to be detected; and since the target detection model is obtained by fusing each group of network layers to be fused in the initial detection model, the model structure of the initial detection model is not changed in this process. Therefore, using the target detection model to process the image to be detected will not affect the detection result of the image to be detected, thereby ensuring the accuracy of the image processing of the image to be detected.
[0191] The following combination Figure 4 , the image processing method is further described. Figure 4 A flowchart of an image processing method provided by an embodiment of the present specification is shown. Figure 4 As shown in the figure, the initial detection model includes a 3*3 convolution layer + BN layer, a 1*1 convolution layer + BN layer and a residual convolution layer group, wherein the residual convolution layer group includes multiple branch network layers, specifically a 3*3 convolution layer + BN layer, a 1*1 convolution layer + BN layer and a jump connection layer. In order to reduce the amount of data calculation of the model and the occupancy of device memory, after the initial detection model training is completed, the 3*3 convolution layer + BN layer, the 1*1 convolution layer + BN layer and the residual convolution layer group can be fused respectively to generate the corresponding 3*3 convolution layer to obtain the target detection model. The following explains the specific implementation process of fusing the 3*3 convolution layer + BN layer, the 1*1 convolution layer + BN layer and the residual convolution layer group.
[0192] Fusion 3*3 convolution layer + BN layer: The calculation formula for obtaining the 3*3 convolution layer for calculating the feature map is: And the calculation formula of the BN layer is Combining the calculation formula of the 3*3 convolutional layer with the calculation formula of the BN layer, we can get Thus, a fused 3*3 convolutional layer (i.e., the first fused convolutional layer described above) is obtained, and the weight parameter of the fused 3*3 convolutional layer is W1=W BN1 ·W conv1 , the bias parameter is b1=W BN1 b conv1 +b BN1.
[0193] Fusion of 1*1 convolution layer + BN layer: Use the preset padding parameter (specifically 0) to pad the 1*1 convolution layer to obtain a padded 3*3 convolution layer. Then, based on the same implementation method as the above fusion of 3*3 convolution layer + BN layer, the padded 3*3 convolution layer is fused with the BN layer to obtain a fused 3*3 convolution layer (i.e., the second fused convolution layer described above). And the weight parameter of the fused 3*3 convolution layer is W2=W BN2 ·W conv2 , the bias parameter is b2=W BN2 b conv2 +b BN2 .
[0194] Fusion residual convolution layer group: First, based on the same implementation as above, fuse the 3*3 convolution layer + BN layer in the residual convolution layer group to obtain the first fused convolution sublayer, and fuse the 1*1 convolution layer + BN layer to obtain the second fused convolution sublayer. Use the unit matrix to replace the jump weight parameter of the jump connection layer, and use the zero matrix to replace the jump bias parameter of the jump connection layer to obtain the replaced third fused convolution sublayer. Fuse the first fused convolution sublayer, the second fused convolution sublayer and the third fused convolution sublayer, that is, Expanding this formula we can get Thus, the fused 3*3 convolutional layer (i.e., the third fused convolutional layer mentioned above) is obtained, and the weight parameter of the fused 3*3 convolutional layer is The bias parameter is
[0195] In summary, the target detection model can be obtained. The image to be detected is obtained, and the image to be detected is input into the target detection model, and the target detection result of the image to be detected output by the target detection model can be obtained.
[0196] An embodiment of the present specification realizes that after the initial detection model training is completed, the 3*3 convolution layer + BN layer, 1*1 convolution layer + BN layer and residual convolution layer group in the initial detection model are fused respectively to obtain 3*3 convolution layers with the same network structure, and generate a corresponding target detection model. In the process of using the target detection model to process the image to be detected, the image to be detected can be directly processed by the fused multiple 3*3 convolution layers, without the need to process the image to be detected in sequence through each branch network layer, thereby improving the processing efficiency of the image processing of the image to be detected; and because the target detection model is obtained by fusing the branch network layers in the initial detection model, the model structure of the initial detection model is not changed in this process, therefore, using the target detection model to process the image to be detected will not affect the detection result of the image to be detected, thereby ensuring the accuracy of the image processing of the image to be detected.
[0197] Corresponding to the above method embodiment, this specification also provides an image processing device embodiment, Figure 5 FIG. 2 shows a schematic diagram of the structure of an image processing device provided by an embodiment of the present specification. Figure 5 As shown, the device comprises:
[0198] An acquisition module 502 is configured to acquire an image to be detected;
[0199] The input module 504 is configured to input the image to be detected into the target detection model to obtain the target detection result of the image to be detected, wherein the target detection model includes at least one fused convolutional layer, and the fused convolutional layer is obtained by fusing the network layer group to be fused in the initial detection model, and the network layer group to be fused includes at least two network layers to be fused.
[0200] Optionally, the device further includes a fusion module configured to:
[0201] Obtain computing resource parameters for each network layer group in the initial detection model;
[0202] Determine at least one network layer group to be merged in each network layer group according to computing resource parameters of each network layer group;
[0203] Fuse each network layer group to be fused separately to obtain the target detection model.
[0204] Optionally, the fusion module is further configured as follows:
[0205] Obtain computing resource information of the target hardware device;
[0206] Sort the computing resource parameters of each network layer group to obtain the computing resource parameter sorting results of each network layer group;
[0207] According to the computing resource parameter sorting result and the computing resource information, at least one network layer group to be merged is determined in each network layer group in descending order of computing resource parameters.
[0208] Optionally, the network layer group to be fused includes a first convolutional layer and a first normalization layer;
[0209] The fusion module is further configured as follows:
[0210] Fusing the first convolutional layer and the first normalization layer to generate a first fused convolutional layer;
[0211] The detection model including the first fused convolutional layer is determined as the target detection model.
[0212] Optionally, the fusion module is further configured as follows:
[0213] Acquire first convolution information of the first convolution layer and first normalization information of the first normalization layer, wherein the first convolution information includes a first convolution parameter, and the first normalization information includes a first normalization parameter;
[0214] The first convolution information and the first normalization information are fused to generate first fused convolution information of the first fused convolution layer, wherein the first fused convolution information includes first fused convolution parameters, and the first fused convolution parameters are determined according to the first convolution parameters and the first normalization parameters.
[0215] Optionally, the first convolution parameter includes a first convolution weight parameter and a first convolution bias parameter, and the first normalization parameter includes a first normalization weight parameter and a first normalization bias parameter;
[0216] The device also includes a first parameter determination module, configured to:
[0217] Determining a first fused convolution weight parameter of the first fused convolution layer according to the first convolution weight parameter and the first normalized weight parameter;
[0218] Determine a first fused convolution bias parameter of the first fused convolution layer according to the first normalized weight parameter, the first convolution bias parameter and the first normalized bias parameter.
[0219] Optionally, the network layer group to be fused includes a second convolutional layer and a second normalization layer;
[0220] The fusion module is further configured as follows:
[0221] Fusing the second convolutional layer and the second normalization layer to generate a second fused convolutional layer;
[0222] The detection model including the second fused convolutional layer is determined as the target detection model.
[0223] Optionally, the fusion module is further configured as follows:
[0224] Convert the second convolutional layer to a convolutional layer to be fused;
[0225] The to-be-fused convolutional layer and the second normalization layer are fused to generate a second fused convolutional layer.
[0226] Optionally, the fusion module is further configured as follows:
[0227] Get preset filling parameters;
[0228] According to the preset filling parameter, the second convolutional layer is filled to obtain the convolutional layer to be fused.
[0229] Optionally, the fusion module is further configured as follows:
[0230] Acquire the to-be-fused convolution information of the to-be-fused convolution layer and the second normalization information of the second normalization layer, wherein the to-be-fused convolution information includes the to-be-fused convolution parameters, and the second normalization information includes the second normalization parameters;
[0231] The convolution parameters to be fused and the second normalization parameters are fused to generate second fused convolution information of the second fused convolution layer, wherein the second fused convolution information includes second fused convolution parameters, and the second fused convolution parameters are determined according to the convolution parameters to be fused and the second normalization parameters.
[0232] Optionally, the convolution parameters to be fused include convolution weight parameters to be fused and convolution bias parameters to be fused, and the second normalization parameters include second normalization weight parameters and second normalization bias parameters;
[0233] The device also includes a second parameter determination module, configured to:
[0234] Determining a second fused convolution weight parameter of the second fused convolution layer according to the to-be-fused convolution weight parameter and the second normalized weight parameter;
[0235] Determine a second fused convolution bias parameter of the second fused convolution layer according to the second normalized weight parameter, the to-be-fused convolution bias parameter and the second normalized bias parameter.
[0236] Optionally, the network layer group to be fused includes a residual convolution layer group;
[0237] The fusion module is further configured as follows:
[0238] Determining a first network layer subgroup to be fused, a second network layer subgroup to be fused, and a skip connection layer in the residual convolutional layer group;
[0239] Fusing the first to-be-fused network layer subgroups to obtain a first fused convolutional sublayer;
[0240] Fusing the second to-be-fused network layer subgroup to obtain a second fused convolutional sublayer;
[0241] Converting the skip connection layer into a third fused convolutional sublayer;
[0242] The first fused convolution sublayer, the second fused convolution sublayer and the third fused convolution sublayer are fused to generate a third fused convolution layer, and the detection model including the third fused convolution layer is determined as a target detection model.
[0243] Optionally, the fusion module is further configured as follows:
[0244] Obtaining a jump weight parameter and a jump bias parameter of the jump connection layer;
[0245] Replacing the jump weight parameter with a preset weight parameter, and replacing the jump bias parameter with a preset bias parameter;
[0246] A jump connection layer including the preset weight parameters and the preset bias parameters is determined as a third fused convolution sublayer.
[0247] Optionally, the fusion module is further configured as follows:
[0248] Acquire first fusion sublayer information of the first fusion convolution sublayer, second fusion sublayer information of the second fusion convolution sublayer, and third fusion sublayer information of the third fusion convolution sublayer, wherein the first fusion sublayer information includes first fusion sublayer parameters, the second fusion sublayer information includes second fusion sublayer parameters, and the third fusion sublayer information includes third fusion sublayer parameters;
[0249] The first fusion sublayer information, the second fusion sublayer information and the third fusion sublayer information are fused to generate third fusion convolution information of the third fusion convolution layer, wherein the third fusion convolution information includes third fusion convolution parameters, and the third fusion convolution parameters are determined according to the first fusion sublayer parameters, the second fusion sublayer parameters and the third fusion sublayer parameters.
[0250] Optionally, the first fusion sublayer parameter includes a first fusion sublayer weight parameter and a first fusion sublayer bias parameter, the second fusion sublayer parameter includes a second fusion sublayer weight parameter and a second fusion sublayer bias parameter, and the third fusion sublayer parameter includes a third fusion sublayer weight parameter and a third fusion sublayer bias parameter;
[0251] The device further includes a third parameter determination module, configured to:
[0252] Determining a third fused convolution weight parameter of the third fused convolution layer according to the first fused sublayer weight parameter, the second fused sublayer weight parameter and the third fused sublayer weight parameter;
[0253] Determine a third fused convolution bias parameter of the third fused convolution layer according to the first fused sublayer bias parameter, the second fused sublayer bias parameter and the third fused sublayer bias parameter.
[0254] Optionally, the device further comprises a training module configured to:
[0255] Acquire sample training data, wherein the sample training data includes a sample training image and a sample detection result corresponding to the sample training image;
[0256] Inputting the sample training image into the initial detection model to obtain a predicted detection result output by the initial detection model;
[0257] Calculating a model loss value of the initial detection model according to the predicted detection result and the sample detection result;
[0258] The model parameters of the initial detection model are adjusted according to the model loss value, and the initial detection model is continuously trained until a model training stop condition is reached.
[0259] The image processing device provided in this specification includes: an acquisition module, configured to acquire an image to be detected; an input module, configured to input the image to be detected into a target detection model to obtain a target detection result of the image to be detected, wherein the target detection model includes at least one fused convolutional layer, and the fused convolutional layer is obtained by fusing a network layer group to be fused in an initial detection model, and the network layer group to be fused includes at least two network layers to be fused.
[0260] One or more embodiments of the present specification realize that image processing is performed on an image to be detected through a target detection model, and a target detection result of the image to be detected is obtained. Since the target detection model includes multiple fused convolutional layers, the fused convolutional layer is obtained by fusing a group of network layers to be fused consisting of at least two network layers to be fused in the initial detection model. Therefore, in the process of using the target detection model to perform image processing on the image to be detected, the image to be detected can be directly processed through the fused convolutional layer, and there is no need to process the image to be detected in sequence through each network layer to be fused, thereby improving the processing efficiency of the image processing of the image to be detected; and since the target detection model is obtained by fusing each group of network layers to be fused in the initial detection model, the model structure of the initial detection model is not changed in this process. Therefore, using the target detection model to process the image to be detected will not affect the detection result of the image to be detected, thereby ensuring the accuracy of the image processing of the image to be detected.
[0261] The above is a schematic scheme of an image processing device of this embodiment. It should be noted that the technical scheme of the image processing device and the technical scheme of the above-mentioned image processing method belong to the same concept, and the details not described in detail in the technical scheme of the image processing device can be referred to the description of the technical scheme of the above-mentioned image processing method.
[0262] See also Figure 6 , Figure 6 The following is a schematic diagram of an application scenario of an access control method provided according to an embodiment of the present specification. In access control scenarios, most access control devices use facial recognition to determine whether a person can pass through the access control and enter the destination. For example, construction sites, office buildings, subways and other places are equipped with corresponding access control devices or access control systems to ensure the safety of these places. Therefore, it is particularly important whether the access control device can accurately recognize the face of a person.
[0263] Based on this, this specification also provides an access control method, which uses the target detection model in the above-mentioned image processing method to perform face recognition on people, outputs the face recognition results, and improves the accuracy and efficiency of judging whether people can pass through the access control device in the subsequent process.
[0264] See also Figure 7 , Figure 7 A flow chart of a door access control method provided according to an embodiment of the present specification is shown, which specifically includes the following steps:
[0265] Step 702: Receive a door access control request sent by a target door access device.
[0266] Specifically, the access control method is applied to the server. The target access control device can be any access control device, such as an access control gate in a construction site, an access control gate in an office building, etc. The access control request refers to a request generated by the target access control device to request the server to control the access control gate door.
[0267] Step 704: In response to the access control request, an image of the person to be detected is obtained.
[0268] Specifically, the person to be detected refers to a person waiting to pass through the target access control device. The image of the person to be detected is an image of the person to be detected, specifically a facial image of the person to be detected.
[0269] After receiving the access control request sent by the target access control device, the server obtains the image of the person to be detected of the person to be detected in response to the access control request.
[0270] Step 706: input the image of the person to be detected into a target detection model to obtain a target detection result of the image of the person to be detected.
[0271] Among them, the target detection model includes at least one fused convolutional layer, and the fused convolutional layer is obtained by fusing the network layer group to be fused in the initial detection model, and the network layer group to be fused includes at least two network layers to be fused.
[0272] Specifically, the acquired image of the person to be detected is input into the target detection model to obtain the target detection result of the image of the person to be detected, for example, the person identification and person category of the person to be detected.
[0273] Step 708: searching a preset search library for a detection result that matches the target detection result, and generating a target matching result for the target detection result.
[0274] Specifically, the target matching result specifically includes a target detection result matching success or a target detection result matching failure. A detection result matching the target detection result is searched in a preset search library, and a target matching result of the target detection result is generated.
[0275] Step 710: When the target matching result is a successful match, a door opening instruction is sent to the target access control device to open the target access control device.
[0276] Specifically, if the target matching result of the target detection result is a successful match, it means that the detection result of the person to be detected has been stored in the preset search library, and the person to be detected can pass through the target access control device. Based on this, the server generates an access control opening instruction for the target access control device and sends the access control opening instruction to the target access control device to open the target access control device. If the target matching result of the target detection result is a failed match, it means that the person to be detected does not have the qualifications to pass through the target access control device, and at this time, the target access control device cannot be opened.
[0277] The access control method provided in this specification uses the target detection model in the above-mentioned image processing method to detect the person to be detected and outputs the target detection result. Since the target detection model includes multiple fused convolutional layers, the fused convolutional layer is obtained by fusing the to-be-fused network layer group consisting of at least two to-be-fused network layers in the initial detection model. Therefore, in the process of using the target detection model to process the image of the person to be detected, the image of the person to be detected can be directly processed through the fused convolutional layer, without the need to process the image to be detected in turn through each to-be-fused network layer, thereby improving the accuracy and efficiency of judging whether a person can pass through the access control device.
[0278] Corresponding to the above method embodiment, this specification also provides an access control device embodiment, Figure 8 FIG. 1 shows a schematic diagram of the structure of a door access control device provided by an embodiment of the present specification. Figure 8 As shown, the device is applied to the server, including:
[0279] The receiving module 802 is configured to receive a door access control request sent by a target door access control device;
[0280] A response module 804 is configured to obtain a person image of a person to be detected in response to the access control request;
[0281] The detection module 806 is configured to input the image of the person to be detected into a target detection model to obtain a target detection result of the image of the person to be detected, wherein the target detection model includes at least one fused convolutional layer, the fused convolutional layer is obtained by fusing the network layer group to be fused in the initial detection model, and the network layer group to be fused includes at least two network layers to be fused;
[0282] A retrieval module 808 is configured to retrieve a detection result matching the target detection result in a preset retrieval library, and generate a target matching result of the target detection result;
[0283] The sending module 810 is configured to send a door opening instruction to the target access control device to open the target access control device when the target matching result is a successful match.
[0284] The access control device provided in this specification uses the target detection model in the above-mentioned image processing method to detect the person to be detected and output the target detection result. Since the target detection model includes multiple fused convolutional layers, the fused convolutional layer is obtained by fusing the to-be-fused network layer group consisting of at least two to-be-fused network layers in the initial detection model. Therefore, in the process of using the target detection model to perform image processing on the image of the person to be detected, the image of the person to be detected can be directly processed through the fused convolutional layer, without the need to process the image to be detected in turn through each to-be-fused network layer, thereby improving the accuracy and efficiency of judging whether a person can pass through the access control device.
[0285] The above is a schematic scheme of a door access control device of this embodiment. It should be noted that the technical scheme of the door access control device and the technical scheme of the above door access control method belong to the same concept, and the details not described in detail in the technical scheme of the door access control device can be referred to the description of the technical scheme of the above door access control method.
[0286] Fig. 9 The structure block diagram of a computing device 900 provided according to an embodiment of the present specification is shown. The components of the computing device 900 include but are not limited to a memory 910 and a processor 920. The processor 920 is connected to the memory 910 via a bus 930, and a database 950 is used to store data.
[0287] The computing device 900 also includes an access device 940 that enables the computing device 900 to communicate via one or more networks 960. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 940 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0288] In one embodiment of the present specification, the above components of the computing device 900 and Fig. 9 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig. 9 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0289] The computing device 900 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 900 may also be a mobile or stationary server.
[0290] Among them, when the processor 920 executes the computer program / instructions, the steps of the image processing method or access control method are implemented.
[0291] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned image processing method or access control method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned image processing method or access control method.
[0292] An embodiment of the present specification further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the image processing method or access control method as described above when the computer program / instruction is executed by a processor.
[0293] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned image processing method or access control method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned image processing method or access control method.
[0294] An embodiment of the present specification further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned image processing method or access control method when executed by a processor.
[0295] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned image processing method or access control method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned image processing method or access control method.
[0296] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0297] The computer program / instruction includes a computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0298] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that this specification is not limited by the order of the actions described, because according to this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this specification.
[0299] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0300] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. An image processing method, characterized in that: include: Acquire the image to be detected; The image to be detected is input into a target detection model to obtain a target detection result of the image to be detected, wherein the target detection model includes at least one fused convolutional layer, the fused convolutional layer is obtained by fusing a network layer group to be fused in the initial detection model, and the network layer group to be fused includes at least two network layers to be fused.
2. The method according to claim 1, characterized in that The method further comprises: Obtain computing resource parameters for each network layer group in the initial detection model; Determine at least one network layer group to be merged in each network layer group according to computing resource parameters of each network layer group; Fuse each network layer group to be fused separately to obtain the target detection model.
3. The method according to claim 2, characterized in that According to the computing resource parameters of each network layer group, at least one network layer group to be merged is determined in each network layer group, including: Obtain computing resource information of the target hardware device; Sort the computing resource parameters of each network layer group to obtain the computing resource parameter sorting results of each network layer group; According to the computing resource parameter sorting result and the computing resource information, at least one network layer group to be merged is determined in each network layer group in descending order of computing resource parameters.
4. The method according to claim 2, characterized in that The network layer group to be fused includes the first convolutional layer and the first normalization layer; Fuse each network layer group to be fused separately to obtain the target detection model, including: Fusing the first convolutional layer and the first normalization layer to generate a first fused convolutional layer; The detection model including the first fused convolutional layer is determined as the target detection model.
5. The method according to claim 4, characterized in that The first convolutional layer and the first normalization layer are fused to generate a first fused convolutional layer, including: Acquire first convolution information of the first convolution layer and first normalization information of the first normalization layer, wherein the first convolution information includes a first convolution parameter, and the first normalization information includes a first normalization parameter; The first convolution information and the first normalization information are fused to generate first fused convolution information of the first fused convolution layer, wherein the first fused convolution information includes first fused convolution parameters, and the first fused convolution parameters are determined according to the first convolution parameters and the first normalization parameters.
6. The method according to claim 5, characterized in that The first convolution parameter includes a first convolution weight parameter and a first convolution bias parameter, and the first normalization parameter includes a first normalization weight parameter and a first normalization bias parameter; The method further comprises: Determining a first fused convolution weight parameter of the first fused convolution layer according to the first convolution weight parameter and the first normalized weight parameter; Determine a first fused convolution bias parameter of the first fused convolution layer according to the first normalized weight parameter, the first convolution bias parameter and the first normalized bias parameter.
7. The method according to claim 2, characterized in that The network layer group to be fused includes the second convolutional layer and the second normalization layer; Fuse each network layer group to be fused separately to obtain the target detection model, including: Fusing the second convolutional layer and the second normalization layer to generate a second fused convolutional layer; The detection model including the second fused convolutional layer is determined as the target detection model.
8. The method according to claim 7, characterized in that The second convolutional layer and the second normalization layer are fused to generate a second fused convolutional layer, including: Convert the second convolutional layer to a convolutional layer to be fused; The to-be-fused convolutional layer and the second normalization layer are fused to generate a second fused convolutional layer.
9. The method according to claim 8, characterized in that Converting the second convolutional layer to a convolutional layer to be fused includes: Get preset filling parameters; According to the preset filling parameter, the second convolutional layer is filled to obtain the convolutional layer to be fused.
10. The method according to claim 8, characterized in that Fusing the to-be-fused convolutional layer and the second normalized layer to generate a second fused convolutional layer, including: Acquire the to-be-fused convolution information of the to-be-fused convolution layer and the second normalization information of the second normalization layer, wherein the to-be-fused convolution information includes the to-be-fused convolution parameters, and the second normalization information includes the second normalization parameters; The convolution parameters to be fused and the second normalization parameters are fused to generate second fused convolution information of the second fused convolution layer, wherein the second fused convolution information includes second fused convolution parameters, and the second fused convolution parameters are determined according to the convolution parameters to be fused and the second normalization parameters.
11. The method according to claim 10, characterized in that The convolution parameters to be fused include convolution weight parameters to be fused and convolution bias parameters to be fused, and the second normalization parameters include second normalization weight parameters and second normalization bias parameters; The method further comprises: Determining a second fused convolution weight parameter of the second fused convolution layer according to the to-be-fused convolution weight parameter and the second normalized weight parameter; Determine a second fused convolution bias parameter of the second fused convolution layer according to the second normalized weight parameter, the to-be-fused convolution bias parameter and the second normalized bias parameter.
12. The method according to claim 2, characterized in that The network layer group to be fused includes a residual convolution layer group; Fuse each network layer group to be fused separately to obtain the target detection model, including: Determining a first network layer subgroup to be fused, a second network layer subgroup to be fused, and a skip connection layer in the residual convolutional layer group; Fusing the first to-be-fused network layer subgroups to obtain a first fused convolutional sublayer; Fusing the second to-be-fused network layer subgroup to obtain a second fused convolutional sublayer; Converting the skip connection layer into a third fused convolutional sublayer; The first fused convolution sublayer, the second fused convolution sublayer and the third fused convolution sublayer are fused to generate a third fused convolution layer, and the detection model including the third fused convolution layer is determined as a target detection model.
13. The method according to claim 12, characterized in that The skip connection layer is converted into a third fused convolutional sublayer, comprising: Obtaining a jump weight parameter and a jump bias parameter of the jump connection layer; Replacing the jump weight parameter with a preset weight parameter, and replacing the jump bias parameter with a preset bias parameter; A jump connection layer including the preset weight parameters and the preset bias parameters is determined as a third fused convolution sublayer.
14. The method according to claim 12, characterized in that Fusing the first fused convolution sublayer, the second fused convolution sublayer, and the third fused convolution sublayer to generate a third fused convolution layer, including: Acquire first fusion sublayer information of the first fusion convolution sublayer, second fusion sublayer information of the second fusion convolution sublayer, and third fusion sublayer information of the third fusion convolution sublayer, wherein the first fusion sublayer information includes first fusion sublayer parameters, the second fusion sublayer information includes second fusion sublayer parameters, and the third fusion sublayer information includes third fusion sublayer parameters; The first fusion sublayer information, the second fusion sublayer information and the third fusion sublayer information are fused to generate third fusion convolution information of the third fusion convolution layer, wherein the third fusion convolution information includes third fusion convolution parameters, and the third fusion convolution parameters are determined according to the first fusion sublayer parameters, the second fusion sublayer parameters and the third fusion sublayer parameters.
15. The method according to claim 14, characterized in that The first fusion sublayer parameters include a first fusion sublayer weight parameter and a first fusion sublayer bias parameter, the second fusion sublayer parameters include a second fusion sublayer weight parameter and a second fusion sublayer bias parameter, and the third fusion sublayer parameters include a third fusion sublayer weight parameter and a third fusion sublayer bias parameter; The method further comprises: Determining a third fused convolution weight parameter of the third fused convolution layer according to the first fused sublayer weight parameter, the second fused sublayer weight parameter and the third fused sublayer weight parameter; Determine a third fused convolution bias parameter of the third fused convolution layer according to the first fused sublayer bias parameter, the second fused sublayer bias parameter and the third fused sublayer bias parameter.
16. The method according to any one of claims 1 to 15, characterized in that: The initial detection model is trained according to the following method: Acquire sample training data, wherein the sample training data includes a sample training image and a sample detection result corresponding to the sample training image; Inputting the sample training image into the initial detection model to obtain a predicted detection result output by the initial detection model; Calculating a model loss value of the initial detection model according to the predicted detection result and the sample detection result; The model parameters of the initial detection model are adjusted according to the model loss value, and the initial detection model is continuously trained until a model training stop condition is reached.
17. A door access control method, characterized in that: Applied to the server, including: Receive access control request sent by target access control device; In response to the access control request, obtaining an image of the person to be detected; Inputting the image of the person to be detected into a target detection model to obtain a target detection result of the image of the person to be detected, wherein the target detection model includes at least one fused convolutional layer, the fused convolutional layer is obtained by fusing the network layer group to be fused in the initial detection model, and the network layer group to be fused includes at least two network layers to be fused; Retrieving a detection result matching the target detection result in a preset search library, and generating a target matching result of the target detection result; When the target matching result is a successful match, a door opening instruction is sent to the target access control device to open the target access control device.
18. An image processing device, characterized in that: include: An acquisition module is configured to acquire an image to be detected; The input module is configured to input the image to be detected into the target detection model to obtain the target detection result of the image to be detected, wherein the target detection model includes at least one fused convolutional layer, and the fused convolutional layer is obtained by fusing the network layer group to be fused in the initial detection model, and the network layer group to be fused includes at least two network layers to be fused.
19. An access control device, characterized in that: Applied to the server, including: A receiving module, configured to receive an access control request sent by a target access control device; A response module is configured to obtain a person image of a person to be detected in response to the access control request; The detection module is configured to input the image of the person to be detected into a target detection model to obtain a target detection result of the image of the person to be detected, wherein the target detection model includes at least one fused convolutional layer, the fused convolutional layer is obtained by fusing the network layer group to be fused in the initial detection model, and the network layer group to be fused includes at least two network layers to be fused; A retrieval module is configured to retrieve a detection result matching the target detection result in a preset retrieval library, and generate a target matching result of the target detection result; The sending module is configured to send a door opening instruction to the target access control device to open the target access control device when the target matching result is a successful match.
20. A computing device comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. It is characterized in that when the computer program / instructions are executed by the processor, the steps of the method described in any one of claims 1 to 17 are implemented.
21. A computer-readable storage medium storing a computer program / instruction, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 17 are implemented.
22. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 17 are implemented.
Citation Information
Patent Citations
Image auditing detection method and device and electronic equipment
CN113065570A
Image detection method, device and equipment, vehicle and medium
CN113378858A
Neural network model calculation method, data processing method, electronic equipment and medium
CN113657584A
Automatic operator fusion method of computational graph and related product
CN115756478A
Model training method and device, target detection method and device and readable storage medium
CN116090517A