Image detection training method, electronic device and readable storage medium
By suppressing the influence of domain-specific directions during gradient backpropagation and optimizing the weight updates of domain-invariant directions, the model is not affected by domain bias during training, and its migration ability and detection performance are improved.
Patent Information
- Application Number
- CN202011446504.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-08
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2040-12-08
AI Technical Summary
During the training process of existing technologies, the model's transfer ability and discrimination ability are affected by domain bias terms, and it is impossible to learn the domain feature invariant space that is effective for detection tasks, resulting in poor performance of the model in actual application scenarios.
By utilizing the projection of the convolutional layer in the weight direction during the gradient backpropagation process, the gradient influence in the domain-specific direction is estimated and suppressed, the weight update in the domain-invariant direction is optimized, and the influence of the domain-specific direction is reduced.
The model's migration capability and universality between different domains are improved, and the detection performance of the model in actual application scenarios is enhanced.
Smart Images

Figure CN114612737B_ABST
Abstract
Description
Technical Field
[0001] The present invention generally relates to the field of neural networks, and more particularly to a training method, electronic device, and readable storage medium for performing image detection using a neural network. Background Art
[0002] With the rapid development of artificial intelligence, neural network models are widely used in various image recognition scenarios. Developers need to use training datasets to train neural network models before they can be used. Generally, training datasets and application scenarios are assumed to have the same distribution. However, the datasets used for model training often differ from actual application scenarios. For example, the data in the training dataset does not take weather factors into account, but real-world scenarios often experience weather changes such as rain and fog, resulting in poor model performance.
[0003] Unsupervised domain adaptation (UDA) provides a method to solve the performance degradation caused by domain distribution mismatch when there is no target domain label. Current UDA research is committed to aligning the feature distributions of different domains by designing loss functions and minimizing the difference distance between domains. A typical pattern is to use the output feature map of the detector to construct the feature space, measure the difference in domains, and then shrink or interpolate it. This method does not optimize the domain-invariant direction, but targets the domain-specific direction and the domain-invariant direction as a whole. Figure 1 As shown in Figure 1, the model's loss function is based on the direction of the maximum gradient when taking the partial derivative of the weights, which is direction 101. However, after considering various changing scenarios, the most ideal gradient direction may be direction 102. In other words, the model's trajectory is severely affected by domain-specific directions.
[0004] Existing distribution alignment techniques are limited to the feature level, optimizing model parameters holistically. However, the model's transferability and discrimination capabilities interact during training. Existing model training is still affected by domain bias, making it impossible to learn a domain-invariant feature space that is effective for detection tasks.
[0005] Therefore, an unsupervised adaptive scheme to adjust the bias term during training is urgently needed. Summary of the Invention
[0006] In order to at least partially solve the technical problems mentioned in the background technology, the solution of the present invention provides a training method, electronic device and readable storage medium for image detection using a neural network.
[0007] In one aspect, the present invention discloses a training method for image detection using a neural network, comprising: in forward propagation, inputting a training image into the neural network to obtain the category or position of a target object; in backward propagation, generating a loss function based on the error between the category or position of the target object and the label information of the training image; and updating the weight based on the loss function and the projection length of the weight gradient in the weight direction.
[0008] In another aspect, the present invention discloses a training method for image detection using a neural network, comprising: in forward propagation, calculating a unit weight based on a weight and the length of the weight, wherein the unit weight reflects the direction of the weight; in forward propagation, inputting a training image into the neural network and performing a convolution calculation with the unit weight to obtain output image target information; in backward propagation, generating a loss function based on the error of the output compared to the training image annotation information; and updating the unit weight based on the loss function.
[0009] In another aspect, the present invention discloses an electronic device, characterized in that it includes: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0010] In another aspect, the present invention discloses a computer-readable storage medium having stored thereon computer program instructions for performing image detection using a neural network, wherein when the computer program code is executed by a processing device, the aforementioned method is executed.
[0011] Based on the purpose of domain-invariant alignment, this paper proposes a new domain-specific direction suppression method. By projecting in the weight direction, the domain-specific part of the gradient is roughly estimated, and the gradient in the corresponding direction is constrained. This makes the trained model unaffected by domain bias and more universal. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts.
[0013] Figure 1 is a schematic diagram showing domain-specific and domain-invariant directions of a neural network during training;
[0014] Figure 2 is a flow chart illustrating a training method for image detection according to an embodiment of the present invention; and
[0015] Figure 3 FIG. 4 is a flowchart illustrating a training method for image detection according to another embodiment of the present invention. DETAILED DESCRIPTION
[0016] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.
[0017] It should be understood that the terms "first," "second," "third," and "fourth," etc. in the claims, description, and drawings of the present invention are used to distinguish different objects, rather than to describe a specific order. The terms "comprise" and "comprising" used in the description and claims of the present invention indicate the presence of the described features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or combinations thereof.
[0018] It should also be understood that the terminology used in this specification is for the purpose of describing specific embodiments only and is not intended to limit the present invention. As used in the specification and claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise. It should further be understood that the term "and / or" as used in the specification and claims refers to any and all possible combinations of one or more of the associated listed items, including and including these combinations.
[0019] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context.
[0020] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0021] Neural network training involves inputting training samples to adjust the parameters of each layer, ensuring that the results calculated by the neural network are as close as possible to the actual results. Neural network training involves forward propagation and backpropagation. Forward propagation, based on an existing model, passes the training samples through the various layers of the neural network, gradually extracting the input feature map into abstract features. Backpropagation, on the other hand, uses gradient descent and the chain rule to calculate the partial derivative of the loss function with respect to each parameter to update the parameters. Training is then repeated repeatedly using the updated parameters until the forward propagation results meet expectations.
[0022] Object detection is one of the fundamental tasks in computer vision. When dealing with object detection, the current mainstream approach is to simultaneously address localization and detection, a technique known as multi-task learning. Multi-task learning for object detection has two output branches: one for image classification, using a fully connected algorithm with softmax to determine the target category, and the other for determining the target location, which outputs a rectangular window to mark the target object when completing the regression task. Since the target object is located in a specific region of the image, the most direct approach is to utilize a sliding window approach. This involves traversing all regions of the image and sliding rectangular windows of varying sizes across the image to generate multiple candidate regions. These regions are then screened to identify which candidate regions possess the characteristics of the target object.
[0023] Developers typically assume that the training dataset and the target training dataset share the same probability distribution. However, in real life, this assumption is difficult to achieve. When the training dataset and the test set differ significantly, overfitting can easily occur, causing the trained model to perform poorly on the test set. Domain adaptation techniques can be used to address this issue.
[0024] Domain adaptation is a special case of transfer learning, mapping data features from different domains (e.g., different datasets) to the same feature space. This allows data from other domains to enhance training in the target domain. Domain adaptation leverages the knowledge gained from training with the training dataset to improve the model's performance on the test dataset. There are two fundamental concepts in domain adaptation: the source domain and the target domain. The source domain contains rich supervised learning information, while the target domain represents the domain of the test set and is typically unlabeled or contains only a small number of labels. The source and target domains often involve the same type of task, but with different distributions.
[0025] This paper applies domain adaptive learning to object detection. Generally speaking, the features captured by shallow layers of deep neural networks are low-level appearance features, reflecting more information about edges, textures, and so on. In contrast, features from deeper layers contain more high-level semantic information. These properties are logically or causally related to the transferability of neural networks, which refers to the ability of a model to perform well across different domains, i.e., its universality.
[0026] One embodiment of the present invention divides the gradient of back propagation during training into two directions: a domain-invariant direction and a domain-specific direction, which respectively emphasize the universality and specificity of the domain. In more detail, the domain-invariant direction represents the universality of target detection, while the domain-specific direction represents the specificity of target detection. Since the training method of the neural network is very sensitive to the domain-specific direction, that is, when updating the weights during training, in the absence of any additional constraints, the change in the domain-specific direction is much greater than the change in the domain-invariant direction, and the weight update follows the direction with the largest gradient change, it is easily affected by the domain-specific direction. This embodiment can pay more attention to the domain-invariant direction during training and suppress the domain-specific direction, making the model universal.
[0027] A neural network can be viewed as a series of motion patterns that transform input into a task-friendly feature space. The entire process can be roughly divided into two stages: decomposing the input into basic features and generating semantic features for the final task. However, if the model's basic feature extraction patterns contain too much domain bias, the second stage will not perform well on the target domain. Furthermore, regardless of whether the target object of the first stage is specific or invariant, the second stage can always find its optimal final task for the annotated domain. For example, if all vehicles in a domain are red, the model may misunderstand that vehicles in that domain should be red, but this misunderstanding will not lead to any difference in performance in that domain compared to a model without this color bias.
[0028] The solution proposed in this embodiment involves a domain adaptation method that suppresses domain-specific directions in the first stage and finds domain-invariant directions in the second stage to fundamentally eliminate the influence of domain-specific directions. Furthermore, this embodiment is a training method for image detection using a neural network, and also a domain difference suppression algorithm. During the gradient backpropagation process of the neural network, the domain difference direction of the gradient is estimated by projecting the updated gradient of the convolutional layer in the direction of the layer's weights. In actual training, the difference between the gradient and its projection direction is used as the gradient update value.
[0029] Training images can come from datasets generated from virtual scenes. Virtual scenes are scenes that are perfectly free of any interference. For example, an outdoor scene might be a sunny day, free of rain, fog, snow, frost, thunder, hail, or haze. Training images can also come from datasets generated from biased environments, such as images where all cars are red or none have sunroofs. Figure 2 A flow chart of this embodiment is shown.
[0030] In step 201, during forward propagation, a training image is input into the neural network to determine the category or location of the target object. During the forward propagation phase of the training phase, multiple epochs are performed. An epoch is the process of using all training samples for a single training run. These samples are called the training set, and each batch size (batch size) of training samples is called an iteration. For example, if the training set contains 1000 training samples and the batch size is set to 10, then each iteration requires 10 training samples to participate in the training, resulting in a total of 100 iterations in one epoch.
[0031] In step 202, in back propagation, a loss function is generated based on the error between the category or position of the target object and the training image label information to represent the degree of difference between the training image label information and the category or position of the target object.
[0032] After obtaining the loss function, the weight update can be expressed using the following formula:
[0033]
[0034] Among them, W t represents the weight matrix for iteration t, η is the learning rate or step size, and L is the loss function. However, this inverse process treats the domain-invariant and domain-specific directions of the gradient equally, using both to update the weights. This weight update tends to reflect domain-specific optimization, while the domain-specific direction is merely a biased, locally optimal direction. This embodiment not only uses the aforementioned formula to update the weights, but also further identifies the domain-invariant direction and updates the weights based on it, as the domain-invariant direction is the most optimized gradient direction.
[0035] In step 203, in the back propagation, the modulus of the weight gradient projected in the weight direction is obtained. The modulus is the norm, that is, the weight gradient is mapped to the weight direction. In order to obtain the modulus of the weight gradient projected in the weight direction, the weight direction is first calculated based on the weight and the weight length. In this embodiment, the weight is divided by the weight length to obtain the weight direction, that is, in is the weight length. Then, we get the partial derivative of the loss function with respect to the weight, which is the weight gradient. The weight gradient is Finally, the vector inner product is performed on the weight direction and partial derivative to obtain the modulus of the weight gradient projection in the weight direction.
[0036] In step 204, in the back propagation, the modulus and the weight direction are multiplied to obtain the projection vector, i.e.
[0037] In step 205, during back propagation, an attenuation coefficient λ is set for the projection length. The attenuation coefficient λ represents the degree to which the projection vector is emphasized on the gradient, and is set to 1 in this embodiment.
[0038] In step 206, the weight is updated according to the loss function and the projection length of the weight gradient in the weight direction. Based on the projection direction obtained above and the set attenuation coefficient λ, this embodiment updates the weight according to the following formula:
[0039]
[0040] As can be seen from the above formula, this embodiment uses the loss function and the projection of the weight gradient onto the weight direction to isolate the domain-specific direction on the gradient, thereby eliminating its influence on the training process. In other words, this embodiment first uses the model's weight direction to estimate the domain-specific direction, then eliminates it by subtracting the projection of the gradient onto the weight direction. This further emphasizes the domain-invariant direction during training, making the training results more universal.
[0041] Since models trained using the unsupervised domain adaptation framework perform better in the source domain than in the target domain, the original motion patterns are naturally dominated by source-domain-specific directions. Therefore, the model's initial weights accurately guide how this embodiment suppresses the influence of domain-specific directions. During training, the entire model's orientation gradually adjusts, focusing more and more on domain-invariant directions rather than domain-specific directions.
[0042] Another embodiment of the present invention is a training method for image detection using a neural network. Compared to the aforementioned embodiment, this embodiment considers the influence of a specific direction of the suppression domain during the forward propagation stage. Figure 3 A flow chart of this embodiment is shown.
[0043] In step 301, in the forward propagation, the unit weight is calculated based on the weight and the length of the weight, and the unit weight reflects the direction of the weight. In more detail, the unit weight is to divide the weight by the weight length, that is
[0044]
[0045] In step 302, during the forward propagation, the training image is input into the neural network and convolved with the unit weight to obtain the output image target information. In this step, the training sample is not convolved with the weight, but instead convolved with the unit weight.
[0046] In step 303, during back propagation, a loss function is generated based on the error of the output compared to the training image annotation information.
[0047] In step 304, the unit weight is updated according to the loss function. After obtaining the loss function, the update of the unit weight can be expressed using the following formula:
[0048]
[0049] Since this embodiment attempts to suppress the influence of a specific direction in the forward propagation, and uses unit weights instead of weights for convolution calculation, during the backward propagation, the existing loss function can be used to update the partial derivative of the unit weights. In fact, the formula in step 304 is equivalent to:
[0050]
[0051] Therefore, this embodiment can also achieve the effects of the aforementioned embodiments.
[0052] Another embodiment of the present invention is an electronic device, comprising a processor and a memory for storing instructions executable by the processor. The processor is configured to call the instructions stored in the memory to execute the methods of the aforementioned embodiments.
[0053] Another embodiment of the present invention is a computer-readable storage medium having stored thereon a computer program code for performing image detection using a neural network, and when the computer program code is executed by a processor, the method of each embodiment as described above is executed. In some implementation scenarios, the above-mentioned integrated unit can be implemented in the form of a software program module. If implemented in the form of a software program module and sold or used as an independent product, the integrated unit can be stored in a computer-readable memory. Based on this, when the solution of the present invention is embodied in the form of a software product (such as a computer-readable storage medium), the software product can be stored in a memory, which may include several instructions for causing a computer device (such as a personal computer, a server or a network device, etc.) to perform some or all of the steps of the method described in the embodiment of the present invention. The aforementioned memory may include, but is not limited to, various media that can store program code, such as a USB flash drive, a flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0054] This paper views the neural network model as a series of motion patterns and divides the gradient direction into domain-invariant and domain-specific directions. The former determines the model's transferability, while the latter is an obstacle to domain adaptation. By estimating and eliminating domain-specific directions in the gradient during forward propagation or backpropagation, this paper optimizes weights for domain-invariant directions, making the model more transferable and universal. During inference, inputting the image into the trained neural network model can more accurately perform object detection tasks.
[0055] Depending on the application scenario, the electronic device or device of the present invention may include a server, a cloud server, a server cluster, a data processing device, a robot, a computer, a printer, a scanner, a tablet computer, a smart terminal, a PC device, an Internet of Things terminal, a mobile terminal, a mobile phone, a driving recorder, a navigator, a sensor, a camera, a camera, a video camera, a projector, a watch, a headset, a mobile storage, a wearable device, a visual terminal, an automatic driving terminal, a vehicle, a household appliance, and / or a medical device. The vehicle includes an airplane, a ship and / or a vehicle; the household appliance includes a television, an air conditioner, a microwave oven, a refrigerator, an electric rice cooker, a humidifier, a washing machine, an electric light, a gas stove, and a range hood; the medical device includes an MRI, an ultrasound machine and / or an electrocardiograph. The electronic device or device of the present invention may also be applied to the Internet, the Internet of Things, data centers, energy, transportation, public administration, manufacturing, education, power grids, telecommunications, finance, retail, construction sites, medical care and other fields. Furthermore, the electronic device or device of the present invention may also be used in application scenarios related to artificial intelligence, big data and / or cloud computing, such as the cloud, edge, and terminal. In one or more embodiments, electronic devices or apparatuses with high computing power according to the solution of the present invention can be applied to cloud devices (such as cloud servers), while electronic devices or apparatuses with low power consumption can be applied to terminal devices and / or edge devices (such as smartphones or cameras). In one or more embodiments, the hardware information of the cloud device and the hardware information of the terminal device and / or edge device are compatible with each other, so that according to the hardware information of the terminal device and / or edge device, appropriate hardware resources can be matched from the hardware resources of the cloud device to simulate the hardware resources of the terminal device and / or edge device, so as to complete the unified management, scheduling and collaborative work of end-to-end or cloud-edge-to-end.
[0056] It should be noted that, for the purpose of simplicity, the present invention describes some methods and embodiments thereof as a series of actions and combinations thereof, but those skilled in the art will understand that the scheme of the present invention is not limited by the order of the described actions. Therefore, based on the disclosure or teachings of the present invention, those skilled in the art will understand that some of the steps therein can be performed in other orders or simultaneously. Further, those skilled in the art will understand that the embodiments described in the present invention can be regarded as optional embodiments, that is, the actions or modules involved therein are not necessarily necessary for the implementation of one or more schemes of the present invention. In addition, depending on the different schemes, the present invention also has different emphases on the description of some embodiments. In view of this, those skilled in the art will understand that the parts that are not described in detail in a certain embodiment of the present invention may also refer to the relevant descriptions of other embodiments.
[0057] In terms of specific implementation, based on the disclosure and teachings of the present invention, those skilled in the art can understand that several embodiments disclosed in the present invention can also be implemented in other ways not disclosed herein. For example, with respect to the various units in the electronic device or device embodiments described above, this article splits them based on the consideration of logical functions, and there may be other ways of splitting them in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features or functions in the units or components can be selectively disabled. With respect to the connection relationship between different units or components, the connection discussed above in conjunction with the accompanying drawings can be a direct or indirect coupling between units or components. In some scenarios, the aforementioned direct or indirect coupling involves a communication connection using an interface, wherein the communication interface can support electrical, optical, acoustic, magnetic or other forms of signal transmission.
[0058] In the present invention, the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units. The aforementioned components or units may be located in the same location or distributed across multiple network elements. In addition, according to actual needs, some or all of the units may be selected to achieve the purpose of the solutions described in the embodiments of the present invention. In addition, in some scenarios, multiple units in the embodiments of the present invention may be integrated into a single unit or each unit may exist physically separately.
[0059] In some other implementation scenarios, the above-mentioned integrated units can also be implemented in the form of hardware, that is, as specific hardware circuits, which may include digital circuits and / or analog circuits, etc. The physical implementation of the hardware structure of the circuit may include but is not limited to physical devices, and the physical devices may include but are not limited to devices such as transistors or memristors. In view of this, the various devices described herein (such as computing devices or other processing devices) can be implemented by appropriate hardware processors, such as central processing units, GPUs, FPGAs, DSPs, and ASICs. Furthermore, the aforementioned storage unit or storage device can be any appropriate storage medium (including magnetic storage media or magneto-optical storage media, etc.), which can be, for example, resistive random access memory (RRAM), dynamic random access memory (DRAM), static random access memory (SRAM), enhanced dynamic random access memory (EDRAM), high bandwidth memory (HBM), hybrid memory cube (HMC), ROM and RAM, etc.
[0060] The foregoing content can be better understood in accordance with the following terms:
[0061] Item A1. A training method for image detection using a neural network, comprising: in forward propagation, inputting a training image into the neural network to obtain the category or position of the target object; in backward propagation, generating a loss function based on the error of the category or position of the target object compared to the label information of the training image; and updating the weight based on the loss function and the projection length of the weight gradient in the weight direction.
[0062] Clause A2. The training method according to Clause A1 further includes: obtaining the modulus of the projection of the weight gradient in the weight direction during back propagation.
[0063] Clause A3. The training method according to Clause A2, wherein the step of obtaining the modulus of the weight gradient projected in the weight direction includes: calculating the weight direction based on the weight and the length of the weight; obtaining the partial derivative of the loss function with respect to the weight; and performing a vector inner product on the weight direction and the partial derivative to obtain the modulus.
[0064] Item A4. The training method according to Item A3 further includes: in back propagation, multiplying the modulus and the weight direction to obtain the projection vector.
[0065] Item A5. The training method according to Item A4 further includes: setting an attenuation coefficient for the projection length in back propagation.
[0066] Item A6. The training method of Item A5, wherein the attenuation coefficient is 1.
[0067] Item A7. A training method according to Item A1, wherein the training images come from a dataset generated from a virtual scene.
[0068] Item A8. A training method according to Item A1, wherein the training images come from a dataset generated in a biased environment.
[0069] Item A9. A training method for image detection using a neural network, comprising: in forward propagation, calculating a unit weight based on the weight and the length of the weight, wherein the unit weight reflects the direction of the weight; in forward propagation, inputting a training image into the neural network and performing a convolution calculation with the unit weight to obtain output image target information; in backward propagation, generating a loss function based on the error of the output compared to the training image annotation information; and updating the unit weight based on the loss function.
[0070] Item A10. An electronic device, characterized in that it comprises: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to call the instructions stored in the memory to execute the method described in any one of Items A1 to 9.
[0071] Item A11. A computer-readable storage medium having stored thereon computer program instructions for performing image detection using a neural network, wherein when the computer program code is run by a processing device, the method described in any one of Items A1 to 9 is executed.
[0072] The embodiments of the present invention are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the contents of this specification should not be understood as limiting the present invention.
Claims
1. A training method for image detection using a neural network, comprising: In the forward propagation, the training image is input into the neural network to obtain the category or location of the target object; In back propagation, a loss function is generated based on the error of the category or position of the target object compared to the label information of the training image; as well as Update the weight according to the loss function and the projection length of the weight gradient in the weight direction, where: According to the weight and the weight length, the weight direction is calculated to obtain the partial derivative of the loss function with respect to the weight, and the vector inner product is performed on the weight direction and the partial derivative to obtain the modulus of the projection of the weight gradient on the weight direction; In backpropagation, the modulus and weight direction are multiplied to obtain the projection vector; In the back propagation, the attenuation coefficient λ is set for the projection length; Based on the obtained projection direction and the set attenuation coefficient λ, the weight is updated according to the following formula: Among them, W t represents the weight matrix of the tth iteration, η is the learning rate or step size, L is the loss function, is the weight direction, is the weight length, is the modulus of the weight gradient projection in the weight direction, is the projection vector. The training method according to claim 1 , wherein the attenuation coefficient is 1.
3. The training method according to claim 1, wherein the training images are from a data set generated from a virtual scene.
4. The training method according to claim 1, wherein the training images are from a dataset generated in a biased environment.
5. A training method for image detection using a neural network, comprising: In the forward propagation, a unit weight is calculated based on the weight and the length of the weight, and the unit weight reflects the direction of the weight; In the forward propagation, the training image is input into the neural network and convolution calculation is performed with the unit weight to obtain output image target information; In back propagation, generating a loss function based on the error of the output compared to the training image annotation information; and updating the unit weight according to the loss function; The unit weight is updated according to the partial derivative of the loss function with respect to the unit weight, and specifically according to the following formula: in, represents the unit weight matrix of the t-th iteration, η is the learning rate or step size, L is the loss function, represents unit weight, and represents the weight length, and λ represents the attenuation coefficient.
6. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 5.
7. A computer-readable storage medium having stored thereon computer program instructions for performing image detection using a neural network, wherein when the computer program code is executed by a processing device, the method according to any one of claims 1 to 5 is executed.