Neural network model construction method, image processing method, device and medium
By determining the target operator candidate set and performance testing, we build a neural network model that adapts to the hardware platform and meets application requirements, solves the problems of insufficient utilization of hardware resources and insufficient model adaptability in the existing technology, and realizes an efficient neural network model. Build.
Patent Information
- Application Number
- CN202111593118.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-23
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-12-23
AI Technical Summary
When existing neural network models are applied on different hardware platforms, it is difficult to make full use of hardware resources, and it is difficult to build highly adaptable models according to specific application requirements.
By determining the candidate set of target operators, multiple neural network models are constructed based on functional requirements, and the target neural network model that adapts to the hardware platform and meets application requirements is selected through performance testing.
It realizes the construction of a neural network model that is highly adaptable and whose functions meet preset requirements under hardware constraints, and improves the utilization efficiency of hardware resources.
Smart Images

Figure CN114298272B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and specifically to a method for constructing a neural network model, an image processing method, a device and a medium. Background Art
[0002] A neural network model is a computational network composed of operators. Operators refer to the various operations performed by each layer in a neural network model. For example, the convolution operation performed by the convolution layer of a neural network model on the input data of the neural network model is called a convolution operator.
[0003] In the actual application of the neural network model, different hardware can be used to implement the operators of the neural network model. For example, for the above-mentioned convolution operator, the operator in the neural network model can be implemented by hardware such as a graphics processing unit (GPU), a central processing unit (CPU), a machine learning unit (machine learning unit) or a field programmable gate array (FPGA).
[0004] However, different hardware has different processing capabilities, supported bandwidth and other performance, as well as storage space. In order to maximize the performance of the hardware, it is necessary to select a more suitable neural network model for the specific hardware. Summary of the invention
[0005] In view of this, the present application provides a method for constructing a neural network model, an image processing method, a device and a medium. Through a method for constructing a neural network model provided in some embodiments of the present application, a target neural network model that adapts to the constraints of a target hardware platform and meets the requirements of a specific application on the target hardware platform can be obtained, making full use of the hardware resources of the mobile phone, such as processor resources, storage space, etc.
[0006] In a first aspect, an embodiment of the present application provides a method for constructing a neural network model, which can be applied to electronic devices, and the method includes: determining a target operator candidate set, the target operator candidate set including at least one operator; based on preset functional requirements, selecting operators and / or combinations of operators from the target operator candidate set to construct multiple first neural network models, and using test data and hardware constraints of electronic devices running the target neural network models to test the multiple first neural network models respectively to obtain performance test results corresponding to each first neural network model; based on the comparison result of the performance test result of each first neural network model with the first preset condition, determining the target neural network model from the multiple first neural network models.
[0007] In some embodiments, determining the target operator candidate set refers to constructing or updating the target operator candidate set using the operators used by the neural network model that meets the preset functional requirements. In some embodiments, the preset functional requirements are determined based on the function or purpose of the neural network model required by the first application installed on the electronic device.
[0008] Exemplarily, the first application installed on the electronic device includes a system application of the target electronic device, wherein the system application includes a face recognition unlocking application. Then, according to the function of the neural network model required for the face recognition unlocking application, the preset functional requirement can be determined to be "image recognition". Then, when determining the target operator candidate set, the operator used by the neural network model with the same or similar function as "image recognition" is used to construct the target operator candidate set.
[0009] It can be understood that the first application installed on the target electronic device may also be other third-party applications, such as video applications, chat applications, etc., and this application does not impose any limitation on this.
[0010] After determining the target operator candidate set, multiple first neural network models are constructed by using the operators or combinations of operators in the target operator candidates. It can be understood that since the operators used by the first neural network model are the operators used by the neural network model that meets the preset functional requirements, the functions of the first neural network model also meet the preset functional requirements.
[0011] In some embodiments, the hardware constraints of the electronic device include the processing power and storage space of the target electronic device. It can be understood that the weaker the processing power of the electronic device, the smaller the storage space, and the stricter the hardware constraints of the target electronic device, the fewer the number of network layers of the target neural network model.
[0012] Therefore, by utilizing the test data and the above-mentioned hardware constraints to test the first neural network models and obtain performance test results of each first neural network model, the first neural network model that is more suitable for the above-mentioned electronic device can be determined from the performance test results of each first neural network model, and the target neural network model can be further determined based on the comparison results of the performance test results of each first neural network model with the first preset conditions.
[0013] Through the above method, a neural network model can be obtained that adapts to the hardware constraints of the electronic device and whose functions meet the preset functional requirements.
[0014] In combination with the first aspect, in a possible implementation of the first aspect, based on the comparison result of the performance test result of each first neural network model with the first preset condition, determining a target neural network model from multiple first neural network models, including: based on the comparison result of the performance test result of each first neural network model with the first preset condition, determining at least one second neural network model whose performance test result meets the first preset condition from multiple first neural network models; based on the second preset condition, determining the target neural network model from at least one second neural network model.
[0015] That is, a second neural network model whose performance test result meets the first preset condition is selected from the first neural network model, and then a target neural network model whose performance test result meets the second preset condition is selected from the second neural network model. In some embodiments, the performance test result includes a comprehensive performance score, and based on the comparison result between the performance test result of each first neural network model and the first preset condition, determining at least one second neural network model whose performance test result meets the first preset condition from multiple first neural network models includes: taking a neural network model whose comprehensive performance score is greater than a first threshold value as the first preset condition as the second neural network model, and based on the second preset condition, determining a target neural network model from at least one second neural network model includes: taking a neural network model with the highest comprehensive performance score among the second neural network models as the target neural network model.
[0016] That is, the first neural network model whose comprehensive performance score is greater than the first threshold (e.g., 50 points) is used as the second neural network model, and then the neural network model with the highest comprehensive performance score among the second neural network models is used as the target neural network model. In some embodiments, the comprehensive performance score refers to a score determined by factors such as the accuracy index of the neural network model, the bandwidth consumed when running the neural network model, and the time spent running the neural network model.
[0017] In some embodiments, if there are multiple neural network models with the highest comprehensive performance score in the second neural network model, then from these neural network models, according to specific needs, the audit net network model with the highest accuracy index, or the smallest bandwidth consumed when running the neural network model, or the shortest time spent running the neural network model is selected as the target neural network model, and this application does not impose any restrictions on this.
[0018] In combination with the first aspect and the above-mentioned possible implementation methods, in a possible implementation method of the first aspect, based on the comparison result of the performance test result of each first neural network model with the first preset condition, determining a target neural network model from multiple first neural network models, including: based on the comparison result of the performance test result of each first neural network model with the first preset condition, determining the target neural network model from multiple first neural network models, including, based on the comparison result of the performance test result of each first neural network model with the first preset condition, from at least one first neural network model whose performance test result does not meet the first preset condition, determining at least one third neural network model based on the comparison result of the performance test result of the at least one first neural network model with a third preset condition; determining the target neural network model from the at least one third neural network model.
[0019] That is, when the performance test results of the first neural network model do not meet the first preset condition, a third neural network model whose performance test results meet the third preset condition is selected from the first neural network model.
[0020] In some embodiments, based on the comparison result of the performance test result of each first neural network model with the first preset condition, from at least one first neural network model whose performance test result does not meet the first preset condition, based on the comparison result of the performance test result of the at least one first neural network model with the third preset condition, determining at least one third neural network model includes: when the comprehensive performance scores of the first neural network models are all less than a first threshold serving as the first preset condition, selecting a neural network model from the first neural network models whose comprehensive performance score is greater than the preset performance test result threshold as the third neural network model.
[0021] That is, if the performance test results are expressed in the form of a comprehensive performance score, when the comprehensive performance scores in the first neural network model are all less than the above-mentioned first threshold, a neural network model whose comprehensive performance score is greater than the preset performance test result threshold is selected from the first neural network model as the third neural network model, and then the target neural network model is selected from the third neural network model.
[0022] In combination with the first aspect and the above possible implementations, in a possible implementation of the first aspect, determining a target neural network model from at least one third neural network model includes: executing N loop processes to determine the target neural network model, where N is an integer greater than or equal to 1, and each loop process includes: updating the target operator candidate set according to the third neural network model; constructing multiple first neural network models according to the updated target operator candidate set using at least one operator or a combination of operators in the target operator candidate set, testing the multiple first neural network models respectively using test data and hardware constraints of the electronic device running the neural network model to obtain performance test results corresponding to each first neural network model; comparing the performance test result with the first preset condition, and if there is a neural network model whose performance test result satisfies the first preset condition, terminating the loop and outputting the second neural network model (that is, if the performance test result satisfies the above first preset condition, determining at least one second neural network model whose performance test result satisfies the first preset condition from the above multiple first neural network models).
[0023] In the absence of a neural network model whose performance test results satisfy the first preset condition, a third neural network model is obtained based on the third preset condition (that is, in the case where the performance test results of multiple first neural network models obtained in the loop confirmation process do not satisfy the first preset condition, from at least one neural network model whose performance test results do not satisfy the first preset condition, based on the comparison result of the performance test result of the at least one first neural network model with the third preset condition, at least one first neural network model is determined as the third neural network model), and then a new loop is re-executed based on the obtained third neural network model.
[0024] That is, in order to obtain a target neural network model with better performance, the electronic device can execute the above method in a loop for multiple times, and then update the target operator candidate set according to the number of occurrences of the operator or combination of operators used by the third neural network model obtained each time, and then use the operator or combination of operators in the updated target operator candidate set to rebuild the first neural network model in the next cycle, and use the test data and the above-mentioned hardware preset conditions to test the first neural network model, select the neural network model whose performance test results meet the first preset conditions as the second neural network model, and select the target neural network model whose performance test results meet the second preset conditions from the second neural network model.
[0025] After multiple cycles, if the target neural network model is still not obtained through the "first neural network model-second neural network model-target neural network model" method, and the number of cycles reaches the preset threshold, that is, (for the Nth cycle of obtaining at least one third neural network model, and N is equal to the preset threshold), the target neural network model is selected from the third neural network models. In some embodiments, for the Nth cycle of obtaining at least one third neural network model, and N is equal to the preset threshold, the target neural network model is determined from at least one third neural network model, including: selecting the neural network model with the largest comprehensive performance score from the third neural network models as the target neural network model.
[0026] Similarly, if there are multiple neural network models with the highest comprehensive performance score in the third neural network model, then according to the needs, the neural network model with the highest neural network model accuracy index, or the shortest time consumed when running the neural network model, or the least bandwidth consumed when running the neural network model can be selected as the target neural network model. This application does not impose any restrictions on this.
[0027] Among them, in some embodiments, the method of updating the target operator candidate set according to the third neural network model includes:
[0028] According to the number of times the operator or combined operator is used by the third neural network model, it is decided whether to update the target operator candidate set. If the number of times the operator or combined operator is used by the third neural network model exceeds the preset number, the weight of the corresponding operator or combined operator in the target operator candidate set is increased. The preset number may be an empirical value or an experimental value, such as 5. It can be understood that the number of times the third neural network model uses an operator or a combined operator can indicate to a certain extent whether the operator or the combined operator is adapted to the hardware conditions of the electronic device. If the third neural network model frequently uses certain operators, it indicates that these operators are more adapted to the hardware conditions of the electronic device.
[0029] If the combination operator used by the third neural network model is not included in the target operator candidate set, the combination operator is added to the target operator candidate set.
[0030] In a second aspect, an embodiment of the present application provides an image processing method, which can also be applied to electronic devices, and the method includes: obtaining an image to be identified; using a neural network model to identify the image to be identified, wherein the neural network model is obtained by using the neural network model construction method of the above-mentioned first aspect and any possible implementation method of the first aspect.
[0031] In a third aspect, an embodiment of the present application provides a readable medium having instructions stored thereon, which, when executed on an electronic device, causes the electronic device to execute the first aspect and various possible implementation methods of the first aspect and a method for constructing a neural network model of the second aspect.
[0032] In a fourth aspect, an embodiment of the present application provides an electronic device, the electronic device comprising:
[0033] a memory for storing instructions to be executed by one or more processors of the electronic device, and
[0034] The processor is one of the processors of the electronic device, and is used to execute the above-mentioned first aspect, various possible implementation methods of the above-mentioned first aspect, and any one of the methods provided by the above-mentioned second aspect.
[0035] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device executes the above-mentioned first aspect, various possible implementation methods of the above-mentioned first aspect, and any one of the methods provided by the above-mentioned second aspect.
[0036] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0038] Figure 1 is an application scenario diagram of a neural network model construction method provided by some embodiments;
[0039] Figure 2 is a flowchart of a method for constructing a target operator candidate set involved in the present application provided by some embodiments;
[0040] Figure 3 is a flowchart of a method for building a neural network model provided by some embodiments;
[0041] Figure 4 is a schematic diagram of a neural network model construction device provided by some embodiments;
[0042] Figure 5 This is a schematic diagram of a computing device structure provided by some embodiments. DETAILED DESCRIPTION
[0043] The following describes the method for constructing the neural network model of the present application.
[0044] Figure 1 1 is an application scenario diagram of the method for constructing a neural network model of the present application, which includes a server 100, a data storage platform 200, and a target hardware platform 300. For ease of explanation, the target hardware platform 300 is taken as an example of a mobile phone, but it can be understood that the target hardware platform 300 is not limited to a mobile phone, but can also be a tablet computer, a laptop computer, etc.
[0045] like Figure 1 As shown, the server 100 can select at least some operators from the operators used by the neural network models with the same or similar functions or uses as the required target neural network model stored in the data storage platform 200 to obtain a target operator candidate set according to the function or use of the target neural network model required by the application of the mobile phone 300, and select at least some operators from the target operator candidate set to construct multiple neural network models that meet the layer number requirements, and then test the above multiple neural network models based on the test data to obtain the test results of each neural network model, and determine the neural network model whose test results meet the preset conditions as the target neural network model. The specific implementation of using the test data to test the neural network model and using the neural network model whose test results meet the preset conditions as the target neural network model will be described below in conjunction with the attached Figure 3 introduce.
[0046] Through the above method, the server 100 can build a target neural network model for the mobile phone 300 that can adapt to the hardware conditions of the mobile phone 300 and conform to the specific system applications of the mobile phone 300, that is, the target neural network model can better utilize the hardware / software resources of the mobile phone 300, such as processor resources, storage space, etc., and at the same time meet the needs of specific system applications on the mobile phone 300.
[0047] In some embodiments, the application in the mobile phone 300 may be a specific system application on the mobile phone 300, that is, the server 100 may select operators from the data storage platform 200 to construct a target operator candidate set according to the purpose of the neural network model required by the specific system application on the mobile phone 300. For example, for the face recognition unlocking application on the mobile phone 300, the purpose of the neural network model required by the application is image recognition, then the server 100 will select operators used by the neural network model with the same or similar purpose as "image recognition" from the data storage platform 200 to construct a target operator candidate set.
[0048] In some embodiments, the application in the mobile phone 300 may also be an application installed by the user on the mobile phone 300 according to the needs, that is, the server 100 can determine the purpose of the neural network model required by the application according to the application installed by the user on the mobile phone 300, when the user installs the application or when the application needs to be updated or upgraded, and filter operators from the data storage platform 200 to construct a target operator candidate set. For example, if the user installs an application that can realize the image search function on the mobile phone 300, then the server 100 will filter the operators used by the neural network model with the same or similar purpose as "image recognition" from the data storage platform 200 according to the purpose of the application "image search" (that is, image recognition) to construct a target operator candidate set. For another example, when the "image search" application installed on the mobile phone 300 is updated or upgraded, the server 100 can determine the purpose of the neural network model required by the application according to the upgrade requirements of the "image search" application.
[0049] Among them, the reason for selecting at least some operators from the operators used by the neural network models with the same or similar purposes as the required target neural network model stored in the data storage platform 200 to obtain the target operator candidate set is that the operators used by neural network models with the same or similar purposes are generally the same. Therefore, selecting operators used by neural network models with the same or similar purposes as the target neural network model to construct the target operator candidate set can ensure that the target neural network model can meet the purposes required by the above-mentioned application.
[0050] Among them, the mentioned layer requirement refers to the layer requirement for the target neural network model determined according to the hardware constraints on the target hardware platform such as the mobile phone 300. It can be understood that the hardware constraints of different target hardware platforms are different, so the layer requirements of the target neural network model on different target hardware platforms are also different. For example, compared with a computer, the processing power of the mobile phone 300 is weaker and the memory space is smaller, so the number of layers of the target neural network model on the mobile phone 300 is less than the number of layers of the neural network model running on the computer. More specifically, for example, the number of layers of the image recognition neural network model running on the computer may be 100 layers, but the number of layers of the target neural network model running on the mobile phone 300 may be only 20 layers.
[0051] Based on the above description, the following Figure 1 The scene diagram shown introduces the process of implementing the construction method of the neural network model of the present application on the server 100, and constructing the target neural network model for the face recognition unlocking application on the mobile phone 300. The construction method of the neural network model of the present application includes the stage of constructing a target operator candidate set and the stage of constructing a target neural network model using operators in the target operator candidate set, which are described separately below.
[0052] like Figure 2 As shown, the process of the server 100 constructing a target operator candidate set includes:
[0053] 201 , determining a screening condition according to the hardware constraints of the mobile phone 300 and the face recognition unlocking application.
[0054] It can be understood that the server 100 first determines that the purpose of the target neural network model is face recognition (i.e., image recognition) based on the face recognition unlocking application of the mobile phone 300. Secondly, the server 100 determines the number of layers of the target neural network model based on the hardware constraints on the mobile phone 300. For example, assuming that the memory of the mobile phone 300 is 8G, excluding the memory occupied by the system application, the available memory of the mobile phone 300 may be less than 4G, and the processor computing power of the mobile phone 300 is insufficient, then the number of layers of the target neural network model is as few as 20 layers.
[0055] 202 , operators meeting the screening conditions are screened out from the data storage platform 200 as target operators.
[0056] In some embodiments of the present application, a plurality of operators are stored in the data storage platform 200, and each operator can be used for a neural network model with at least one purpose. Then, according to the purpose (image recognition) of the above-mentioned target neural network model, the server 100 selects an operator corresponding to a neural network model with the same or similar purpose as the target neural network model from the data storage platform 200 as the target operator. Exemplarily, the correspondence between the operators and the purposes of the neural network model in the data storage platform 200 can be shown in Table 1:
[0057] Table 1
[0058] Operator Neural Network Model Application Operator 1 Image recognition, semantic segmentation Operator 2 Image classification, image recognition Operator 3 Voice Detection … … Operator n-1 Voice detection, voice recognition Operator n Image classification, semantic segmentation
[0059] As can be seen from Table 1, operator 1 corresponds to a neural network model with two uses (image recognition, semantic segmentation), operator 2 also corresponds to a neural network model with two uses (image classification, image recognition), operator 3 only corresponds to a neural network model with one use (speech detection), ..., operator n-1 also corresponds to a neural network model with two uses (speech detection, speech recognition), and operator n also corresponds to a neural network model with two uses (image classification, semantic segmentation).
[0060] Since the purpose of the target neural network model is image recognition, the server 100 will select an operator corresponding to the same or similar neural network model as "image recognition" from Table 1 above as the target operator, that is, select operator 1, operator 2, ..., operator n-1.
[0061] 203 , construct a target operator candidate set using the target operator, and set an initial weight for each operator in the target operator candidate set.
[0062] In some embodiments of the present application, weights can be used to represent the number of times an operator is used in the process of building a target neural network model. It can be understood that the greater the weight of the operator, the more times it is used, and the more it can adapt to the hardware resources of the mobile phone 300. In order to reflect the change in the number of times each operator is used in the process of building a target neural network model, that is, the change in weight, so that in the subsequent process of building a target neural network model, the server 100 can give priority to using operators with larger weights to build the target neural network model. The server 100 needs to set initial weights for each operator. In some embodiments, the initial weights of each operator in the target operator candidate set can be the same, and the sum of the initial weights of each operator is 1. For example, if there are 5 operators in the target operator candidate set, the weights of these 5 operators can all be 1 / 5=0.2. In other embodiments, the initial weights of each operator in the target operator candidate set can also be other values, and this application does not limit this.
[0063] The above method 200 introduces the method for the server 100 to construct a target operator candidate set. The following describes the process of the server 100 constructing a target neural network model based on the above target operator candidate set. Figure 3 As shown, the process includes:
[0064] 301, using each operator in the target operator candidate set, construct a first neural network model whose number of layers meets the layer number requirement.
[0065] In some embodiments, assuming that the operators included in the target operator candidate set constructed by the above 300 are operator a1, operator a2, operator a3, operator a4, ... a(n-1), an, and the number of layers of the target neural network model is 20, then when the server 100 uses the target operator candidate set to construct a 20-layer first neural network model, it will select a combined operator composed of one or more operators from the target operator candidate set for each layer of the neural network as the operator of the layer, and the operators or combined operators used in each layer of the neural network can be the same or different, and then multiple first neural network models are obtained.
[0066] For ease of understanding, taking the case where the target operator candidate set includes four operators a1, a2, a3, and a4, and the number of layers of the target neural network model is also 4 as an example, the server 100 is introduced to construct the first neural network model whose number of layers meets the screening conditions. The details are as follows:
[0067] The server 100 first calculates each combination of operators a1 to a4 to obtain operators and combination operators, as shown in Table 2 below:
[0068] Table 2
[0069]
[0070] That is, there are 15 (4+4+6+1) combinations of operators a1 to a4. Among them, the single operators are operator a1, operator a2, operator a3, and operator a4. The combination operators of 2 operators are [operator a1, operator a2], [operator a1, operator a3], [operator a1, operator a4], [operator a2, operator a3], [operator a2, operator a4], [operator a3, operator a4], the combination operators of 3 operators are [operator a1, operator a2, operator a3], [operator a1, operator a2, operator a4], [operator a2, operator a3, operator a4], and the combination operators of 4 operators are [operator a1, operator a2, operator a3, operator a4].
[0071] The server 100 matches one operator from the 15 operators to each layer of the 4-layer neural network model, and obtains The first neural network model. Where C represents the number of combinations.
[0072] It can be understood that if the number of operators in the target operator candidate set and the number of layers of the target neural network model are large, the number of first neural network models constructed based on the target operator will be very large. At this time, if the server 100 directly tests all the candidate neural network models, it will consume a lot of computing resources. Therefore, in order to reduce the computing resources consumed by the server 100, in some embodiments, the server 100 can first screen out a part of the first neural network models with better performance from a large number of first neural network models, and then only test these first neural network models with relatively good performance.
[0073] For example, the server 100 can use the training data to train the above-mentioned first neural network model, and then select the first neural network model with better training results. It can be understood that the training data is also data corresponding to the target neural network model. For example, assuming that the target neural network model is an image recognition neural network model, then the training data is a large number of images corresponding to the detected data. For another example, assuming that the target neural network model is a speech detection neural network model, then the training data is a large amount of audio data. It should be understood that this application does not limit the training data.
[0074] Among them, a neural network model with better training results refers to a neural network model in which the similarity between the output result of the neural network model and the preset label corresponding to the input data is not less than the similarity threshold. Among them, the preset label refers to the reference result (or standard result) of the input data after being processed by the neural network model. For example, assuming that the input data is an image with a preset label of "Husky", then the preset label "Husky" is the result that should be obtained after the image is input into the neural network model. It can be understood that the actual output result is often not exactly the same as the reference result, so the quality of the neural network model training result (or the accuracy of the neural network model) is generally indicated by calculating the similarity between the actual output result and the reference result.
[0075] For example, assuming that the input of the neural network model is a labeled image in the semantic segmentation dataset ("Husky (preset label)"-image), if the output of the neural network model is "Husky", it indicates that the similarity between the output result of the neural network model and the label of the input image is high, and the training result of the neural network model is good. If the output result of the neural network model is "Alaska", it indicates that the similarity between the output result of the neural network model and the label of the input image is low, and the training result of the neural network model is poor.
[0076] Among them, the method of calculating the similarity between the label of the neural network model input image and the output result can be to calculate the Euclidean distance between the two. For another example, based on the storage space occupied by the first neural network model, the computing resources consumed, etc., the server 100 selects the first neural network model with smaller storage space and computing resources consumed from the first neural network model; or, the server 100 can also select some first neural network models with better performance from the first neural network model by reinforcement learning, evolutionary algorithm or differentiable gradient descent algorithm, etc., and this application does not limit this.
[0077] It is understandable that the above-mentioned method of calculating the similarity between the label of the neural network model input image and the output result can also be other similarity calculation methods, such as Manhattan distance calculation formula, cosine calculation formula, etc. This application does not limit this.
[0078] 302, using the test data and the hardware constraints of the mobile phone 300 to test the above-mentioned multiple first neural network models, and obtain the performance test results of each first neural network model.
[0079] Specifically, the server 100 inputs test data into these first neural network models in combination with the hardware constraints of the mobile phone 300 to obtain the performance test results of each first neural network model. The difference between the test data and the above-mentioned training data is that the test data has a larger number and a wider variety. In some embodiments, the performance test result of the first neural network model can be a comprehensive performance score of the running time, accuracy, bandwidth resources consumed, etc. of the first neural network model on the mobile phone 300. According to the size of the comprehensive performance score, a second neural network model suitable for the mobile phone 300 can be selected from the first neural network model.
[0080] In some embodiments, the comprehensive performance score can be calculated by the following formula (1):
[0081] Comprehensive performance score = α*(running time) + β*(accuracy index of neural network model) + γ*(consumed bandwidth) (1)
[0082] Among them, α, β, and γ are weights. It should be noted that the comprehensive performance score is positively correlated with the accuracy index of the neural network model, but negatively correlated with the running time and bandwidth consumed by the mobile phone 300 when running the neural network model. That is, the higher the accuracy index of the neural network model, the higher the comprehensive performance score, and the longer the running time consumed by the mobile phone 300 to run the neural network model or the more bandwidth consumed when the mobile phone 300 runs the neural network model, the lower the comprehensive performance score.
[0083] Exemplarily, the multiple first neural network models constructed by 302 and their performance test results may be shown in Table 3 below: α=-0.1, β=0.8, γ=-0.1
[0084] Table 3
[0085]
[0086] It can be seen from Table 3 that the comprehensive performance score of the first neural network model A constructed by 402 is 63, the comprehensive performance score of the first neural network model B is 54, the comprehensive performance score of the first neural network model C is 39, the comprehensive performance score of the first neural network model D is 39, the comprehensive performance score of the first neural network model E is 4, the comprehensive performance score of the first neural network model F is 48, and the comprehensive performance score of the first neural network model G is 4.
[0087] 303, determining whether the first neural network model has a second neural network model that meets a preset condition.
[0088] If it exists, then proceed to 304, i.e., select the target neural network model from the second neural network models that meet the preset conditions. If it does not exist, then proceed to 305, i.e., based on the performance test results, select a third neural network model whose performance test results are greater than a preset performance test result threshold from the above-mentioned first neural network model.
[0089] In some embodiments, the preset condition may be that the performance test result of the neural network model is greater than a preset first threshold. The preset first threshold may be an empirical value or an experimental value, such as 50 points. Continuing with Table 2 as an example, the server 100 will select the first neural network models A, B, C, and D with a comprehensive performance score greater than 80 points from the first neural network models shown in Table 1 as the second neural network model.
[0090] 304, selecting a target neural network model from the second neural network models that meet the preset conditions.
[0091] In some implementations, the second neural network model with the largest comprehensive performance score can be selected from the second neural network models as the target neural network model. It is understood that when there are multiple second neural network models with the largest comprehensive performance score, one second neural network model can be selected from the multiple second neural network models as the target neural network model according to the needs.
[0092] For example, if there are 10 second neural network models with the highest comprehensive performance scores, the demand for neural network models can be sorted by priority, such as the priority is: accuracy index> running time> consumed bandwidth, then the second neural network model with the highest accuracy index can be preferentially selected from the 10 second neural network models as the target neural network model, if there are multiple second neural network models with the highest accuracy index, then the second neural network model with the shortest running time can be selected from the second neural network models with the highest accuracy index as the target neural network model, if there are multiple neural network models with the shortest running time, then the second neural network model with the shortest running time that consumes the least bandwidth can be selected from the second neural network models with the shortest running time as the target neural network model. This application does not impose any restrictions on this.
[0093] 305. According to the performance test result, a third neural network model having a performance test result greater than a preset performance test result threshold is selected from the plurality of first neural network models.
[0094] If there is a second neural network model that meets the preset conditions in the first neural network model, for example, the comprehensive performance scores of the above-mentioned first neural network models are all less than or equal to the above-mentioned preset first threshold (for example, 50 points), it indicates that the currently obtained first neural network model does not meet the conditions as the target neural network model, then the server 100 will further screen out the neural network model whose performance test result is greater than the preset performance test result threshold from the first neural network model as the third neural network model, and then perform a subsequent screening process based on the third neural network model whose performance test result is greater than the preset performance test result threshold. Among them, the preset performance test result is an empirical value or an experimental value, which can be determined according to the performance test results of all the first neural network models obtained according to the needs. For example, the average value of the performance test results of the first neural network model in Table 3 above can be used as the preset performance test result, for example, (63+54+39+39+4+48+4) / 7=35.8 can be used as the preset performance test result. Then, the first neural network model with a performance test result greater than 35.8 is selected from Table 3 above as the third neural network model.
[0095] It can be understood that the preset performance test result threshold is less than the preset first threshold.
[0096] 306 , determining whether there is a combination operator that is not in the target operator candidate set among the operators used by the third neural network model.
[0097] It can be seen from the above 302 that new combination operators may appear in each round of building the first neural network model. In order to ensure that the operators in the target operator candidate set can better meet the requirements of building the first neural network model in the next round of screening, in some embodiments, the server 100 can determine whether the operators used by the third neural network model have combination operators that are not in the target operator candidate set.
[0098] If yes, proceed to 307, that is, add the combined operator to the target operator candidate set. If no, proceed to 308, that is, directly determine whether there is an operator whose appearance number exceeds the preset number among the operators used by the third neural network model.
[0099] Specifically, it is assumed that a third neural network model (assuming it is neural network model A) obtained by the server 100 in the Nth (N is greater than 2) round of screening and the operators used by the neural network model are shown in Table 4 below:
[0100] Table 4
[0101]
[0102]
[0103] From Table 4, we can see that the number of layers of neural network model A is 20, and the operators used are operator a2, operator a4, operator a11, operator a9, ..., operator a21, operator a20, and operator a19. Assume that operator a2 and operator a4 appear 5 times, operator a11 appears 6 times, operator a9 appears 1 time, and operator a21 and operator a20 appear 2 times. Then operator a9 is a new combination operator that appears in the Nth round of screening.
[0104] 307, adding the operator to the target operator candidate set.
[0105] It can be understood that if the operator used by the third neural network model is a combination operator that did not appear in the previous target operator candidate set, the combination operator is added to the target operator candidate set.
[0106] 308 , determining whether there is an operator whose occurrence number is greater than or equal to a preset number among the operators used by the third neural network model.
[0107] As described above, the operators used in the third neural network model obtained in each round may be different, that is, the number of times the operators in the target operator candidate set appear in the third neural network model may be different, but if the weights of the operators in the target operator candidate set are updated only once or a few times, then the stability of the target operator candidate set is not high, and the stability of the first neural network model constructed based on the unstable target operator candidate set and even the subsequent third neural network model is not high, that is, it is possible that a different third neural network model is obtained in each round of screening, which is not conducive to selecting the target neural network model from the third neural network model. Therefore, in order to prevent the contingency of the screening results, the server 100 needs to determine whether the operators used by the third neural network model have operators exceeding the preset number of times. In some embodiments, the above-mentioned preset number of times can be an empirical value or an experimental value, and its value can be 5, for example.
[0108] If yes, then go to 309, that is, update the weight of the operator in the target operator candidate base. If no, then go to 310, that is, determine whether the number of loops reaches the termination condition.
[0109] Specifically, continuing to take Table 4 as an example, assuming that the preset number is 5, in the neural network model A obtained by the server 100 for the Nth time (N is greater than 2), the number of times operators a2 and a4 appear is 5 times, and the number of times operator a11 appears is 6 times, which is not less than the preset number, then the server 100 will update the weights of operators a2, a4, and a11 in the target operator candidate set. However, the number of times operator a9 appears is 1, and the number of times operators a21 and a20 appear is 2 times, which are all less than the preset number, then the server 100 will not update the weights of operators a9, a21, and a20 in the target operator candidate set.
[0110] 309, updating the weight of the operator in the target operator candidate set.
[0111] In some embodiments, assuming that the preset number is 5, the server 100 may update the weight of each operator using the following formula (2):
[0112] W 2i =W 1i +T*H
[0113]
[0114] Among them, W 1i represents the weight of the operator before testing and evaluation, W 2i It represents the weight of the operator after the test evaluation, i represents a specific operator, i is a positive integer, T represents the difference of the operator weight change during the test evaluation, which is generally 0.01, H is the function of the saturation calculation of the delay, n represents the number of times the operator appears, when the number of times the operator appears is greater than 5 times, the value of H is 5, when the number of times the operator appears is less than 5 times, the value of H is 0, that is, the weight of the operator will change only when the number of times the operator appears in the first neural network model above is greater than 5 times.
[0115] Specifically, continuing to take the above Table 4 as an example, the number of times operator a2 and operator a4 appear is 5, that is, the weights of operator a2 and operator a4 have not been updated before, that is, the weights of operator a2 and operator a4 are initial weights (for example, 0).
[0116] Then, when the server 100 updates the weights of operators a2 and a4 using the above formula (2), the weight of operator a2 is W 22 =W 12 +T*H=0+0.01*5=0.05.
[0117] Similarly, the weight W of operator a4 is 24 =0+T*H=0+0.01*5=0.05.
[0118] The number of times operator a11 appears is 6, which means that the number of times operator a11 has appeared before is greater than the preset number, that is, the weight of operator a11 has been updated once, so the weight of operator a11 should be W at this time. 211 =W 111 +T*H=0.05+0.01*5=0.1.
[0119] It can be understood that the above formula (2) for updating the operator weight is only exemplary. In other embodiments, the server 100 may also use other methods to update the operator weight, and this application does not limit this.
[0120] Furthermore, it is understood that in order to reduce the storage space occupied by the target operator candidate set, the server 100 may also delete the operators in the target operator candidate set whose weights are less than the preset weights after m rounds of screening. The preset weights are experimental values or empirical values, such as 0.1.
[0121] 310, determine whether the termination condition is met. If not, proceed to 301, that is, the server 100 continues to repeat the above screening process to obtain the target neural network model. If yes, proceed to 311, that is, the server 100 selects the target neural network model from the third neural network model obtained in the above screening process.
[0122] It can be understood that in order to save the processing resources of the server 100, in some embodiments of the present application, a termination condition of the loop can be set for the screening process of the server 100. It can be understood that the termination condition can include a preset number of loops. When the number of loops is greater than the preset number, it means that the termination condition is met, and the target neural network model is screened out from the third neural model obtained in 305 of this round of screening process; otherwise, when the number of loops is greater than the preset number, it means that the termination condition has not been met, and the server 100 continues to repeat the above screening process until the target neural network model is obtained or the number of loops reaches the termination condition.
[0123] 311, selecting a target neural network model from the third neural network model.
[0124] In some embodiments, the server 100 may select the neural network model with the highest comprehensive performance score from the third neural network models as the target neural network model. Furthermore, if there are multiple third neural network models with the highest comprehensive performance score, the third neural network model with the fastest running speed or the least bandwidth consumed when running the neural network model, or the third neural network model with the highest accuracy index may be selected as the target neural network model according to the needs. The specific screening method may refer to 304 above, which will not be described in detail here.
[0125] In some embodiments of the present application, a specific structural diagram of a neural network model construction device is provided, specifically, as follows Figure 4 As shown, the method of the present application can be applied to a neural network model construction device 400. The functions of the neural network model construction device 400 can be implemented by a software system, or by a hardware device, or by a combination of a software system and a hardware device. The present application does not limit this. When the neural network model construction device is a software device, the neural network model construction device 400 can be logically divided into multiple modules, each module can have different functions, and the functions of each module are implemented by a processor in a computing device reading and executing instructions in a memory, wherein the structure of the computing device can be as follows Figure 5 The computing device 500 shown in FIG.
[0126] Exemplarily, the neural network model construction device 400 may include a target operator candidate set construction module 401, a neural network model construction module 402, a test module 403 and a weight update module 404. It should be noted that the embodiment of the present application only exemplarily divides the structure and functional modules of the neural network model construction module 400, but does not impose any limitation on its specific division.
[0127] Among them, the target operator candidate set construction module 401 is used to select the target operator from the above-mentioned data storage platform 200 to construct the target operator candidate set according to the hardware constraints of the above-mentioned target hardware platform 300 and the purpose of the neural network model required by the target hardware platform 300. In some embodiments, the target operator candidate set construction module 401 can prompt the user to enter the hardware constraints of the mobile phone 300 and the purpose of the required neural network model in the corresponding input box in a visual manner, and this application does not limit this. It can be understood that after the target operator candidate set is constructed, the target operator candidate set construction module 401 can store it in the following Figure 5 In some embodiments, the method 300 can be implemented on the target operator candidate set construction module 401 .
[0128] The neural network model construction module 402 is used to select operators from the target operator candidate set construction module 401 to construct the above-mentioned first neural network model, and select a second neural network model whose test results meet the preset conditions from the first neural network model according to the test results of the test module 403 on the first neural network model, and determine the target neural network model from the second neural network model. In addition, when there is no second neural network model that meets the preset conditions in the first neural network model, the neural network model construction module 402 is used to select a third neural network model whose test results meet the preset test result conditions from the first neural network model, for example, select a third neural network model whose comprehensive performance score is greater than the preset test result threshold from the first neural network model, and then select the target neural network model from the third neural network model when the number of cycles exceeds the preset number. If the number of cycles does not exceed the preset number, the weight update module 404 is determined according to the number of occurrences of the operator used by the third neural network model to determine whether to update the target operator candidate set constructed by the target operator candidate set construction module 401. Among them, the relevant introduction of the preset conditions, test results, etc. can refer to the relevant description in the above-mentioned method 400, and is not limited here.
[0129] Among them, the weight updating module 404 updates the target operator candidate set, including adding the weight of the operator whose number of occurrences exceeds the preset number in the target operator candidate set or adding the combination operator used by the third neural network model and not appearing in the target operator candidate set to the target operator candidate set. It can be understood that in some embodiments, the weight updating module 404 can also delete the operator whose weight is less than a certain value from the target operator candidate set, which is not limited here.
[0130] In some embodiments, the above method 300 can be executed on a neural network model building device 400.
[0131] Reference now Figure 5 , which is a block diagram of an electronic device 500 according to an embodiment of the present application. The electronic device 500 may include one or more processors 502, a system control logic 508 connected to at least one of the processors 502, a system memory 504 connected to the system control logic 508, a non-volatile memory (NVM) 505 connected to the system control logic 508, and a network interface 510 connected to the system control logic 508.
[0132] The processor 502 may include one or more single-core or multi-core processors. The processor 502 may include any combination of general-purpose processors and special-purpose processors (e.g., graphics processors, application processors, baseband processors, etc.). In the embodiments of the present invention, the processor 502 may be configured to execute the following operations: Figure 3-5 One or more of the various embodiments shown.
[0133] In some embodiments, the system control logic 508 may include any suitable interface controller to provide any suitable interface to at least one of the processors 502 and / or any suitable device or component in communication with the system control logic 508. In some embodiments, the system control logic 508 may include one or more memory controllers to provide an interface to the system memory 504. The system memory 504 may be used to load and store data and / or instructions. In some embodiments, the memory 504 of the electronic device 500 may include any suitable volatile memory, such as a suitable dynamic random access memory (DRAM).
[0134] NVM / storage 505 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, NVM / storage 505 may include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as at least one of a HDD (Hard Disk Drive), a CD (compact Disc) drive, and a DVD (Digital Versatile Disc) drive. NVM / storage 505 may include a portion of storage resources installed on a device of the electronic device 500, or it may be accessible by the device but is not necessarily a part of the device. For example, NVM / storage 505 may be accessed over a network via a network interface 510. In particular, system memory 504 and NVM / storage 505 may include: a temporary copy and a permanent copy of instructions 520, respectively. Instructions 520 may include: when executed by at least one of the processors 502, causing the electronic device 500 to implement such as Figure 3-4 In some embodiments, instructions 520 , hardware, firmware, and / or software components thereof may additionally / alternatively be placed in system control logic 508 , network interface 510 , and / or processor 502 .
[0135] The network interface 510 may include a transceiver for providing a radio interface for the electronic device 500, thereby communicating with any other suitable device (such as a front-end module, an antenna, etc.) through one or more networks. In some embodiments, the network interface 510 may be integrated with other components of the electronic device 500. For example, the network interface 510 may be integrated with at least one of the processor 502, the system memory 504, the NVM / storage 505, and a firmware device (not shown) having instructions, and when at least one of the processors 502 executes the instructions, the electronic device 500 implements one or more of the various embodiments described above.
[0136] The network interface 510 may further include any suitable hardware and / or firmware to provide a multiple-input multiple-output radio interface. For example, the network interface 510 may be a network adapter, a wireless network adapter, a telephone modem and / or a wireless modem.
[0137] In one embodiment, at least one of the processors 502 may be packaged together with logic for one or more controllers of the system control logic 508 to form a system in package (SiP). In one embodiment, at least one of the processors 502 may be integrated on the same die with logic for one or more controllers of the system control logic 508 to form a system on a chip (SoC).
[0138] The electronic device 500 may further include: an input / output (I / O) device 512. The I / O device 512 may include a user interface to enable a user to interact with the electronic device 500; the peripheral component interface is designed so that the peripheral components can also interact with the electronic device 500. In some embodiments, the electronic device 500 also includes a sensor for determining at least one of environmental conditions and location information related to the electronic device 500. In some embodiments, the user interface may include but is not limited to a display (e.g., a liquid crystal display, a touch screen display, etc.), a speaker, a microphone, one or more cameras (e.g., a still image camera and / or a video camera), a flashlight (e.g., a light-emitting diode flash), and a keyboard. In some embodiments, the peripheral component interface may include but is not limited to a non-volatile memory port, an audio jack, and a power interface. In some embodiments, the sensor may include but is not limited to a gyroscope sensor, an accelerometer, a proximity sensor, an ambient light sensor, and a positioning unit. The positioning unit may also be part of the network interface 510 or interact with the network interface 510 to communicate with components of a positioning network (e.g., a global positioning system (GPS) satellite).
[0139] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 500. In other embodiments of the present application, the electronic device 500 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0140] Program code can be applied to input instructions to perform the functions described herein and generate output information. The output information can be applied to one or more output devices in a known manner. For purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
[0141] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described herein is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.
[0142] One or more aspects of at least one embodiment may be implemented by representative instructions stored on a computer-readable storage medium, which represent various logic in a processor, and when the instructions are read by a machine, cause the machine to fabricate logic for performing the techniques described herein. These representations, known as "IP cores," may be stored on a tangible computer-readable storage medium and supplied to multiple customers or manufacturing facilities to load into a manufacturing machine that actually manufactures the logic or processor.
[0143] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned decoding process embodiment implemented in the form of computer program code can be implemented.
[0144] An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above embodiment when executing the computer program product.
[0145] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0146] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0147] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are only schematic, for example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0148] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0149] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for constructing a neural network model, applied to electronic equipment, characterized in that: The method comprises: Determine a target operator candidate set, wherein the target operator candidate set includes at least one operator; Based on preset functional requirements, operators and / or combinations of operators are selected from the target operator candidate set to construct a plurality of first neural network models, Using the test data and the hardware constraints of the electronic device running the target neural network model, the plurality of first neural network models are tested respectively to obtain performance test results corresponding to the respective first neural network models; Based on the comparison result of the performance test result of each first neural network model with the first preset condition, at least one third neural network model is determined from at least one first neural network model whose performance test result does not meet the first preset condition based on the comparison result of the performance test result of the at least one first neural network model with the third preset condition; Determining a target neural network model from the at least one third neural network model; Determining a target neural network model from the at least one third neural network model comprises: Determine whether to update the target operator candidate set according to the number of times the operator or combined operator is used by the third neural network model, and increase the weight of the corresponding operator or combined operator in the target operator candidate set when the number of times the operator or combined operator is used by the third neural network model exceeds a preset number; Delete operators or combination operators whose weights are lower than preset weights in the target operator candidate set.
2. The method according to claim 1, characterized in that The step of determining a target neural network model from a plurality of first neural network models based on a comparison result between a performance test result of each first neural network model and a first preset condition comprises: Based on the comparison result between the performance test result of each first neural network model and the first preset condition, determining at least one second neural network model whose performance test result meets the first preset condition from the plurality of first neural network models; Based on a second preset condition, the target neural network model is determined from at least one of the second neural network models.
3. The method according to claim 2, characterized in that The performance test result includes a comprehensive performance score, and the comparison result based on the performance test result of each first neural network model and the first preset condition, determining at least one second neural network model whose performance test result meets the first preset condition from the multiple first neural network models includes: The neural network model having a comprehensive performance score greater than a first threshold value as a first preset condition is used as the second neural network model, and the determining the target neural network model from at least one of the second neural network models based on the second preset condition comprises: The neural network model with the highest comprehensive performance score among the second neural network models is used as the target neural network model.
4. The method according to claim 1, characterized in that: The step of determining at least one third neural network model based on a comparison result between the performance test result of each first neural network model and the first preset condition, from at least one first neural network model whose performance test result does not satisfy the first preset condition, and based on a comparison result between the performance test result of the at least one first neural network model and the third preset condition, comprises: When the comprehensive performance scores of the first neural network models are all less than a first threshold value serving as a first preset condition, a neural network model having a comprehensive performance score greater than a preset performance test result threshold value is selected from the first neural network models as the third neural network model.
5. The method according to claim 1 or 4, characterized in that: Determining a target neural network model from the at least one third neural network model comprises: Execute N loops to determine the target neural network model, where N is an integer greater than or equal to 1, and each loop includes: According to the third neural network model, updating the target operator candidate set; According to the updated target operator candidate set, multiple first neural network models are constructed using at least one operator or a combination of operators in the target operator candidate set, Using the test data and the hardware constraints of the electronic device running the neural network model, the plurality of first neural network models are tested respectively to obtain performance test results corresponding to the respective first neural network models; Compare the performance test result with the first preset condition, and if there is a neural network model whose performance test result satisfies the first preset condition, terminate the loop and output a second neural network model; In the absence of a neural network model whose performance test results satisfy the first preset condition, the third neural network model is obtained based on the third preset condition, and a new cycle is re-executed based on the obtained third neural network model.
6. The method according to claim 1, characterized in that For the Nth cycle of obtaining at least one third neural network model, when N is equal to a preset threshold, determining a target neural network model from the at least one third neural network model includes: From the third neural network models, the neural network model with the largest comprehensive performance score is selected as the target neural network model.
7. The method according to claim 5, characterized in that The updating of the target operator candidate set according to the third neural network model comprises: When the combination operator used by the third neural network model is a combination operator that has not appeared in the target operator candidate set, the combination operator is added to the target operator candidate set.
8. The method according to claim 1, characterized in that The hardware constraints of the electronic device include the processing capability and storage space of the electronic device.
9. The method according to claim 1, characterized in that: The preset functional requirement is determined according to the function of the neural network model required by the first application installed on the electronic device.
10. The method according to claim 9, characterized in that The first application installed on the electronic device includes a system application of the electronic device, wherein the system application includes a face recognition unlocking application.
11. An image processing method, characterized in that: Applied to electronic equipment, the method comprises: Obtain an image to be recognized; A neural network model is used to identify the image to be identified, wherein the neural network model is obtained by using the neural network model construction method described in any one of claims 1 to 10.
12. A readable medium, characterized in that The readable medium stores instructions, which, when executed on an electronic device, enable the electronic device to execute the method according to any one of claims 1 to 10.
13. An electronic device, characterized in that: include: a memory for storing instructions to be executed by one or more processors of the electronic device, and The processor is one of the processors of the electronic device, and is used to execute the method according to any one of claims 1 to 10.
