Training method, device and equipment for image recognition model based on sparsity

By repeatedly training deep learning models under different sparsities, generating multiple training models and selecting qualified models, the problem of low image recognition accuracy and large model size in the existing technology is solved, and efficient and accurate image recognition is achieved.

CN114627342BActive Publication Date: 2024-09-06BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210210049.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-03
Publication Date
2024-09-06
Estimated Expiration
2042-03-03

AI Technical Summary

Technical Problem

The training process of existing deep learning models in image recognition is relatively simple, resulting in low recognition accuracy, and many parameters lead to large model sizes and low training efficiency.

Method used

By repeatedly training under different sparsities, multiple training models suitable for different sparsities are generated, and qualified models are selected from the trained models as image recognition models to improve recognition accuracy and model accuracy.

Benefits of technology

The recognition accuracy and training efficiency of the image recognition model are improved, the model volume is reduced, and the effect of accurate image recognition is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114627342B
    Figure CN114627342B
Patent Text Reader

Abstract

The present disclosure provides a training method, device and equipment for an image recognition model based on sparsity, which relates to computer vision, deep learning and other fields in the field of artificial intelligence technology, including: inputting an acquired image to be trained into an initial training model; wherein the training model includes a plurality of network layers for processing image feature maps of the image to be trained, the network layers are configured with parameter matrices, and the parameter matrices are set with sparsity; repeating the following steps until a preset stop condition is reached: training the i-th training model composed of each network layer with the j-th level of sparsity to obtain the i-th training model after training; generating the network layer of the i+1-th training model according to the parameter matrix of the network layer of the i-th training model after training; adding 1 to the value of i and adding 1 to the value of j; determining that the training model after training that meets the first preset condition is an image recognition model for identifying images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the fields of computer vision, deep learning, etc. in artificial intelligence, and in particular to a training method, device and equipment for a sparsity-based image recognition model. Background Art

[0002] With the development of deep learning technology, deep learning models can be applied to image recognition. It is necessary to train the deep learning model to obtain an image recognition model for image recognition.

[0003] In the prior art, a deep learning model includes multiple network layers, each of which can be used to process an image feature map of an image to be trained; then, by training the network layers in the deep learning model based on the image to be trained, an image recognition model for image recognition can be obtained.

[0004] However, in the above method, the training process is relatively simple, resulting in low recognition accuracy of the obtained image recognition model. Summary of the invention

[0005] The present disclosure provides a method, apparatus and device for training a sparsity-based image recognition model for improving the recognition accuracy of the image recognition model.

[0006] According to a first aspect of the present disclosure, a method for training a sparsity-based image recognition model is provided, comprising:

[0007] Acquire an image to be trained and input the image to be trained into an initial training model; wherein the training model includes a plurality of network layers for processing image feature maps of the image to be trained, the network layers are configured with a parameter matrix, the parameter matrix is ​​provided with a sparsity, and the sparsity represents the proportion of zero-value parameters in the parameter matrix.

[0008] Repeat the following steps until a preset stop condition is reached, where the initial value of i is 1, i is a positive integer, and j is a positive integer: train the i-th training model composed of network layers with the j-th level of sparsity to obtain the trained i-th training model; generate the network layer of the i+1-th training model according to the parameter matrix of the network layer of the trained i-th training model, where the parameter matrix of the network layer of the i+1-th training model has the j+1-th level of sparsity; add 1 to the value of i, and add 1 to the value of j.

[0009] The trained training model that meets the first preset condition is determined to be an image recognition model for recognizing images.

[0010] According to a second aspect of the present disclosure, there is provided an image recognition method based on an image recognition model, comprising:

[0011] Acquire an image to be recognized, and input the image to be recognized into an image recognition model to obtain an image recognition result; wherein the image recognition model is a model obtained according to the method described in the first aspect above.

[0012] According to a third aspect of the present disclosure, a training device for a sparsity-based image recognition model is provided, comprising:

[0013] The first acquisition unit is used to acquire the image to be trained.

[0014] An input unit is used to input the image to be trained into an initial training model; wherein the training model includes a plurality of network layers for processing the image feature map of the image to be trained, the network layer is configured with a parameter matrix, the parameter matrix is ​​set with sparsity, and the sparsity represents the proportion of zero-value parameters in the parameter matrix.

[0015] The training unit, the generating unit and the first determining unit are repeated until a preset stopping condition is reached, wherein the initial value of i is 1, i is a positive integer, and j is a positive integer.

[0016] The training unit is used to train the i-th training model composed of each network layer with the j-th level of sparsity to obtain the i-th training model after training.

[0017] A generating unit is used to generate a network layer of an i+1th training model according to a parameter matrix of a network layer of an i-th training model after training, wherein the parameter matrix of the network layer of the i+1th training model has a j+1th level of sparsity.

[0018] The first determining unit is used to add 1 to the value of i and add 1 to the value of j.

[0019] The second determination unit is used to determine that the trained training model that meets the first preset condition is an image recognition model for recognizing images.

[0020] According to a fourth aspect of the present disclosure, there is provided an image recognition device based on an image recognition model, comprising:

[0021] The second acquisition unit is used to acquire the image to be recognized.

[0022] A recognition unit is used to input the image to be recognized into an image recognition model to obtain an image recognition result; wherein the image recognition model is a model obtained by the device according to the third aspect.

[0023] According to a fifth aspect of the present disclosure, there is provided an electronic device, including:

[0024] at least one processor; and

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

[0026] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in the first aspect, or to enable the at least one processor to execute the method described in the second aspect.

[0027] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the first aspect, or the computer instructions are used to cause the computer to execute the method described in the second aspect.

[0028] According to a seventh aspect of the present disclosure, a computer program product is provided, comprising: a computer program, wherein the computer program is stored in a readable storage medium, and at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program so that the electronic device executes the method described in the first aspect, or the at least one processor executes the computer program so that the electronic device executes the method described in the second aspect.

[0029] 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 disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0031] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;

[0032] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;

[0033] Figure 3 is a schematic diagram of a scenario in which the training method of the sparsity-based image recognition model of the embodiment of the present disclosure can be implemented;

[0034] Figure 4 is a schematic diagram according to a third embodiment of the present disclosure;

[0035] Figure 5 is a schematic diagram according to a fourth embodiment of the present disclosure;

[0036] Figure 6 is a schematic diagram according to a fifth embodiment of the present disclosure;

[0037] Figure 7 is a schematic diagram according to a sixth embodiment of the present disclosure;

[0038] Figure 8 is a schematic diagram according to a seventh embodiment of the present disclosure;

[0039] Fig. 9 It is a block diagram of an electronic device that can implement the sparsity-based image recognition model training method or the image recognition model-based image recognition method of the embodiment of the present disclosure. DETAILED DESCRIPTION

[0040] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0041] With the development of deep learning technology, deep learning algorithms can now be applied to the field of image recognition, for example, detection of moving objects in images, classification of images, etc. At present, multiple network layers are usually set in deep learning models, wherein each network layer can be used to process the input feature map of the layer (for example, feature extraction processing). In addition, the network layers in the deep learning model can be continuously trained based on the training images in the preset training set, and after the training reaches the preset conditions, an image recognition model that can be used for image recognition is obtained.

[0042] In one example, when an image recognition model is trained based on multiple training images in a training set, the network layer in the deep learning model can only be fully trained once based on multiple images to be trained, and the training accuracy is not high; this results in the recognition accuracy of the obtained image recognition model being low, and an image recognition model that can accurately recognize images cannot be obtained.

[0043] In one example, in order to avoid the image recognition model being too large due to the large number of parameters in the image recognition model, the sparsity of the parameter matrix corresponding to each network layer in the image recognition model is set to the same sparsity, and then a complete training is performed. However, the recognition accuracy of the image recognition model obtained in the above manner is not high.

[0044] In order to avoid at least one of the above technical problems, the inventors of the present disclosure have creatively worked to obtain the inventive concept of the present disclosure: by repeating multiple trainings at different sparsities, multiple trained training models suitable for different sparsities can be obtained. Afterwards, a qualified trained training model can be selected from the trained training models as an image recognition model for recognizing images.

[0045] Based on the above-mentioned inventive concept, the present disclosure provides a training method, device and equipment for a sparsity-based image recognition model, which is applied to the fields of computer vision, deep learning, etc. in the field of artificial intelligence, so as to achieve the effect of obtaining an image recognition model for accurately identifying images.

[0046] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure. The training method of the image recognition model based on sparsity in the embodiment of the present disclosure includes:

[0047] S101, obtaining an image to be trained, and inputting the image to be trained into an initial training model; wherein the training model includes a plurality of network layers for processing image feature maps of the image to be trained, the network layers are configured with a parameter matrix, the parameter matrix is ​​set with sparsity, and the sparsity represents the proportion of zero-value parameters in the parameter matrix.

[0048] Exemplarily, the executor of this embodiment may be a training device for a sparsity-based image recognition model (hereinafter referred to as a training device), and the training device may be a server (such as a local server or a cloud server), a computer, a terminal device, a processor, a chip, etc., which is not limited in this embodiment.

[0049] The training model in this embodiment is an image recognition model for image recognition, and includes multiple network layers, wherein the network layer processes the image to be trained or the feature map of the image to be trained input into the network layer based on the parameter matrix corresponding to the network layer. The image to be trained obtained is a training image in a public data set.

[0050] In addition, for each network layer, a parameter matrix is ​​set, and each parameter matrix has sparsity, wherein the sparsity is used to characterize the ratio of the number of zero-valued parameters in a parameter matrix to the number of all parameters in the parameter matrix.

[0051] When training the initial training model, a batch training method can be used, that is, multiple images are input at one time to train the training model.

[0052] Repeat steps S102-S104 until a preset stop condition is reached, wherein the initial value of i is 1, i is a positive integer, and j is a positive integer.

[0053] Exemplarily, in this embodiment, multiple trainings are performed based on different levels of sparsity until a preset stop condition is reached, and then the training process is stopped.

[0054] In one example, the preset stop condition can be set by the training duration.

[0055] S102, training the i-th training model composed of each network layer with the j-th level of sparsity to obtain the trained i-th training model.

[0056] Exemplarily, the i-th training model is composed of network layers with j-th level sparsity, and after training the i-th training model, a trained i-th training model can be obtained.

[0057] In one example, when training the i-th training model, the time to stop training can be determined by setting the training duration, and then when the training duration is reached, the training model at this time is used as the i-th training model.

[0058] S103. Generate a network layer of the i+1th training model according to the parameter matrix of the network layer of the i-th training model after training, wherein the parameter matrix of the network layer of the i+1th training model has a j+1th level of sparsity.

[0059] Exemplarily, after obtaining the i-th training model after training, the network layer of the i+1-th training model can be obtained based on the parameter matrix of the network layer of the i-th training model after training, wherein the parameter matrix of the network layer of the i+1-th training model has the j+1-th level of sparsity, that is, the i+1-th training model has a different sparsity level from the i-th training model.

[0060] For example, assuming that the sparsity of the parameter matrices of each network layer in the i-th training model after training is 70%, then the parameter matrices of each network layer in the i-th training model after training can be used to obtain the parameter matrices of each parameter matrix with a sparsity of 80% corresponding to each parameter matrix with a sparsity of 70%, thereby generating the i+1-th model.

[0061] S104. Increase the value of i by 1, and increase the value of j by 1.

[0062] Exemplarily, the values ​​of i and j are respectively increased by 1, and then the above steps S102-S104 are repeated until the preset condition is met.

[0063] S105: Determine that the trained training model that meets the first preset condition is an image recognition model for recognizing images.

[0064] Exemplarily, after a plurality of trained training models are obtained based on the above process, an image recognition model for recognizing an image may be determined based on the plurality of trained training models and the first preset condition.

[0065] In one example, the first preset condition includes a model accuracy threshold and a model time threshold. The training model can be determined as an image recognition model for recognizing images only when the model accuracy and model time corresponding to the determined training model meet the first preset condition. Among them, the model accuracy is used to characterize the accuracy of the output results of the model when performing image recognition. The model time is used to characterize the time consumed by the model in image recognition.

[0066] In this embodiment, a supernet containing many training models is obtained by training multiple training models composed of network layers with different levels of sparsity. When determining the image recognition model for recognizing images later, there is no need to train again, and it can be obtained by directly searching in the previously trained training model. Compared with the method in the related art where each layer of the network model is set with the same sparsity for a single complete training to determine the final image recognition model, the method provided in this embodiment can improve the model accuracy of the final image recognition model through multiple training.

[0067] Figure 2 According to the second embodiment of the present disclosure, Figure 2 As shown, the training method of the sparsity-based image recognition model of the embodiment of the present disclosure includes:

[0068] S201. Obtain an image to be trained and input the image to be trained into an initial training model; wherein the training model includes a plurality of network layers for processing image feature maps of the image to be trained, the network layers are configured with a parameter matrix, the parameter matrix is ​​set with sparsity, and the sparsity represents the proportion of zero-value parameters in the parameter matrix.

[0069] Exemplarily, the executor of this embodiment may be a training device for a sparsity-based image recognition model (hereinafter referred to as a training device), and the training device may be a server (such as a local server or a cloud server), a computer, a terminal device, a processor, a chip, etc., which is not limited in this embodiment.

[0070] This step may refer to step S101 and will not be described in detail here.

[0071] Repeat steps S202-S206 until a preset stop condition is reached, wherein the initial value of i is 1, i is a positive integer, and j is a positive integer.

[0072] S202. Input the image to be trained into the first network layer of the i-th training model, and output the image feature map corresponding to the first network layer, wherein the i-th training model is composed of network layers with j-th level of sparsity.

[0073] Exemplarily, in this embodiment, when training the i-th training model composed of network layers with j-th level sparsity, the image to be trained can first be used as the input of the i-th model and input into the first network layer in the i-th training model. After that, the image to be trained is processed by the first network layer, and the first network layer will output the image feature map corresponding to the network layer.

[0074] In one example, the sparsity of the parameter matrix of each network layer in the i-th training model is the same; or, the sparsity of the parameter matrix of some network layers in the i-th training model is the same. Furthermore, by setting the same sparsity for the parameter matrix of each network layer in the i-th training model, the training time can be reduced; and by setting the same sparsity for the parameter matrix of some network layers in the i-th training model, the trained model can meet the requirements of different sparsities, and the accuracy of the determined training model is higher.

[0075] Repeat the following steps S203-S205 until a second preset condition is reached, wherein the initial value of q is 1 and q is a positive integer.

[0076] S203. Input the image feature map corresponding to the qth network layer into the q+1th network layer, and output the image feature map corresponding to the q+1th network layer.

[0077] S204, adding 1 to the value of q; wherein the model formed by the trained network layer obtained when the second preset condition is met is the i-th training model after training.

[0078] Exemplarily, after that, for each network layer, the image feature map corresponding to the output of the network layer is used as the input of the next network layer, and after being input to the next network layer, the next network layer outputs its corresponding image feature map. The above process is repeated until the second preset condition is met, and the training is stopped, and the model formed by each network layer after the training is stopped is used as the i-th training model after training.

[0079] The second preset condition is that the training of each network layer under the training model is completed, that is, after the parameter matrix of each network layer under the training model is trained, the model training reaches the preset accuracy, thereby improving the model accuracy of the trained model. Alternatively, the second preset condition is that the preset number of iterations is reached, and then the training time can be reduced by setting the number of iterations as the training stop condition of the i-th training model.

[0080] It can be understood that, through the above-mentioned training method of training the i-th training model, an image recognition model that can be used to recognize images can be determined based on multiple trained training models, so that the determined image recognition model for recognizing images has higher accuracy.

[0081] S205. Adjust the number of zero-value parameters in the parameter matrix of the network layer of the i-th training model after training to generate a network layer of the i+1-th training model, wherein the parameter matrix of the network layer of the i+1-th training model has a j+1-th level of sparsity.

[0082] Exemplarily, after obtaining the i-th training model after training, the parameter matrix of the adjusted network layer can be obtained by adjusting the number of zero-value parameters contained in the parameter matrix of the network layer in the i-th training model, and then the parameter matrix of the adjusted network layer is used as the parameter matrix of the network layer of the i+1-th training model to obtain the i+1-th training model.

[0083] It can be understood that after the training of the i-th training model, the important parameters in the network layer of the i-th training model after training will be retained after the training. Therefore, the network layer of the i+1-th training model can be generated by adjusting the number of zero-value parameters in the parameter matrix of the network layer of the i-th training model after training. Compared with randomly setting the parameter matrix of the network layer of the i+1-th training model, the training speed of the training model can be improved.

[0084] In one example, step S205 includes the following implementations:

[0085] A first implementation of step S205 is: adjusting the number of zero-valued parameters in the parameter matrix of each network layer of the i-th training model after training, respectively, to generate a network layer of the i+1-th training model.

[0086] Exemplarily, in this example, the number of zero-valued parameters in the parameter matrix corresponding to each network layer in the i-th training model after training can be adjusted to obtain the network layer of the i+1-th training model. Compared with adjusting the parameter matrix corresponding to some network layers in the i-th training model, in this embodiment, by adjusting the parameter matrix of each network layer, the training time for the training model corresponding to multiple levels of sparsity can be shortened, thereby shortening the time to finally determine an image recognition model that meets the requirements for recognizing images.

[0087] In one example, the number of zero-valued parameters in the parameter matrix of each network layer of the i-th training model after training is adjusted to generate the network layer of the i+1-th training model, including the following two methods:

[0088] First implementation mode: for each network layer of the i-th training model after training, the parameters in the parameter matrix of the network layer are randomly adjusted to adjust the number of zero-value parameters in the parameter matrix to generate the network layer of the i+1-th training model.

[0089] Exemplarily, when adjusting the parameter matrix of each network layer of each trained training model, the non-zero parameters in the parameter matrix of the network layer can be randomly selected and adjusted to zero-value parameters, thereby generating the network layer of the i+1th training model. The above-mentioned random adjustment method is easy to implement, thereby reducing the time taken to generate the training model, thereby shortening the time taken to finally determine the image recognition model used to recognize the image.

[0090] Second implementation mode: for each network layer of the i-th training model after training, the parameters in the parameter matrix of the network layer are adjusted at intervals to adjust the number of zero-value parameters in the parameter matrix to generate the network layer of the i+1-th training model.

[0091] Exemplarily, for the parameter matrix of each network layer of the i-th training model after training, the non-zero parameters in the parameter matrix can be selected intermittently and the selected parameters can be adjusted to zero values ​​to avoid the situation where the parameters in the parameter matrix selected for adjustment are relatively concentrated, resulting in the network layer of the generated i+1-th training model easily losing more key parameters, thereby prolonging the subsequent training time.

[0092] The second implementation method of step S205 is: based on the parameter matrix of the network layer of the i-th training model after training, generate the network layer of the intermediate training model, wherein the parameter matrix of the network layer of the intermediate training model has a new sparsity; based on the image to be trained, train the intermediate training model to obtain the trained intermediate training model; based on the network layers of the i-th training model after training and the network layers of the intermediate training model after training, generate the network layer of the (i+1)-th training model.

[0093] Exemplarily, when generating the network layer of the i+1th training model, the sparsity of the parameter matrix of the network layer of the i-th training model after training is adjusted so that the network layer of the intermediate training model has a parameter matrix with different sparsity from the network layer of the i-th training model after training. The intermediate training model is trained by inputting the image to be trained into the intermediate training model, thereby obtaining the parameter matrix of the network layer corresponding to the trained intermediate training model. Afterwards, based on the parameter matrices of the network layers contained in the trained i-th training model and the trained intermediate training model, the parameter matrix of the i+1th training model is obtained.

[0094] For example, assuming that the sparsity of the parameter matrix of each network layer in the i-th training model after training is 70%, then, by adjusting the sparsity of each parameter matrix in the i-th training model, a parameter matrix with a sparsity of 80% corresponding to each parameter matrix with a sparsity of 70% can be obtained, and then an intermediate training model can be obtained based on each parameter matrix with a sparsity of 80%. After training the intermediate training model, each parameter matrix with a sparsity of 80% after training is obtained. Then, based on each parameter matrix with a sparsity of 70% and each parameter matrix with a sparsity of 80% after training, the i+1-th training model is determined.

[0095] It can be understood that in this embodiment, in determining the i+1th training model, not only the parameter matrix in the i-th training model after training is considered, but also an intermediate training model is set, so that the parameter matrices under different sparsities are considered in the determined i+1th training model. After training the above-mentioned i+1th training model, a training model with different sparsities between each network layer can be obtained, so that the image recognition model finally determined for recognizing images has higher accuracy.

[0096] Among them, “generating the network layer of the (i+1)th training model according to each network layer of the trained i-th training model and the network layer of the trained intermediate training model” can be implemented as follows:

[0097] The first implementation method: for each network layer, randomly select any training model from the i-th training model after training and the intermediate training model after training, and determine the network layer of the selected training model as the network layer of the i+1-th training model.

[0098] Exemplarily, when generating a network layer of the i+1th training model, for each network layer in the i+1th training model, the parameter matrix of the network layer of one of the trained i+1th training model and the trained intermediate training model can be randomly selected as the network layer of the i+1th training model. Since the network layer having the same sparsity as the trained i+1th training model and the trained intermediate layer training model corresponds to different sparsities, the i+1th training model constructed by the above-mentioned random selection method can be applicable to training models with different sparsity combinations after training.

[0099] The second implementation method: for each network layer, randomly select any training model from the trained training models and the intermediate training models corresponding to the trained training models; determine the network layer of the selected training model as the network layer of the i+1th training model.

[0100] Exemplarily, in this embodiment, when determining any network layer in the i+1th training model, not only the trained i-th training model and the intermediate training layer corresponding to the trained i-th training model are considered, but also each previously trained training model and the intermediate training model corresponding to each previously trained training model are considered, thereby improving the diversity of the network layers constituting the i+1th training model, so that the network layers of the i+1th training model finally trained have different sparsities, thereby improving the accuracy of the final image recognition model.

[0101] S206. Increase the value of i by 1, and increase the value of j by 1.

[0102] S207: Determine that the trained training model that meets the first preset condition is an image recognition model for recognizing images.

[0103] Step S207 can be implemented by the following implementations:

[0104] The first implementation method of step S207: the first preset condition is that the accuracy represented by the image processing accuracy information is the highest; the image processing accuracy information of the trained training model is obtained; wherein the image processing accuracy information represents the accuracy of the model in recognizing the image; and the model with the highest accuracy represented by the image processing accuracy information is determined as the image recognition model used to recognize the image.

[0105] Exemplarily, when determining an image recognition model for recognizing an image, at this time, the accuracy of the image processing model in recognizing the image, that is, the precision information of the image processing, can be used as a judgment indicator in the first preset condition. By obtaining the image processing precision information corresponding to the previously obtained trained training model, the model with the highest image processing precision information, that is, the model with the highest accuracy in recognizing the image, can be used as the image recognition model for subsequent recognition of the image.

[0106] It can be understood that by determining the image processing accuracy information of the trained training model as described above, and then selecting the trained model with the highest image processing accuracy information as the image recognition model for recognizing images, the determined model has higher accuracy and image recognition is more accurate.

[0107] A second implementation of step S207 includes: determining multiple initial objects in each trained training model, wherein the initial object is a selected trained training model; obtaining image processing accuracy information of the initial object; wherein the image processing accuracy information characterizes the accuracy of the model in recognizing the image; determining the initial object whose image processing accuracy information is greater than the preset accuracy information, and determining an image recognition model for recognizing the image based on the initial object whose image processing accuracy information is greater than the preset accuracy information, wherein the first preset condition is that the image processing accuracy information is greater than the preset accuracy information.

[0108] Exemplarily, in this embodiment, when determining an image recognition model for recognizing an image, multiple trained training models can be selected from all trained training models, wherein each selected trained training model is used as an initial object, and the image processing accuracy information corresponding to each initial object, that is, the accuracy of the model recognizing the image, is determined. Then, among the multiple initial objects, the initial objects whose image processing accuracy information is greater than the preset accuracy information are screened out. And based on the initial objects whose image processing accuracy information is greater than the preset accuracy information, an image recognition model for recognizing an image is further obtained.

[0109] That is to say, in this embodiment, by eliminating the trained models with poor image processing accuracy information in the initial objects, the final image recognition model for identifying the image is further determined by the initial objects with image processing accuracy information greater than the preset accuracy information, thereby avoiding the complex process of determining the image processing accuracy information of all trained models, thereby improving the timeliness of determining the image recognition model for identifying the image.

[0110] Wherein, when determining the image recognition model for recognizing the image according to the initial object whose image processing accuracy information is greater than the preset accuracy information, it can be achieved in the following manner:

[0111] For each network layer, a network layer is randomly determined from initial objects whose image processing accuracy information is greater than a preset accuracy information; and an image recognition model for recognizing an image is determined based on each determined network layer.

[0112] Exemplarily, when determining an image recognition model for recognizing an image, for each network layer, you can randomly select a parameter matrix of an initial object in the network layer from the initial objects whose image processing accuracy information is greater than the preset accuracy information as the determined parameter matrix of the network layer. Afterwards, based on the determined network layers, determine the image recognition model for recognizing the image. For example, you can continue to determine the image processing accuracy information of the model composed of the determined network layers, and after comparing the image processing information with the image accuracy processing information corresponding to the screened initial object, use the model with higher image processing accuracy information as the image recognition model for recognizing the image.

[0113] In a possible situation, based on the initial object whose image processing accuracy information is greater than the preset accuracy information, an image recognition model for recognizing the image is further obtained, which can be determined by using a genetic algorithm.

[0114] It can be understood that in this embodiment, by randomly determining the network layer from the initial object whose image processing accuracy information is greater than the preset accuracy information, a training model with a different network layer from the initial object whose image processing accuracy information is greater than the preset accuracy information is obtained, which takes into account the diversity of the composition of the training model and improves the accuracy of the model finally determined for recognizing the image.

[0115] It is worth noting that in this embodiment, the network layer of the next training model is obtained by combining the trained model and the network layer of the intermediate training model after training, so that the network layer of the next training model contains multiple sparsities, and then the training model can meet the requirements of different sparsities after training, thereby improving the applicability of the trained model.

[0116] For example, Figure 3 FIG. 1 is a schematic diagram of a scenario in which the training method of the sparsity-based image recognition model of the embodiment of the present disclosure can be implemented. Figure 3The network structure diagram shown includes four network layers, namely, the first network layer, the second network layer, the third network layer, and the fourth network layer. The sparsity of the first parameter matrix in each network layer (i.e., the first parameter matrix 301 of the first network layer, the first parameter matrix 304 of the second network layer, the first parameter matrix 307 of the third network layer, and the first parameter matrix 310 of the fourth network layer) is 75%. The sparsity of the second parameter matrix in each network layer (i.e., the second parameter matrix 302 of the first network layer, the second parameter matrix 305 of the second network layer, the second parameter matrix 308 of the third network layer, and the second parameter matrix 311 of the fourth network layer) is 80%. The sparsity of the third parameter matrix in each network layer (i.e., the third parameter matrix 303 of the first network layer, the third parameter matrix 306 of the second network layer, the third parameter matrix 309 of the third network layer, and the third parameter matrix 312 of the fourth network layer) is 85%.

[0117] During training, the sparsity of the parameter matrix of each network layer in the training model (i.e., the first parameter matrix 301 of the first network layer, the first parameter matrix 304 of the second network layer, the first parameter matrix 307 of the third network layer, and the first parameter matrix 310 of the fourth network layer) is first set to 75%, and then the training model composed of the first parameter matrix 301 of the first network layer, the first parameter matrix 304 of the second network layer, the first parameter matrix 307 of the third network layer, and the first parameter matrix 310 of the fourth network layer is trained to obtain a trained training model, wherein each network layer of the trained training model has a corresponding parameter matrix with a sparsity of 75% after training. In this embodiment, the condition for stopping training is set to stop training after the training reaches a preset time. When the sparsity of the parameter matrix corresponding to each network layer needs to be adjusted to 80%, at this time, for each network layer, a parameter matrix with a sparsity of 80% is obtained based on the parameter matrix with a sparsity of 75% after training. For example, the second parameter matrix of the first network layer is obtained by adjusting the number of zero values ​​in the first parameter matrix of the first network layer after training.

[0118] Afterwards, the training model composed of the parameter matrix with a sparsity of 80% for each network layer is trained. During the training process, the sparsity of the parameter matrix of each network layer is first fixed to 80% to obtain the parameter matrix with a sparsity of 80% corresponding to each network layer after training. Then, for each network layer, a parameter matrix is ​​randomly selected from the parameter matrix with a sparsity of 75% after training and the parameter matrix with a sparsity of 80% after training as the parameter matrix of the network layer. The training model composed of the parameter matrix of the randomly selected network layer is trained. After the training is completed, the parameter matrix with a sparsity of 80% obtained from the training after this random selection is used to obtain the parameter matrix with a sparsity of 85% corresponding to each network layer. After that, the above process is repeated, that is, the sparsity of each network layer is fixed to 85% for training, and after training, random selection is started. That is, the parameter matrix of each network layer is randomly selected from the parameter matrix of 75% after training, the parameter matrix of 80% after random selection, and the parameter matrix of each network layer after fixed sparsity of 85% after training, and then training is performed according to the random route.

[0119] Figure 3 In the figure, the training model composed of the parameter matrices indicated by the dotted arrows is a training model that uses a fixed sparsity of 85% for each network layer. The training model composed of the parameter matrices indicated by the solid arrows is a training model that uses 75% of the parameter matrices after training, a parameter matrix with a sparsity of 80% obtained after random selection, and a parameter matrix of each network layer randomly selected from the parameter matrix after training with a fixed sparsity of 85% for each network layer. The sparsities of each network layer in the training model are 85%, 80%, 75%, and 80%, respectively, that is, the sparsity of the parameter matrices corresponding to each network layer in the training model is the same. After the random selection route training is completed, the parameter matrix with a sparsity of 85% corresponding to each network layer after the current training is obtained, and the parameter matrix with a sparsity of 90% corresponding to each network layer is obtained.

[0120] Figure 4 is a schematic diagram of the third embodiment of the present disclosure, such as Figure 4 As shown, the image recognition method based on the image recognition model of the embodiment of the present disclosure includes:

[0121] S401: Obtain an image to be recognized.

[0122] Exemplarily, the execution subject of this embodiment can be an image recognition device based on an image recognition model (hereinafter referred to as a recognition device), and the recognition device can be a server (such as a local server, or a cloud server), a computer, a terminal device, a processor, or a chip, etc., which is not limited in this embodiment. In addition, the recognition device and the training device can be the same device or different devices.

[0123] For example, if the recognition device is a device different from the training device, the training device can execute the training method of the sparse image recognition model of any of the above embodiments. After obtaining the image recognition model, the image recognition model is transmitted to the recognition device, and the recognition device deploys the image recognition model and realizes image recognition based on the image recognition model.

[0124] Specifically, the image to be identified may be collected by the recognition device itself, or may be received from other devices, and no specific limitation is made here.

[0125] S402. Input the image to be recognized into the image recognition model to obtain an image recognition result; wherein the image recognition model is trained based on the training method of the sparsity-based image recognition model in any of the above embodiments.

[0126] Exemplarily, after acquiring the image to be recognized, the image to be recognized can be input into the image recognition model trained by the training method of the image recognition model based on sparsity in any of the above embodiments to perform image recognition. Since the accuracy of the determined image recognition model is high, when the image to be recognized is recognized based on the image recognition model, the final recognition result can have a high reliability.

[0127] Figure 5 is a schematic diagram of a fourth embodiment of the present disclosure, such as Figure 5 As shown, the training device 500 of the sparsity-based image recognition model according to the embodiment of the present disclosure includes:

[0128] The first acquisition unit 501 is used to acquire the image to be trained.

[0129] The input unit 502 is used to input the image to be trained into the initial training model; wherein the training model includes a plurality of network layers for processing the image feature map of the image to be trained, the network layer is configured with a parameter matrix, the parameter matrix is ​​set with sparsity, and the sparsity represents the proportion of zero-value parameters in the parameter matrix.

[0130] The training unit 503, the generating unit 504 and the first determining unit 505 are repeated until a preset stop condition is reached, wherein the initial value of i is 1, i is a positive integer, and j is a positive integer.

[0131] The training unit 503 is used to train the i-th training model composed of each network layer with the j-th level of sparsity to obtain the i-th training model after training.

[0132] The generating unit 504 is used to generate the network layer of the i+1th training model according to the parameter matrix of the network layer of the i-th training model after training, wherein the parameter matrix of the network layer of the i+1th training model has the j+1th level of sparsity.

[0133] The first determining unit 505 is used to increase the value of i by 1 and increase the value of j by 1.

[0134] The second determining unit 506 is used to determine that the trained training model that meets the first preset condition is an image recognition model for recognizing images.

[0135] Illustratively, the device of this embodiment can execute the technical solution in the above method, and its specific implementation process and technical principles are the same, which will not be repeated here.

[0136] Figure 6 is a schematic diagram of the fifth embodiment of the present disclosure, such as Figure 6 As shown, the training device 600 of the sparsity-based image recognition model according to the embodiment of the present disclosure includes:

[0137] The first acquisition unit 601 is used to acquire the image to be trained.

[0138] The input unit 602 is used to input the image to be trained into the initial training model; wherein the training model includes a plurality of network layers for processing the image feature map of the image to be trained, the network layer is configured with a parameter matrix, the parameter matrix is ​​set with sparsity, and the sparsity represents the proportion of zero-value parameters in the parameter matrix.

[0139] The training unit 603, the generating unit 604 and the first determining unit 605 are repeated until a preset stop condition is reached, wherein the initial value of i is 1, i is a positive integer, and j is a positive integer.

[0140] The training unit 603 is used to train the i-th training model composed of each network layer with the j-th level of sparsity to obtain the i-th training model after training.

[0141] The generating unit 604 is used to generate the network layer of the i+1th training model according to the parameter matrix of the network layer of the i-th training model after training, wherein the parameter matrix of the network layer of the i+1th training model has the j+1th level of sparsity.

[0142] The first determining unit 605 is used to increase the value of i by 1 and increase the value of j by 1.

[0143] The second determining unit 606 is used to determine that the trained training model that meets the first preset condition is an image recognition model for recognizing images.

[0144] In one example, the generating unit 604 is specifically configured to:

[0145] The number of zero-valued parameters in the parameter matrix of the network layer of the i-th training model after training is adjusted to generate the network layer of the i+1-th training model.

[0146] In one example, the generating unit 604 is specifically configured to:

[0147] The number of zero-valued parameters in the parameter matrix of each network layer of the i-th training model after training is adjusted respectively.

[0148] In one example, the generating unit 604 includes:

[0149] The first adjustment module 6041 is used to randomly adjust the parameters in the parameter matrix of the network layer for each network layer of the i-th training model after training, so as to adjust the number of zero-value parameters in the parameter matrix and generate the network layer of the i+1-th training model.

[0150] Alternatively, the second adjustment module 6042 is used to intermittently adjust the parameters in the parameter matrix of the network layer for each network layer of the i-th training model after training, so as to adjust the number of zero-value parameters in the parameter matrix and generate the network layer of the i+1-th training model.

[0151] In one example, the generating unit 604 includes:

[0152] The first generating module 6043 is used to generate a network layer of an intermediate training model according to the parameter matrix of the network layer of the i-th training model after training, wherein the parameter matrix of the network layer of the intermediate training model has a new sparsity.

[0153] The training module 6044 is used to train the intermediate training model according to the image to be trained to obtain the trained intermediate training model.

[0154] The second generating module 6045 is used to generate the network layers of the (i+1)th training model according to the trained network layers of the i-th training model and the trained network layers of the intermediate training model.

[0155] In one example, the first generating module 6043 is specifically used to:

[0156] For each network layer, any training model is randomly selected from the i-th training model after training and the intermediate training model after training, and the network layer of the selected training model is determined to be the network layer of the i+1-th training model.

[0157] In one example, the first generation module 6043 includes:

[0158] The selection submodule 60431 is used to randomly select any training model from the trained training models and the intermediate training models corresponding to the trained training models for each network layer.

[0159] The first determination submodule 60432 is used to determine that the network layer of the selected training model is the network layer of the (i+1)th training model.

[0160] In one example, the first preset condition is that the accuracy represented by the image processing accuracy information is the highest; the second determination unit 606 includes:

[0161] The first acquisition module 6061 acquires the image processing accuracy information of the trained model; wherein the image processing accuracy information represents the accuracy of the model in recognizing the image.

[0162] The first determination module 6062 is used to determine the model with the highest accuracy represented by the image processing accuracy information, which is an image recognition model used to recognize images.

[0163] In one example, the first preset condition is that the image processing accuracy information is greater than the preset accuracy information; the second determination unit 606 includes:

[0164] The second determination module is used to determine multiple initial objects in each trained training model, wherein the initial object is the selected trained training model.

[0165] The second acquisition module is used to acquire the image processing accuracy information of the initial object; wherein the image processing accuracy information represents the accuracy of the model in recognizing the image.

[0166] The third determining module is used to determine the initial object whose image processing accuracy information is greater than the preset accuracy information.

[0167] The fourth determination module is used to determine an image recognition model for recognizing an image according to an initial object whose image processing accuracy information is greater than a preset accuracy information.

[0168] In one example, the fourth determination module includes:

[0169] The second determination submodule is used to randomly determine a network layer from initial objects whose image processing accuracy information is greater than a preset accuracy information for each network layer.

[0170] The third determination submodule is used to determine an image recognition model for recognizing an image according to the determined network layers.

[0171] In one example, the sparsity of the parameter matrices of each network layer in the i-th training model is the same; or, the sparsity of the parameter matrices of some network layers in the i-th training model is the same.

[0172] In one example, the training unit 603 includes:

[0173] The first output module 6031 is used to input the image to be trained into the first network layer of the i-th training model, and output the image feature map corresponding to the first network layer.

[0174] Repeat the following modules until the second preset condition is reached, wherein the initial value of q is 1 and q is a positive integer.

[0175] The second output module 6032 is used to input the image feature map corresponding to the qth network layer into the q+1th network layer, and output the image feature map corresponding to the q+1th network layer.

[0176] The fourth determination module 6033 is used to add 1 to the value of q, wherein the model formed by the trained network layer obtained when the second preset condition is met is the i-th training model after training.

[0177] In one example, the second preset condition is that the training of each network layer under the training model has been completed, or the second preset condition is that a preset number of iterations has been reached.

[0178] Illustratively, the device of this embodiment can execute the technical solution in the above method, and its specific implementation process and technical principles are the same, which will not be repeated here.

[0179] Figure 7 is a schematic diagram according to a sixth embodiment of the present disclosure, Figure 7 As shown, the image recognition device 700 based on the image recognition model of the embodiment of the present disclosure includes:

[0180] The second acquisition unit 701 is used to acquire an image to be recognized;

[0181] The recognition unit 702 is used to input the image to be recognized into the image recognition model to obtain the image recognition result; wherein the image recognition model is based on Figure 5 or Figure 6 The resulting model of the device is shown.

[0182] Illustratively, the device of this embodiment can execute the technical solution in the above method, and its specific implementation process and technical principles are the same, which will not be repeated here.

[0183] Figure 8 is a schematic diagram according to the seventh embodiment of the present disclosure, Figure 8As shown, the electronic device 800 in the present disclosure may include: a processor 801 and a memory 802 .

[0184] The memory 802 is used to store programs; the memory 802 may include volatile memory (English: volatile memory), such as random-access memory (English: random-access memory, abbreviated: RAM), such as static random-access memory (English: static random-access memory, abbreviated: SRAM), double data rate synchronous dynamic random access memory (English: Double Data Rate Synchronous Dynamic Random Access Memory, abbreviated: DDR SDRAM), etc.; the memory may also include non-volatile memory (English: non-volatile memory), such as flash memory (English: flash memory). The memory 802 is used to store computer programs (such as applications, functional modules, etc. that implement the above method), computer instructions, etc., and the above computer programs, computer instructions, etc. can be partitioned and stored in one or more memories 802. And the above computer programs, computer instructions, data, etc. can be called by the processor 801.

[0185] The above-mentioned computer programs, computer instructions, etc. may be stored in partitions in one or more memories 802 . And the above-mentioned computer programs, computer instructions, etc. may be called by the processor 801 .

[0186] The processor 801 is used to execute the computer program stored in the memory 802 to implement each step of the method involved in the above embodiment.

[0187] For details, please refer to the relevant description in the previous method embodiment.

[0188] The processor 801 and the memory 802 may be independent structures or integrated structures. When the processor 801 and the memory 802 are independent structures, the memory 802 and the processor 801 may be coupled and connected via a bus 803 .

[0189] The electronic device of this embodiment can execute the technical solution in the above method, and its specific implementation process and technical principle are the same, which will not be repeated here.

[0190] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0191] According to an embodiment of the present disclosure, the present disclosure further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute a solution provided by any of the above embodiments.

[0192] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, which includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.

[0193] Fig. 9 A schematic block diagram of an example electronic device 900 that can be used to implement an embodiment of the present disclosure 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 processing, cellular phones, smart phones, wearable devices, 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 disclosure described and / or required herein.

[0194] like Fig. 9 As shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0195] A number of components in the device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0196] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above, such as a training method for an image recognition model based on sparsity, or an image recognition method based on an image recognition model. For example, in some embodiments, a training method for an image recognition model based on sparsity, or an image recognition method based on an image recognition model may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into RAM 903 and executed by computing unit 901, the above-described training method of the image recognition model based on sparsity, or one or more steps of the image recognition method based on the image recognition model, may be executed. Alternatively, in other embodiments, computing unit 901 may be configured to execute the training method of the image recognition model based on sparsity, or the image recognition method based on the image recognition model, by any other appropriate means (e.g., by means of firmware).

[0197] Various implementations of the systems and techniques described above 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), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including 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.

[0198] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0199] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0200] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer 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 computer. 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).

[0201] The systems and techniques described herein may 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 a 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 may 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), and the Internet.

[0202] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0203] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0204] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A training method for a sparsity-based image recognition model, comprising: Acquire an image to be trained, and input the image to be trained into an initial training model; wherein the training model includes a plurality of network layers for processing image feature maps of the image to be trained, the network layers are configured with a parameter matrix, the parameter matrix is ​​provided with a sparsity, and the sparsity represents the proportion of zero-value parameters in the parameter matrix; Repeat the following steps until a preset stop condition is reached, wherein the initial value of i is 1, i is a positive integer, and j is a positive integer: train the i-th training model composed of each network layer with the j-th level of sparsity to obtain the i-th training model after training; adjust the number of zero-valued parameters in the parameter matrix of the network layer of the i-th training model after training to generate the network layer of the i+1-th training model, wherein the parameter matrix of the network layer of the i+1-th training model has the j+1-th level of sparsity; add 1 to the value of i, and add 1 to the value of j; The trained training model that meets the first preset condition is determined to be an image recognition model for recognizing images.

2. The method according to claim 1, wherein: The number of zero-valued parameters in the parameter matrix of the network layer of the i-th training model after training is adjusted to generate the network layer of the i+1-th training model, including: The number of zero-valued parameters in the parameter matrix of each network layer of the i-th training model after training is adjusted respectively to generate the network layer of the i+1-th training model.

3. The method according to claim 2, wherein: The number of zero-valued parameters in the parameter matrix of each network layer of the i-th training model after training is adjusted respectively to generate the network layer of the i+1-th training model, including: For each network layer of the i-th training model after training, randomly adjust the parameters in the parameter matrix of the network layer to adjust the number of zero-value parameters in the parameter matrix to generate the network layer of the i+1-th training model; Alternatively, for each network layer of the i-th training model after training, the parameters in the parameter matrix of the network layer are adjusted at intervals to adjust the number of zero-value parameters in the parameter matrix to generate the network layer of the i+1-th training model.

4. The method according to claim 1, wherein: The number of zero-valued parameters in the parameter matrix of the network layer of the i-th training model after training is adjusted to generate the network layer of the i+1-th training model, including: Generate a network layer of an intermediate training model according to a parameter matrix of a network layer of the i-th training model after training, wherein the parameter matrix of the network layer of the intermediate training model has a new sparsity; According to the image to be trained, the intermediate training model is trained to obtain a trained intermediate training model; The network layers of the (i+1)th training model are generated according to the network layers of the trained i-th training model and the network layers of the trained intermediate training model.

5. The method according to claim 4, wherein: According to each network layer of the trained i-th training model and the network layer of the trained intermediate training model, a network layer of the i+1-th training model is generated, including: For each network layer, any training model is randomly selected from the i-th training model after training and the intermediate training model after training, and the network layer of the selected training model is determined to be the network layer of the i+1-th training model.

6. The method according to claim 4, wherein: According to each network layer of the trained i-th training model and the network layer of the trained intermediate training model, a network layer of the i+1-th training model is generated, including: For each network layer, any training model is randomly selected from the trained training models and the intermediate training models corresponding to the trained training models; the network layer of the selected training model is determined to be the network layer of the i+1th training model.

7. The method according to any one of claims 1 to 6, wherein: The first preset condition is that the accuracy represented by the image processing accuracy information is the highest; the training model determined to meet the first preset condition is an image recognition model for recognizing images, including: Obtaining image processing accuracy information of the trained model; wherein the image processing accuracy information represents the accuracy of the model in recognizing the image; The model with the highest accuracy represented by the image processing accuracy information is determined to be the image recognition model used to recognize the image.

8. The method according to any one of claims 1 to 6, wherein: The first preset condition is that the image processing accuracy information is greater than the preset accuracy information; the training model after training determined to meet the first preset condition is an image recognition model for recognizing images, including: Determining a plurality of initial objects in each trained training model, wherein the initial objects are selected trained training models; Acquire image processing accuracy information of the initial object; wherein the image processing accuracy information represents the accuracy of the model in recognizing the image; An initial object whose image processing precision information is greater than the preset precision information is determined, and an image recognition model for recognizing the image is determined based on the initial object whose image processing precision information is greater than the preset precision information.

9. The method according to claim 8, wherein: According to the initial object whose image processing precision information is greater than the preset precision information, an image recognition model for recognizing the image is determined, including: For each network layer, randomly determine the network layer from the initial objects whose image processing accuracy information is greater than the preset accuracy information; According to the determined network layers, an image recognition model for recognizing an image is determined.

10. The method according to any one of claims 1 to 6 and 9, wherein: The sparsity of the parameter matrix of each network layer in the i-th training model is the same; Alternatively, the sparsity of the parameter matrices of some network layers in the i-th training model is the same.

11. The method according to any one of claims 1 to 6 and 9, wherein: The i-th training model composed of each network layer with the j-th level of sparsity is trained to obtain the i-th training model after training, including: Input the image to be trained into the first network layer of the i-th training model, and output an image feature map corresponding to the first network layer; Repeat the following steps until the second preset condition is reached, where the initial value of q is 1 and q is a positive integer: input the image feature map corresponding to the qth network layer to the q+1th network layer, and output the image feature map corresponding to the q+1th network layer; add 1 to the value of q; Among them, the model composed of the trained network layers obtained when the second preset condition is met is the i-th training model after training.

12. The method according to claim 11, wherein: The second preset condition is that the training of each network layer under the training model has been completed, or the second preset condition is that a preset number of iterations has been reached.

13. An image recognition method based on an image recognition model, comprising: Acquire an image to be recognized, and input the image to be recognized into an image recognition model to obtain an image recognition result; Wherein, the image recognition model is a model obtained by the method according to any one of claims 1-12.

14. A training device for a sparsity-based image recognition model, comprising: A first acquisition unit, used to acquire an image to be trained; An input unit, used for inputting the image to be trained into an initial training model; wherein the training model includes a plurality of network layers for processing the image feature map of the image to be trained, the network layer is configured with a parameter matrix, the parameter matrix is ​​provided with a sparsity, and the sparsity represents the proportion of zero-value parameters in the parameter matrix; The training unit, the generating unit and the first determining unit are repeated until a preset stopping condition is reached, wherein the initial value of i is 1, i is a positive integer, and j is a positive integer: A training unit, used for training an i-th training model composed of each network layer having a j-th level of sparsity, to obtain an i-th training model after training; A generating unit, used for adjusting the number of zero-valued parameters in the parameter matrix of the network layer of the i-th training model after training, and generating the network layer of the i+1-th training model, wherein the parameter matrix of the network layer of the i+1-th training model has a j+1-th level of sparsity; A first determining unit, used to increase the value of i by 1 and increase the value of j by 1; The second determination unit is used to determine that the trained training model that meets the first preset condition is an image recognition model for recognizing images.

15. The device according to claim 14, wherein: The generating unit is specifically used for: The number of zero-valued parameters in the parameter matrix of each network layer of the i-th training model after training is adjusted respectively.

16. The device according to claim 15, wherein: The generating unit comprises: The first adjustment module is used to randomly adjust the parameters in the parameter matrix of the network layer for each network layer of the i-th training model after training, so as to adjust the number of zero-value parameters in the parameter matrix and generate the network layer of the i+1-th training model; Alternatively, the second adjustment module is used to intermittently adjust the parameters in the parameter matrix of the network layer for each network layer of the i-th training model after training, so as to adjust the number of zero-value parameters in the parameter matrix and generate the network layer of the i+1-th training model.

17. The device according to claim 14, wherein: The generating unit comprises: A first generating module is used to generate a network layer of an intermediate training model according to a parameter matrix of a network layer of an i-th training model after training, wherein the parameter matrix of the network layer of the intermediate training model has a new sparsity; A training module, used for training the intermediate training model according to the image to be trained to obtain a trained intermediate training model; The second generating module is used to generate the network layer of the (i+1)th training model according to the network layers of the trained i-th training model and the network layers of the trained intermediate training model.

18. The device according to claim 17, wherein: The first generating module is specifically used for: For each network layer, any training model is randomly selected from the i-th training model after training and the intermediate training model after training, and the network layer of the selected training model is determined to be the network layer of the i+1-th training model.

19. The device according to claim 17, wherein: The first generating module comprises: A selection submodule, for randomly selecting any training model from each trained training model and each intermediate training model corresponding to each trained training model for each network layer; The first determination submodule is used to determine that the network layer of the selected training model is the network layer of the (i+1)th training model.

20. The device according to any one of claims 14 to 19, wherein: The first preset condition is that the accuracy represented by the image processing accuracy information is the highest; The second determining unit includes: A first acquisition module is used to acquire the image processing accuracy information of the trained training model; wherein the image processing accuracy information represents the accuracy of the model in recognizing the image; The first determination module is used to determine the model with the highest accuracy represented by the image processing accuracy information, which is an image recognition model used to recognize images.

21. The device according to any one of claims 14 to 19, wherein: The first preset condition is that the image processing accuracy information is greater than the preset accuracy information; The second determining unit includes: A second determination module is used to determine a plurality of initial objects in each trained training model, wherein the initial objects are selected trained training models; A second acquisition module is used to acquire the image processing accuracy information of the initial object; wherein the image processing accuracy information represents the accuracy of the model in recognizing the image; A third determination module is used to determine an initial object whose image processing precision information is greater than a preset precision information; The fourth determination module is used to determine an image recognition model for recognizing an image according to an initial object whose image processing accuracy information is greater than a preset accuracy information.

22. The device according to claim 21, wherein The fourth determining module includes: A second determination submodule is used to randomly determine a network layer from initial objects whose image processing accuracy information is greater than a preset accuracy information for each network layer; The third determination submodule is used to determine an image recognition model for recognizing an image according to the determined network layers.

23. The device according to any one of claims 14 to 19 and 22, wherein: The sparsity of the parameter matrix of each network layer in the i-th training model is the same; Alternatively, the sparsity of the parameter matrices of some network layers in the i-th training model is the same.

24. The device according to any one of claims 14 to 19 and 22, wherein: The training unit comprises: A first output module, used for inputting the image to be trained into the first network layer of the i-th training model, and outputting an image feature map corresponding to the first network layer; Repeat the following modules until the second preset condition is reached, where the initial value of q is 1 and q is a positive integer: The second output module is used to input the image feature map corresponding to the qth network layer into the q+1th network layer, and output the image feature map corresponding to the q+1th network layer; A fourth determination module, used to add 1 to the value of q; Among them, the model composed of the trained network layers obtained when the second preset condition is met is the i-th training model after training.

25. The device according to claim 24, wherein: The second preset condition is that the training of each network layer under the training model has been completed, or the second preset condition is that a preset number of iterations has been reached.

26. An image recognition device based on an image recognition model, comprising: A second acquisition unit, used for acquiring an image to be recognized; A recognition unit, used for inputting the image to be recognized into an image recognition model to obtain an image recognition result; wherein the image recognition model is a model obtained by the device according to any one of claims 14-25.

27. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of any one of claims 1 to 12, or to enable the at least one processor to execute the method of claim 13.

28. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 12, or the computer instructions are used to cause the computer to execute the method according to claim 13.

29. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 12, or the computer program implements the steps of the method according to claim 13 when the computer program is executed by a processor.