Target Detection Network Training Method, Device, Equipment and Storage Medium

By quantizing and adjusting network parameters using tangent function and backpropagation function in neural network model, the problems of low weight value accuracy and slow model convergence in binary training are solved, and efficient operation on embedded devices is achieved.

CN114612784BActive Publication Date: 2025-08-05CHINA FAW CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210260168.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-16
Publication Date
2025-08-05
Estimated Expiration
2042-03-16

AI Technical Summary

Technical Problem

During the binarization process, the weight value accuracy of existing neural network models is low and oscillating easily during training, resulting in slow convergence of the model and difficult to run on embedded devices.

Method used

The floating-point network parameters of the target detection network are quantified by using the preset tangent function, and the network parameters are adjusted layer by layer through the backpropagation function, combining the weight offset and the preset amplification coefficient to optimize the binary training process.

Benefits of technology

The quantitative accuracy and convergence of network parameters in the target detection network obtained by binary training are improved, and the effective operation of the model on embedded devices is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114612784B_ABST
    Figure CN114612784B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, apparatus, device, and storage medium for training a target detection network. The method comprises: obtaining current network parameters of the target detection network; wherein the current network parameters are floating-point type; quantizing the current network parameters based on a preset tangent function to update the target detection network; and training the updated target detection network based on sample images and sample labels to adjust the current network parameters of the target detection network before the update. Embodiments of the present application improve the quantization accuracy of network parameters in a target detection network obtained through binarization training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a target detection network training method, device, equipment and storage medium. Background Art

[0002] With the continuous development of neural network models, people's requirements for the accuracy of neural network models are also getting higher and higher.

[0003] As the number of layers in existing neural network models increases, the complexity of the network becomes increasingly higher and the amount of computation becomes increasingly larger, resulting in the inability of complex neural networks to run on embedded devices such as surveillance cameras.

[0004] To reduce the complexity of neural network models, existing techniques typically directly binarize the floating-point weights or activations of the neural network. This results in low accuracy in the binarized weight values of the neural network model. Furthermore, neural network model training is prone to oscillation, resulting in slow model convergence during quantization training. Summary of the Invention

[0005] The present invention provides a target detection network training method, apparatus, equipment and storage medium to improve the quantization accuracy of network parameters in the target detection network obtained by binarization training.

[0006] According to one aspect of the present invention, a method for training a target detection network is provided, the method comprising:

[0007] Obtain current network parameters of the target detection network; wherein the current network parameters are floating point type;

[0008] quantizing the current network parameters based on a preset tangent function to update the target detection network;

[0009] The updated target detection network is trained based on the sample images and sample labels to adjust the current network parameters of the target detection network before the update.

[0010] According to another aspect of the present invention, a target detection network training device is provided, the device comprising:

[0011] The current network parameter acquisition module is used to obtain the current network parameters of the target detection network; wherein the current network parameters are floating point type;

[0012] A target detection network updating module, configured to quantize the current network parameters based on a preset tangent function to update the target detection network;

[0013] The current network parameter adjustment module is used to train the updated target detection network according to the sample images and sample labels to adjust the current network parameters of the target detection network before the update.

[0014] According to another aspect of the present invention, an electronic device is provided, comprising:

[0015] at least one processor; and

[0016] a memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the target detection network training method described in any embodiment of the present invention.

[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the target detection network training method described in any embodiment of the present invention when executed.

[0019] This embodiment scheme obtains the current network parameters of the target detection network; wherein the current network parameters are floating-point type; based on the preset tangent function, the current network parameters are quantized to update the target detection network; the updated target detection network is trained according to the sample image and sample label to adjust the current network parameters of the target detection network before the update. The above scheme quantizes the network parameters of the target detection network by using the tangent function, and continuously adjusts the quantized network parameters to perform binarization training on the target detection network, thereby improving the quantization accuracy of the network parameters in the target detection network obtained by the binarization training. It avoids the situation where the quantization result is low in accuracy due to the direct quantization of the floating-point weight parameters by the sgnx function; by using the tangent function and based on the back propagation function, the network parameters before binarization are continuously trained layer by layer to make the result after binarization quantization more accurate, while improving the convergence of the network.

[0020] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 This is a flowchart of a target detection network training method provided in accordance with the first embodiment of the present invention;

[0023] Figure 2 This is a flow chart of a target detection network training method provided in accordance with the second embodiment of the present invention;

[0024] Figure 3 This is a flowchart of a target detection network training method provided in accordance with the third embodiment of the present invention;

[0025] Figure 4 2 is a schematic diagram of the structure of a target detection network training device provided according to a fourth embodiment of the present invention;

[0026] Figure 5 3 is a schematic diagram of the structure of an electronic device for implementing the target detection network training method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "current", "target", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] Example 1

[0030] Figure 1 A flowchart of a target detection network training method is provided for the first embodiment of the present invention. This embodiment is applicable to the case where a target detection network after binarization of weight parameters is applied to an embedded device. The method can be executed by a target detection network training device, which can be implemented in the form of hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:

[0031] S110. Obtain current network parameters of the target detection network; wherein the current network parameters are floating point type.

[0032] The target detection network can be a network to be trained for binarization. For example, the target detection network can be a network capable of detecting targets used in technical fields such as face recognition, vehicle detection, or object recognition. The current network parameters of the target detection network can be floating-point parameters obtained before binarization training. The current network parameters can be weight parameters of the target detection network.

[0033] S120: quantize the current network parameters based on a preset tangent function to update the target detection network.

[0034] The preset tangent function can be pre-set in the target detection network by relevant technical personnel. The preset tangent function is used to binarize the floating-point current network parameters of the target detection network. The network parameters after binarization are used to update the current network parameters of the target detection network.

[0035] Exemplarily, according to a tangent function preset in the target detection network, the floating-point current network parameters of the target detection network are binarized to obtain the binarized network parameters in the updated target detection network.

[0036] S130 : Training the updated target detection network according to the sample images and sample labels to adjust the current network parameters of the target detection network before the update.

[0037] The sample images can be a sample training set for training the target detection network. Exemplarily, the sample images and sample labels can be input into the binarized target detection network to train the updated target detection network. Based on the predicted values of the trained target detection network and the true values corresponding to the sample labels, and based on a preset loss function, it is determined whether the training of the target detection network is completed. Specifically, it can be determined whether the target detection model has converged based on the calculation results of the loss function. If so, the training of the target network parameters is completed to obtain the binarized network parameters of the target detection network. If not, the current network parameters of the target detection network before the update, i.e., the network parameters that have not been binarized, are adjusted according to the preset back-propagation function, and the network parameters adjusted according to the back-propagation function are binarized again to update the target detection network until the target detection model converges.

[0038] This embodiment scheme obtains the current network parameters of the target detection network; wherein the current network parameters are floating-point type; based on the preset tangent function, the current network parameters are quantized to update the target detection network; the updated target detection network is trained according to the sample image and sample label to adjust the current network parameters of the target detection network before the update. The above scheme quantizes the network parameters of the target detection network by using the tangent function, and continuously adjusts the quantized network parameters to perform binarization training on the target detection network, thereby improving the quantization accuracy of the network parameters in the target detection network obtained by the binarization training. It avoids the situation where the quantization result is low in accuracy due to the direct quantization of the floating-point weight parameters by the sgnx function; by using the tangent function and based on the back propagation function, the network parameters before binarization are continuously trained layer by layer to make the result after binarization quantization more accurate, while improving the convergence of the network.

[0039] Example 2

[0040] Figure 2 This is a flowchart of a target detection network training method provided in Example 2 of the present invention. This embodiment is optimized and improved based on the above technical solutions.

[0041] Furthermore, the current network parameters include weight parameters and weight offset parameters corresponding to the weight parameters; accordingly, the step of "quantizing the current network parameters based on a preset tangent function to update the target detection network" is refined into "determining the weight offset according to the difference between the weight parameter and the weight offset parameter corresponding to the weight parameter; determining the weight quantization result according to the weight offset and the preset amplification factor; and using the weight quantization result to replace the corresponding weight parameters in the target detection network to update the target detection network." to improve the update method of the target detection network.

[0042] like Figure 2As shown, the method includes the following specific steps:

[0043] S210. Obtain current network parameters of the target detection network; wherein the current network parameters are floating point type; the current network parameters include weight parameters and weight offset parameters corresponding to the weight parameters.

[0044] Among them, the weight parameters and weight offset parameters are obtained during the training process of the target detection network.

[0045] S220: Determine a weight offset according to a difference between the weight parameter and a weight offset parameter corresponding to the weight parameter.

[0046] It should be noted that for weight parameters that do not satisfy the Gaussian distribution, there may be a certain offset. In order to reduce the impact of weight offset on the accuracy of network parameters during network training, weight offset parameters are introduced in the process of determining the weight quantization results, and the weight offset parameters are obtained during the training of the target detection network.

[0047] Exemplarily, the weight parameters and weight offset parameters corresponding to each channel in each network layer in the target detection network can be determined; the weight offset parameters corresponding to each channel in each network layer are subtracted from the weight offset parameters to obtain the weight offset corresponding to each channel in each network layer.

[0048] S230: Determine a weight quantization result according to the weight offset and the preset amplification factor.

[0049] The preset magnification factor is used to smoothly transition the quantization results during the training iteration. The preset magnification factor can be preset by relevant technical personnel. For example, the preset magnification factor can be a preset fixed value, such as 2 10 .

[0050] Optionally, the preset amplification factor can increase with the number of training iterations. It should be noted that as the preset amplification factor increases during network training and as the number of training iterations increases, the quantization result gradually approaches the binary value. For example, the binary value can be -1 or 1, etc., so that during the training process, as the number of training iterations increases, the quantization result continuously approaches the binary value, thereby achieving the purpose of progressive quantization and improving the accuracy of the quantization process during network training.

[0051] The preset amplification factor may be a pre-set value range and increase exponentially with the increase in the number of training times. Optionally, the preset amplification factor used for different training times has the same base and is greater than 1, and the exponent increases with the increase in the number of training times.

[0052] For example, the preset amplification factor may be in the range of [2, 2 16]. As the number of training times increases during the training process, the preset magnification factor gradually increases. For example, the preset magnification factor of the target detection network during the first training process is 2, and the preset magnification factor of the second training process is 2. 2 , the preset amplification factor during the third training process is 2 3 The specific parameters can be preset by relevant technical personnel, and during the training process, the preset amplification factor can be automatically increased as the number of iterations increases.

[0053] Exemplarily, the following tangent function can be used to update the floating-point network parameters of the target detection network:

[0054]

[0055] in, is the quantization result of the weight parameter, β is the preset amplification coefficient, W ic is the weight parameter, B ic is the weight offset parameter corresponding to the weight parameter, i is the layer identifier of the target detection network, and c is the channel identifier in the network layer of the target detection network. ic -B ic This is the weight offset.

[0056] S240: Use the weight quantization result to replace the corresponding weight parameters in the target detection network to update the target detection network.

[0057] Exemplarily, a weight quantization result obtained based on a tangent function, that is, a quantization function used for binarization, is used to replace the weight parameters before quantization in the target detection network, and the target detection network is updated.

[0058] S250: Train the updated target detection network according to the sample images and sample labels to adjust the current network parameters of the target detection network before the update.

[0059] This embodiment determines a weight offset based on the difference between the weight parameter and the weight offset parameter corresponding to the weight parameter; determines a weight quantization result based on the weight offset and a preset amplification factor; and uses the weight quantization result to replace the corresponding weight parameter in the target detection network to update the target detection network. By introducing a weight offset, the above scheme solves the problem that weight parameters that do not satisfy the Gaussian distribution may have weight offsets that affect quantization accuracy; by introducing a preset amplification factor, the preset amplification factor gradually increases with the number of training times, enabling the target detection network to be gradually quantized during the binary quantization training process, thereby improving the accuracy of the weight quantization results.

[0060] Example 3

[0061] Figure 3This is a flowchart of a target detection network training method provided in Example 3 of the present invention. This embodiment is optimized and improved based on the above technical solutions.

[0062] Furthermore, the step of "training the updated target detection network based on the sample image and the sample label to adjust the current network parameters of the target detection network before the update" is refined into "inputting the sample image into the updated target detection network to obtain a sample prediction result; determining the target loss based on the sample prediction result and the sample label; determining the back propagation result of the current network parameters of the target detection network before the update under the target back propagation function; wherein the target back propagation function is a derivative function of the preset tangent function; and adjusting the current network parameters of the target detection network before the update based on the target loss and the back propagation result."

[0063] like Figure 3 As shown, the method includes the following specific steps:

[0064] S310. Obtain current network parameters of the target detection network; wherein the current network parameters are floating point type.

[0065] S320: quantize the current network parameters based on a preset tangent function to update the target detection network.

[0066] S330: Input the sample image into the updated target detection network to obtain a sample prediction result.

[0067] The updated target detection network may be a target detection network obtained by binarizing and quantizing floating-point parameters in the target detection network based on a preset tangent function.

[0068] Exemplarily, the sample image can be input into the updated target detection network, and the target detection network can be trained to obtain a sample prediction result.

[0069] S340: Determine the target loss based on the sample prediction results and sample labels.

[0070] The sample label includes the true sample result corresponding to the sample image; the target loss can be a target loss value obtained based on the sample prediction result and the sample label using a preset loss function. The loss function can be pre-defined by relevant technical personnel. For example, the loss function can be a logarithmic loss function or an exponential loss function.

[0071] Exemplarily, based on the sample prediction results and the true sample results in the sample labels, a target loss result is obtained based on a preset loss function, wherein the target loss result can be a target loss value. Based on the target loss result, it can be determined whether the training of the target detection network is completed, that is, whether the target detection network has converged. Specifically, if the target loss result has stabilized as the number of training times increases, it can be said that the target detection model has converged and the target detection network has completed training. Alternatively, if the target loss result is a target loss value, it can also be determined whether the target loss value is less than or equal to a preset loss threshold; if so, it can be said that the target detection model has converged and the target detection network has completed training; if not, it can be said that the target detection model has not converged and the target detection network has not completed training.

[0072] It should be noted that in order to avoid overfitting during network training, a regularization term can be introduced into the loss function used to determine the target loss; at the same time, in order to ensure that the weight quantization result is as close as possible to the original floating-point weight parameter, a scale factor can also be introduced into the regularization term.

[0073] In an optional embodiment, the target loss is determined based on the sample prediction results and the sample labels, including: determining the initial loss based on the sample prediction results and the sample labels; determining the scale factors corresponding to the current network parameters of each layer based on the current network parameters of the target detection network before updating; determining the regularization loss based on the distance between the current network parameters of each layer and the corresponding scale factors; and determining the target loss based on the initial loss and the regularization loss.

[0074] The current network parameters of the target detection network before update are the floating-point network parameters before binary quantization during each iterative training process. Each network layer of the target detection network corresponds to a scale factor.

[0075] For example, the initial loss can be determined based on the sample prediction results and sample labels using a preset initial loss function. The scale factors corresponding to each network layer of the target detection network are determined based on the floating-point network parameters before binarization and quantization. The difference between the floating-point network parameters of each network layer before binarization and quantization and the corresponding scale factor is used as the distance between the current network parameters of each layer and the corresponding scale factor.

[0076] The regularization loss is determined based on the distance between the current network parameters of each layer and the corresponding scale factor. The formula for the regularization loss is as follows:

[0077] R=∑ i (W i -A i -1) 2 ;

[0078] Among them, i is the level identifier of the target detection network, W i is the weight parameter, A i is the scale factor.

[0079] The target loss is determined based on the initial loss and the regularization loss. The target loss can be determined based on the target loss function, and the formula of the target loss function is as follows:

[0080] J(W)=L(W)+αR;

[0081] Among them, L(W) is the preset initial loss function; α is an adjustable parameter; R is the regularization term.

[0082] In an optional embodiment, the scaling factors corresponding to the current network parameters of each layer are determined based on the current network parameters of the target detection network before the update, including: determining the median of the current network parameters of each layer in the target detection network before the update; and using the median determination result as the scaling factor corresponding to the current network parameters of the layer.

[0083] For example, the median value of the current network parameters of each network layer in the target detection network before the update can be used as the scaling factor corresponding to the current network parameters of the network layer. It should be noted that if the parameter value of the current network parameter is negative, the absolute value of the current network parameter with the negative parameter value is first taken, and then the scaling factor corresponding to the network parameter of each layer is determined.

[0084] The formula for determining the scale factor is as follows:

[0085] A i =median(|W i |);

[0086] Among them, W i is the weight parameter; i is the level identifier of the target detection network.

[0087] Optionally, the mean of the current network parameters of each layer in the target detection network before the update may be determined, and the mean determination result may be used as the scale factor corresponding to the current network parameters of the layer.

[0088] S350. Determine the back propagation result of the current network parameters of the target detection network before updating under the target back propagation function; wherein the target back propagation function is a derivative function of a preset tangent function.

[0089] The current network parameters of the target detection network before updating are floating-point network parameters before binary quantization. The target backpropagation function is determined according to a preset tangent function.

[0090] Among them, the formula of the target back propagation function is as follows:

[0091]

[0092] Where β is the preset amplification factor, W ic is the weight parameter, B ic is the weight offset parameter corresponding to the weight parameter, i is the layer identifier of the target detection network, and c is the channel identifier in the network layer of the target detection network.

[0093] Exemplarily, before the target detection model converges, the target detection model is reversely trained through the target back propagation function to update the floating-point network parameters before binarization; based on the tangent function, the updated floating-point network parameters are binarized and quantized to update the target detection model.

[0094] S360. Adjust the current network parameters of the target detection network before updating according to the target loss and the back propagation result.

[0095] Exemplarily, during the binarization training of the target detection network, the current floating-point network parameters are quantized based on a preset tangent function to obtain the quantized network parameters, thereby updating the target detection network. The sample image is input into the updated target detection network to obtain a sample prediction result; the target loss is determined based on the sample prediction result and the sample label; and whether the target detection model has converged is determined based on the target loss. If the updated target detection network has not converged, that is, the training has not been completed, the target back propagation function is used for reverse training. At this time, the network parameters trained by the target back propagation function are the floating-point network parameters before binarization. After the floating-point network parameters are adjusted by the target back propagation function, the adjusted floating-point network parameters are binarized and quantized by the tangent function, and the target detection network is updated again until the network model of the target detection network converges.

[0096] The binarized weights of the trained target detection network are close to sgn(WB), where W is the weight parameter of the target detection model and B is the weight offset parameter corresponding to the weight parameter of the target detection model.

[0097] Optionally, after adding the scale factor to each layer of the object detection network, the network input to output derivation process is:

[0098]

[0099] Among them, X i Indicates the input value; Y i Indicates the output value; A i represents the scale factor; W i b Represents the weight parameter after binary quantization; i is the level identifier of the target detection network.

[0100] This embodiment obtains a sample prediction result by inputting a sample image into the updated target detection network; determines the target loss based on the sample prediction result and the sample label; determines the back propagation result of the current network parameters of the target detection network before the update under the target back propagation function; wherein the target back propagation function is a derivative function of the preset tangent function; and adjusts the current network parameters of the target detection network before the update based on the target loss and the back propagation result. The above scheme adjusts the floating-point network parameters by using the target back propagation function to reversely train the floating-point network parameters before binarization quantization. By continuously adjusting the floating-point network parameters and the binarized network parameters through the target loss and the back propagation result, the quantization accuracy of the network parameters in the target detection network obtained by binarization training is improved, and the convergence speed of the network is improved.

[0101] Example 4

[0102] Figure 4 This is a schematic diagram of the structure of a target detection network training device provided by the fourth embodiment of the present invention. The target detection network training device provided by the embodiment of the present invention is applicable to the case where the target detection network after the weight parameters are binarized is applied to an embedded device. The device can be implemented in software and / or hardware. Figure 4 As shown, the device specifically includes: a current network parameter acquisition module 401, a target detection network update module 402 and a current network parameter adjustment module 403.

[0103] The current network parameter acquisition module 401 is used to obtain the current network parameters of the target detection network; wherein the current network parameters are floating point type;

[0104] The target detection network updating module 402 is configured to quantize the current network parameters based on a preset tangent function to update the target detection network;

[0105] The current network parameter adjustment module 403 is used to train the updated object detection network according to the sample images and sample labels to adjust the current network parameters of the object detection network before the update.

[0106] This embodiment scheme obtains the current network parameters of the target detection network; wherein the current network parameters are floating-point type; based on the preset tangent function, the current network parameters are quantized to update the target detection network; the updated target detection network is trained according to the sample image and sample label to adjust the current network parameters of the target detection network before the update. The above scheme quantizes the network parameters of the target detection network by using the tangent function, and continuously adjusts the quantized network parameters to perform binarization training on the target detection network, thereby improving the quantization accuracy of the network parameters in the target detection network obtained by the binarization training. It avoids the situation where the quantization result is low in accuracy due to the direct quantization of the floating-point weight parameters by the sgnx function; by using the tangent function and based on the back propagation function, the network parameters before binarization are continuously trained layer by layer to make the result after binarization quantization more accurate, while improving the convergence of the network.

[0107] Optionally, the current network parameters include weight parameters and weight offset parameters corresponding to the weight parameters;

[0108] Accordingly, the target detection network update module 402 includes:

[0109] a weight offset determining unit, configured to determine a weight offset based on a difference between the weight parameter and a weight offset parameter corresponding to the weight parameter;

[0110] A weight quantization result determining unit, configured to determine a weight quantization result based on the weight offset and a preset amplification factor;

[0111] The target detection network updating unit is used to replace the corresponding weight parameters in the target detection network with the weight quantization result to update the target detection network.

[0112] Optionally, the preset amplification factor increases as the number of training times increases.

[0113] Optionally, the preset amplification coefficient base used for different training times is the same and greater than 1, and the exponent increases with the increase in the training times.

[0114] Optionally, the current network parameter adjustment module 403 includes:

[0115] a sample prediction result determination unit, configured to input the sample image into the updated target detection network to obtain a sample prediction result;

[0116] a target loss determining unit, configured to determine a target loss based on the sample prediction result and the sample label;

[0117] A back propagation result determination unit, configured to determine a back propagation result of the current network parameters of the target detection network before updating under a target back propagation function; wherein the target back propagation function is a derivative function of the preset tangent function;

[0118] A current network parameter adjustment unit is used to adjust the current network parameters of the target detection network before updating according to the target loss and the back propagation result.

[0119] Optionally, the target loss determination unit includes:

[0120] an initial loss determination subunit, configured to determine an initial loss based on the sample prediction result and the sample label;

[0121] A scale factor determination subunit is used to determine the scale factors corresponding to the current network parameters of each layer according to the current network parameters of the target detection network before updating;

[0122] Regularization loss determination subunit, used to determine the regularization loss based on the distance between the current network parameters of each layer and the corresponding scale factor;

[0123] A target loss determination subunit is used to determine the target loss based on the initial loss and the regularization loss.

[0124] Optionally, the scale factor determination subunit is specifically configured to:

[0125] Determine the median value of the current network parameters of each layer in the target detection network before updating;

[0126] The median determination result is used as the scale factor corresponding to the current network parameters of this layer.

[0127] The above-mentioned target detection network training device can execute the target detection network training method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing each target detection network training method.

[0128] Example 5

[0129] Figure 5A schematic diagram of the structure of an electronic device 50 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0130] like Figure 5 As shown, the electronic device 50 includes at least one processor 51 and a memory, such as a read-only memory (ROM) 52, a random access memory (RAM) 53, etc., which is communicatively connected to the at least one processor 51. The memory stores a computer program that can be executed by the at least one processor. The processor 51 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 52 or the computer program loaded from the storage unit 58 into the random access memory (RAM) 53. Various programs and data required for the operation of the electronic device 50 can also be stored in the RAM 53. The processor 51, ROM 52, and RAM 53 are connected to each other via a bus 54. An input / output (I / O) interface 55 is also connected to the bus 54.

[0131] Multiple components in the electronic device 50 are connected to the I / O interface 55, including an input unit 56, such as a keyboard, a mouse, etc.; an output unit 57, such as various types of displays, speakers, etc.; a storage unit 58, such as a magnetic disk, an optical disk, etc.; and a communication unit 59, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 59 allows the electronic device 50 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0132] The processor 11 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the target detection network training method.

[0133] In some embodiments, the target detection network training method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 58. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 50 via the ROM 52 and / or the communication unit 59. When the computer program is loaded into the RAM 53 and executed by the processor 51, one or more steps of the target detection network training method described above can be performed. Alternatively, in other embodiments, the processor 51 can be configured to execute the target detection network training method in any other appropriate manner (e.g., by means of firmware).

[0134] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0135] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0136] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0137] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0138] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0139] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0140] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0141] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A target detection network training method, characterized in that: include: Obtain current network parameters of the target detection network; wherein the current network parameters are floating point type; quantizing the current network parameters based on a preset tangent function to update the target detection network; Train the updated target detection network based on the sample images and sample labels to adjust the current network parameters of the target detection network before the update; The training of the updated target detection network based on the sample images and sample labels to adjust the current network parameters of the target detection network before the update includes: Inputting the sample image into the updated target detection network to obtain a sample prediction result; Determining a target loss based on the sample prediction result and the sample label; Determine the back propagation result of the current network parameters of the target detection network before the update under the target back propagation function; wherein the target back propagation function is a derivative function of the preset tangent function; Adjusting current network parameters of the target detection network before updating according to the target loss and the back-propagation result; The determining of the target loss according to the sample prediction result and the sample label includes: Determine an initial loss based on the sample prediction result and the sample label; Determining a scaling factor corresponding to the current network parameters of each layer according to the current network parameters of the target detection network before the update; wherein the scaling factor refers to the median value of the current network parameters of each layer determined according to the current network parameters of each layer in the target detection network before the update; Determine the regularization loss based on the distance between the current network parameters of each layer and the corresponding scale factor; The target loss is determined according to the initial loss and the regularization loss.

2. The method according to claim 1, characterized in that The current network parameters include weight parameters and weight offset parameters corresponding to the weight parameters; The quantizing of the current network parameters based on a preset tangent function to update the target detection network includes: Determining a weight offset according to a difference between the weight parameter and a weight offset parameter corresponding to the weight parameter; Determining a weight quantization result according to the weight offset and a preset amplification factor; The weight quantization result is used to replace the corresponding weight parameters in the target detection network to update the target detection network.

3. The method according to claim 2, characterized in that The preset amplification factor increases as the number of training times increases.

4. The method according to claim 3, characterized in that The preset amplification coefficient used for different training times has the same base and is greater than 1, and the exponent increases with the increase in the number of training times.

5. A target detection network training device, characterized in that: include: The current network parameter acquisition module is used to obtain the current network parameters of the target detection network; wherein the current network parameters are floating point type; A target detection network updating module, configured to quantize the current network parameters based on a preset tangent function to update the target detection network; A current network parameter adjustment module is used to train the updated target detection network according to the sample images and sample labels to adjust the current network parameters of the target detection network before the update; Among them, the current network parameter adjustment module includes: a sample prediction result determination unit, configured to input the sample image into the updated target detection network to obtain a sample prediction result; a target loss determining unit, configured to determine a target loss based on the sample prediction result and the sample label; A back propagation result determination unit, configured to determine a back propagation result of the current network parameters of the target detection network before updating under a target back propagation function; wherein the target back propagation function is a derivative function of the preset tangent function; a current network parameter adjustment unit, configured to adjust the current network parameters of the target detection network before updating according to the target loss and the back-propagation result; Among them, the target loss unit includes: an initial loss determination subunit, configured to determine an initial loss based on the sample prediction result and the sample label; a scale factor determination subunit, configured to determine a scale factor corresponding to the current network parameters of each layer based on the current network parameters of the target detection network before the update; wherein the scale factor refers to the median value of the current network parameters of each layer determined based on the current network parameters of each layer in the target detection network before the update; Regularization loss determination subunit, used to determine the regularization loss based on the distance between the current network parameters of each layer and the corresponding scale factor; A target loss determination subunit is used to determine the target loss based on the initial loss and the regularization loss.

6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the target detection network training method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the target detection network training method according to any one of claims 1 to 4 when executed.

Citation Information

Patent Citations

  • Method and system for compressing convolutional neural network model used for target detection

    CN108898168A

  • Neural network training method, convolution calculation acceleration method, device and equipment

    CN110414630A

  • Hybrid neural network training method, system and device and storage medium

    CN112990444A