Image recognition method, device, equipment and computer readable medium

文档序号:616061 发布日期:2021-05-07 浏览:2次 中文

阅读说明:本技术 图像识别方法、装置、设备及计算机可读介质 (Image recognition method, device, equipment and computer readable medium ) 是由 刘向阳 赵晨旭 唐大闰 于 2021-01-18 设计创作,主要内容包括:本申请涉及一种图像识别方法、装置、设备及计算机可读介质。该方法包括:获取待识别图像;将待识别图像输入目标图像识别模型,以利用目标图像识别模型提取待识别图像的图像特征,目标图像识别模型为通过迭代搜索得到模型超参数的神经网络模型;获取所目标图像识别模型对图像特征进行识别得到的图像识别结果。本申请通过使用迭代搜索得到模型超参数的神经网络模型作为图像识别模型来进行图像识别,避免了因人工设置超参数及经验不足导致的模型无法获得最优参数,识别结果不准确的问题。(The application relates to an image recognition method, an image recognition device, an image recognition equipment and a computer readable medium. The method comprises the following steps: acquiring an image to be identified; inputting an image to be recognized into a target image recognition model so as to extract image characteristics of the image to be recognized by using the target image recognition model, wherein the target image recognition model is a neural network model for obtaining a model hyper-parameter through iterative search; and acquiring an image recognition result obtained by recognizing the image features by the target image recognition model. According to the method and the device, the neural network model with the model hyperparameters obtained through iterative search is used as the image recognition model to perform image recognition, and the problems that the model cannot obtain optimal parameters and recognition results are inaccurate due to manual setting of hyperparameters and insufficient experience are solved.)

1. An image recognition method, comprising:

acquiring an image to be identified;

inputting the image to be recognized into a target image recognition model so as to extract image characteristics of the image to be recognized by using the target image recognition model, wherein the target image recognition model is a neural network model of which the model hyperparameter is obtained through iterative search;

and acquiring an image recognition result obtained by recognizing the image features by the target image recognition model.

2. The method of claim 1, wherein before inputting the image to be recognized into a target image recognition model, the method further comprises training the target image recognition model as follows:

training the target image recognition model by using a training data set, and determining a first updating hyper-parameter of the target image recognition model by using a first loss function obtained by training;

taking the first updating hyper-parameter as a hyper-parameter of the target image recognition model, training the target image recognition model by using a reference data set, and determining a second updating hyper-parameter of the target image recognition model by using a second loss function obtained by training;

and taking the second updated hyper-parameter as a new hyper-parameter of the target image recognition model, and performing iterative training on the target image recognition model by using the training data set and the reference data set in sequence until the value of the first loss function obtained by training is reduced to a minimum value, thereby completing the training of the target image recognition model.

3. The method of claim 2, wherein training the target image recognition model with a training data set to obtain a first loss function comprises:

selecting a target training data set from a training data pool and inputting the target training data set into the target image recognition model so as to extract a first training feature of the target training data set by using the target image recognition model, wherein the target training data set is a data set which is not selected in the training data pool;

substituting the first training characteristic into a loss function of the target image recognition model to obtain a first sub-loss function obtained by the training;

and under the condition that all the training data sets in the training data pool are selected, adding all the first sub-loss functions to obtain the first loss function obtained by training the target image recognition model by the training data pool.

4. The method of claim 2, wherein training the target image recognition model using a reference data set to obtain a second loss function comprises:

selecting a target reference data set from a reference data pool and inputting the target reference data set into the target image recognition model so as to extract a second training feature of the target reference data set by using the target image recognition model, wherein the target reference data set is a data set which is not selected from the reference data pool;

substituting the second training characteristic into a loss function of the target image recognition model to obtain a second sub-loss function obtained by the training;

and under the condition that all the reference data sets in the reference data pool are selected, adding all the second sub-loss functions to obtain the second loss function obtained by training the target image recognition model by the reference data pool.

5. The method according to any one of claims 3 to 4,

determining a first update hyper-parameter of the target image recognition model using the trained first loss function comprises: subtracting the gradient of the first loss function from the initial hyper-parameter of the target image recognition model to obtain the first updating hyper-parameter;

determining a second update hyper-parameter of the target image recognition model using a trained second loss function comprises: and subtracting the gradient of the second loss function from the initial hyper-parameter of the target image recognition model to obtain the second updating hyper-parameter.

6. The method of claim 5, wherein training the target image recognition model further comprises:

extracting a search space and a weight parameter of the target image recognition model when the value of the first loss function is reduced to a minimum value, wherein the hyper-parameter of the target image recognition model comprises at least one of the search space and the weight parameter;

inputting business training data into the target image recognition model for training, wherein the business training data are image data of a business field represented by the image to be recognized;

and in the training process, the search space is fixed, the weight parameter is used as an initialization weight parameter and is adjusted along with the training of the business training data on the target image recognition model until the output recognition result of the business training data by the target image recognition model reaches a target threshold value.

7. An image recognition apparatus, comprising:

the image acquisition module is used for acquiring an image to be identified;

the characteristic extraction module is used for inputting the image to be recognized into a target image recognition model so as to extract the image characteristics of the image to be recognized by using the target image recognition model, wherein the target image recognition model is a neural network model for obtaining model hyper-parameters through iterative search;

and the identification result acquisition module is used for acquiring an image identification result obtained by identifying the image characteristics by the target image identification model.

8. The apparatus of claim 7, further comprising:

the first training module is used for training the target image recognition model by utilizing a training data set and determining a first updating hyperparameter of the target image recognition model by utilizing a first loss function obtained by training;

the second training module is used for taking the first updating super-parameter as a super-parameter of the target image recognition model, training the target image recognition model by using a reference data set, and determining a second updating super-parameter of the target image recognition model by using a second loss function obtained by training;

and the iterative training module is used for taking the second updated hyper-parameter as a new hyper-parameter of the target image recognition model, sequentially performing iterative training on the target image recognition model by using the training data set and the reference data set, and finishing the training of the target image recognition model until the value of the first loss function obtained by training is reduced to the minimum value.

9. An electronic device comprising a memory, a processor, a communication interface and a communication bus, wherein the memory stores a computer program operable on the processor, and the memory and the processor communicate via the communication bus and the communication interface, wherein the processor implements the steps of the method according to any of the claims 1 to 6 when executing the computer program.

10. A computer-readable medium having non-volatile program code executable by a processor, wherein the program code causes the processor to perform the method of any of claims 1 to 6.

Technical Field

The present application relates to the field of image recognition technologies, and in particular, to an image recognition method, an image recognition device, an image recognition apparatus, and a computer-readable medium.

Background

With the rapid development of the deep learning technology, the neural network model based on the deep learning technology is often used for constructing an image recognition model to recognize images, so that repeated and complicated recognition work can be completed instead of manpower, wherein the application of the face recognition model is wider and is more closely related to the life of people.

At present, in the related art, hyper-parameters of an image recognition model need to be set manually, a great deal of expert experience is needed, and the model cannot obtain optimal parameters easily due to insufficient experience.

In view of the above problems, no effective solution has been proposed.

Disclosure of Invention

The application provides an image identification method, an image identification device, image identification equipment and a computer readable medium, which are used for solving the technical problems that hyper-parameters need to be set manually, and the accuracy of a model identification result is influenced by inaccurate setting.

According to an aspect of an embodiment of the present application, there is provided an image recognition method including:

acquiring an image to be identified;

inputting an image to be recognized into a target image recognition model so as to extract image characteristics of the image to be recognized by using the target image recognition model, wherein the target image recognition model is a neural network model for obtaining a model hyper-parameter through iterative search;

and acquiring an image recognition result obtained by recognizing the image features by the target image recognition model.

Optionally, before the image to be recognized is input into the target image recognition model, the method further includes training the target image recognition model as follows:

training a target image recognition model by using a training data set, and determining a first updating hyper-parameter of the target image recognition model by using a first loss function obtained by training;

taking the first updating super-parameter as a super-parameter of the target image recognition model, training the target image recognition model by using a reference data set, and determining a second updating super-parameter of the target image recognition model by using a second loss function obtained by training;

and taking the second updated hyper-parameter as a new hyper-parameter of the target image recognition model, and performing iterative training on the target image recognition model by using the training data set and the reference data set in sequence until the value of the first loss function obtained by training is reduced to the minimum value, thereby finishing the training of the target image recognition model.

Optionally, training the target image recognition model by using the training data set, and obtaining the first loss function includes:

selecting a target training data set from a training data pool and inputting the target training data set into a target image recognition model so as to extract a first training characteristic of the target training data set by using the target image recognition model, wherein the target training data set is an unselected data set in the training data pool;

substituting the first training characteristic into a loss function of the target image recognition model to obtain a first sub-loss function obtained by the training;

and under the condition that all the training data sets in the training data pool are selected, adding all the first sub-loss functions to obtain a first loss function obtained by training the target image recognition model by the training data pool.

Optionally, training the target image recognition model by using the reference data set, and obtaining the second loss function includes:

selecting a target reference data set from the reference data pool, inputting the target reference data set into the target image recognition model, and extracting second training characteristics of the target reference data set by using the target image recognition model, wherein the target reference data set is a data set which is not selected from the reference data pool;

substituting the second training characteristic into a loss function of the target image recognition model to obtain a second sub-loss function obtained by the training;

and under the condition that all the reference data sets in the reference data pool are selected, adding all the second sub-loss functions to obtain a second loss function obtained by training the target image recognition model by the reference data pool.

Optionally, the determining a first update hyper-parameter of the target image recognition model by using the trained first loss function includes: subtracting the gradient of the first loss function from the initial hyper-parameter of the target image recognition model to obtain a first updating hyper-parameter; determining a second update hyper-parameter of the target image recognition model by using the trained second loss function comprises: and subtracting the gradient of the second loss function from the initial hyper-parameter of the target image recognition model to obtain a second updating hyper-parameter.

Optionally, training the target image recognition model further comprises:

when the value of the first loss function is extracted to be reduced to the minimum value, the search space and the weight parameter of the target image recognition model are extracted, and the hyper-parameter of the target image recognition model comprises at least one of the search space and the weight parameter;

inputting business training data into a target image recognition model for training, wherein the business training data is image data of a business field represented by an image to be recognized;

and in the training process, the search space is fixed, the weight parameter is used as an initialization weight parameter and is adjusted along with the training of the business training data on the target image recognition model until the output recognition result of the business training data by the target image recognition model reaches a target threshold value.

According to another aspect of embodiments of the present application, there is provided an image recognition apparatus including:

the image acquisition module is used for acquiring an image to be identified;

the characteristic extraction module is used for inputting the image to be recognized into a target image recognition model so as to extract the image characteristics of the image to be recognized by using the target image recognition model, and the target image recognition model is a neural network model for obtaining model hyper-parameters through iterative search;

and the identification result acquisition module is used for acquiring an image identification result obtained by identifying the image characteristics by the target image identification model.

Optionally, the apparatus further comprises:

the first training module is used for training the target image recognition model by using a training data set and determining a first updating hyper-parameter of the target image recognition model by using a first loss function obtained by training;

the second training module is used for taking the first updating super-parameter as a super-parameter of the target image recognition model, training the target image recognition model by using a reference data set, and determining a second updating super-parameter of the target image recognition model by using a second loss function obtained by training;

and the iterative training module is used for taking the second updated hyper-parameter as a new hyper-parameter of the target image recognition model, and performing iterative training on the target image recognition model by using the training data set and the reference data set in sequence until the value of the first loss function obtained by training is reduced to the minimum value, so that the training of the target image recognition model is completed.

According to another aspect of the embodiments of the present application, there is provided an electronic device, including a memory, a processor, a communication interface, and a communication bus, where the memory stores a computer program executable on the processor, and the memory and the processor communicate with each other through the communication bus and the communication interface, and the processor implements the steps of the method when executing the computer program.

According to another aspect of embodiments of the present application, there is also provided a computer readable medium having non-volatile program code executable by a processor, the program code causing the processor to perform the above-mentioned method.

Compared with the related art, the technical scheme provided by the embodiment of the application has the following advantages:

the technical scheme of the application is to obtain an image to be identified; inputting an image to be recognized into a target image recognition model so as to extract image characteristics of the image to be recognized by using the target image recognition model, wherein the target image recognition model is a neural network model for obtaining a model hyper-parameter through iterative search; and acquiring an image recognition result obtained by recognizing the image features by the target image recognition model. According to the method and the device, the neural network model with the model hyperparameters obtained through iterative search is used as the image recognition model to perform image recognition, and the problems that the model cannot obtain optimal parameters and recognition results are inaccurate due to manual setting of hyperparameters and insufficient experience are solved.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.

In order to more clearly illustrate the technical solutions in the embodiments or related technologies of the present application, the drawings needed to be used in the description of the embodiments or related technologies will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without any creative effort.

FIG. 1 is a diagram illustrating an alternative hardware environment for an image recognition method according to an embodiment of the present application;

FIG. 2 is a flow chart of an alternative image recognition method provided in accordance with an embodiment of the present application;

FIG. 3 is a schematic diagram of an alternative vector relationship provided in accordance with an embodiment of the present application;

FIG. 4 is a block diagram of an alternative image recognition apparatus according to an embodiment of the present application;

fig. 5 is a schematic structural diagram of an alternative electronic device according to an embodiment of the present application.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

In the following description, suffixes such as "module", "component", or "unit" used to denote elements are used only for the convenience of description of the present application, and have no specific meaning in themselves. Thus, "module" and "component" may be used in a mixture.

In the related art, the parameter search of the loss function may be performed by:

firstly, based on Loss functions such as A-Softmax, Cosine Margin Loss, ArcFace and the like of a boundary, a classification boundary is increased in an angle space or a Cosine space to increase an inter-class distance and reduce an intra-class distance;

secondly, designing a search space capable of covering common popular loss functions, wherein the sampled candidate loss functions can adjust gradients of samples with different difficulty levels, balance the importance of intra-class distance and inter-class distance in the training process, and optimize the loss functions by using reinforcement learning, wherein the inner-layer optimization is the loss function for minimizing network parameters, and the outer-layer optimization is the maximization reward;

thirdly, the purpose of the boundary-based loss function is to reduce cosine values, and a uniform hyper-parameter construction search space is found through notational transformation. And selecting a plurality of candidate parameters in each round of training, wherein each candidate parameter forms a loss function to train a model, and the best model is selected as the initial value of the next round of training by using the idea of reinforcement learning.

However, in the above method, the boundary-based loss function represented by ArcFace requires manual super-parameters, requires a great deal of expert experience, and cannot enable the model to obtain optimal parameters; the search space constructed by the AutoML is complex and unstable, and the search is complex; in the third mode, a plurality of models need to be trained and the optimal model needs to be selected in each turn, so that the occupation of a display card is increased, and the application in practice is not facilitated.

To solve the problems mentioned in the background, according to an aspect of embodiments of the present application, an embodiment of an image recognition method is provided. The technical scheme of the application can be particularly applied to face recognition.

Face recognition refers to a biometric technology that performs identification based on facial feature information of a person. A series of related technologies, also commonly called face recognition and face recognition, are used to collect images or video streams containing faces by using a camera or a video camera, automatically detect and track the faces in the images, and then perform face recognition on the detected faces.

Alternatively, in the embodiment of the present application, the method described above may be applied to a hardware environment formed by the terminal 101 and the server 103 as shown in fig. 1. As shown in fig. 1, a server 103 is connected to a terminal 101 through a network, which may be used to provide services for the terminal or a client installed on the terminal, and a database 105 may be provided on the server or separately from the server, and is used to provide data storage services for the server 103, and the network includes but is not limited to: wide area network, metropolitan area network, or local area network, and the terminal 101 includes but is not limited to a PC, a cell phone, a tablet computer, and the like.

A method in this embodiment may be executed by the server 103, or may be executed by both the server 103 and the terminal 101, as shown in fig. 2, where the method may include the following steps: acquiring an image to be identified; inputting an image to be recognized into a target image recognition model so as to extract image characteristics of the image to be recognized by using the target image recognition model, wherein the target image recognition model is a neural network model for obtaining a model hyper-parameter through iterative search; and acquiring an image recognition result obtained by recognizing the image features by the target image recognition model. According to the method and the device, the neural network model with the model hyperparameters obtained through iterative search is used as the image recognition model to perform image recognition, and the problems that the model cannot obtain optimal parameters and recognition results are inaccurate due to manual setting of hyperparameters and insufficient experience are solved.

Step S202, acquiring an image to be identified.

In the embodiment of the application, the method and the device are applied to face recognition scenes, and the image to be recognized can be a face image of a person who punches a card in a certain company.

Step S204, inputting the image to be recognized into a target image recognition model, so as to extract the image characteristics of the image to be recognized by using the target image recognition model, wherein the target image recognition model is a neural network model for obtaining the hyper-parameters of the model through iterative search.

In the embodiment of the application, the characteristic extraction is carried out on the face image of the card punch through the target image recognition model, and then the extracted image characteristic (face characteristic) is recognized. The target image recognition model provided by the technical scheme of the application is a neural network model with model hyper-parameters obtained through iterative search, the hyper-parameters of the model can be used for searching the optimal model hyper-parameters in a self-adaptive mode when the target image recognition model is trained by utilizing training data, so that the target image recognition model can obtain the optimal model parameters, the accuracy of image recognition and face recognition can be obviously improved, and the neural network model can be a convolutional neural network model and the like.

And step S206, acquiring an image recognition result obtained by recognizing the image characteristics by the target image recognition model.

In the embodiment of the application, the target image recognition model recognizes the image characteristics, so that the identity information (identity id) of the card punch is matched, and the card punching is completed.

Through the steps S202 to S206, the neural network model with the model hyper-parameters obtained through iterative search is used as the image recognition model to perform image recognition, and the problems that the model cannot obtain the optimal parameters and the recognition result is inaccurate due to manual hyper-parameter setting and insufficient experience are solved.

Optionally, before the image to be recognized is input into the target image recognition model, the method further includes training the target image recognition model as follows:

step 11, training a target image recognition model by using a training data set, and determining a first updating hyperparameter of the target image recognition model by using a first loss function obtained by training;

step 12, taking the first updating hyper-parameter as a hyper-parameter of the target image recognition model, training the target image recognition model by using a reference data set, and determining a second updating hyper-parameter of the target image recognition model by using a second loss function obtained by training;

and step 13, taking the second updated hyper-parameter as a new hyper-parameter of the target image recognition model, and performing iterative training on the target image recognition model by using the training data set and the reference data set in sequence until the value of the first loss function obtained by training is reduced to the minimum value, thereby completing the training of the target image recognition model.

Optionally, the reference data set and the training data set are respectively divided into a plurality of subsets, the subsets of the reference data set and the training data set are paired pairwise, training of a pair of subsets on the target image recognition model is used as one iteration, and iterative training is performed on the target image recognition model by using all the subsets, so that the optimal search space α and the optimal weight parameter W are found more accurately.

In the embodiment of the application, the training data and the reference data can be adopted to carry out iterative training on the target image recognition model, training a target image recognition model by using training data, calculating a first update hyperparameter by using a first loss function obtained by training the training data, using the first update hyperparameter as a new model parameter of the target image recognition model, training the target image recognition model by using reference data at the moment, calculating a second update hyperparameter by using a second loss function obtained by training the reference data, and using the second update hyperparameter as a new model parameter of the target image recognition model, wherein the first update hyper-parameter calculated by the first loss function may be a weight parameter of the target image recognition model, and the second update hyper-parameter calculated by the second loss function may be a search space and a weight parameter of the target image recognition model. And according to the circulation, sequentially and iteratively training the target image recognition model by using the training data and the reference data until the value of the first loss function obtained by training is reduced to the minimum value, and finishing the training of the target image recognition model.

In this embodiment of the application, the loss function of the target image recognition model may be:

wherein, 0<Alpha is less than or equal to 1, is a search space in the application, and when alpha is 1, the loss function is commonS is a scale factor, and K is the total number of samples. x is f (input, W | α), input is the input image, and W is the weight of the model. As shown in figure 3 of the drawings,is the angle between two vectors, a vector wyThe y-th row in the full concatenation weight is referred to, and the other vector, the feature x, is the output of the picture after passing through the backbone network (backbone in fig. 3). And both vectors are normalized, so that x is distributed on a hypersphere with the radius of 1, and s is a scale coefficient, so that the radius of the hypersphere is changed into s. y refers to identity information to which the face image belongs during training, i.e., id, which indicates a person, and also indicates the y-th class as a class. For example, the whole training set has 10000 ids, and a certain training image belongs to the 10 th class, and when the loss is calculated after the image passes through the network, y is 10, K is 9999 numbers except 10, and K is 10000.

Lower to upper inFurther explanation is made.

In the related art, the inter-class distance can be increased and the intra-class distance can be decreased by a boundary-based loss function, and the boundary is increased in an angle space or a cosine space on the basis of softmax. The boundary-based penalty function can be written in a uniform form:

wherein, in the A-Softmax loss function,

in the arecface loss function,

in Cosine MarginIn the Loss function of the Loss in Loss,

m in the three forms of the original loss function is a fixed value which is selected artificially. Although they differ in their three forms, m being a different number, they all play the same role, i.e. they all play the same roleTherefore, the present application constructs the above-mentioned loss function L, where one parameter is α search space, and this search space also serves as the search spaceBut alpha is not given by a manual determination and is searched in the training.

In the embodiment of the present application, based on the loss function L, the loss functions with different hyper-parameters (search space α and weight W) are obtained through iterative training of training data and reference data, for example, a first loss function obtained by training a target image recognition model with a training data set may be:

wherein, inputiRefers to the ith picture among the input pictures. Determining a first update hyper-parameter of the target image recognition model using the first loss function may be:

wherein the content of the first and second substances,to determine the gradient. W' is a new model parameter obtained using the gradient descent method. The second loss function obtained by training the target image recognition model with the reference data set may be:

determining a second update hyper-parameter of the target image recognition model using the second loss function may be:

in the embodiment of the application, the reference data set and the training data set can be divided into a plurality of subsets respectively, the subsets of the reference data set and the training data set are paired pairwise, the training of the target image recognition model by the pair of subsets is used as an iteration, and the target image recognition model is iteratively trained by using all the subsets, so that the optimal search space alpha and the optimal weight parameter W can be found more accurately.

Optionally, training the target image recognition model by using the training data set, and obtaining the first loss function includes:

step 21, selecting a target training data set from a training data pool and inputting the target training data set into a target image recognition model so as to extract a first training characteristic of the target training data set by using the target image recognition model, wherein the target training data set is a data set which is not selected in the training data pool;

step 22, substituting the first training characteristic into a loss function of the target image recognition model to obtain a first sub-loss function obtained by the training;

and step 23, adding all the first sub-loss functions under the condition that all the training data sets in the training data pool are selected, so as to obtain a first loss function obtained by training the target image recognition model by the training data pool.

In the embodiment of the application, all training data are stored in a training data pool, the data in the training data pool are divided into a plurality of training data sets, a target image recognition model is trained one by one, first sub-loss functions are calculated one by one, and finally all the first sub-loss functions are added to obtain a total first loss function. For example, there are 1000 ids, each id corresponding to 5 pictures. Now, 20 ids are selected at a time, that is, 20 × 5 pictures are input into the network, x is output after the network is input to calculate the loss, and there are 1000 ids in total, 50 times are selected to calculate 50 losses, and the 50 losses are added to obtain a total loss.

Optionally, training the target image recognition model by using the reference data set, and obtaining the second loss function includes:

step 31, selecting a target reference data set from the reference data pool and inputting the target reference data set into the target image recognition model so as to extract a second training feature of the target reference data set by using the target image recognition model, wherein the target reference data set is a data set which is not selected from the reference data pool;

step 32, substituting the second training characteristic into a loss function of the target image recognition model to obtain a second sub-loss function obtained by the training;

and step 33, adding all the second sub-loss functions under the condition that all the reference data sets in the reference data pool are selected, so as to obtain a second loss function obtained by training the target image recognition model by the reference data pool.

In the embodiment of the application, all reference data are stored in a reference data pool, the data in the reference data pool are divided into a plurality of reference data sets, a target image recognition model is trained one by one, second sub-loss functions are calculated one by one, and finally all the second sub-loss functions are added to obtain a total second loss function.

Optionally, training the target image recognition model further comprises:

step 41, when the value of the first loss function is extracted to be reduced to the minimum value, a search space and a weight parameter of the target image recognition model are extracted, and a hyper-parameter of the target image recognition model comprises at least one of the search space and the weight parameter;

step 42, inputting business training data into the target image recognition model for training, wherein the business training data is image data of a business field represented by the image to be recognized;

and 43, in the training process, the search space is fixed, the weight parameter is used as an initialization weight parameter and is adjusted along with the training of the business training data on the target image recognition model until the output recognition result of the business training data by the target image recognition model reaches a target threshold value.

In the embodiment of the application, the model trained in the above manner already has the optimal search space and weight parameters. In order to further fit the application field, alpha is fixed when business training data are input into a target image recognition model for training, W is used as an initialization parameter during the training of the business training data instead of random initialization, and new business training can be carried out according to the traditional deep learning network training method, so that the image recognition model in the business field with high recognition accuracy can be quickly trained through few iterations, and infinite extension space is provided.

According to still another aspect of the embodiments of the present application, as shown in fig. 4, there is provided an image recognition apparatus including:

an image obtaining module 401, configured to obtain an image to be identified;

the feature extraction module 403 is configured to input the image to be recognized into a target image recognition model, so as to extract image features of the image to be recognized by using the target image recognition model, where the target image recognition model is a neural network model that obtains model hyper-parameters through iterative search;

and an identification result obtaining module 405, configured to obtain an image identification result obtained by identifying the image feature by the target image identification model.

It should be noted that the image obtaining module 401 in this embodiment may be configured to execute step S202 in this embodiment, the feature extracting module 403 in this embodiment may be configured to execute step S204 in this embodiment, and the recognition result obtaining module 405 in this embodiment may be configured to execute step S206 in this embodiment.

It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may operate in a hardware environment as shown in fig. 1, and may be implemented by software or hardware.

Optionally, the apparatus further comprises:

the first training module is used for training the target image recognition model by using a training data set and determining a first updating hyper-parameter of the target image recognition model by using a first loss function obtained by training;

the second training module is used for taking the first updating super-parameter as a super-parameter of the target image recognition model, training the target image recognition model by using a reference data set, and determining a second updating super-parameter of the target image recognition model by using a second loss function obtained by training;

and the iterative training module is used for taking the second updated hyper-parameter as a new hyper-parameter of the target image recognition model, and performing iterative training on the target image recognition model by using the training data set and the reference data set in sequence until the value of the first loss function obtained by training is reduced to the minimum value, so that the training of the target image recognition model is completed.

Optionally, the first training module is specifically configured to:

selecting a target training data set from a training data pool and inputting the target training data set into a target image recognition model so as to extract a first training characteristic of the target training data set by using the target image recognition model, wherein the target training data set is an unselected data set in the training data pool;

substituting the first training characteristic into a loss function of the target image recognition model to obtain a first sub-loss function obtained by the training;

and under the condition that all the training data sets in the training data pool are selected, adding all the first sub-loss functions to obtain a first loss function obtained by training the target image recognition model by the training data pool.

Optionally, the second training module is specifically configured to:

selecting a target reference data set from the reference data pool, inputting the target reference data set into the target image recognition model, and extracting second training characteristics of the target reference data set by using the target image recognition model, wherein the target reference data set is a data set which is not selected from the reference data pool;

substituting the second training characteristic into a loss function of the target image recognition model to obtain a second sub-loss function obtained by the training;

and under the condition that all the reference data sets in the reference data pool are selected, adding all the second sub-loss functions to obtain a second loss function obtained by training the target image recognition model by the reference data pool.

Optionally, the first training module is further configured to: subtracting the gradient of the first loss function from the initial hyper-parameter of the target image recognition model to obtain a first updating hyper-parameter; the second training module is further to: and subtracting the gradient of the second loss function from the initial hyper-parameter of the target image recognition model to obtain a second updating hyper-parameter.

Optionally, the apparatus further comprises a third training module configured to:

when the value of the first loss function is extracted to be reduced to the minimum value, the search space and the weight parameter of the target image recognition model are extracted, and the hyper-parameter of the target image recognition model comprises at least one of the search space and the weight parameter;

inputting business training data into a target image recognition model for training, wherein the business training data is image data of a business field represented by an image to be recognized;

and in the training process, the search space is fixed, the weight parameter is used as an initialization weight parameter and is adjusted along with the training of the business training data on the target image recognition model until the output recognition result of the business training data by the target image recognition model reaches a target threshold value.

According to another aspect of the embodiments of the present application, there is provided an electronic device, as shown in fig. 5, including a memory 501, a processor 503, a communication interface 505, and a communication bus 507, where a computer program operable on the processor 503 is stored in the memory 501, the memory 501 and the processor 503 communicate with each other through the communication interface 505 and the communication bus 507, and the steps of the method are implemented when the processor 503 executes the computer program.

The memory and the processor in the electronic equipment are communicated with the communication interface through a communication bus. The communication bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc.

The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.

The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.

There is also provided, in accordance with yet another aspect of an embodiment of the present application, a computer-readable medium having non-volatile program code executable by a processor.

Optionally, in an embodiment of the present application, a computer readable medium is configured to store program code for the processor to perform the following steps:

an image obtaining module 401, configured to obtain an image to be identified;

the feature extraction module 403 is configured to input the image to be recognized into a target image recognition model, so as to extract image features of the image to be recognized by using the target image recognition model, where the target image recognition model is a neural network model that obtains model hyper-parameters through iterative search;

and an identification result obtaining module 405, configured to obtain an image identification result obtained by identifying the image feature by the target image identification model.

Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.

When the embodiments of the present application are specifically implemented, reference may be made to the above embodiments, and corresponding technical effects are achieved.

It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For a hardware implementation, the Processing units may be implemented within one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof.

For a software implementation, the techniques described herein may be implemented by means of units performing the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.

Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.

It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.

In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical division, and in actual implementation, there may be other divisions, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.

The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.

In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.

The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially implemented or make a contribution to the prior art, or may be implemented in the form of a software product stored in a storage medium and including several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk. It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

The above description is merely exemplary of the present application and is presented to enable those skilled in the art to understand and practice the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于多尺度卷积网络的两相流流型识别方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!