Model training method, device, computer equipment and storage medium
By rotating the convolution kernel, multiple neural networks are generated, and training and loss value fusion are performed on the same training sample set, the problem of insufficient feature learning caused by insufficient data of neural network models is solved, and the robustness of the model is improved. Accuracy.
Patent Information
- Application Number
- CN202011161452.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-27
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2040-10-27
AI Technical Summary
During the training process, the existing neural network model cannot learn enough features due to insufficient training data, which in turn affects its accuracy and robustness.
By obtaining the initial neural network and the preset rotation angle of multiple convolution kernels, the convolution kernel is rotated, multiple rotation neural networks are generated, and these neural networks are trained based on the same training sample set, fusion loss values are integrated to adjust parameters , thereby improving the robustness of the model.
Through multiple rotating neural networks, learning of the same training sample set is increased, the learning metrics of features are improved, the robustness and accuracy of the model are improved, and enough features can be learned in finite training data.
Smart Images

Figure CN112329915B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine learning technology, and in particular to a model training method, apparatus, computer device and storage medium. Background Art
[0002] With the development of artificial intelligence technology, machine learning technology based on neural network structure has emerged. Machine Learning (ML) is a multi-disciplinary cross-discipline that specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance.
[0003] In the prior art, the training process of a neural network model requires a large amount of training data. The larger the amount of training data, the more features the neural network model can learn, and accordingly, the higher the accuracy of the neural network model.
[0004] However, in practical applications, the amount of training data available for learning the neural network model is small, resulting in the neural network model being unable to learn enough features, thereby causing poor training results for the neural network model. Summary of the invention
[0005] Based on this, it is necessary to provide a model training method, device, computer equipment and storage medium that can enhance the robustness of the neural network model in response to the above technical problems.
[0006] A model training method, the method comprising:
[0007] Get the initial neural network and multiple preset convolution kernel rotation angles;
[0008] The convolution kernels of the initial neural network are rotated according to the multiple convolution kernel rotation angles respectively, so as to obtain multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles;
[0009] Based on the training sample set, each rotational neural network is trained to obtain multiple trained target models. During the training process, the loss values corresponding to each rotational neural network are fused to obtain a fused loss value, and the fused loss value is used to adjust the parameters in each rotational neural network.
[0010] In one embodiment, the loss values corresponding to each rotational neural network are fused to obtain a fused loss value, including:
[0011] For each training sample in the training sample set, the training sample is input into each rotation neural network respectively to obtain the loss value of each rotation neural network;
[0012] The loss values of each rotation neural network are summed to obtain the fusion loss value.
[0013] In one embodiment, the convolution kernel of the initial neural network is rotated according to the multiple convolution kernel rotation angles to obtain multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles, including:
[0014] For each convolution kernel rotation angle, the convolution kernel of the initial neural network is rotated using a matrix rotation function to obtain a rotated neural network corresponding to the convolution kernel rotation angle.
[0015] In one embodiment, the angle differences between the rotation angles of multiple convolution kernels are the same, and the rotation angles of multiple convolution kernels are all less than 360 degrees.
[0016] In one embodiment, multiple convolution kernel rotation angles include 0 degree, 90 degrees, 180 degrees, and 270 degrees.
[0017] In one embodiment, after performing network training on each rotational neural network based on the training sample set to obtain multiple trained target models, the method further includes:
[0018] Acquire the image to be tested;
[0019] Input the image to be tested into each target model respectively, and obtain the image feature map output by each target model;
[0020] The image feature maps output by each target model are added bit by bit to obtain the target feature map;
[0021] The detection result of the image to be tested is obtained based on the target feature map.
[0022] In one embodiment, after performing network training on each rotational neural network based on the training sample set to obtain multiple trained target models, the method further includes:
[0023] Acquire the image to be tested;
[0024] Inputting the image to be tested into any one of the multiple target models, and obtaining an image feature map output by any one of the target models;
[0025] The detection result of the image to be tested is obtained based on the image feature map output by any target model.
[0026] A model training device, comprising:
[0027] An acquisition module is used to obtain the initial neural network and multiple preset convolution kernel rotation angles;
[0028] A rotation module, used to rotate the convolution kernel of the initial neural network according to multiple convolution kernel rotation angles, to obtain multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles;
[0029] The training module is used to perform network training on each rotational neural network based on the training sample set to obtain multiple trained target models. During the training process, the loss values corresponding to each rotational neural network are fused to obtain a fused loss value, and the fused loss value is used to adjust the parameters in each rotational neural network.
[0030] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0031] Get the initial neural network and multiple preset convolution kernel rotation angles;
[0032] The convolution kernels of the initial neural network are rotated according to the multiple convolution kernel rotation angles respectively, so as to obtain multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles;
[0033] Based on the training sample set, each rotational neural network is trained to obtain multiple trained target models. During the training process, the loss values corresponding to each rotational neural network are fused to obtain a fused loss value, and the fused loss value is used to adjust the parameters in each rotational neural network.
[0034] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0035] Get the initial neural network and multiple preset convolution kernel rotation angles;
[0036] The convolution kernels of the initial neural network are rotated according to the multiple convolution kernel rotation angles respectively, so as to obtain multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles;
[0037] Based on the training sample set, each rotational neural network is trained to obtain multiple trained target models. During the training process, the loss values corresponding to each rotational neural network are fused to obtain a fused loss value, and the fused loss value is used to adjust the parameters in each rotational neural network.
[0038] The above-mentioned model training method, device, computer equipment and storage medium obtain an initial neural network and a plurality of preset convolution kernel rotation angles; respectively rotate the convolution kernel of the initial neural network according to the plurality of convolution kernel rotation angles to obtain a plurality of rotation neural networks corresponding to the plurality of convolution kernel rotation angles; respectively perform network training on each of the rotation neural networks based on a training sample set to obtain a plurality of trained target models, wherein, during the training process, the loss values corresponding to each of the rotation neural networks are fused to obtain a fusion loss value, and the fusion loss value is used to adjust the parameters in each of the rotation neural networks. In the embodiment of the present application, the same training sample set is learned through multiple rotation neural network models, so the degree of learning of the training sample set is more refined, so that more features are learned from the training sample set, thereby improving the robustness of the target model. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A schematic diagram of a flow chart of a model training method in one embodiment;
[0040] Figure 2 is a flow chart of a method for applying a target model in one embodiment;
[0041] Figure 3 is a flow chart of a method for applying a target model in another embodiment;
[0042] Figure 4 is a structural block diagram of a model training device in one embodiment;
[0043] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0045] In one embodiment, Figure 1 As shown, a model training method is provided. This embodiment uses the method applied to a computer device as an example. The computer device can be a terminal or a server. In this embodiment, the method includes the following steps:
[0046] Step 101: A computer device obtains an initial neural network and a plurality of preset convolution kernel rotation angles.
[0047] The initial neural network is an untrained neural network. Optionally, the network structure of the initial neural network can be a YOLO_v3 (English: You only look once) network structure, a convolutional neural network structure, etc. Optionally, the network structure of the initial neural network can be determined according to the type of model that actually needs to be trained. For example, if the model that actually needs to be trained is a vehicle recognition model, then the network structure of the initial neural network can select a YOLO_v3 network structure. If the model that actually needs to be trained is a human posture recognition model, then the network structure of the initial neural network can be, for example, an OpenPose network structure.
[0048] In the embodiment of the present application, the preset convolution kernel rotation angle refers to the rotation angle when the convolution kernel in the initial neural network is rotated. Optionally, multiple convolution kernel rotation angles can be arbitrarily set by humans; optionally, the angle difference between multiple convolution kernel rotation angles is the same, and multiple convolution kernel rotation angles are all less than 360 degrees. Optionally, multiple convolution kernel rotation angles include 0 degrees, 90 degrees, 180 degrees, and 270 degrees.
[0049] In step 102, the computer device rotates the convolution kernel of the initial neural network according to the multiple convolution kernel rotation angles, and obtains multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles.
[0050] In the embodiment of the present application, the computer device rotates the convolution kernel of the initial neural network according to the multiple convolution kernel rotation angles, which means that for each convolution kernel rotation angle, the convolution kernel of the initial neural network is rotated to the angle corresponding to the convolution kernel rotation angle, and the initial neural network after the convolution kernel rotation is a rotated neural network. Therefore, multiple rotated neural networks corresponding to the multiple convolution kernel rotation angles can be obtained.
[0051] In the embodiment of the present application, the initial neural network may include multiple convolution kernels, and rotating the convolution kernel of the initial neural network to an angle corresponding to the rotation angle of the convolution kernel refers to synchronously rotating the multiple convolution kernels in the initial neural network and rotating them to the convolution kernel rotation angle. The so-called synchronous rotation means that, at each rotation, the multiple convolution kernels in the initial neural network are rotated at the same angle.
[0052] Optionally, in an embodiment of the present application, the angles of multiple convolution kernels included in the initial neural network are set to 0 degrees by default.
[0053] Step 103, the computer device performs network training on each rotational neural network based on the training sample set to obtain multiple trained target models, wherein during the training process, the loss values corresponding to each rotational neural network are fused to obtain a fused loss value, and the fused loss value is used to adjust the parameters in each rotational neural network.
[0054] In the embodiment of the present application, multiple rotational neural networks are trained separately based on the same training sample set.
[0055] Optionally, the training sample set includes multiple training samples.
[0056] Optionally, in an embodiment of the present application, the process of training multiple rotational neural networks may include the following: a certain training sample may be input into multiple rotational neural networks respectively, and the convolution kernel of each rotational neural network may extract features from the input training sample. Since the convolution kernels of each rotational neural network are obtained by rotating the convolution kernel of the initial neural network at different angles, the convolution kernels of each rotational neural network are not the same, and therefore, the features extracted from the training sample by the convolution kernel of each rotational neural network are different. The computer device may calculate the loss value of each rotational neural network based on the features extracted from the training sample by the convolution kernel of each rotational neural network. Then the computer device may fuse the loss values corresponding to each rotational neural network to obtain a fusion loss value. And the fusion loss value is used to adjust the parameters in each rotational neural network. After the parameter adjustment of each rotational neural network is completed, a training sample is continuously selected from the multiple training samples and input into the multiple rotational neural networks respectively, and the above process is repeated to adjust the parameters of each rotational neural network.
[0057] Optionally, in an embodiment of the present application, the computer device fuses the loss values corresponding to each rotational neural network, and the process of obtaining the fused loss value may refer to: summing the loss values of each rotational neural network, and the sum result is the fused loss value.
[0058] Optionally, in an embodiment of the present application, for the fusion loss value obtained during the training process, the computer device can compare the fusion loss value and the loss value threshold. When the fusion loss value is less than or equal to the loss value threshold, it means that each rotational neural network has converged, and the network training process is now completed, and the trained rotational neural network is the target model. If the fusion loss value is greater than the loss value threshold, the fusion loss value is used to adjust the parameters in each rotational neural network until the network training process is completed.
[0059] It should be noted that in the embodiments of the present application, the above-mentioned model training method can be used to train various types of neural network models such as face recognition models, target detection and recognition models, human key point detection models, human posture models, scene semantic analysis models, pedestrian re-identification models and vehicle recognition models, which are not listed exhaustively here.
[0060] For example, when training a face recognition model, a training sample set may be obtained, and the training sample set may include multiple training samples, each training sample includes a face image and an identification label, such as an identification label that may be age or gender. The process of training a face recognition model based on the above model training method may include the following: a computer device may obtain an initial neural network and multiple preset convolution kernel rotation angles, respectively rotate the convolution kernel of the initial neural network according to the multiple convolution kernel rotation angles to obtain multiple rotation neural networks, select a target training sample from the multiple training samples, and input the selected target training sample into each rotation neural network, respectively, and each rotation neural network may extract face features from the target training sample, wherein, since the convolution kernels of each rotation neural network are different, the face features extracted from the target training sample by each rotation neural network are not the same, so using multiple rotation neural networks to perform feature learning on the same target training sample can learn more and more refined features, and then each rotation neural network can calculate a loss value based on the learned face features, perform feature fusion on the loss values of each rotation neural network, obtain a fusion feature value, and then use the fusion feature value to adjust the parameters of each rotation neural network. This training process is repeated until the trained rotational neural network converges, and target models corresponding to each rotational neural network are obtained. These target models are the trained face recognition models.
[0061] For another example, when training a vehicle recognition model, a training sample set may be obtained, and the training sample set may include multiple training samples, each training sample including a vehicle image and a vehicle type label. The process of training a vehicle recognition model based on the above model training method may include the following: the computer device may obtain an initial neural network and multiple preset convolution kernel rotation angles, respectively rotate the convolution kernel of the initial neural network according to the multiple convolution kernel rotation angles to obtain multiple rotation neural networks, select a target training sample from the multiple training samples, and input the selected target training sample into each rotation neural network, respectively, and each rotation neural network may extract vehicle features from the target training sample, wherein, since the convolution kernels of each rotation neural network are different, the vehicle features extracted from the target training sample by each rotation neural network are not the same, so using multiple rotation neural networks to perform feature learning on the same target training sample can learn more and more refined features, and then each rotation neural network can calculate a loss value based on the learned vehicle features, perform feature fusion on the loss values of each rotation neural network, obtain a fusion feature value, and then use the fusion feature value to adjust the parameters of each rotation neural network. This training process is repeated until the trained rotational neural network converges, and target models corresponding to each rotational neural network are obtained. These target models are the trained vehicle recognition models.
[0062] In the embodiments of the present application, the process of training other models is similar to the process of training a face recognition model and training a vehicle recognition model, and is not enumerated here.
[0063] In the embodiment of the present application, feature learning is performed on training samples in the same training sample set through multiple rotational neural networks. Since the convolution kernels of the various rotational neural networks are different, the features extracted from the training samples by the convolution kernels of each rotational neural network are different. In this way, more and more comprehensive features can be learned from the training samples, thereby achieving the purpose of learning enough features from limited training samples, and thus, the robustness of the target model obtained by training is better.
[0064] In one embodiment, the process of rotating the convolution kernel of the initial neural network according to the multiple convolution kernel rotation angles to obtain multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles includes the following:
[0065] The computer device rotates the convolution kernel of the initial neural network using a matrix rotation function for each convolution kernel rotation angle, and obtains a rotated neural network corresponding to the convolution kernel rotation angle.
[0066] For example, the rotation angles of multiple convolution kernels are 0 degrees, 45 degrees, 90 degrees, 135 degrees, 180 degrees, 225 degrees, and 270 degrees. Taking the rotation of 90 degrees as an example, the computer device can use the matrix rotation function to rotate the multiple convolution kernels of the initial neural network by 90 degrees respectively to obtain a rotated neural network corresponding to 90 degrees. The rotation process of the remaining convolution kernel rotation angles is the same and will not be repeated here.
[0067] Optionally, the matrix rotation function can be, for example, torch.rotation(x,90), where x represents the image matrix and 90 represents the rotation angle. torch.rotation(x,90) means rotating the target image by 90 degrees.
[0068] In the embodiment of the present application, the convolution kernel of the initial neural network is rotated using a matrix rotation function, and a rotated neural network corresponding to the rotation angle of the convolution kernel can be obtained. In this way, when the convolution kernels of each rotated neural network are different, the features extracted from the training samples by the convolution kernels of each rotated neural network are different. Therefore, more and more comprehensive features can be learned from the training samples, thereby achieving the purpose of learning enough features from limited training samples, thereby improving the robustness of the target model.
[0069] In one embodiment, Figure 2 As shown, after obtaining multiple target models, the following contents may also be included:
[0070] Step 201: A computer device obtains an image to be tested.
[0071] In the embodiment of the present application, the image to be tested may be an image to be tested. If the target model is a face recognition model, then the image to be tested may be a face image to be recognized. If the target model is a vehicle recognition model, then the image to be tested may be an image containing or not containing a vehicle.
[0072] In step 202, the computer device inputs the image to be tested into each target model respectively, and obtains the image feature map output by each target model.
[0073] In each of the embodiments of the present application, the computer device can input the image to be tested into each target model respectively, wherein each target model can learn the features of the image to be tested based on the trained network structure and network parameters, and each target model can output the learned image feature map (English: Feature Map).
[0074] Step 203: The computer device performs bitwise addition on the image feature maps output by each target model to obtain a target feature map.
[0075] In the embodiment of the present application, the image feature map is a feature matrix, and the computer device performs bit-by-bit addition on the image feature map output by each target model, which means that the feature matrix output by each target model is added bit-by-bit, and the result of the addition is the target feature map.
[0076] Step 204: The computer device obtains the detection result of the image to be tested based on the target feature map.
[0077] The target feature map is a feature map used to represent the features of the image to be tested. In the embodiment of the present application, the computer device can use a classifier to classify the target feature map to obtain the detection result of the image to be tested.
[0078] In an embodiment of the present application, after the model is trained, in order to improve the detection accuracy of the target model, multiple trained target models can be used to extract features of the image to be tested, so that more total features can be extracted. After adding the image feature maps output by multiple target models, a target feature map that can more accurately describe the image to be tested can be obtained, and the detection result of the image to be tested determined based on the target feature map is more accurate.
[0079] In one embodiment, Figure 3 As shown, after obtaining multiple target models, the following contents may also be included:
[0080] Step 301: A computer device obtains an image to be tested.
[0081] In the embodiment of the present application, the image to be tested may be an image to be detected.
[0082] In step 302, the computer device inputs the image to be tested into any one of the multiple target models, and obtains an image feature map output by any one of the target models.
[0083] Since the multiple target models are trained through the same set of training samples, each target model can realize its function independently. Therefore, in the embodiment of the present application, any one of the multiple target models can be used to detect the image to be tested.
[0084] In an embodiment of the present application, the image to be tested can be input into any target model, and the any target model can learn the features of the image to be tested based on the trained network structure and network parameters, and output the learned image feature map of the image to be tested.
[0085] Step 303: The computer device obtains a model output result based on an image feature map output by any target model.
[0086] In an embodiment of the present application, the computer device may utilize a classifier to classify the image feature map of the image to be tested, thereby obtaining a detection result of the image to be tested.
[0087] It should be understood that although Figure 1-Figure 3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-Figure 3 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0088] In one embodiment, Figure 4 As shown, a model training device is provided, including: an acquisition module 401, a rotation module 402 and a training module 403, wherein:
[0089] An acquisition module 401 is used to acquire an initial neural network and a plurality of preset convolution kernel rotation angles;
[0090] A rotation module 402, used to rotate the convolution kernel of the initial neural network according to the multiple convolution kernel rotation angles, to obtain multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles;
[0091] The training module 403 is used to perform network training on each rotational neural network based on the training sample set to obtain multiple trained target models. During the training process, the loss values corresponding to each rotational neural network are fused to obtain a fused loss value, and the fused loss value is used to adjust the parameters in each rotational neural network.
[0092] In one embodiment, the training module 403 is further used to input the training samples in the training sample set into each rotation neural network to obtain the loss value of each rotation neural network;
[0093] The loss values of each rotation neural network are summed to obtain the fusion loss value.
[0094] In one embodiment, the rotation module 402 is further used to rotate the convolution kernel of the initial neural network using a matrix rotation function for each convolution kernel rotation angle to obtain a rotated neural network corresponding to the convolution kernel rotation angle.
[0095] In one embodiment, the angle differences between the rotation angles of multiple convolution kernels are the same, and the rotation angles of multiple convolution kernels are all less than 360 degrees.
[0096] In one embodiment, multiple convolution kernel rotation angles include 0 degree, 90 degrees, 180 degrees, and 270 degrees.
[0097] In one embodiment, the device further includes a first detection module, the first detection module is used to
[0098] Acquire the image to be tested;
[0099] Input the image to be tested into each target model respectively, and obtain the image feature map output by each target model;
[0100] The image feature maps output by each target model are added bit by bit to obtain the target feature map;
[0101] The detection result of the image to be tested is obtained based on the target feature map.
[0102] In one embodiment, the device further includes a second detection module, the second detection module is used to
[0103] Acquire the image to be tested;
[0104] Inputting the image to be tested into any one of the multiple target models, and obtaining an image feature map output by any one of the target models;
[0105] The detection result of the image to be tested is obtained based on the image feature map output by any target model.
[0106] For the specific definition of the model training device, please refer to the definition of the model training method above, which will not be repeated here. Each module in the above-mentioned model training device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0107] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store multiple convolution kernel rotation angles. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a model training method is implemented.
[0108] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0109] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0110] Get the initial neural network and multiple preset convolution kernel rotation angles;
[0111] The convolution kernels of the initial neural network are rotated according to the multiple convolution kernel rotation angles respectively, so as to obtain multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles;
[0112] Based on the training sample set, each rotational neural network is trained to obtain multiple trained target models. During the training process, the loss values corresponding to each rotational neural network are fused to obtain a fused loss value, and the fused loss value is used to adjust the parameters in each rotational neural network.
[0113] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each training sample in the training sample set, the training sample is input into each rotational neural network respectively to obtain the loss value of each rotational neural network; the loss value of each rotational neural network is summed to obtain the fusion loss value.
[0114] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each convolution kernel rotation angle, the convolution kernel of the initial neural network is rotated using a matrix rotation function to obtain a rotated neural network corresponding to the convolution kernel rotation angle.
[0115] In one embodiment, when the processor executes the computer program, the following steps are also implemented: the angle differences between the rotation angles of multiple convolution kernels are the same, and the rotation angles of multiple convolution kernels are all less than 360 degrees.
[0116] In one embodiment, when the processor executes the computer program, the following steps are also implemented: multiple convolution kernel rotation angles include 0 degrees, 90 degrees, 180 degrees, and 270 degrees.
[0117] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the image to be tested; inputting the image to be tested into each target model respectively, and obtaining the image feature map output by each target model; adding the image feature map output by each target model bit by bit to obtain the target feature map; and obtaining the detection result of the image to be tested based on the target feature map.
[0118] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining an image to be tested; inputting the image to be tested into any one of a plurality of target models, and obtaining an image feature map output by any one of the target models; and obtaining a detection result of the image to be tested based on the image feature map output by any one of the target models.
[0119] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0120] Get the initial neural network and multiple preset convolution kernel rotation angles;
[0121] The convolution kernels of the initial neural network are rotated according to the multiple convolution kernel rotation angles respectively, so as to obtain multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles;
[0122] Based on the training sample set, each rotational neural network is trained to obtain multiple trained target models. During the training process, the loss values corresponding to each rotational neural network are fused to obtain a fused loss value, and the fused loss value is used to adjust the parameters in each rotational neural network.
[0123] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each training sample in the training sample set, the training sample is input into each rotation neural network respectively to obtain the loss value of each rotation neural network; the loss value of each rotation neural network is summed to obtain the fusion loss value.
[0124] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each convolution kernel rotation angle, the convolution kernel of the initial neural network is rotated using a matrix rotation function to obtain a rotated neural network corresponding to the convolution kernel rotation angle.
[0125] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: the angle differences between the rotation angles of multiple convolution kernels are the same, and the rotation angles of multiple convolution kernels are all less than 360 degrees.
[0126] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: multiple convolution kernel rotation angles include 0 degrees, 90 degrees, 180 degrees, and 270 degrees.
[0127] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the image to be tested; inputting the image to be tested into each target model respectively, and obtaining the image feature map output by each target model; adding the image feature maps output by each target model bit by bit to obtain the target feature map; and obtaining the detection result of the image to be tested based on the target feature map.
[0128] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: obtaining an image to be tested; inputting the image to be tested into any one of a plurality of target models, and obtaining an image feature map output by any one of the target models; and obtaining a detection result of the image to be tested based on the image feature map output by any one of the target models.
[0129] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0130] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0131] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A model training method, characterized in that: The method comprises: Get the initial neural network and multiple preset convolution kernel rotation angles; Rotating the convolution kernels of the initial neural network according to the multiple convolution kernel rotation angles respectively to obtain multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles; Based on the same training sample set, network training is performed on each of the rotational neural networks to obtain multiple trained target models, wherein during the training process, the loss values corresponding to each of the rotational neural networks are fused to obtain a fused loss value, and the fused loss value is used to adjust the parameters in each of the rotational neural networks, and the fused loss value is compared with the loss value threshold. When the fused loss value is less than or equal to the loss value threshold, the network training process ends, and the trained rotational neural network is used as the target model; when the fused loss value is greater than the loss value threshold, the fused loss value is used to continue adjusting the parameters in each of the rotational neural networks until the network training process ends; Acquire the image to be tested; Inputting the image to be tested into each of the target models respectively, and obtaining the image feature map output by each of the target models; Adding the image feature maps output by each target model bit by bit to obtain a target feature map; A detection result of the image to be tested is obtained based on the target feature map.
2. The method according to claim 1, characterized in that: The step of fusing the loss values corresponding to the rotational neural networks to obtain a fused loss value includes: For each training sample in the training sample set, input the training sample into each rotation neural network respectively to obtain a loss value of each rotation neural network; The loss values of each of the rotational neural networks are summed to obtain the fusion loss value.
3. The method according to claim 1, characterized in that The method of rotating the convolution kernels of the initial neural network according to the multiple convolution kernel rotation angles to obtain multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles comprises: For each convolution kernel rotation angle, the convolution kernel of the initial neural network is rotated using a matrix rotation function to obtain a rotated neural network corresponding to the convolution kernel rotation angle.
4. The method according to claim 1, characterized in that: The angle differences between the rotation angles of the multiple convolution kernels are the same, and the rotation angles of the multiple convolution kernels are all less than 360 degrees.
5. The method according to claim 4, characterized in that The multiple convolution kernel rotation angles include 0 degree, 90 degrees, 180 degrees, and 270 degrees.
6. The method according to claim 1, characterized in that After performing network training on each of the rotational neural networks based on the same training sample set to obtain a plurality of trained target models, the method further includes: Acquire the image to be tested; Inputting the image to be tested into any one of the multiple target models, and obtaining an image feature map output by any one of the target models; The detection result of the image to be tested is obtained based on the image feature map output by any one of the target models.
7. A model training device, characterized in that: The device comprises: An acquisition module is used to obtain the initial neural network and multiple preset convolution kernel rotation angles; A rotation module, used to rotate the convolution kernel of the initial neural network according to the multiple convolution kernel rotation angles, to obtain multiple rotation neural networks corresponding to the multiple convolution kernel rotation angles; A training module, used for performing network training on each of the rotational neural networks based on the same training sample set to obtain multiple trained target models, wherein during the training process, the loss values corresponding to each of the rotational neural networks are fused to obtain a fused loss value, and the fused loss value is used to adjust the parameters in each of the rotational neural networks; the fused loss value is compared with a loss value threshold, and when the fused loss value is less than or equal to the loss value threshold, the network training process ends, and the trained rotational neural network is used as the target model; if the fused loss value is greater than the loss value threshold, the fused loss value is used to continue adjusting the parameters in each of the rotational neural networks until the network training process ends; The first detection module is used to obtain the image to be tested; input the image to be tested into each of the target models respectively, and obtain the image feature map output by each of the target models; add the image feature maps output by each of the target models bit by bit to obtain a target feature map; and obtain the detection result of the image to be tested based on the target feature map.
8. The device according to claim 7, characterized in that The training module is also used to input each training sample in the training sample set into each rotational neural network to obtain a loss value of each rotational neural network; and sum the loss values of each rotational neural network to obtain the fusion loss value.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Image processing method and device and electronic device
CN109165619A
A target classification and angle estimation method based on convolution kernel weight parameters
CN109726769A
Convolutional neural network model training method and device and computer readable storage medium
CN110276345A
Image classification method and related device
CN110909796A
Monocular vision odometer method and system based on deep learning
CN111080699A
