WO2023272987A1 - Model recommendation method and apparatus, and device and computer storage medium - Google Patents

Model recommendation method and apparatus, and device and computer storage medium Download PDF

Info

Publication number
WO2023272987A1
WO2023272987A1 PCT/CN2021/121263 CN2021121263W WO2023272987A1 WO 2023272987 A1 WO2023272987 A1 WO 2023272987A1 CN 2021121263 W CN2021121263 W CN 2021121263W WO 2023272987 A1 WO2023272987 A1 WO 2023272987A1
Authority
WO
WIPO (PCT)
Prior art keywords
neural network
model
network model
hardware
library
Prior art date
Application number
PCT/CN2021/121263
Other languages
French (fr)
Chinese (zh)
Inventor
袁坤
余锋伟
Original Assignee
深圳市商汤科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市商汤科技有限公司 filed Critical 深圳市商汤科技有限公司
Publication of WO2023272987A1 publication Critical patent/WO2023272987A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • the present disclosure relates to the field of artificial intelligence, and in particular to a model recommendation method, device, device, and computer storage medium.
  • Embodiments of the present disclosure provide a model recommendation method, device, device, and computer storage medium.
  • An embodiment of the present disclosure provides a model recommendation method, the method comprising:
  • the target attribute parameters of the neural network model running on the first hardware include expected speed values and/or expected accuracy values; based on the first hardware and the target attribute parameters, in the preset neural network model
  • Each neural network model is screened in the library to obtain a neural network model that matches the target attribute parameter; the attribute parameter of each neural network model in the preset neural network model library is obtained in the second hardware test,
  • the second hardware includes the first hardware.
  • the neural network that matches the target attribute parameters can be quickly and accurately determined from the pre-set model library.
  • the network model realizes the automatic recommendation of the model.
  • An embodiment of the present disclosure provides a model recommendation device, including:
  • the acquiring part is configured to acquire target attribute parameters of the neural network model running on the first hardware; the target attribute parameters include expected speed values and/or expected accuracy values;
  • the screening part is configured to screen each neural network model in a preset neural network model library based on the first hardware and the target attribute parameter to obtain a neural network model that matches the target attribute parameter;
  • the attribute parameters of each neural network model in the preset neural network model library are obtained through testing on the second hardware, and the second hardware includes the first hardware.
  • An embodiment of the present disclosure provides a model recommendation device.
  • the model recommendation device includes a processor and a memory storing executable instructions of the processor. When the instructions are executed by the processor, the above-mentioned model is realized. recommended method.
  • An embodiment of the present disclosure provides a computer-readable storage medium, on which a program is stored and applied to a model recommendation device.
  • the program is executed by a processor, the above-mentioned model recommendation method is implemented.
  • An embodiment of the present disclosure provides a computer program, including computer readable codes.
  • the computer readable codes run in an electronic device and are executed by a processor in the electronic device, the above-mentioned model recommendation is implemented. method.
  • An embodiment of the present disclosure provides a computer program product, which, when run on a computer, enables the computer to execute the above-mentioned model recommendation method.
  • the model recommendation device can obtain the target attribute parameters of the neural network model running on the first hardware; the target attribute parameters include expected speed value and/or expected accuracy value; based on the first hardware and target attribute parameters, Each neural network model is screened in the preset neural network model library to obtain a neural network model that matches the target attribute parameter; the attribute parameters of each neural network model in the preset neural network model library are obtained in the second hardware.
  • the test shows that the second hardware includes the first hardware.
  • the target attribute parameters such as the expected speed value and/or the expected accuracy value included in the expected hardware platform environment, it can be quickly and accurately determined from the preset model library that matches the target attribute parameters.
  • the neural network model realizes the automatic recommendation of models, improves the accuracy of model selection, reduces the cost of model trial and error, and further overcomes the defect of long model selection cycle.
  • FIG. 1 is a first schematic diagram of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure
  • FIG. 2 is a second schematic diagram of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of the third implementation process of the model recommendation method proposed by the embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of the fifth implementation flow of the model recommendation method proposed by the embodiment of the present disclosure.
  • FIG. 8 is a schematic diagram of an application scenario of a model recommendation method proposed by an embodiment of the present disclosure.
  • ImageNet-1k Val standard test set a computer vision data set, which is a large-scale image data set established to promote the development of computer image recognition technology, used for training and testing neural network models, and can be used to evaluate the performance of image classification algorithms benchmark.
  • Test accuracy refers to the accuracy index obtained by evaluating the trained network on the standard test set.
  • Calculation amount refers to the number of multiplication and addition calculations required by the model for a given input size image.
  • Running time refers to the running speed of the model on a specific hardware platform.
  • the model recommendation method proposed by the embodiment of the present disclosure is applied to a model recommendation device.
  • the following describes the exemplary application of the model recommendation device proposed by the embodiment of the present disclosure.
  • the model recommendation device proposed by the embodiment of the present disclosure can be implemented as a mobile phone, a notebook computer, a tablet computer, a desktop computer, a smart TV, a vehicle-mounted device, a wearable device, an industrial equipment etc.
  • FIG. 1 is a schematic diagram of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure.
  • the model recommendation device executes the model A recommended approach could include the following steps:
  • the target attribute parameter includes an expected speed value and/or an expected accuracy value.
  • the model recommendation device is configured with a search engine, and the front end of the search engine corresponds to the first interface.
  • the user can configure the performance requirement parameters of the neural network model in the first interface, so as to obtain the performance requirement parameters used to describe the model to be recommended in response to the user's configuration operation in the first interface.
  • the performance requirement parameters used to describe the neural network model matching the target attribute parameters may include target application scenarios and target attribute parameters.
  • the target application scenario at least includes the expected hardware platform environment, that is, the first hardware that supports model deployment and operation.
  • the target attribute parameter includes at least one of an expected speed value and an expected accuracy value
  • the expected accuracy value is the accuracy index obtained when the neural network model matching the target attribute parameter is deployed and tested under the first hardware
  • the expected speed value is the expected computing speed when the model to be recommended is deployed and run under the first hardware, in other words, the running time.
  • each neural network model in the preset neural network model library screen each neural network model in the preset neural network model library to obtain a neural network model that matches the target attribute parameter; each of the preset neural network model libraries
  • the attribute parameters of the neural network model are obtained through testing on the second hardware, and the second hardware includes the first hardware.
  • the model recommendation device may select the target attribute parameter from the preset The neural network model is screened in the established model library.
  • the preset model library is a model library containing a large number of neural network models.
  • the neural network models in this model library cover a wide range, and can be neural network models deployed on mobile terminals, that is, small models on the terminal;
  • the neural network model deployed on the cloud that is, the large model on the cloud, covers a wide range from small models on the end to large models on the cloud.
  • various models different in at least one of type, depth, width, and resolution are covered in the model library.
  • each neural network model in the preset model library is obtained by training through a preset training data set, and each neural network model is tested on a preset testing data set.
  • each neural network model in the preset model library corresponds to a piece of associated information, and a corresponding relationship between the identification of the neural network model and the associated information can be established; wherein, the associated information can represent the neural network model
  • the test results obtained by testing on the preset test data set can associate each neural network model in the model library with its corresponding test results.
  • the model recommendation device is provided with a search engine, and the back-end access of the search engine contains a preset model library with a large number of model structures, and the model recommendation device can use the search engine based on the first hardware including The target attribute parameters of the expected speed value and/or the expected accuracy value are screened for the neural network model in the preset model library connected to the backend.
  • the screening of the neural network model can be performed based on at least one set of associated information; wherein, each set of associated information can be represented under the first hardware, and the model
  • Each neural network model in the library takes a specific batch size (batch size) as input to obtain the calculation speed value and calculation accuracy value after testing.
  • the model library may be searched based on the target attribute parameters under the first platform, and then the neural network model matching the target attribute parameters may be obtained.
  • the first hardware can be a mobile phone terminal.
  • the expected speed value is the upper limit of the running time (in other words, running speed) when the model is running on the mobile phone terminal, and the expected accuracy value is the lower limit of the model’s accuracy when the model is running on the mobile phone terminal.
  • the model recommendation device retrieves and matches the neural network models that can support the deployment and operation of the first hardware from the back-end model library based on the above parameters through the model search engine, so as to determine the neural network model that matches the target attribute parameters.
  • the neural network model matching the target attribute parameter can be presented on a second interface; wherein, the second interface can be the same interface as the first interface, or can be is a different interface.
  • the embodiment of the present disclosure proposes a model recommendation method, by obtaining the target attribute parameters of the neural network model running on the first hardware; the target attribute parameters include the expected speed value and/or the expected accuracy value; based on the first hardware and the target attribute parameters,
  • Each neural network model is screened in the preset neural network model library to obtain a neural network model that matches the target attribute parameter; the attribute parameters of each neural network model in the preset neural network model library are obtained in the second hardware.
  • the test shows that the second hardware includes the first hardware.
  • the target attribute parameters such as the expected speed value and/or the expected accuracy value included in the expected hardware platform environment, it can be quickly and accurately determined from the preset model library that matches the target attribute parameters.
  • the neural network model realizes the automatic recommendation of models, improves the accuracy of model selection, reduces the cost of model trial and error, and further overcomes the defect of long model selection cycle.
  • Fig. 2 is a schematic diagram of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure.
  • the method for screening each neural network model in the model library to obtain a neural network model that matches the target attribute parameters may include the following steps:
  • the target attribute parameter also includes a batch size, that is, the batch size processed by the neural network model when the neural network model is deployed and run under the expected hardware platform environment, ie, the first hardware.
  • At least one batch size can be preset, and each neural network model can be tested with any batch size as input for each neural network model in the model library under any hardware platform environment , so as to obtain the test results corresponding to each neural network model.
  • the test results are the calculation speed values and calculation accuracy values corresponding to each neural network model under any batch size under any hardware platform environment, and then the test results can be The results are correlated with the corresponding neural network model.
  • any preset hardware platform environment may refer to second hardware capable of model deployment, operation and testing, and the first hardware may be one of the second hardware.
  • the neural network model when the neural network model is screened based on the target attribute parameters including batch size, expected speed value and/or expected precision value under the first hardware, the neural network model can be performed based on at least one set of associated information. Screening of network models; wherein, each group of associated information can be characterized under the first hardware, and each neural network model in the model library uses the same batch size (batch size) as an input to obtain the calculation speed value and calculation speed obtained after testing precision value.
  • All candidate models that meet the target attribute parameters that is, the running time is less than the expected speed value and the accuracy is greater than the expected accuracy value, can be determined, and then based on the optimal solution algorithm, such as the Pareto algorithm, it can be determined from these candidate models that can be deployed On the mobile phone terminal, the Pareto optimal neural network model with the least time-consuming movement and the highest precision is used as the neural network model matching the target attribute parameters.
  • the optimal solution algorithm such as the Pareto algorithm
  • the Pareto model with optimal calculation accuracy realizes the automatic recommendation of models, improves the accuracy of model selection, reduces the cost of model trial and error, and further overcomes the defect of long model selection cycle.
  • Fig. 3 is a schematic diagram of the third implementation process of the model recommendation method proposed by the embodiment of the present disclosure.
  • the method for the model recommendation device to perform model recommendation may include the following steps:
  • the model recommendation device may pre-build a model library.
  • the construction of the model library can be realized in the following ways: a large number of neural network structures can be defined first, and these neural network structures are trained and processed to obtain neural network models, and each neural network model is tested and processed to obtain the representation of each neural network. Each test result of the model attribute, and then associate each test result with the corresponding neural network structure, so as to build a model library based on each neural network structure and the association relationship between each neural network structure and the corresponding test result.
  • defining a large number of neural network structures can be implemented in the following manner: a first network structure library including different types of initial neural network structures can be obtained, and by expanding the dimension of the initial neural network structure, the first network The structure library is expanded to obtain a second network structure library; here, the second network structure library contains a large number of neural network structures.
  • the model recommendation device may first obtain the first network structure library, which includes the initial neural network structure, respectively residual neural network (ResNet), dense neural network ( DenseNet), efficient neural network (EfficientNet), mobile terminal neural network (MobileNet), normative neural network (RegNet), etc., these neural network structures can be expanded and transformed in dimension, so as to achieve the first network structure library contained in The neural network structure is expanded to obtain the second network structure library.
  • the first network structure library which includes the initial neural network structure, respectively residual neural network (ResNet), dense neural network ( DenseNet), efficient neural network (EfficientNet), mobile terminal neural network (MobileNet), normative neural network (RegNet), etc.
  • the model recommendation device may perform model training processing on each neural network structure in the expanded second network structure library, so as to obtain a neural network model corresponding to each neural network structure.
  • each neural network structure in the second network structure library can be trained and processed based on a preset training data set, ie, the first data set, according to a unified standard, and then a corresponding neural network model can be obtained.
  • the unified standard may be that each neural network structure follows a unified target loss function and a unified learning rate, which is not specifically limited in this application.
  • each neural network structure in the second network structure library can be trained on the first task type based on the preset training data set, wherein the first task type is not limited to any task type , such as classification tasks, or object detection tasks or image segmentation tasks.
  • the training process of classifying each neural network structure in the second network structure library may be performed based on the preset training data set, so as to obtain the neural network model corresponding to each neural network structure.
  • the training data set performs image segmentation task training processing on each neural network structure in the second network structure library, so as to obtain the neural network model corresponding to each neural network structure.
  • the model recommendation device respectively trains ResNet, DenseNet, and EfficientNet based on the preset training data set to obtain the trained neural network model corresponding to ResNet, the trained neural network model corresponding to DenseNet, and the trained neural network model corresponding to EfficientNet. Model.
  • the model recommendation device can be implemented under a variety of hardware platform environments, that is, a variety of second hardware, including a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) or a mobile phone chip
  • the deployment test of the model is carried out in the mobile phone chip and so on.
  • different batch sizes may be used as input to test each neural network model to obtain a test result.
  • test results here may include the running speed of the model obtained under each second hardware and each batch size as input, that is, the calculation speed value, and the test accuracy of the model, that is, the calculation accuracy value.
  • the test results may also include the amount of parameters of the model and the amount of computation of the model.
  • a corresponding neural network model is obtained, and a A model library with a rich and extensive range of neural network models.
  • Each neural network model is tested to obtain test results, and the identification of each neural network model is further associated with the corresponding test results, so as to quickly detect the neural network model that matches the target attribute parameters based on the association relationship.
  • each initial neural network structure in the first network structure library in at least one dimension to obtain an expanded neural network structure set corresponding to each initial neural network structure; the dimension includes at least one of the following: neural network structure width, depth and resolution.
  • S402. Construct a second network structure library based on each initial neural network structure and the corresponding expanded neural network structure set.
  • the expansion of the network structure library can be realized based on the expansion of each initial neural network structure in different dimensions. expand.
  • the ResNet in the initial neural network structure is expanded and changed in one dimension, that is, the expanded transformation in depth, width, and resolution respectively, to obtain the first ResNet after depth expansion, and the second ResNet after width expansion.
  • the expanded neural network structure set corresponding to each initial neural network structure can be obtained, which can be based on the expanded
  • the set of neural network structures expands the first network structure library to obtain the second network structure library.
  • each neural network model is tested with each batch size as input, and each neural network model is tested in each batch size below is the corresponding calculation speed value and calculation precision value.
  • each neural network model in the model library is tested with each batch size as input, and the running time of each neural network model on each hardware platform is obtained. and precision.
  • the task requirement parameter may refer to the second task type to be processed by the neural network model on the first hardware.
  • the model recommendation device is configured with a creation interface for model creation, and the front end of the creation interface corresponds to the second interface.
  • the user can perform the creation operation of the neural network model on the creation interface, such as specifying the second task type to be processed by the neural network model on the first hardware, and then the model recommendation device can respond to the user's creation operation on the creation interface, and obtain the user Used to describe the second task type to be processed.
  • the second task type may be a classification task; or may also be an object detection task; or may also be an image segmentation task, which is not specifically limited in the present application.
  • the task requirement parameter may also include the number of categories of the neural network model.
  • the output data of each layer of the neural network model is different, and the output data of the middle layer of the neural network model can be obtained, and the output data of the last layer of the neural network model can also be obtained.
  • the user when creating a model, the user can also specify which layer of the model needs to obtain the output data, that is, specify the data output layer of the model, in other words, the depth of the model or the number of categories.
  • the user can create a neural network model on the creation interface, such as specifying the type of task to be processed and the number of categories of the neural network model, and then the model recommendation device can respond to The creation operation of the creation interface by the user obtains the second task type and the corresponding number of categories used to describe the neural network model to be processed on the first hardware.
  • the model when the model is created based on the user's task requirements, according to the specified task type and the neural network structure model to be recommended, if the task type to be processed is different from the preset task type during model training, The neural network model can be further retrained based on new task types and new data sets to achieve fine-tuning of model parameters.
  • Fig. 7 is a schematic diagram of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure VII. As shown in Fig. 7, in the embodiment of the present disclosure, after the model recommendation device obtains the neural network model that matches the target attribute parameters, the method further Can include the following steps:
  • the model recommendation device can predefine the multiple task types supported by each neural network model in the specification model library, and the corresponding input and output formats of each neural network model under each task type, that is, at least one set of tasks Specification information.
  • the at least one set of specification information is at least one task type, and the corresponding input format and output format under each neural network model in the model library.
  • the second task type after obtaining the second task type to be processed on the first hardware for describing the neural network model matching the target attribute parameter, based on the second task type and at least one set of task specification information, Determine the input and output formats of the model under the second task type, and then standardize the input and output formats of the neural network model that match the target attribute parameters, so as to further construct the target neural network model that supports the second task type.
  • the task type and input and output formats of each neural network model can be adjusted.
  • specification definition where at least one set of task specification information can be implemented in the following ways:
  • classification tasks For example, classification tasks, object detection tasks, image classification tasks, etc.
  • the classification task is standardized, given the specified input, and the returned output format is a fixed-length two-dimensional vector, which can support the use of classifiers for category determination.
  • FIG. 8 is a schematic diagram of the application scenario of the model recommendation method proposed by the embodiment of the present disclosure.
  • the model The library contains 11 types of neural network models, including resnet, regnet, bignas, bignas, dmcp, shufflenet_v2, mobilenet_v2, oneshot_supcell, crnas_resnet, efficient, and netmobilenet_v3.
  • the structure of each neural network model can be adjusted in width, By expanding at least one of the dimensions of depth and resolution, a set of neural network models corresponding to each type can be obtained.
  • neural network models of the same type but different dimensional structures such as resnet18c_ ⁇ 0_25, resnet18c_ ⁇ 0.5, resnet18c_ ⁇ 0_125, and dmcp_resnet18_47M can be obtained.
  • the extensions of corresponding structures of other types of neural network models are similar, and will not be repeated here.
  • the target attribute parameters based on the GPU hardware platform for example, the running time is 1ms.
  • the accuracy is 60%.
  • the multiple neural network models are all candidate models that satisfy the requirement that the running time is less than 1ms and the accuracy is greater than 60%. Further, the fastest and best accuracy can be determined from these candidate models based on the Pareto optimal solution method.
  • the Pareto model that is, the neural network model bignas_resnet18_492M corresponding to the points on the Pareto curve.
  • FIG. 9 is a schematic diagram of the composition and structure of the model recommendation device proposed by the embodiment of the present disclosure.
  • the model recommendation device 10 includes an acquisition part 11, a screening Part 12, extension part 13, training part 14, testing part 15, association part 16, determination part 17.
  • the acquiring part 11 is configured to acquire target attribute parameters of the neural network model running on the first hardware; the target attribute parameters include expected speed values and/or expected accuracy values;
  • the screening part 12 is configured to screen each neural network model in a preset neural network model library based on the first hardware and the target attribute parameter to obtain a neural network model that matches the target attribute parameter;
  • the attribute parameters of each neural network model in the preset neural network model library are obtained through testing on the second hardware, and the second hardware includes the first hardware.
  • the target attribute parameter further includes a batch amount processed by the neural network model based on the first hardware
  • the screening part 12 is further configured to be based on the first hardware, the batch quantity, the target attribute parameter, and screen each neural network model in the preset neural network model library to obtain a Pareto model; wherein, the Pareto model is to satisfy the desired speed value and/or Or a neural network model with an expected accuracy value and optimal calculation speed and calculation accuracy; and determining the Pareto model as a neural network model that matches the target attribute parameter.
  • the obtaining part 11 is configured to obtain a first network structure library, and the first network structure library includes different types of initial neural network structures.
  • the training part 14 is configured to perform training processing on each neural network structure in the second network structure library based on the first data set to obtain corresponding neural network models.
  • the testing part 15 is configured to test each of the neural network models by using each of the batch sizes as input under each of the second hardware to obtain the neural network models.
  • the calculation speed value and calculation accuracy value of the network model are configured to test each of the neural network models by using each of the batch sizes as input under each of the second hardware to obtain the neural network models.
  • the expansion part 13 is configured to perform expansion processing on each initial neural network structure in the first network structure library in at least one dimension, to obtain the expanded neural network structure corresponding to each initial neural network structure.
  • the set of neural network structures; the dimension includes at least one of the following: the width, depth and resolution of the neural network structure; and based on each initial neural network structure and the corresponding expanded neural network structure set, construct the Describe the second network structure library.
  • the training part 14 is configured to use the first data set to train each neural network structure in the second network structure library based on the preset first task type to obtain the corresponding Each neural network model of .
  • the testing part 15 is configured to extract at least one batch size from a preset test data set; and determine at least one preset second hardware; and in each of the second Under the hardware, for each neural network model in the model library, each neural network model is tested with each of the batch sizes as input, and each neural network model is tested under each of the batch sizes. Corresponding calculation speed value and calculation accuracy value.
  • the acquisition part 11 is configured to acquire the second task type to be processed by the neural network model on the first hardware after obtaining the neural network model that matches the target attribute parameter .
  • the training part 14 is configured to, in the case that the second task type does not match the first task type, based on the second data set corresponding to the second task type, pair the The neural network model is retrained to fine-tune the parameters of the neural network model.
  • the determining part 17 is configured to determine a preset task type; wherein, the preset task type includes at least the first task type and the second task type; and based on each one of the task types and its corresponding input format and output format, and confirm the input format and output format of each neural network model in the preset neural network model library.
  • the above-mentioned processor 21 may be an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a digital signal processor (Digital Signal Processor, DSP), a digital signal processing device (Digital Signal Processing Device, DSPD ), Programmable Logic Device (ProgRAMmable Logic Device, PLD), Field Programmable Gate Array (Field Prog RAMmable Gate Array, FPGA), Central Processing Unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor at least one of the It can be understood that, for different devices, the electronic device used to implement the above processor function may also be other, which is not specifically limited in this embodiment of the present disclosure.
  • ASIC Application Specific Integrated Circuit
  • DSP Digital Signal Processor
  • DSPD Digital Signal Processing Device
  • PLD Programmable Logic Device
  • Field Programmable Gate Array Field Programmable Gate Array
  • CPU Central Processing Unit
  • controller microcontroller, microprocessor at least one of the electronic device used to implement the above processor function may also be other, which is not specifically limited in this embodiment of the
  • the living body detection device 20 may also include a memory 22, which may be connected to the processor 21, wherein the memory 22 is used to store executable program codes, the program codes include computer operation instructions, and the memory 22 may include a high-speed RAM memory, or may Also included is non-volatile memory, eg, at least two disk memories.
  • the bus 24 is used to connect the communication interface 23 , the processor 21 and the memory 22 and communicate with each other among these devices.
  • the above-mentioned processor 21 is configured to acquire a target application scenario and a target index value used to describe a neural network model that matches the target attribute parameters, and the target application scenario includes at least: expected hardware platform environment; the target index value includes at least an expected speed value and/or an expected accuracy value; based on the target application scenario and the target index value, each neural network model in the preset model library is screened, Obtain the neural network model that matches the target attribute parameter; the neural network model that matches the target attribute parameter is that the test result obtained by testing under the expected hardware platform environment meets the target index value, and the calculation speed and Calculate the neural network model with optimal accuracy.
  • the above-mentioned memory 22 can be a volatile memory (volatile memory), such as a random access memory (Random-Access Memory, RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (Read-Only Memory, ROM), flash memory (flash memory), hard disk (Hard Disk Drive, HDD) or solid-state drive (Solid-State Drive, SSD); Provide instructions and data.
  • volatile memory such as a random access memory (Random-Access Memory, RAM)
  • non-volatile memory such as a read-only memory (Read-Only Memory, ROM), flash memory (flash memory), hard disk (Hard Disk Drive, HDD) or solid-state drive (Solid-State Drive, SSD); Provide instructions and data.
  • each functional module in this embodiment may be integrated into one recommendation unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software function modules.
  • An embodiment of the present disclosure provides a model recommendation device, which can pre-build a target model library; where the target model library is used to characterize the correspondence between candidate models, software attribute parameters, and hardware attribute parameters; and then receive In the case of a recommendation request to a model; wherein, the recommendation request carries recommended software attribute parameters and recommended hardware attribute parameters; the target model library is searched and processed according to the recommended software attribute parameters and recommended hardware attribute parameters, and then the target recommendation model is obtained.
  • the target model library that contains rich model structures and rich model attributes, it is possible to automatically search for a suitable recommended model in the target model library according to the specified model recommendation requirements, realizing automatic model recommendation and improving the efficiency of model selection. Accuracy reduces the cost of model trial and error, and further overcomes the defect of long model selection cycle. .
  • the neural network model matched with the target attribute parameter is a neural network model whose test results obtained by testing under the expected hardware platform environment meet the target index value, and whose calculation speed and calculation accuracy are optimal.
  • an embodiment of the present disclosure further provides a computer program product, where the computer program product includes computer-executable instructions, and the computer-executable instructions are used to implement the steps in the model recommendation method proposed by the embodiments of the present disclosure.
  • the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Accordingly, the present disclosure may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, optical storage, etc.) having computer-usable program code embodied therein.
  • a computer-usable storage media including but not limited to disk storage, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions
  • the device realizes the function specified in implementing one or more procedures of the flowchart and/or one or more blocks of the block diagram.
  • the target attribute parameters of the neural network model running on the first hardware include the expected speed value and/or the expected accuracy value; based on the first hardware and the target attribute parameters, in the preset neural network
  • Each neural network model is screened in the model library to obtain a neural network model that matches the target attribute parameters; the attribute parameters of each neural network model in the preset neural network model library are obtained from the second hardware test, and the second hardware Includes first hardware. Realized the automatic recommendation of the model.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Molecular Biology (AREA)
  • Computational Linguistics (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Mathematical Physics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Image Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Provided in the present disclosure are a model recommendation method and apparatus, and a device and a computer storage medium. The model recommendation method comprises: acquiring a target attribute parameter of a neural network model, which runs in first hardware, wherein the target attribute parameter comprises a desired speed value and/or a desired precision value; and on the basis of the first hardware and the target attribute parameter, screening each neural network model in a preset neural network model library, so as to obtain a neural network model which matches the target attribute parameter, wherein an attribute parameter of each neural network model in the preset neural network model library is obtained by performing a test in second hardware, and the second hardware comprises the first hardware. Therefore, automatic model recommendation is realized.

Description

模型推荐方法及装置、设备、计算机存储介质Model recommendation method and device, equipment, computer storage medium
相关申请的交叉引用Cross References to Related Applications
本公开基于申请号为202110730001.1、申请日为2021年06月29日、申请名称为“模型推荐方法及装置、设备、计算机存储介质”的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本公开作为参考。This disclosure is based on the Chinese patent application with the application number 202110730001.1, the application date is June 29, 2021, and the application name is "model recommendation method and device, equipment, computer storage medium", and claims the priority of the Chinese patent application. The entire content of this Chinese patent application is hereby incorporated by reference into this disclosure.
技术领域technical field
本公开涉及人工智能领域,尤其涉及一种模型推荐方法及装置、设备、计算机存储介质。The present disclosure relates to the field of artificial intelligence, and in particular to a model recommendation method, device, device, and computer storage medium.
背景技术Background technique
随着人工智能的快速发展,深度学习技术成功的被应用于计算机视觉领域。使得对图像的特征提取从传统的手工设计转变为根据数据进行自动提取,极大的提高了图像特征的鲁棒性和识别的准确性。在这其中,模型的设计起到了至关重要的作用。With the rapid development of artificial intelligence, deep learning technology has been successfully applied to the field of computer vision. It makes the feature extraction of the image change from traditional manual design to automatic extraction based on data, which greatly improves the robustness of image features and the accuracy of recognition. Among them, the design of the model plays a crucial role.
由于针对同一任务,基于不同模型所能达到的任务处理效果是存在差异的,因此,对于特定任务选取合适的模型具有重要的意义。然而,相关技术中在进行模型的选择时,往往是工程人员基于工作经验进行选择,选择难度高、准确性较差,使得模型的试错成本较高,进而导致了模型的选择周期较长的缺陷。Since different models can achieve different task processing effects for the same task, it is of great significance to select an appropriate model for a specific task. However, in related technologies, when selecting a model, engineers often choose based on work experience, which is difficult to select and has poor accuracy, which makes the trial and error cost of the model higher, which in turn leads to a longer cycle of model selection. defect.
发明内容Contents of the invention
本公开实施例提供一种模型推荐方法及装置、设备、计算机存储介质。Embodiments of the present disclosure provide a model recommendation method, device, device, and computer storage medium.
本公开的技术方案是这样实现的:The disclosed technical solution is achieved in this way:
本公开实施例提供一种模型推荐方法,所述方法包括:An embodiment of the present disclosure provides a model recommendation method, the method comprising:
获取在第一硬件运行的神经网络模型目标属性参数;所述目标属性参数包括期望速度值和/或期望精度值;基于所述第一硬件和所述目标属性参数,在预设的神经网络模型库中对各神经网络模型进行筛选,得到与所述目标属性参数相匹配的神经网络模型;所述预设的神经网络模型库中的各神经网络模型的属性参数为在第二硬件测试得到,所述第二硬件包括所述第一硬件。Obtaining the target attribute parameters of the neural network model running on the first hardware; the target attribute parameters include expected speed values and/or expected accuracy values; based on the first hardware and the target attribute parameters, in the preset neural network model Each neural network model is screened in the library to obtain a neural network model that matches the target attribute parameter; the attribute parameter of each neural network model in the preset neural network model library is obtained in the second hardware test, The second hardware includes the first hardware.
这样,在给定期望的硬件平台环境下包括的期望的速度值和期望的精度值等目标属性参数之后,便可以从预先设置的模型库中快速且准确的确定出与目标属性参数匹配的神经网络模型,实现了模型的自动化推荐。In this way, after the target attribute parameters such as the expected speed value and the expected accuracy value are given under the expected hardware platform environment, the neural network that matches the target attribute parameters can be quickly and accurately determined from the pre-set model library. The network model realizes the automatic recommendation of the model.
本公开实施例提供一种模型推荐装置,包括:An embodiment of the present disclosure provides a model recommendation device, including:
获取部分,配置为获取在第一硬件运行的神经网络模型目标属性参数;所述目标属性参数包括期望速度值和/或期望精度值;The acquiring part is configured to acquire target attribute parameters of the neural network model running on the first hardware; the target attribute parameters include expected speed values and/or expected accuracy values;
筛选部分,配置为基于所述第一硬件和所述目标属性参数,在预设的神经网络模型库中对各神经网络模型进行筛选,得到与所述目标属性参数相匹配的神经网络模型;所述预设的神经网络模型库中的各神经网络模型的属性参数为在第二硬件测试得到,所述第二硬件包括所述第一硬件。The screening part is configured to screen each neural network model in a preset neural network model library based on the first hardware and the target attribute parameter to obtain a neural network model that matches the target attribute parameter; The attribute parameters of each neural network model in the preset neural network model library are obtained through testing on the second hardware, and the second hardware includes the first hardware.
本公开实施例提供一种模型推荐设备,所述模型推荐设备包括处理器、存储有所述处理器可执行指令的存储器,当所述指令被所述处理器执行时,实现如上所述的模型推荐方法。An embodiment of the present disclosure provides a model recommendation device. The model recommendation device includes a processor and a memory storing executable instructions of the processor. When the instructions are executed by the processor, the above-mentioned model is realized. recommended method.
本公开实施例提供一种计算机可读存储介质,其上存储有程序,应用于模型推荐设备中,所述程序被处理器执行时,实现如上所述的模型推荐方法。An embodiment of the present disclosure provides a computer-readable storage medium, on which a program is stored and applied to a model recommendation device. When the program is executed by a processor, the above-mentioned model recommendation method is implemented.
本公开实施例提供一种计算机程序,包括计算机可读代码,在所述计算机可读代码在电子设备中运行,被所述电子设备中的处理器执行的情况下,实现如上所述的模型推荐方法。An embodiment of the present disclosure provides a computer program, including computer readable codes. When the computer readable codes run in an electronic device and are executed by a processor in the electronic device, the above-mentioned model recommendation is implemented. method.
本公开实施例提供一种计算机程序产品,当其在计算机上运行时,使得计算机执行如上所述的模型推荐方法。An embodiment of the present disclosure provides a computer program product, which, when run on a computer, enables the computer to execute the above-mentioned model recommendation method.
本公开实施例提出的技术方案,模型推荐设备可以获取在第一硬件运行的神经网络模型目标属性参数;目标属性参数包括期望速度值和/或期望精度值;基于第一硬件和目标属性参数,在预设的神经网络模型库中对各神经网络模型进行筛选,得到与目标属性参数相匹配的神经网络模型;预设的神经网络模型库中的各神经网络模型的属性参数为在第二硬件测试得到,第二硬件包括第一硬件。如此,在给定期望的硬件平台环境下包括的期望的速度值和/或期望的精度值等目标属性参数之后,便可以从预先设置的模型库中快速且准确的确定出与目标属性参数匹配的神经网络模型,实现了模型的自动化推荐,提高了模型选择的准确性,降低了模型试错成本,进一步克服了模型选择周期较长的缺陷。According to the technical solution proposed by the embodiments of the present disclosure, the model recommendation device can obtain the target attribute parameters of the neural network model running on the first hardware; the target attribute parameters include expected speed value and/or expected accuracy value; based on the first hardware and target attribute parameters, Each neural network model is screened in the preset neural network model library to obtain a neural network model that matches the target attribute parameter; the attribute parameters of each neural network model in the preset neural network model library are obtained in the second hardware The test shows that the second hardware includes the first hardware. In this way, after the target attribute parameters such as the expected speed value and/or the expected accuracy value included in the expected hardware platform environment, it can be quickly and accurately determined from the preset model library that matches the target attribute parameters. The neural network model realizes the automatic recommendation of models, improves the accuracy of model selection, reduces the cost of model trial and error, and further overcomes the defect of long model selection cycle.
附图说明Description of drawings
图1为本公开实施例提出的模型推荐方法的实现流程示意图一;FIG. 1 is a first schematic diagram of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure;
图2为本公开实施例提出的模型推荐方法的实现流程示意图二;FIG. 2 is a second schematic diagram of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure;
图3为本公开实施例提出的模型推荐方法的实现流程示意图三;FIG. 3 is a schematic diagram of the third implementation process of the model recommendation method proposed by the embodiment of the present disclosure;
图4为本公开实施例提出的模型推荐方法的实现流程示意图四;FIG. 4 is a schematic diagram 4 of the implementation flow of the model recommendation method proposed by the embodiment of the present disclosure;
图5为本公开实施例提出的模型推荐方法的实现流程示意图五;FIG. 5 is a schematic diagram of the fifth implementation flow of the model recommendation method proposed by the embodiment of the present disclosure;
图6为本公开实施例提出的模型推荐方法的实现流程示意图六;FIG. 6 is a sixth schematic diagram of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure;
图7为本公开实施例提出的模型推荐方法的实现流程示意图七;FIG. 7 is a schematic diagram of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure VII;
图8为本公开实施例提出的模型推荐方法的应用场景示意图;FIG. 8 is a schematic diagram of an application scenario of a model recommendation method proposed by an embodiment of the present disclosure;
图9为本公开实施例提出的模型推荐装置的组成结构示意图;FIG. 9 is a schematic diagram of the composition and structure of a model recommendation device proposed by an embodiment of the present disclosure;
图10为本公开实施例提出的模型推荐设备的组成结构示意图。FIG. 10 is a schematic diagram of the composition and structure of a model recommendation device proposed by an embodiment of the present disclosure.
具体实施方式detailed description
为了使本公开的目的、技术方案和优点更加清楚,下面将结合附图对本公开作进一步地详细描述,所描述的实施例不应视为对本公开的限制,本领 域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本公开保护的范围。In order to make the purpose, technical solutions and advantages of the present disclosure clearer, the present disclosure will be further described in detail below in conjunction with the accompanying drawings. All other embodiments obtained under the premise of creative labor belong to the protection scope of the present disclosure.
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。In the following description, references to "some embodiments" describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or a different subset of all possible embodiments, and Can be combined with each other without conflict.
在以下的描述中,所涉及的术语“第一\第二\第三”仅仅是是区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本公开实施例能够以除了在这里图示或描述的以外的顺序实施。In the following description, the term "first\second\third" is only used to distinguish similar objects, and does not represent a specific ordering of objects. Understandably, "first\second\third" Where permitted, the specific order or sequencing may be interchanged such that the embodiments of the disclosure described herein can be practiced in sequences other than those illustrated or described herein.
除非另有定义,本文所使用的所有的技术和科学术语与属于本公开的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本公开实施例的目的,不是旨在限制本公开。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs. The terms used herein are only for the purpose of describing the embodiments of the present disclosure, and are not intended to limit the present disclosure.
对本公开实施例进行进一步详细说明之前,对本公开实施例中涉及的名词和术语进行说明,本发明实施例中涉及的名词和术语适用于如下的解释。Before the embodiments of the present disclosure are further described in detail, the nouns and terms involved in the embodiments of the present disclosure will be described, and the nouns and terms involved in the embodiments of the present invention are applicable to the following explanations.
1)ImageNet-1k Val标准测试集:一个计算机视觉数据集,是为了促进计算机图像识别技术的发展而设立的一个大型图像数据集,用于训练和测试神经网络模型,可作为评估图像分类算法性能的基准。1) ImageNet-1k Val standard test set: a computer vision data set, which is a large-scale image data set established to promote the development of computer image recognition technology, used for training and testing neural network models, and can be used to evaluate the performance of image classification algorithms benchmark.
2)测试精度:指在标准测试集上对训练好的网络进行评测所得到的精度指标。2) Test accuracy: refers to the accuracy index obtained by evaluating the trained network on the standard test set.
3)参数量:指模型所包含的可学习的参数数量。3) Parameter quantity: refers to the number of learnable parameters contained in the model.
4)计算量:指模型对给定输入大小图像所需要的乘加计算次数。4) Calculation amount: refers to the number of multiplication and addition calculations required by the model for a given input size image.
5)运行耗时:指在特定硬件平台上模型的运行速度。5) Running time: refers to the running speed of the model on a specific hardware platform.
6)帕累托(Pareto)算法:一种多目标优化算法,在现实生活中存在很多的问题都是由互相冲突和影响的多个目标组成,这些目标不可能同时达到最优的状态,多目标优化是指在约束条件下有两个或两个以上优化目标,且这些目标相互矛盾,一个目标往往以牺牲另一个目标为代价,可利用帕累托算法求解出帕累托最优解。6) Pareto algorithm: a multi-objective optimization algorithm. Many problems in real life are composed of multiple goals that conflict and influence each other. These goals cannot reach the optimal state at the same time. Objective optimization means that there are two or more optimization objectives under constraint conditions, and these objectives are contradictory. One objective is often at the expense of the other objective, and the Pareto algorithm can be used to solve the Pareto optimal solution.
随着人工智能的快速发展,深度学习技术成功的被应用于计算机视觉领域。使得对图像的特征提取从传统的手工设计转变为根据数据进行自动提取,极大的提高了图像特征的鲁棒性和识别的准确性。在这其中,神经网络的结构/模型的设计起到了至关重要的作用。With the rapid development of artificial intelligence, deep learning technology has been successfully applied to the field of computer vision. It makes the feature extraction of the image change from traditional manual design to automatic extraction based on data, which greatly improves the robustness of image features and the accuracy of recognition. Among them, the design of the structure/model of the neural network plays a crucial role.
由于针对同一任务,基于不同模型所能达到的任务处理效果是存在差异的,因此,对于特定任务选取合适的模型具有重要的意义。并且由于模型的选择与诸多参数相关,在模型的选择时需要综合考虑这些因素进行推荐。然而,相关技术中在进行模型的选择时,不仅模型结构较为有限,而且与实际脱节,只考虑参数量和计算量等有限的软件属性参数,同时模型结构普遍为单一任务支持,灵活性差。甚至于模型的选择往往也是工程人员基于工作经验进行选择,使得模型选择难度高、准确性较差,模型的试错成本较高,进而导致了模型的选择周期较长的缺陷。Since different models can achieve different task processing effects for the same task, it is of great significance to select an appropriate model for a specific task. And because the selection of the model is related to many parameters, it is necessary to consider these factors comprehensively when selecting the model for recommendation. However, when selecting a model in related technologies, not only the model structure is relatively limited, but also out of touch with reality, and only limited software attribute parameters such as parameter amount and calculation amount are considered. At the same time, the model structure is generally supported by a single task, which has poor flexibility. Even the selection of models is often made by engineers based on work experience, which makes model selection difficult, poor accuracy, and high trial and error costs for models, which in turn leads to the defect of a long model selection cycle.
鉴于此,如何实现高效的模型选择是亟待解决的问题,是本公开实施例所要讨论的内容,下面将结合以下具体实施例进行阐述。In view of this, how to realize efficient model selection is an urgent problem to be solved, which is the content to be discussed in the embodiments of the present disclosure, and will be described below in conjunction with the following specific embodiments.
本公开实施例提供一种模型推荐方法及装置、设备、计算机存储介质,在给定期望的硬件平台环境下包括的期望的速度值和/或期望的精度值等目标属性参数之后,便可以从预先设置的模型库中快速且准确的确定出与目标属性参数匹配的神经网络模型,实现了模型的自动化推荐,提高了模型选择的准确性,降低了模型试错成本,进一步克服了模型选择周期较长的缺陷。Embodiments of the present disclosure provide a model recommendation method, device, device, and computer storage medium. After the target attribute parameters such as the expected speed value and/or the expected accuracy value are given under the expected hardware platform environment, it can be obtained from Quickly and accurately determine the neural network model that matches the target attribute parameters in the pre-set model library, realize the automatic recommendation of the model, improve the accuracy of model selection, reduce the cost of model trial and error, and further overcome the model selection cycle longer flaws.
本公开实施例提出的模型推荐方法应用于模型推荐设备中。下面说明本公开实施例提出的模型推荐设备的示例性应用,本公开实施例提出的模型推荐设备可以实施为手机、笔记本电脑,平板电脑,台式计算机,智能电视、车载设备、可穿戴设备、工业设备等。The model recommendation method proposed by the embodiment of the present disclosure is applied to a model recommendation device. The following describes the exemplary application of the model recommendation device proposed by the embodiment of the present disclosure. The model recommendation device proposed by the embodiment of the present disclosure can be implemented as a mobile phone, a notebook computer, a tablet computer, a desktop computer, a smart TV, a vehicle-mounted device, a wearable device, an industrial equipment etc.
下面,将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述。In the following, the technical solutions in the embodiments of the present disclosure will be clearly and completely described with reference to the drawings in the embodiments of the present disclosure.
本公开一实施例提供了一种模型推荐方法,图1为本公开实施例提出的模型推荐方法的实现流程示意图一,如图1所示,在本公开的实施例中,模型推荐设备执行模型推荐的方法可以包括以下步骤:An embodiment of the present disclosure provides a model recommendation method. FIG. 1 is a schematic diagram of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure. As shown in FIG. 1 , in the embodiment of the present disclosure, the model recommendation device executes the model A recommended approach could include the following steps:
S100、获取在第一硬件运行的神经网络模型目标属性参数;目标属性参数包括期望速度值和/或期望精度值。S100. Obtain a target attribute parameter of the neural network model running on the first hardware; the target attribute parameter includes an expected speed value and/or an expected accuracy value.
在一些实施例中,模型推荐设备设置搜索引擎,该搜索引擎的前端对应第一界面。其中,用户可以在第一界面中进行神经网络模型的性能需求参数的配置操作,从而响应于用户在第一界面中的配置操作,获取用于描述待推荐模型的性能需求参数。In some embodiments, the model recommendation device is configured with a search engine, and the front end of the search engine corresponds to the first interface. Wherein, the user can configure the performance requirement parameters of the neural network model in the first interface, so as to obtain the performance requirement parameters used to describe the model to be recommended in response to the user's configuration operation in the first interface.
在一些实施例中,用于描述与目标属性参数匹配的神经网络模型的性能需求参数可以包括目标应用场景和目标属性参数。In some embodiments, the performance requirement parameters used to describe the neural network model matching the target attribute parameters may include target application scenarios and target attribute parameters.
其中,目标应用场景至少包括期望的硬件平台环境即支持进行模型部署运行的第一硬件。Wherein, the target application scenario at least includes the expected hardware platform environment, that is, the first hardware that supports model deployment and operation.
其中,目标属性参数至少包括期望的速度值和期望的精度值中的至少一项,期望的精度值即与目标属性参数匹配的神经网络模型在第一硬件下进行部署测试时获得的精度指标,期望的速度值即待推荐模型的在第一硬件下部署运行时期望的计算速度,换言之运行耗时。Wherein, the target attribute parameter includes at least one of an expected speed value and an expected accuracy value, and the expected accuracy value is the accuracy index obtained when the neural network model matching the target attribute parameter is deployed and tested under the first hardware, The expected speed value is the expected computing speed when the model to be recommended is deployed and run under the first hardware, in other words, the running time.
也就是说,在本公开实施例中,响应于用户在第一界面的配置操作,可以至少获取用户指定在第一硬件部署运行的神经网络模型的目标属性参数,包括期望的速度值和期望的精度值中的至少一项。That is to say, in the embodiment of the present disclosure, in response to the user's configuration operation on the first interface, at least the target attribute parameters of the neural network model specified by the user to run on the first hardware deployment can be obtained, including the expected speed value and expected At least one of the precision values.
S110、基于第一硬件和目标属性参数,在预设的神经网络模型库中对各神经网络模型进行筛选,得到与目标属性参数相匹配的神经网络模型;预设的神经网络模型库中的各神经网络模型的属性参数为在第二硬件测试得到,第二硬件包括第一硬件。S110. Based on the first hardware and the target attribute parameters, screen each neural network model in the preset neural network model library to obtain a neural network model that matches the target attribute parameter; each of the preset neural network model libraries The attribute parameters of the neural network model are obtained through testing on the second hardware, and the second hardware includes the first hardware.
在本公开实施例中,在获取到用户指定的第一硬件下的目标属性参数,即期望的速度值和期望的精度值中的至少一项之后,模型推荐设备可以基于 该目标属性参数从预设的模型库中进行神经网络模型的筛选。In an embodiment of the present disclosure, after obtaining the target attribute parameter under the first hardware specified by the user, that is, at least one of the expected speed value and the expected accuracy value, the model recommendation device may select the target attribute parameter from the preset The neural network model is screened in the established model library.
应理解,预设的模型库为包含大量神经网络模型的模型库,该模型库中的神经网络模型覆盖范围较为广泛,可以是移动端部署的神经网络模型,即端上小模型;也可以是云端部署的神经网络模型,即云上大模型,覆盖了从端上小模型至云上大模型的广泛范围。另外,模型库中涵盖了在类型、深度、宽度以及分辨率中的至少一项上不同的各种模型。It should be understood that the preset model library is a model library containing a large number of neural network models. The neural network models in this model library cover a wide range, and can be neural network models deployed on mobile terminals, that is, small models on the terminal; The neural network model deployed on the cloud, that is, the large model on the cloud, covers a wide range from small models on the end to large models on the cloud. In addition, various models different in at least one of type, depth, width, and resolution are covered in the model library.
其中,预设的模型库中的各神经网络模型为经预设训练数据集进行训练获得的,且在预设测试数据集对各神经网络模型进行测试。Wherein, each neural network model in the preset model library is obtained by training through a preset training data set, and each neural network model is tested on a preset testing data set.
在一些实施例中,预设的模型库中的每一神经网络模型都对应一关联信息,可以建立神经网络模型的标识与该关联信息的对应关系;其中,该关联信息可以表征该神经网络模型在预设测试数据集进行测试获得的测试结果,即可以对模型库中的各神经网络模型与其对应的测试结果进行关联。In some embodiments, each neural network model in the preset model library corresponds to a piece of associated information, and a corresponding relationship between the identification of the neural network model and the associated information can be established; wherein, the associated information can represent the neural network model The test results obtained by testing on the preset test data set can associate each neural network model in the model library with its corresponding test results.
其中,可以针对模型库中各神经网络模型,在任一预设硬件平台环境下进行部署测试,从而得到各神经网络模型对应的测试结果,该测试结果即针对任一硬件平台环境下,各神经网络模型对应的计算速度值和计算精度值,进而可以将该测试结果与对应的神经网络模型进行关联。Among them, each neural network model in the model library can be deployed and tested in any preset hardware platform environment, so as to obtain the corresponding test results of each neural network model. The calculation speed value and calculation accuracy value corresponding to the model, and then the test result can be associated with the corresponding neural network model.
这里,任一预设硬件平台环境可以指能够进行模型部署运行及测试的第二硬件,第一硬件可以是该第二硬件中的其中一种。Here, any preset hardware platform environment may refer to second hardware capable of model deployment, operation and testing, and the first hardware may be one of the second hardware.
在一些实施例中,模型推荐设备设置有搜索引擎,该搜索引擎的后端接入包含具有大量模型结构的预设的模型库,模型推荐设备可以通过该搜索引擎,基于第一硬件下的包括期望的速度值和或期望的精度值的目标属性参数在后端接入的预设的模型库中进行神经网络模型的筛选处理。In some embodiments, the model recommendation device is provided with a search engine, and the back-end access of the search engine contains a preset model library with a large number of model structures, and the model recommendation device can use the search engine based on the first hardware including The target attribute parameters of the expected speed value and/or the expected accuracy value are screened for the neural network model in the preset model library connected to the backend.
其中,在基于第一硬件下的目标属性参数进行待推荐模型的筛选时,可以基于至少一组关联信息进行神经网络模型的筛选;其中,每一组关联信息可以表征在第一硬件下,模型库中的各神经网络模型以特定批次大小(批次量)作为输入经过测试得到的计算速度值以及计算精度值。Wherein, when screening the model to be recommended based on the target attribute parameters under the first hardware, the screening of the neural network model can be performed based on at least one set of associated information; wherein, each set of associated information can be represented under the first hardware, and the model Each neural network model in the library takes a specific batch size (batch size) as input to obtain the calculation speed value and calculation accuracy value after testing.
在本公开实施例的一实施方式中,可以是在第一平台下基于目标属性参数对模型库进行检索,进而获取到与目标属性参数匹配的神经网络模型。In an implementation manner of the embodiment of the present disclosure, the model library may be searched based on the target attribute parameters under the first platform, and then the neural network model matching the target attribute parameters may be obtained.
例如,第一硬件可以是手机移动端,期望的速度值即模型在手机移动端运行时的运行耗时上限(换言之运行速度),期望的精度值即模型在手机移动端运行时模型的精度下限,模型推荐设备通过模型搜索引擎从后端模型库中基于上述参数在可支持在第一硬件部署运行的神经网络模型中进行检索匹配,便可以确定出与目标属性参数匹配的神经网络模型。For example, the first hardware can be a mobile phone terminal. The expected speed value is the upper limit of the running time (in other words, running speed) when the model is running on the mobile phone terminal, and the expected accuracy value is the lower limit of the model’s accuracy when the model is running on the mobile phone terminal. The model recommendation device retrieves and matches the neural network models that can support the deployment and operation of the first hardware from the back-end model library based on the above parameters through the model search engine, so as to determine the neural network model that matches the target attribute parameters.
在一些实施例中,在确定出与目标属性参数匹配的神经网络模型之后,可以将该神经网络模型呈现在第二界面;其中,该第二界面可以是与第一界面相同的界面,也可以是不同的界面。In some embodiments, after the neural network model matching the target attribute parameter is determined, the neural network model can be presented on a second interface; wherein, the second interface can be the same interface as the first interface, or can be is a different interface.
本公开实施例提出了一种模型推荐方法,通过获取在第一硬件运行的神经网络模型目标属性参数;目标属性参数包括期望速度值和/或期望精度值;基于第一硬件和目标属性参数,在预设的神经网络模型库中对各神经网络模 型进行筛选,得到与目标属性参数相匹配的神经网络模型;预设的神经网络模型库中的各神经网络模型的属性参数为在第二硬件测试得到,第二硬件包括第一硬件。如此,在给定期望的硬件平台环境下包括的期望的速度值和/或期望的精度值等目标属性参数之后,便可以从预先设置的模型库中快速且准确的确定出与目标属性参数匹配的神经网络模型,实现了模型的自动化推荐,提高了模型选择的准确性,降低了模型试错成本,进一步克服了模型选择周期较长的缺陷。The embodiment of the present disclosure proposes a model recommendation method, by obtaining the target attribute parameters of the neural network model running on the first hardware; the target attribute parameters include the expected speed value and/or the expected accuracy value; based on the first hardware and the target attribute parameters, Each neural network model is screened in the preset neural network model library to obtain a neural network model that matches the target attribute parameter; the attribute parameters of each neural network model in the preset neural network model library are obtained in the second hardware The test shows that the second hardware includes the first hardware. In this way, after the target attribute parameters such as the expected speed value and/or the expected accuracy value included in the expected hardware platform environment, it can be quickly and accurately determined from the preset model library that matches the target attribute parameters. The neural network model realizes the automatic recommendation of models, improves the accuracy of model selection, reduces the cost of model trial and error, and further overcomes the defect of long model selection cycle.
图2为本公开实施例提出的模型推荐方法的实现流程示意图二,如图2所示,在本公开的实施例中,模型推荐设备基于第一硬件和目标属性参数,在预设的神经网络模型库中对各神经网络模型进行筛选,得到与目标属性参数相匹配的神经网络模型的方法可以包括以下步骤:Fig. 2 is a schematic diagram of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure. The method for screening each neural network model in the model library to obtain a neural network model that matches the target attribute parameters may include the following steps:
S200、基于第一硬件、批次量、目标属性参数,在预设的神经网络模型库中对各神经网络模型进行筛选,得到帕累托模型;其中,帕累托模型为满足期望速度值和/或期望精度值,且计算速度和计算精度最优的神经网络模型。S200. Based on the first hardware, batch size, and target attribute parameters, screen each neural network model in the preset neural network model library to obtain a Pareto model; wherein, the Pareto model is to satisfy the expected speed value and /or the expected accuracy value, and the neural network model with optimal calculation speed and calculation accuracy.
S210、将帕累托模型确定为与目标属性参数相匹配的神经网络模型。S210. Determine the Pareto model as a neural network model that matches the target attribute parameter.
在一些实施例中,目标属性参数还包括批次量,即神经网络模型在期望的硬件平台环境即第一硬件下部署运行时,神经网络模型处理的批次量。In some embodiments, the target attribute parameter also includes a batch size, that is, the batch size processed by the neural network model when the neural network model is deployed and run under the expected hardware platform environment, ie, the first hardware.
在本公开实施例中,在获取到用户指定的第一硬件下期望的批次量,以及期望的速度值和期望的精度值中的至少一项之后,模型推荐设备可以基于上述参数从预设的模型库中进行神经网络模型的筛选。In an embodiment of the present disclosure, after acquiring the expected batch size under the first hardware specified by the user, and at least one of the expected speed value and expected precision value, the model recommendation device may select from the preset Screening of neural network models in the model library.
在一些实施例中,可以预设至少一种批次大小,可以在任一硬件平台环境下,针对模型库中的各神经网络模型,以任一种批次量作为输入对各神经网络模型进行测试,从而得到各神经网络模型对应的测试结果,该测试结果即针对任一硬件平台环境下,各神经网络模型在任一种批次量下对应的计算速度值和计算精度值,进而可以将该测试结果与对应的神经网络模型进行关联。In some embodiments, at least one batch size can be preset, and each neural network model can be tested with any batch size as input for each neural network model in the model library under any hardware platform environment , so as to obtain the test results corresponding to each neural network model. The test results are the calculation speed values and calculation accuracy values corresponding to each neural network model under any batch size under any hardware platform environment, and then the test results can be The results are correlated with the corresponding neural network model.
这里,任一预设硬件平台环境可以指能够进行模型部署运行及测试的第二硬件,第一硬件可以是该第二硬件中的其中一种。Here, any preset hardware platform environment may refer to second hardware capable of model deployment, operation and testing, and the first hardware may be one of the second hardware.
在一些实施例中,在基于第一硬件下的包括批次量、期望的速度值和/或期望的精度值的目标属性参数进行神经网络模型的筛选时,可以基于至少一组关联信息进行神经网络模型的筛选;其中,每一组关联信息可以表征在第一硬件下,模型库中的各神经网络模型以同一种批次大小(批次量)作为输入经过测试得到的计算速度值以及计算精度值。In some embodiments, when the neural network model is screened based on the target attribute parameters including batch size, expected speed value and/or expected precision value under the first hardware, the neural network model can be performed based on at least one set of associated information. Screening of network models; wherein, each group of associated information can be characterized under the first hardware, and each neural network model in the model library uses the same batch size (batch size) as an input to obtain the calculation speed value and calculation speed obtained after testing precision value.
例如,第一硬件可以是手机移动端,第一硬件运行的神经网络模型处理的批次量可以是256,期望的速度值即模型在手机移动端运行时的运行耗时上限(换言之运行速度),期望的精度值即模型在手机移动端运行时模型的精度下限,模型推荐设备基于上述参数在可支持在第一硬件部署运行,且处理批次量为256的神经网络模型中进行检索匹配,便可以确定出满足目标属性参数即运行耗时小于期望的速度值且精度大于期望的精度值的所有候选模型, 然后基于最优解算法,如帕累托算法从这些候选模型中确定出可以部署在手机移动端,且运动耗时最小且精度最高的帕累托最优神经网络模型作为与目标属性参数匹配的神经网络模型。For example, the first hardware can be a mobile phone terminal, the batch size of the neural network model run by the first hardware can be 256, and the expected speed value is the upper limit of the running time of the model when running on the mobile phone terminal (in other words, the running speed) , the expected accuracy value is the lower limit of the model’s accuracy when the model is running on the mobile phone terminal. Based on the above parameters, the model recommendation device performs search and matching in the neural network model that can support the deployment and operation of the first hardware and has a processing batch size of 256. All candidate models that meet the target attribute parameters, that is, the running time is less than the expected speed value and the accuracy is greater than the expected accuracy value, can be determined, and then based on the optimal solution algorithm, such as the Pareto algorithm, it can be determined from these candidate models that can be deployed On the mobile phone terminal, the Pareto optimal neural network model with the least time-consuming movement and the highest precision is used as the neural network model matching the target attribute parameters.
如此,在给定期望的硬件平台环境、期望的批次量以及期望的速度值和期望的精度值之后,便可以从预先设置的模型库中快速且准确的确定出满足目标指标值且计算速度和计算精度最优的帕累托模型,实现了模型的自动化推荐,提高了模型选择的准确性,降低了模型试错成本,进一步克服了模型选择周期较长的缺陷。In this way, given the expected hardware platform environment, expected batch size, expected speed value, and expected accuracy value, it can be quickly and accurately determined from the pre-set model library that meets the target index value and the calculation speed And the Pareto model with optimal calculation accuracy realizes the automatic recommendation of models, improves the accuracy of model selection, reduces the cost of model trial and error, and further overcomes the defect of long model selection cycle.
图3为本公开实施例提出的模型推荐方法的实现流程示意图三,如图3所示,在本公开的实施例中,模型推荐设备执行模型推荐的方法可以包括以下步骤:Fig. 3 is a schematic diagram of the third implementation process of the model recommendation method proposed by the embodiment of the present disclosure. As shown in Fig. 3, in the embodiment of the present disclosure, the method for the model recommendation device to perform model recommendation may include the following steps:
S300、获取第一网络结构库,第一网络结构库包括不同类型的初始神经网络结构。S300. Acquire a first network structure library, where the first network structure library includes different types of initial neural network structures.
S310、对获取的第一网络结构库进行扩展,得到第二网络结构库。S310. Extend the acquired first network structure library to obtain a second network structure library.
在本公开实施例中,模型推荐设备可以预先构建模型库。其中,构建模型库可以通过以下方式实现:可以先定义大量的神经网络结构,并对这些神经网络结构进行训练处理,获得神经网络模型,并对各神经网络模型进行测试处理,获得表征各神经网络模型属性的各项测试结果,进而对各项测试结果与对应的神经网络结构进行关联,从而基于各神经网络结构以及各神经网络结构与对应的测试结果的关联关系构建模型库。In this embodiment of the present disclosure, the model recommendation device may pre-build a model library. Among them, the construction of the model library can be realized in the following ways: a large number of neural network structures can be defined first, and these neural network structures are trained and processed to obtain neural network models, and each neural network model is tested and processed to obtain the representation of each neural network. Each test result of the model attribute, and then associate each test result with the corresponding neural network structure, so as to build a model library based on each neural network structure and the association relationship between each neural network structure and the corresponding test result.
在一些实施例中,定义大量神经网络结构可以通过以下方式实现:可以获取包括不同类型的初始神经网络结构的第一网络结构库,并通过对初始神经网络结构的维度的扩展,对第一网络结构库进行扩展,从而得到第二网络结构库;这里,第二网络结构库中包含大量的神经网络结构。In some embodiments, defining a large number of neural network structures can be implemented in the following manner: a first network structure library including different types of initial neural network structures can be obtained, and by expanding the dimension of the initial neural network structure, the first network The structure library is expanded to obtain a second network structure library; here, the second network structure library contains a large number of neural network structures.
在本公开实施例的一实施方式中,模型推荐设备可以先获取第一网络结构库,该第一网络结构库中包含初始神经网络结构,分别为残差神经网络(ResNet),密集神经网络(DenseNet),高效神经网络(EfficientNet),移动端神经网络(MobileNet),规范神经网络(RegNet)等,可以对这些神经网络结构进行维度上的扩展变换,以实现对第一网络结构库中包含的神经网络结构进行扩充,进而得到第二网络结构库。In an implementation manner of an embodiment of the present disclosure, the model recommendation device may first obtain the first network structure library, which includes the initial neural network structure, respectively residual neural network (ResNet), dense neural network ( DenseNet), efficient neural network (EfficientNet), mobile terminal neural network (MobileNet), normative neural network (RegNet), etc., these neural network structures can be expanded and transformed in dimension, so as to achieve the first network structure library contained in The neural network structure is expanded to obtain the second network structure library.
S320、基于第一数据集对第二网络结构库中各神经网络结构进行训练处理,得到对应的各神经网络模型。S320. Perform training processing on each neural network structure in the second network structure library based on the first data set, to obtain corresponding neural network models.
在本公开实施例中,模型推荐设备可以对扩展后的第二网络结构库中的各神经网络结构进行模型训练处理,从而得到各神经网络结构对应的神经网络模型。In the embodiment of the present disclosure, the model recommendation device may perform model training processing on each neural network structure in the expanded second network structure library, so as to obtain a neural network model corresponding to each neural network structure.
其中,可以基于预设的训练数据集即第一数据集按照统一的标准对第二网络结构库中的各神经网络结构进行训练处理,进而获得对应的神经网络模型。这里,统一的标准可以是各神经网络结构按照统一的目标损失函数、统一的学习率,本申请对此不作具体限定。Wherein, each neural network structure in the second network structure library can be trained and processed based on a preset training data set, ie, the first data set, according to a unified standard, and then a corresponding neural network model can be obtained. Here, the unified standard may be that each neural network structure follows a unified target loss function and a unified learning rate, which is not specifically limited in this application.
在本公开实施例中,可以基于预设训练数据集对第二网络结构库中的各神经网路结构进行第一任务类型的训练处理,其中,该第一任务类型不限制于任一任务类型,如分类任务,或目标检测任务或图像分割任务。In the embodiment of the present disclosure, each neural network structure in the second network structure library can be trained on the first task type based on the preset training data set, wherein the first task type is not limited to any task type , such as classification tasks, or object detection tasks or image segmentation tasks.
其中,可以基于预设训练数据集对第二网络结构库中的各神经网路结构进行分类的训练处理,从而获得各神经网络结构对应的神经网络模型。或者,也可以基于预设训练数据集对第二网络结构库中的各神经网路结构进行目标检测任务的训练处理,从而获得各神经网络结构对应的神经网络模型;或者,也可以基于预设训练数据集对第二网络结构库中的各神经网路结构进行图像分割任务的训练处理,从而获得各神经网络结构对应的神经网络模型。Wherein, the training process of classifying each neural network structure in the second network structure library may be performed based on the preset training data set, so as to obtain the neural network model corresponding to each neural network structure. Or, it is also possible to perform target detection task training processing on each neural network structure in the second network structure library based on the preset training data set, so as to obtain the neural network model corresponding to each neural network structure; or, it can also be based on the preset The training data set performs image segmentation task training processing on each neural network structure in the second network structure library, so as to obtain the neural network model corresponding to each neural network structure.
例如,模型推荐设备基于预设训练数据集分别对ResNet、DenseNet、EfficientNet进行训练处理,便可获得ResNet对应的训练后神经网络模型模型,DenseNet对应的训练后神经网络模型,EfficientNet对应的训练后的模型。For example, the model recommendation device respectively trains ResNet, DenseNet, and EfficientNet based on the preset training data set to obtain the trained neural network model corresponding to ResNet, the trained neural network model corresponding to DenseNet, and the trained neural network model corresponding to EfficientNet. Model.
S330、在每一第二硬件下,以每一种批次量作为输入对模型库中各神经网络模型进行测试,得到各神经网络模型的计算速度值和计算精度值。S330. Under each second hardware, use each type of batch size as an input to test each neural network model in the model library, and obtain a calculation speed value and a calculation accuracy value of each neural network model.
S340、将第二硬件、批次量、计算速度值和计算精度值,与对应的神经网络模型进行关联,得到预设的神经网络模型库中的各神经网络模型的属性参数。S340. Associating the second hardware, the batch size, the calculation speed value, and the calculation accuracy value with the corresponding neural network model to obtain the attribute parameters of each neural network model in the preset neural network model library.
在本公开实施例中,模型推荐设备可以对训练后得到的各神经网络模型进行性能测试;其中,可以基于预设测试数据集如ImageNet-1k Val标准测试集,进行模型测试处理,从而得到各神经网络模型对应的测试结果。In the embodiment of the present disclosure, the model recommendation device can perform a performance test on each neural network model obtained after training; wherein, model testing can be performed based on a preset test data set such as the ImageNet-1k Val standard test set, so as to obtain each The test results corresponding to the neural network model.
在一些实施例中,模型推荐设备可以在多种硬件平台环境下即多种第二硬件下,包括中央处理器(Central Processing Unit,CPU),图形处理器(Graphics Processing Unit,GPU)或者手机芯片中手机芯片等进行模型的部署测试。其中,可以在每一第二硬件下,对于各神经网络模型,采用以不同的批次量作为输入对各神经网络模型进行测试,得到测试结果。In some embodiments, the model recommendation device can be implemented under a variety of hardware platform environments, that is, a variety of second hardware, including a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) or a mobile phone chip The deployment test of the model is carried out in the mobile phone chip and so on. Wherein, under each second hardware, for each neural network model, different batch sizes may be used as input to test each neural network model to obtain a test result.
这里测试结果可以包括模型在每一第二硬件下以每一种批次量作为输入时得到的运行速度即计算速度值,以及模型的测试精度即计算精度值。另一方面,测试结果还可以包括模型的参数量和模型的计算量。The test results here may include the running speed of the model obtained under each second hardware and each batch size as input, that is, the calculation speed value, and the test accuracy of the model, that is, the calculation accuracy value. On the other hand, the test results may also include the amount of parameters of the model and the amount of computation of the model.
在本公开实施例中,可以建立神经网络结构模型与对应的测试结果的关联关系;这里,可以将每一硬件平台环境下即每一第二硬件下,以每一种批次量作为输入进行测试得到的各神经网络模型的测试结果,与对应的神经网络模型的进行关联。In the embodiment of the present disclosure, the relationship between the neural network structure model and the corresponding test results can be established; here, under each hardware platform environment, that is, under each second hardware, each batch size can be used as an input. The test results of each neural network model obtained from the test are associated with the corresponding neural network model.
这里,可以将每一硬件平台环境下,以每一种批次量作为输入进行测试得到的各神经网络模型的计算速度和计算精度与对应的神经网络的标识进行关联,也就是建立神经网络结构模型与模型属性参数的关联关系。Here, the calculation speed and calculation accuracy of each neural network model obtained by testing each batch size as input under each hardware platform environment can be associated with the corresponding neural network identification, that is, the neural network structure is established The relationship between models and model attribute parameters.
可见,在本公开实施例中,通过定义在类型、深度、宽度以及分辨率中的至少一项上不同的大量神经网络结构,并对各神经网络结构进行训练,获得对应的神经网络模型,构建出具有丰富广泛神经网络模型的模型库。并对各神经网络模型进行测试,获得测试结果,进一步对各神经网络模型的标识 与对应的测试结果进行关联,以便于基于关联关系快速进行与目标属性参数匹配的神经网络模型的检测。It can be seen that in the embodiments of the present disclosure, by defining a large number of neural network structures different in at least one of type, depth, width, and resolution, and training each neural network structure, a corresponding neural network model is obtained, and a A model library with a rich and extensive range of neural network models. Each neural network model is tested to obtain test results, and the identification of each neural network model is further associated with the corresponding test results, so as to quickly detect the neural network model that matches the target attribute parameters based on the association relationship.
图4为本公开实施例提出的模型推荐方法的实现流程示意图四,如图4所示,在本公开的实施例中,模型推荐设备对获取的第一网络结构库进行扩展,得到第二网络结构库的方法可以包括以下步骤:Fig. 4 is a schematic diagram of the fourth implementation process of the model recommendation method proposed by the embodiment of the present disclosure. As shown in Fig. 4, in the embodiment of the present disclosure, the model recommendation device expands the acquired first network structure library to obtain the second network A method of structuring a library may include the steps of:
S401、对第一网络结构库中的各初始神经网络结构在至少一个维度上进行扩展处理,得到各初始神经网络结构对应的扩展后的神经网络结构集合;维度包括以下至少之一:神经网络结构的宽度、深度以及分辨率。S401. Extend each initial neural network structure in the first network structure library in at least one dimension to obtain an expanded neural network structure set corresponding to each initial neural network structure; the dimension includes at least one of the following: neural network structure width, depth and resolution.
S402、基于各初始神经网络结构与对应的扩展后的神经网络结构集合构建第二网络结构库。S402. Construct a second network structure library based on each initial neural network structure and the corresponding expanded neural network structure set.
在本公开实施例中,对包含初始神经网络结构的第一网络结构库进行由第二网络结构库的扩展时,可以基于对各初始神经网络结构在不同维度上的扩展进而实现网络结构库的扩展。In the embodiment of the present disclosure, when the first network structure library containing the initial neural network structure is extended by the second network structure library, the expansion of the network structure library can be realized based on the expansion of each initial neural network structure in different dimensions. expand.
其中,可以对各初始神经网络结构在宽度、深度以及分辨率中的至少一个维度上进行扩展处理,从而得到各初始神经网络结构对应的扩展后的神经网络结构集合。Wherein, each initial neural network structure may be expanded in at least one dimension of width, depth, and resolution, so as to obtain an expanded neural network structure set corresponding to each initial neural network structure.
例如,对初始神经网络结构中的ResNet分别进行一个维度上的扩展变化,即分别在深度、宽度、分辨率上的扩展变换,获得深度扩展后的第一ResNet,宽度扩展后的第二ResNet,分辨率扩展后的第三ResNet;或者在两个维度上的扩展变换,即分别在深度和宽度,或者深度和分辨率,或者宽度和分辨率上的扩展变换,获得深度和宽度扩展后的第四ResNet,深度和分辨率扩展后的第五ResNet,宽度和分辨率扩展后的第六ResNet;或者三个维度上都进行扩展变化的深度和宽度以及分辨率扩展后的第七ResNet,也就是说,在对每一初始神经网络结构在深度、宽度以及分辨率中的至少一个维度上进行扩展变化,可以得到每一初始神经网络结构对应的扩展后的神经网络结构集合,便可以基于扩展后的神经网络结构集合对第一网络结构库进行扩展,获得第二网络结构库。For example, the ResNet in the initial neural network structure is expanded and changed in one dimension, that is, the expanded transformation in depth, width, and resolution respectively, to obtain the first ResNet after depth expansion, and the second ResNet after width expansion. The third ResNet after resolution expansion; or the expansion transformation in two dimensions, that is, the expansion transformation in depth and width, or depth and resolution, or width and resolution respectively, to obtain the depth and width expansion of the first Four ResNets, the fifth ResNet after depth and resolution expansion, the sixth ResNet after width and resolution expansion; or the seventh ResNet after expansion and change in three dimensions and resolution expansion, that is In other words, after expanding and changing each initial neural network structure in at least one dimension of depth, width, and resolution, the expanded neural network structure set corresponding to each initial neural network structure can be obtained, which can be based on the expanded The set of neural network structures expands the first network structure library to obtain the second network structure library.
可见,在本公开实施例中,对初始定义的初始神经网络结构进行在类型、深度、宽度以及分辨率中的至少一项维度上的扩展变换,进一步扩充神经网络结构。It can be seen that, in the embodiments of the present disclosure, the initially defined initial neural network structure is extended and transformed in at least one dimension of type, depth, width and resolution to further expand the neural network structure.
图5为本公开实施例提出的模型推荐方法的实现流程示意图五,如图5所示,在本公开的实施例中,模型推荐设备对模型库中各神经网络模型进行测试,得到测试结果的方法可以包括以下步骤:FIG. 5 is a schematic diagram of the implementation process of the model recommendation method proposed in the embodiment of the present disclosure. As shown in FIG. 5, in the embodiment of the present disclosure, the model recommendation device tests each neural network model in the model library, and obtains the results of the test The method may include the steps of:
S500、从预设测试数据集中提取至少一种批次量。S500. Extract at least one batch size from the preset test data set.
S510、确定预设的至少一种第二硬件。S510. Determine at least one preset second hardware.
S511、在每一第二硬件下,针对模型库中各神经网络模型,以每一种所述批次量作为输入对各神经网络模型进行测试,得到各神经网络模型在每一种批次量下对应的计算速度值和计算精度值。S511. Under each second hardware, for each neural network model in the model library, each neural network model is tested with each batch size as input, and each neural network model is tested in each batch size Below is the corresponding calculation speed value and calculation precision value.
在本公开实施例中,模型推荐设备可以基于预设的标准测试集在多种硬 件平台环境下,基于不同的批次大小对每一神经网络模型进行测试。In the embodiment of the present disclosure, the model recommendation device can test each neural network model based on different batch sizes under various hardware platform environments based on a preset standard test set.
其中,模型推荐设备可以从预设测试数据集,如标准测试集中提取至少一种批次大小,并确定支持模型部署测试的至少一种第二硬件,然后在每一第二硬件下,针对每一神经网络模型以各种批次大小作为输入进行测试,可以得到每一种神经网络模型在每一第二硬件下以每一中批次大小作为输入得到的计算速度以及计算精度。Among them, the model recommendation device can extract at least one batch size from a preset test data set, such as a standard test set, and determine at least one second hardware that supports model deployment testing, and then under each second hardware, for each A neural network model is tested with various batch sizes as input, and the calculation speed and calculation accuracy of each neural network model under each second hardware with each batch size as input can be obtained.
可见,在每一硬件平台环境下,针对模型库中各神经网络模型,以每一种批次量作为输入对各神经网络模型进行测试,获得各神经网络模型在各硬件平台上的运行耗时和精度。It can be seen that in each hardware platform environment, for each neural network model in the model library, each neural network model is tested with each batch size as input, and the running time of each neural network model on each hardware platform is obtained. and precision.
图6为本公开实施例提出的模型推荐方法的实现流程示意图六,如图6所示,在本公开的实施例中,模型推荐设备在得到所述与目标属性参数匹配的神经网络模型之后的方法可以包括以下步骤:Fig. 6 is a schematic diagram 6 of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure. As shown in Fig. 6, in the embodiment of the present disclosure, after the model recommendation device obtains the neural network model that matches the target attribute parameters The method may include the steps of:
S601、获取神经网络模型在第一硬件上待处理的第二任务类型。S601. Acquire a second task type to be processed by the neural network model on the first hardware.
在一些实施例中,在确定出与目标属性参数匹配的神经网络模型,并将该推荐的神经网络模型呈现在第二界面之后,可以响应于用户在第二界面执行的模型创建操作,基于针对模型的任务需求参数和获取到的与目标属性参数匹配的神经网络模型,创建出满足任务需求参数的目标神经网络模型。In some embodiments, after determining the neural network model that matches the target attribute parameters and presenting the recommended neural network model on the second interface, it may respond to the model creation operation performed by the user on the second interface, based on the The task requirement parameters of the model and the obtained neural network model matching the target attribute parameters are used to create a target neural network model that meets the task requirement parameters.
其中,任务需求参数可以指神经网络模型在第一硬件上待处理的第二任务类型。Wherein, the task requirement parameter may refer to the second task type to be processed by the neural network model on the first hardware.
在本公开实施例的一实施方式中,模型推荐设备设置创建接口用于进行模型创建,该创建接口的前端便对应第二界面。其中,用户可以对创建接口进行神经网络模型的创建操作,如指定神经网络模型在第一硬件上待处理的第二任务类型,进而模型推荐设备可以响应于用户对创建接口的创建操作,获取用于描述待处理的第二任务类型。In an implementation manner of the embodiments of the present disclosure, the model recommendation device is configured with a creation interface for model creation, and the front end of the creation interface corresponds to the second interface. Among them, the user can perform the creation operation of the neural network model on the creation interface, such as specifying the second task type to be processed by the neural network model on the first hardware, and then the model recommendation device can respond to the user's creation operation on the creation interface, and obtain the user Used to describe the second task type to be processed.
这里,该第二任务类型可以为分类任务;或者也可以为目标检测任务;或者还可以为图像分割任务,本申请对此不做具体限定。Here, the second task type may be a classification task; or may also be an object detection task; or may also be an image segmentation task, which is not specifically limited in the present application.
在另一些实施例中,任务需求参数还可以包括神经网络模型的类别数量。In other embodiments, the task requirement parameter may also include the number of categories of the neural network model.
可以理解的是,神经网络模型每一层的输出数据是存在差异的,可以获得神经网络模型中间层的输出,也可以获取神经网络模型最后一层的输出数据。在本公开实施例中,在进行模型创建时,用户还可以对需要获取模型哪一层的输出数据指定,即指定模型的数据输出层,换言之模型的深度或者是类别数量。It can be understood that the output data of each layer of the neural network model is different, and the output data of the middle layer of the neural network model can be obtained, and the output data of the last layer of the neural network model can also be obtained. In the embodiment of the present disclosure, when creating a model, the user can also specify which layer of the model needs to obtain the output data, that is, specify the data output layer of the model, in other words, the depth of the model or the number of categories.
在本公开实施例的另一实施方式中,用户可以对创建接口进行神经网络模型的创建操作,如指定神经网络模型的待处理任务类型和神经网络模型的类别数量,进而模型推荐设备可以响应于用户对创建接口的创建操作,获取用于描述神经网络模型在第一硬件上待处理的第二任务类型以及对应的类别数量。In another embodiment of the present disclosure, the user can create a neural network model on the creation interface, such as specifying the type of task to be processed and the number of categories of the neural network model, and then the model recommendation device can respond to The creation operation of the creation interface by the user obtains the second task type and the corresponding number of categories used to describe the neural network model to be processed on the first hardware.
S602、在第二任务类型与第一任务类型未匹配的情况下,基于第二任务类型对应的第二数据集对神经网络模型进行再训练,以对神经网络模型的参 数进行微调。S602. When the second task type does not match the first task type, retrain the neural network model based on the second data set corresponding to the second task type, so as to fine-tune the parameters of the neural network model.
在一些实施例中,在确定出与目标属性参数匹配的神经网络模型,并将该神经网络模型呈现在第二界面,并响应于用户在第二界面执行的模型创建操作获取用于描述待处理的第二任务类型之后,如果第二任务类型与预设的第一任务类型不匹配,也就是说,对模型库中的神经网络模型进行训练时的任务类型与当前模型创建时的待处理任务类型并不相同,那么模型推荐设备可以基于第二任务类型对应的第二数据集对神经网络模型进行再训练,以对神经网络模型的参数进行微调,例如,模型一些超参数,学习率、优化器、迭代次数等的调整。In some embodiments, after determining the neural network model that matches the target attribute parameters, and presenting the neural network model on the second interface, and obtaining a description for processing in response to the model creation operation performed by the user on the second interface After the second task type, if the second task type does not match the preset first task type, that is, the task type when training the neural network model in the model library is different from the pending task when the current model is created different types, then the model recommendation device can retrain the neural network model based on the second data set corresponding to the second task type to fine-tune the parameters of the neural network model, for example, some hyperparameters of the model, learning rate, optimization Adjustment of the device, number of iterations, etc.
可见,在本公开实施例中,在基于用户任务需求,根据指定的任务类型和待推荐的神经网络结构模型进行模型创建时,如果待处理的任务类型与模型训练时预设的任务类型不同,可以进一步基于新的任务类型和新的数据集对神经网络模型进行再训练,实现模型参数微调。It can be seen that in the embodiment of the present disclosure, when the model is created based on the user's task requirements, according to the specified task type and the neural network structure model to be recommended, if the task type to be processed is different from the preset task type during model training, The neural network model can be further retrained based on new task types and new data sets to achieve fine-tuning of model parameters.
图7为本公开实施例提出的模型推荐方法的实现流程示意图七,如图7所示,在本公开的实施例中,模型推荐设备在得到与目标属性参数匹配的神经网络模型之后,方法还可以包括以下步骤:Fig. 7 is a schematic diagram of the implementation process of the model recommendation method proposed by the embodiment of the present disclosure VII. As shown in Fig. 7, in the embodiment of the present disclosure, after the model recommendation device obtains the neural network model that matches the target attribute parameters, the method further Can include the following steps:
S701、获取神经网络模型在第一硬件上待处理的第二任务类型。S701. Acquire a second task type to be processed by the neural network model on the first hardware.
S702、在第二任务类型与第一任务类型匹配的情况下,基于第二任务类型、预设的至少一组任务规范信息以及与目标属性参数匹配的神经网络模型,创建对应的目标神经网络模型;其中:每一组任务规范信息用于表征预设的至少一种任务类型,在模型库中每一神经网络模型下对应的输入格式和输出格式。S702. In the case that the second task type matches the first task type, create a corresponding target neural network model based on the second task type, at least one set of preset task specification information, and a neural network model that matches the target attribute parameters ; wherein: each set of task specification information is used to represent at least one preset task type, and the corresponding input format and output format under each neural network model in the model library.
在本公开实施例中,响应于在创建接口的创建操作,获取用于描述与目标属性参数匹配的神经网络模型在第一硬件上待处理的第二任务类型之后,如果该第二任务类型与预设的第一任务类型相匹配,便可以基于该第二任务类型和与目标属性参数匹配的神经网络模型进行模型的创建。In the embodiment of the present disclosure, in response to the creation operation of the creation interface, after obtaining the second task type used to describe the neural network model matching the target attribute parameter on the first hardware to be processed, if the second task type is consistent with If the preset first task type matches, the model can be created based on the second task type and the neural network model matching the target attribute parameters.
在一些实施例中,模型推荐设备可以预先定义规范模型库中各神经网络模型支持的多种任务类型,以及各神经网络模型在每一任务类型下对应的输入、输出格式,即至少一组任务规范信息。其中,该至少一组规范信息为至少一种任务类型,在模型库中每一神经网络模型下对应的输入格式和输出格式。In some embodiments, the model recommendation device can predefine the multiple task types supported by each neural network model in the specification model library, and the corresponding input and output formats of each neural network model under each task type, that is, at least one set of tasks Specification information. Wherein, the at least one set of specification information is at least one task type, and the corresponding input format and output format under each neural network model in the model library.
在一些实施例中,在获取用于描述与目标属性参数匹配的神经网络模型在第一硬件上待处理的第二任务类型之后,便可以基于该第二任务类型和至少一组任务规范信息,确定出在该第二任务类型下模型的输入、输出格式,进而规范与目标属性参数匹配的神经网络模型的输入、输出格式,从而进一步构建出支持第二任务类型的目标神经网络模型。In some embodiments, after obtaining the second task type to be processed on the first hardware for describing the neural network model matching the target attribute parameter, based on the second task type and at least one set of task specification information, Determine the input and output formats of the model under the second task type, and then standardize the input and output formats of the neural network model that match the target attribute parameters, so as to further construct the target neural network model that supports the second task type.
在本公开实施例中,为了使模型库中的各神经网络模型支持不同的任务,如分类任务、目标检测任务、图像分类任务等,可以对各神经网络模型进行任务类型和输入、输出格式进行规范定义;其中至少一组任务规范信息可以 采用如下方式实现:In the embodiment of the present disclosure, in order to enable each neural network model in the model library to support different tasks, such as classification tasks, target detection tasks, image classification tasks, etc., the task type and input and output formats of each neural network model can be adjusted. specification definition; where at least one set of task specification information can be implemented in the following ways:
确定预设的至少一种任务类型;对模型库中的每一神经网络模型,基于每一种任务类型和对应的输入格式和输出格式进行规范定义处理,得到对应的一组任务规范信息。Determine at least one preset task type; for each neural network model in the model library, perform specification definition processing based on each task type and corresponding input format and output format, and obtain a corresponding set of task specification information.
例如分类任务、目标检测任务、图像分类任务等。For example, classification tasks, object detection tasks, image classification tasks, etc.
其中,对于分类任务进行规范定义,给予指定的输入,返回的输出格式为定长的二维向量,可以支持使用分类器进行类别的判定。Among them, the classification task is standardized, given the specified input, and the returned output format is a fixed-length two-dimensional vector, which can support the use of classifiers for category determination.
其中,对于目标检测任务或者图像分割任务进行规范定义,给予指定的输入,返回的输出格式为为一组不同尺度大小的特征矩阵,支持下有任务的特征提取。Among them, the target detection task or image segmentation task is standardized and defined, given the specified input, the returned output format is a set of feature matrices of different scales, and the feature extraction of the task is supported.
可见,对模型库中的各模型进行了多种任务类型的定义规范,以使各神经网络模型能够被不同的下游任务所调用。It can be seen that various task types are defined and standardized for each model in the model library, so that each neural network model can be called by different downstream tasks.
在另一些实施例中,在获取用于描述与目标属性参数匹配的神经网络模型在第一硬件上待处理的第二任务类型和类别数量之后,便可以基于该第二任务类型和至少一组任务规范信息,确定出在该第二任务类型下模型的输入、输出格式,基于类别数量确定出模型的数据输出层,进而规范与目标属性参数匹配的神经网络模型的输入、输出格式,以及与目标属性参数匹配的神经网络模型的数据输出层,从而进一步构建出支持第二任务类型的目标神经网络模型。In some other embodiments, after obtaining the second task type and the number of categories to be processed on the first hardware for describing the neural network model matching with the target attribute parameters, based on the second task type and at least one set of Task specification information, determine the input and output formats of the model under the second task type, determine the data output layer of the model based on the number of categories, and then standardize the input and output formats of the neural network model that match the target attribute parameters, and The data output layer of the neural network model matching the target attribute parameters, thereby further constructing the target neural network model supporting the second task type.
可见,在本公开实施例中,可以基于用户任务需求,根据指定的任务类型和待推荐的神经网络结构模型构建能够支持特定任务的目标神经网络模型。It can be seen that in the embodiments of the present disclosure, based on user task requirements, a target neural network model capable of supporting a specific task can be constructed according to the specified task type and the neural network structure model to be recommended.
示例性的,图8为本公开实施例提出的模型推荐方法的应用场景示意图,如图8所示为GPU硬件平台上模型库各神经网络模型的性能(运行耗时和精度)分布,该模型库中包含了对应11种类型的神经网络模型,包括resnet、regnet、bignas、bignas、dmcp、shufflenet_v2、mobilenet_v2、oneshot_supcell、crnas_resnet、efficient、netmobilenet_v3,可以对每一种神经网络模型的结构进行在宽度、深度以及分辨率中的至少一个维度上的扩展,便可以获得对应每一类型的神经网络模型集合。如resnet对应的神经网络结构进行至少一个维度上的扩展处理之后,可以获得resnet18c_×0_25、resnet18c_×0.5、resnet18c_×0_125、dmcp_resnet18_47M等同一类型但不同维度结构的神经网络模型。其他类型的神经网络模型对应结构的扩展类同,此处不再赘述。Exemplarily, FIG. 8 is a schematic diagram of the application scenario of the model recommendation method proposed by the embodiment of the present disclosure. As shown in FIG. 8, the performance (running time and accuracy) distribution of each neural network model in the model library on the GPU hardware platform, the model The library contains 11 types of neural network models, including resnet, regnet, bignas, bignas, dmcp, shufflenet_v2, mobilenet_v2, oneshot_supcell, crnas_resnet, efficient, and netmobilenet_v3. The structure of each neural network model can be adjusted in width, By expanding at least one of the dimensions of depth and resolution, a set of neural network models corresponding to each type can be obtained. For example, after the neural network structure corresponding to resnet is expanded in at least one dimension, neural network models of the same type but different dimensional structures such as resnet18c_×0_25, resnet18c_×0.5, resnet18c_×0_125, and dmcp_resnet18_47M can be obtained. The extensions of corresponding structures of other types of neural network models are similar, and will not be repeated here.
进一步的,在基于GPU硬件平台下的目标属性参数,如运行耗时为1ms。精度为60%,对模型库进行筛选以确定与目标属性参数匹配的神经网络模型时,可以先确定出所有运行耗时小于1ms,精度大于60%的候选模型,即虚线相交对应的左上角处的多个神经网络模型均为满足运行耗时小于1ms,精度大于60%的候选模型,进一步的,可以基于帕累托最优解方法从这些候选模型中确定出速度最快且精度最优的帕累托模型,也就是帕累托曲线即pareto上的点对应的神经网络模型bignas_resnet18_492M。Further, the target attribute parameters based on the GPU hardware platform, for example, the running time is 1ms. The accuracy is 60%. When screening the model library to determine the neural network model that matches the target attribute parameters, you can first determine all candidate models that take less than 1ms to run and have an accuracy greater than 60%, that is, the upper left corner corresponding to the dotted line intersection The multiple neural network models are all candidate models that satisfy the requirement that the running time is less than 1ms and the accuracy is greater than 60%. Further, the fastest and best accuracy can be determined from these candidate models based on the Pareto optimal solution method. The Pareto model, that is, the neural network model bignas_resnet18_492M corresponding to the points on the Pareto curve.
基于上述实施例,在本公开的在一实施例中,图9为本公开实施例提出 的模型推荐装置的组成结构示意图,如图9所示,所述模型推荐装置10包括获取部分11、筛选部分12、扩展部分13、训练部分14、测试部分15、关联部分16、确定部分17。Based on the above-mentioned embodiment, in an embodiment of the present disclosure, FIG. 9 is a schematic diagram of the composition and structure of the model recommendation device proposed by the embodiment of the present disclosure. As shown in FIG. 9, the model recommendation device 10 includes an acquisition part 11, a screening Part 12, extension part 13, training part 14, testing part 15, association part 16, determination part 17.
获取部分11,配置为获取在第一硬件运行的神经网络模型目标属性参数;所述目标属性参数包括期望速度值和/或期望精度值;The acquiring part 11 is configured to acquire target attribute parameters of the neural network model running on the first hardware; the target attribute parameters include expected speed values and/or expected accuracy values;
筛选部分12,配置为基于所述第一硬件和所述目标属性参数,在预设的神经网络模型库中对各神经网络模型进行筛选,得到与所述目标属性参数相匹配的神经网络模型;所述预设的神经网络模型库中的各神经网络模型的属性参数为在第二硬件测试得到,所述第二硬件包括所述第一硬件。The screening part 12 is configured to screen each neural network model in a preset neural network model library based on the first hardware and the target attribute parameter to obtain a neural network model that matches the target attribute parameter; The attribute parameters of each neural network model in the preset neural network model library are obtained through testing on the second hardware, and the second hardware includes the first hardware.
在一些实施例中,所述目标属性参数还包括基于所述第一硬件运行的神经网络模型处理的批次量,所述筛选部分12,还配置为基于所述第一硬件、所述批次量、所述目标属性参数,在所述预设的神经网络模型库中对各神经网络模型进行筛选,得到帕累托模型;其中,所述帕累托模型为满足所述期望速度值和/或期望精度值,且计算速度和计算精度最优的神经网络模型;以及将所述帕累托模型确定为与所述目标属性参数相匹配的神经网络模型。In some embodiments, the target attribute parameter further includes a batch amount processed by the neural network model based on the first hardware, and the screening part 12 is further configured to be based on the first hardware, the batch quantity, the target attribute parameter, and screen each neural network model in the preset neural network model library to obtain a Pareto model; wherein, the Pareto model is to satisfy the desired speed value and/or Or a neural network model with an expected accuracy value and optimal calculation speed and calculation accuracy; and determining the Pareto model as a neural network model that matches the target attribute parameter.
在一些实施例中,所述获取部分11,配置为获取第一网络结构库,所述第一网络结构库包括不同类型的初始神经网络结构。In some embodiments, the obtaining part 11 is configured to obtain a first network structure library, and the first network structure library includes different types of initial neural network structures.
在一些实施例中,所述扩展部分13,配置为对获取的第一网络结构库进行扩展,得到第二网络结构库。In some embodiments, the extension part 13 is configured to expand the obtained first network structure library to obtain the second network structure library.
在一些实施例中,所述训练部分14,配置为基于第一数据集对所述第二网络结构库中各神经网络结构进行训练处理,得到对应的各神经网络模型。In some embodiments, the training part 14 is configured to perform training processing on each neural network structure in the second network structure library based on the first data set to obtain corresponding neural network models.
在一些实施例中,所述测试部分15,配置为在每一所述第二硬件下,以每一种所述批次量作为输入对所述各神经网络模型进行测试,得到所述各神经网络模型的计算速度值和计算精度值。In some embodiments, the testing part 15 is configured to test each of the neural network models by using each of the batch sizes as input under each of the second hardware to obtain the neural network models. The calculation speed value and calculation accuracy value of the network model.
在一些实施例中,所述关联部分16,配置为将所述第二硬件、所述批次量、所述计算速度值和所述计算精度值,与对应的所述神经网络模型进行关联,得到所述预设的神经网络模型库中的所述各神经网络模型的属性参数。In some embodiments, the association part 16 is configured to associate the second hardware, the batch size, the calculation speed value and the calculation accuracy value with the corresponding neural network model, The attribute parameters of each neural network model in the preset neural network model library are obtained.
在一些实施例中,所述扩展部分13,配置为对所述第一网络结构库中的各初始神经网络结构在至少一个维度上进行扩展处理,得到所述各初始神经网络结构对应的扩展后的神经网络结构集合;所述维度包括以下至少之一:神经网络结构的宽度、深度以及分辨率;以及基于所述各初始神经网络结构与对应的所述扩展后的神经网络结构集合,构建所述第二网络结构库。In some embodiments, the expansion part 13 is configured to perform expansion processing on each initial neural network structure in the first network structure library in at least one dimension, to obtain the expanded neural network structure corresponding to each initial neural network structure. The set of neural network structures; the dimension includes at least one of the following: the width, depth and resolution of the neural network structure; and based on each initial neural network structure and the corresponding expanded neural network structure set, construct the Describe the second network structure library.
在一些实施例中,所述训练部分14,配置为基于预设的第一任务类型,使用所述第一数据集对所述第二网络结构库中的各神经网络结构进行训练处理,得到对应的各神经网络模型。In some embodiments, the training part 14 is configured to use the first data set to train each neural network structure in the second network structure library based on the preset first task type to obtain the corresponding Each neural network model of .
在一些实施例中,所述测试部分15,配置为从预设测试数据集中提取至少一种批次量;以及确定预设的至少一种所述第二硬件;以及在每一所述第二硬件下,针对所述模型库中各神经网络模型,以每一种所述批次量作为输入对各神经网络模型进行测试,得到所述各神经网络模型在每一种所述批次 量下对应的计算速度值和计算精度值。In some embodiments, the testing part 15 is configured to extract at least one batch size from a preset test data set; and determine at least one preset second hardware; and in each of the second Under the hardware, for each neural network model in the model library, each neural network model is tested with each of the batch sizes as input, and each neural network model is tested under each of the batch sizes. Corresponding calculation speed value and calculation accuracy value.
在一些实施例中,所述获取部分11,配置为在得到与所述目标属性参数相匹配的神经网络模型之后,获取所述神经网络模型在所述第一硬件上待处理的第二任务类型。In some embodiments, the acquisition part 11 is configured to acquire the second task type to be processed by the neural network model on the first hardware after obtaining the neural network model that matches the target attribute parameter .
在一些实施例中,所述训练部分14,配置为在所述第二任务类型与所述第一任务类型未匹配的情况下,基于所述第二任务类型对应的第二数据集对所述神经网络模型进行再训练,以对所述神经网络模型的参数进行微调。In some embodiments, the training part 14 is configured to, in the case that the second task type does not match the first task type, based on the second data set corresponding to the second task type, pair the The neural network model is retrained to fine-tune the parameters of the neural network model.
在一些实施例中,所述确定部分17,配置为确定预设的任务类型;其中,所述预设的任务类型至少包括所述第一任务类型和所述第二任务类型;以及基于每一种所述任务类型和及其对应的输入格式和输出格式,确认所述预设的神经网络模型库中的每一所述神经网络模型的输入格式和输出格式。In some embodiments, the determining part 17 is configured to determine a preset task type; wherein, the preset task type includes at least the first task type and the second task type; and based on each one of the task types and its corresponding input format and output format, and confirm the input format and output format of each neural network model in the preset neural network model library.
在本公开的实施例中,进一步地,图10为本公开实施例提出的模型推荐设备的组成结构示意图,如图10所示,本公开实施例提出的模型推荐设备20还可以包括处理器21、存储有处理器21可执行指令的存储器22,进一步地,活体检测设备20还可以包括通信接口23,和用于连接处理器21、存储器22以及通信接口23的总线24。In the embodiment of the present disclosure, further, FIG. 10 is a schematic diagram of the composition and structure of the model recommendation device proposed in the embodiment of the present disclosure. As shown in FIG. 10 , the model recommendation device 20 proposed in the embodiment of the present disclosure may also include a processor 21 , a memory 22 storing instructions executable by the processor 21 , further, the living body detection device 20 may further include a communication interface 23 , and a bus 24 for connecting the processor 21 , the memory 22 and the communication interface 23 .
在本公开的实施例中,上述处理器21可以为特定用途集成电路(Application Specific Integrated Circuit,ASIC)、数字信号处理器(Digital Signal Processor,DSP)、数字信号处理装置(Digital Signal Processing Device,DSPD)、可编程逻辑装置(ProgRAMmable Logic Device,PLD)、现场可编程门阵列(Field Prog RAMmable Gate Array,FPGA)、中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器中的至少一种。可以理解地,对于不同的设备,用于实现上述处理器功能的电子器件还可以为其它,本公开实施例不作具体限定。活体检测设备20还可以包括存储器22,该存储器22可以与处理器21连接,其中,存储器22用于存储可执行程序代码,该程序代码包括计算机操作指令,存储器22可能包含高速RAM存储器,也可能还包括非易失性存储器,例如,至少两个磁盘存储器。In an embodiment of the present disclosure, the above-mentioned processor 21 may be an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a digital signal processor (Digital Signal Processor, DSP), a digital signal processing device (Digital Signal Processing Device, DSPD ), Programmable Logic Device (ProgRAMmable Logic Device, PLD), Field Programmable Gate Array (Field Prog RAMmable Gate Array, FPGA), Central Processing Unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor at least one of the It can be understood that, for different devices, the electronic device used to implement the above processor function may also be other, which is not specifically limited in this embodiment of the present disclosure. The living body detection device 20 may also include a memory 22, which may be connected to the processor 21, wherein the memory 22 is used to store executable program codes, the program codes include computer operation instructions, and the memory 22 may include a high-speed RAM memory, or may Also included is non-volatile memory, eg, at least two disk memories.
在本公开的实施例中,总线24用于连接通信接口23、处理器21以及存储器22以及这些器件之间的相互通信。In the embodiment of the present disclosure, the bus 24 is used to connect the communication interface 23 , the processor 21 and the memory 22 and communicate with each other among these devices.
在本公开的实施例中,存储器22,用于存储指令和数据。In an embodiment of the present disclosure, the memory 22 is used to store instructions and data.
进一步地,在本公开的实施例中,上述处理器21,用于获取用于描述与目标属性参数匹配的神经网络模型的目标应用场景和目标指标值,所述目标应用场景至少包括:期望的硬件平台环境;所述目标指标值至少包括期望的速度值和/或期望的精度值;基于所述目标应用场景和所述目标指标值,对预设的模型库中各神经网络模型进行筛选,得到所述与目标属性参数匹配的神经网络模型;所述与目标属性参数匹配的神经网络模型为在所述期望的硬件平台环境下测试得到的测试结果满足所述目标指标值,且计算速度和计算精度最优的神经网络模型。Further, in the embodiment of the present disclosure, the above-mentioned processor 21 is configured to acquire a target application scenario and a target index value used to describe a neural network model that matches the target attribute parameters, and the target application scenario includes at least: expected hardware platform environment; the target index value includes at least an expected speed value and/or an expected accuracy value; based on the target application scenario and the target index value, each neural network model in the preset model library is screened, Obtain the neural network model that matches the target attribute parameter; the neural network model that matches the target attribute parameter is that the test result obtained by testing under the expected hardware platform environment meets the target index value, and the calculation speed and Calculate the neural network model with optimal accuracy.
在实际应用中,上述存储器22可以是易失性存储器(volatile memory), 例如随机存取存储器(Random-Access Memory,RAM);或者非易失性存储器(non-volatile memory),例如只读存储器(Read-Only Memory,ROM),快闪存储器(flash memory),硬盘(Hard Disk Drive,HDD)或固态硬盘(Solid-State Drive,SSD);或者上述种类的存储器的组合,并向处理器15提供指令和数据。In practical applications, the above-mentioned memory 22 can be a volatile memory (volatile memory), such as a random access memory (Random-Access Memory, RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (Read-Only Memory, ROM), flash memory (flash memory), hard disk (Hard Disk Drive, HDD) or solid-state drive (Solid-State Drive, SSD); Provide instructions and data.
另外,在本实施例中的各功能模块可以集成在一个推荐单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in this embodiment may be integrated into one recommendation unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software function modules.
集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment is essentially or The part contributed by the prior art or the whole or part of the technical solution can be embodied in the form of software products, the computer software products are stored in a storage medium, and include several instructions to make a computer device (which can be a personal A computer, a server, or a network device, etc.) or a processor (processor) executes all or part of the steps of the method of this embodiment. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (Read Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other various media that can store program codes.
本公开实施例提供了一种模型推荐设备,该模型推荐设备可以预先构建目标模型库;其中,目标模型库用于表征候选模型、软件属性参数以及硬件属性参数之间的对应关系;然后在接收到模型的推荐请求的情况下;其中,推荐请求携带推荐软件属性参数和推荐硬件属性参数;根据推荐软件属性参数和推荐硬件属性参数对目标模型库进行搜索处理,进而获得目标推荐模型。如此,通过构建包含丰富模型结构,且包含丰富模型属性的目标模型库,能够根据指定模型推荐需求在目标模型库中自动搜索出合适的推荐模型,实现了模型的自动化推荐,提高了模型选择的准确性,降低了模型试错成本,进一步克服了模型选择周期较长的缺陷。。An embodiment of the present disclosure provides a model recommendation device, which can pre-build a target model library; where the target model library is used to characterize the correspondence between candidate models, software attribute parameters, and hardware attribute parameters; and then receive In the case of a recommendation request to a model; wherein, the recommendation request carries recommended software attribute parameters and recommended hardware attribute parameters; the target model library is searched and processed according to the recommended software attribute parameters and recommended hardware attribute parameters, and then the target recommendation model is obtained. In this way, by building a target model library that contains rich model structures and rich model attributes, it is possible to automatically search for a suitable recommended model in the target model library according to the specified model recommendation requirements, realizing automatic model recommendation and improving the efficiency of model selection. Accuracy reduces the cost of model trial and error, and further overcomes the defect of long model selection cycle. .
本公开实施例提供一种计算机可读存储介质,其上存储有程序,该程序被处理器执行时实现如上所述的模型推荐方法。An embodiment of the present disclosure provides a computer-readable storage medium on which a program is stored, and when the program is executed by a processor, the above-mentioned model recommendation method is implemented.
具体来讲,本实施例中的一种模型推荐方法对应的程序指令可以被存储在光盘,硬盘,U盘等存储介质上,当存储介质中的与一种模型推荐方法对应的程序指令被一电子设备读取或被执行时,包括如下步骤:Specifically, the program instructions corresponding to a model recommendation method in this embodiment can be stored on a storage medium such as an optical disk, a hard disk, or a USB flash drive. When the program instructions corresponding to a model recommendation method in the storage medium are stored by a When an electronic device is read or executed, the following steps are included:
获取用于描述与目标属性参数匹配的神经网络模型的目标应用场景和目标指标值,所述目标应用场景至少包括:期望的硬件平台环境;所述目标指标值至少包括期望的速度值和/或期望的精度值;Obtaining a target application scenario and a target index value used to describe a neural network model that matches the target attribute parameter, the target application scenario at least includes: an expected hardware platform environment; the target index value includes at least an expected speed value and/or expected precision value;
基于所述目标应用场景和所述目标指标值,对预设的模型库中各神经网络模型进行筛选,得到所述与目标属性参数匹配的神经网络模型;Based on the target application scenario and the target index value, filter each neural network model in the preset model library to obtain the neural network model matching the target attribute parameters;
所述与目标属性参数匹配的神经网络模型为在所述期望的硬件平台环境下测试得到的测试结果满足所述目标指标值,且计算速度和计算精度最优的 神经网络模型。The neural network model matched with the target attribute parameter is a neural network model whose test results obtained by testing under the expected hardware platform environment meet the target index value, and whose calculation speed and calculation accuracy are optimal.
相应地,本公开实施例再提供一种计算机程序产品,所述计算机程序产品包括计算机可执行指令,该计算机可执行指令用于实现本公开实施例提出的模型推荐方法中的步骤。Correspondingly, an embodiment of the present disclosure further provides a computer program product, where the computer program product includes computer-executable instructions, and the computer-executable instructions are used to implement the steps in the model recommendation method proposed by the embodiments of the present disclosure.
本领域内的技术人员应明白,本公开的实施例可提供为方法、系统、或计算机程序产品。因此,本公开可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本公开可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Accordingly, the present disclosure may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, optical storage, etc.) having computer-usable program code embodied therein.
本公开是参照根据本公开实施例的方法、设备(系统)、和计算机程序产品的实现流程示意图和/或方框图来描述的。应理解可由计算机程序指令实现流程示意图和/或方框图中的每一流程和/或方框、以及实现流程示意图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在实现流程示意图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present disclosure is described with reference to the implementation flow diagrams and/or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and/or block in the schematic flowchart and/or block diagram, and a combination of processes and/or blocks in the schematic flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a Means for realizing the functions specified in one or more steps of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在实现流程示意图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in implementing one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在实现流程示意图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in implementing the process flow or processes of the flowchart diagrams and/or the block or blocks of the block diagrams.
以上所述,仅为本公开的较佳实施例而已,并非用于限定本公开的保护范围。The above descriptions are only preferred embodiments of the present disclosure, and are not intended to limit the protection scope of the present disclosure.
工业实用性Industrial Applicability
本公开实施例中,通过获取在第一硬件运行的神经网络模型目标属性参数;目标属性参数包括期望速度值和/或期望精度值;基于第一硬件和目标属性参数,在预设的神经网络模型库中对各神经网络模型进行筛选,得到与目标属性参数相匹配的神经网络模型;预设的神经网络模型库中的各神经网络模型的属性参数为在第二硬件测试得到,第二硬件包括第一硬件。实现了模型的自动化推荐。In the embodiment of the present disclosure, by obtaining the target attribute parameters of the neural network model running on the first hardware; the target attribute parameters include the expected speed value and/or the expected accuracy value; based on the first hardware and the target attribute parameters, in the preset neural network Each neural network model is screened in the model library to obtain a neural network model that matches the target attribute parameters; the attribute parameters of each neural network model in the preset neural network model library are obtained from the second hardware test, and the second hardware Includes first hardware. Realized the automatic recommendation of the model.

Claims (20)

  1. 一种模型推荐方法,所述方法包括:A model recommendation method, the method comprising:
    获取在第一硬件运行的神经网络模型目标属性参数;所述目标属性参数包括期望速度值和/或期望精度值;Obtain target attribute parameters of the neural network model running on the first hardware; the target attribute parameters include expected speed values and/or expected accuracy values;
    基于所述第一硬件和所述目标属性参数,在预设的神经网络模型库中对各神经网络模型进行筛选,得到与所述目标属性参数相匹配的神经网络模型;所述预设的神经网络模型库中的各神经网络模型的属性参数为在第二硬件测试得到,所述第二硬件包括所述第一硬件。Based on the first hardware and the target attribute parameters, each neural network model is screened in a preset neural network model library to obtain a neural network model that matches the target attribute parameters; the preset neural network model The attribute parameters of each neural network model in the network model library are obtained through testing on the second hardware, and the second hardware includes the first hardware.
  2. 根据权利要求1所述的方法,其中,所述目标属性参数还包括基于所述第一硬件运行的神经网络模型处理的批次量;所述基于所述第一硬件和所述目标属性参数,在预设的神经网络模型库中对各神经网络模型进行筛选,得到与所述目标属性参数相匹配的神经网络模型,包括:The method according to claim 1, wherein the target property parameter further comprises a batch size processed by a neural network model running on the first hardware; the target property parameter based on the first hardware, Each neural network model is screened in the preset neural network model library to obtain a neural network model that matches the target attribute parameters, including:
    基于所述第一硬件、所述批次量、所述目标属性参数,在所述预设的神经网络模型库中对各神经网络模型进行筛选,得到帕累托模型;其中,所述帕累托模型为满足所述期望速度值和/或期望精度值,且计算速度和计算精度最优的神经网络模型;Based on the first hardware, the batch size, and the target attribute parameters, each neural network model is screened in the preset neural network model library to obtain a Pareto model; wherein, the Pareto The support model is a neural network model that satisfies the desired speed value and/or desired precision value, and has optimal calculation speed and calculation accuracy;
    将所述帕累托模型确定为与所述目标属性参数相匹配的神经网络模型。The Pareto model is determined as a neural network model matching the target attribute parameter.
  3. 根据权利要求1或2所述的方法,其中,所述预设的神经网络模型库基于如下方法构建,包括:The method according to claim 1 or 2, wherein the preset neural network model library is constructed based on the following method, comprising:
    获取第一网络结构库,所述第一网络结构库包括至少一种类型的初始神经网络结构;Obtaining a first network structure library, the first network structure library including at least one type of initial neural network structure;
    对获取的第一网络结构库进行扩展,得到第二网络结构库;expanding the acquired first network structure library to obtain a second network structure library;
    基于第一数据集对所述第二网络结构库中各神经网络结构进行训练处理,得到对应的各神经网络模型;performing training processing on each neural network structure in the second network structure library based on the first data set to obtain corresponding neural network models;
    在每一所述第二硬件下,以每一种所述批次量作为输入对所述各神经网络模型进行测试,得到所述各神经网络模型的计算速度值和计算精度值;Under each of the second hardware, each of the neural network models is tested by using each of the batch sizes as an input, and the calculation speed value and the calculation accuracy value of the various neural network models are obtained;
    将所述第二硬件、所述批次量、所述计算速度值和所述计算精度值,与对应的所述神经网络模型进行关联,得到所述预设的神经网络模型库中的所述各神经网络模型的属性参数。associating the second hardware, the batch size, the calculation speed value, and the calculation accuracy value with the corresponding neural network model to obtain the The attribute parameters of each neural network model.
  4. 根据权利要求3所述的方法,其中,所述对获取的第一网络结构库进行扩展,得到第二网络结构库,包括:The method according to claim 3, wherein said expanding the obtained first network structure library to obtain a second network structure library includes:
    对所述第一网络结构库中的各初始神经网络结构在至少一个维度上进行扩展处理,得到所述各初始神经网络结构对应的扩展后的神经网络结构集合;所述维度包括以下至少之一:神经网络结构的宽度、深度以及分辨率;Each initial neural network structure in the first network structure library is extended in at least one dimension to obtain a set of expanded neural network structures corresponding to each initial neural network structure; the dimension includes at least one of the following : The width, depth and resolution of the neural network structure;
    基于所述各初始神经网络结构与对应的所述扩展后的神经网络结构集合,构建所述第二网络结构库。The second network structure library is constructed based on each initial neural network structure and the corresponding expanded neural network structure set.
  5. 根据权利要求3所述的方法,其中,所述基于预设训练数据集对所述 第一神经网络结构集合中各神经网络结构进行训练处理,得到对应的各神经网络模型,包括:The method according to claim 3, wherein, the training process is performed on each neural network structure in the first neural network structure set based on the preset training data set to obtain corresponding neural network models, including:
    基于预设的第一任务类型,使用所述第一数据集对所述第二网络结构库中的各神经网络结构进行训练处理,得到对应的各神经网络模型。Based on the preset first task type, the first data set is used to train each neural network structure in the second network structure library to obtain corresponding neural network models.
  6. 根据权利要求3至5任一项所述的方法,其中,所述对所述模型库中各神经网络模型进行测试,得到测试结果,包括:The method according to any one of claims 3 to 5, wherein the testing of each neural network model in the model library to obtain test results includes:
    从预设测试数据集中提取至少一种批次量;Extract at least one batch size from a preset test data set;
    确定预设的至少一种所述第二硬件;determining at least one preset second hardware;
    在每一所述第二硬件下,针对所述模型库中各神经网络模型,以每一种所述批次量作为输入对各神经网络模型进行测试,得到所述各神经网络模型在每一种所述批次量下对应的计算速度值和计算精度值。Under each of the second hardware, for each neural network model in the model library, each neural network model is tested with each batch size as input, and each neural network model is obtained in each neural network model. The corresponding calculation speed value and calculation accuracy value under the batch size.
  7. 根据权利要求1至6任一项所述的方法,其中,所述得到与所述目标属性参数相匹配的神经网络模型之后,所述方法还包括:The method according to any one of claims 1 to 6, wherein, after obtaining the neural network model matched with the target attribute parameters, the method further comprises:
    获取所述神经网络模型在所述第一硬件上待处理的第二任务类型;Acquiring a second task type to be processed by the neural network model on the first hardware;
    在所述第二任务类型与所述第一任务类型未匹配的情况下,基于所述第二任务类型对应的第二数据集对所述神经网络模型进行再训练,以对所述神经网络模型的参数进行微调。When the second task type does not match the first task type, retrain the neural network model based on the second data set corresponding to the second task type, so as to retrain the neural network model fine-tuning of the parameters.
  8. 根据权利要求7所述的方法,其中,所述方法还包括:The method according to claim 7, wherein the method further comprises:
    确定预设的任务类型;其中,所述预设的任务类型至少包括所述第一任务类型和所述第二任务类型;determining a preset task type; wherein, the preset task type includes at least the first task type and the second task type;
    基于每一种所述任务类型和及其对应的输入格式和输出格式,确认所述预设的神经网络模型库中的每一所述神经网络模型的输入格式和输出格式。Based on each task type and its corresponding input format and output format, confirm the input format and output format of each neural network model in the preset neural network model library.
  9. 一种模型推荐装置,所述模型推荐装置包括:A model recommendation device, the model recommendation device comprising:
    获取部分,配置为获取在第一硬件运行的神经网络模型目标属性参数;所述目标属性参数包括期望速度值和/或期望精度值;The acquiring part is configured to acquire target attribute parameters of the neural network model running on the first hardware; the target attribute parameters include expected speed values and/or expected accuracy values;
    筛选部分,配置为基于所述第一硬件和所述目标属性参数,在预设的神经网络模型库中对各神经网络模型进行筛选,得到与所述目标属性参数相匹配的神经网络模型;所述预设的神经网络模型库中的各神经网络模型的属性参数为在第二硬件测试得到,所述第二硬件包括所述第一硬件。The screening part is configured to screen each neural network model in a preset neural network model library based on the first hardware and the target attribute parameter to obtain a neural network model that matches the target attribute parameter; The attribute parameters of each neural network model in the preset neural network model library are obtained through testing on the second hardware, and the second hardware includes the first hardware.
  10. 根据权利要求9所述的模型推荐装置,其中,所述目标属性参数还包括基于所述第一硬件运行的神经网络模型处理的批次量,The model recommendation device according to claim 9, wherein the target attribute parameter further includes the batch size of the neural network model run based on the first hardware,
    所述筛选部分,还配置为基于所述第一硬件、所述批次量、所述目标属性参数,在所述预设的神经网络模型库中对各神经网络模型进行筛选,得到帕累托模型;其中,所述帕累托模型为满足所述期望速度值和/或期望精度值,且计算速度和计算精度最优的神经网络模型;以及将所述帕累托模型确定为与所述目标属性参数相匹配的神经网络模型。The screening part is further configured to screen each neural network model in the preset neural network model library based on the first hardware, the batch size, and the target attribute parameter to obtain a Pareto model; wherein, the Pareto model is a neural network model that satisfies the desired speed value and/or desired precision value, and has optimal calculation speed and calculation accuracy; and the Pareto model is determined to be compatible with the described A neural network model that matches the target attribute parameters.
  11. 根据权利要求9或10所述的模型推荐装置,其中,The model recommendation device according to claim 9 or 10, wherein,
    所述获取部分,配置为获取第一网络结构库,所述第一网络结构库包括不同类型的初始神经网络结构;The obtaining part is configured to obtain a first network structure library, and the first network structure library includes different types of initial neural network structures;
    所述扩展部分,配置为对获取的第一网络结构库进行扩展,得到第二网络结构库;The extension part is configured to expand the acquired first network structure library to obtain a second network structure library;
    所述训练部分,配置为基于第一数据集对所述第二网络结构库中各神经网络结构进行训练处理,得到对应的各神经网络模型;The training part is configured to perform training processing on each neural network structure in the second network structure library based on the first data set, to obtain corresponding neural network models;
    所述测试部分,配置为在每一所述第二硬件下,以每一种所述批次量作为输入对所述各神经网络模型进行测试,得到所述各神经网络模型的计算速度值和计算精度值;The testing part is configured to test each of the neural network models with each of the batch quantities as input under each of the second hardware, and obtain the calculation speed value and the value of each neural network model. Calculation precision value;
    所述关联部分,配置为将所述第二硬件、所述批次量、所述计算速度值和所述计算精度值,与对应的所述神经网络模型进行关联,得到所述预设的神经网络模型库中的所述各神经网络模型的属性参数。The associating part is configured to associate the second hardware, the batch size, the calculation speed value, and the calculation accuracy value with the corresponding neural network model to obtain the preset neural network model. The attribute parameters of each neural network model in the network model library.
  12. 根据权利要求11所述的模型推荐装置,其中,The model recommendation device according to claim 11, wherein,
    所述扩展部分,配置为对所述第一网络结构库中的各初始神经网络结构在至少一个维度上进行扩展处理,得到所述各初始神经网络结构对应的扩展后的神经网络结构集合;所述维度包括以下至少之一:神经网络结构的宽度、深度以及分辨率;以及基于所述各初始神经网络结构与对应的所述扩展后的神经网络结构集合,构建所述第二网络结构库。The extension part is configured to perform extension processing on at least one dimension of each initial neural network structure in the first network structure library, to obtain an expanded neural network structure set corresponding to each initial neural network structure; The dimensions include at least one of the following: width, depth and resolution of the neural network structure; and building the second network structure library based on the initial neural network structures and the corresponding expanded neural network structure set.
  13. 根据权利要求11所述的模型推荐装置,其中,The model recommendation device according to claim 11, wherein,
    所述训练部分,配置为基于预设的第一任务类型,使用所述第一数据集对所述第二网络结构库中的各神经网络结构进行训练处理,得到对应的各神经网络模型。The training part is configured to use the first data set to train each neural network structure in the second network structure library based on a preset first task type to obtain corresponding neural network models.
  14. 根据权利要求11至13任一项所述的模型推荐装置,其中,The model recommendation device according to any one of claims 11 to 13, wherein,
    所述测试部分,配置为从预设测试数据集中提取至少一种批次量;以及确定预设的至少一种所述第二硬件;以及在每一所述第二硬件下,针对所述模型库中各神经网络模型,以每一种所述批次量作为输入对各神经网络模型进行测试,得到所述各神经网络模型在每一种所述批次量下对应的计算速度值和计算精度值。The test part is configured to extract at least one batch size from a preset test data set; and determine at least one preset second hardware; and under each of the second hardware, for the model For each neural network model in the library, each neural network model is tested with each of the batch sizes as input, and the corresponding calculation speed value and calculation speed value of each neural network model under each of the batch sizes are obtained. precision value.
  15. 根据权利要求9至14任一项所述的模型推荐装置,其中,The model recommendation device according to any one of claims 9 to 14, wherein,
    所述获取部分,配置为在得到与所述目标属性参数相匹配的神经网络模型之后,获取所述神经网络模型在所述第一硬件上待处理的第二任务类型;The obtaining part is configured to obtain a second task type to be processed by the neural network model on the first hardware after obtaining the neural network model matching the target attribute parameter;
    所述训练部分,配置为在所述第二任务类型与所述第一任务类型未匹配的情况下,基于所述第二任务类型对应的第二数据集对所述神经网络模型进行再训练,以对所述神经网络模型的参数进行微调。The training part is configured to retrain the neural network model based on a second data set corresponding to the second task type when the second task type does not match the first task type, to fine-tune the parameters of the neural network model.
  16. 根据权利要求15所述的模型推荐装置,其中,The model recommendation device according to claim 15, wherein,
    所述确定部分,配置为确定预设的任务类型;其中,所述预设的任务类型至少包括所述第一任务类型和所述第二任务类型;以及基于每一种所述任务类型和及其对应的输入格式和输出格式,确认所述预设的神经网络模型库中的每一所述神经网络模型的输入格式和输出格式。The determining part is configured to determine a preset task type; wherein, the preset task type includes at least the first task type and the second task type; and based on each of the task types and The corresponding input format and output format confirm the input format and output format of each neural network model in the preset neural network model library.
  17. 一种模型推荐设备,所述模型推荐设备包括处理器、存储有所述处理器可执行指令的存储器,当所述指令被所述处理器执行时,实现如权利要 求1-8任一项所述的方法。A model recommendation device, the model recommendation device includes a processor and a memory storing instructions executable by the processor, and when the instructions are executed by the processor, the model described in any one of claims 1-8 is implemented. described method.
  18. 一种计算机可读存储介质,其上存储有程序,应用于模型推荐设备中,所述程序被处理器执行时,实现如权利要求1-8任一项所述的方法。A computer-readable storage medium, on which a program is stored and applied to a model recommendation device, and when the program is executed by a processor, the method according to any one of claims 1-8 is implemented.
  19. 一种计算机程序,包括计算机可读代码,在所述计算机可读代码在电子设备中运行,被所述电子设备中的处理器执行的情况下,实现如权利要求权利要求1-8任一项所述的方法。A computer program, comprising computer readable code, when the computer readable code runs in an electronic device and is executed by a processor in the electronic device, any one of claims 1-8 can be realized the method described.
  20. 一种计算机程序产品,当其在计算机上运行时,使得计算机执行如权利要求1-8任一项所述的方法。A computer program product, which, when run on a computer, causes the computer to execute the method according to any one of claims 1-8.
PCT/CN2021/121263 2021-06-29 2021-09-28 Model recommendation method and apparatus, and device and computer storage medium WO2023272987A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110730001.1 2021-06-29
CN202110730001.1A CN113408634B (en) 2021-06-29 2021-06-29 Model recommendation method and device, equipment and computer storage medium

Publications (1)

Publication Number Publication Date
WO2023272987A1 true WO2023272987A1 (en) 2023-01-05

Family

ID=77680226

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/121263 WO2023272987A1 (en) 2021-06-29 2021-09-28 Model recommendation method and apparatus, and device and computer storage medium

Country Status (2)

Country Link
CN (1) CN113408634B (en)
WO (1) WO2023272987A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116167431A (en) * 2023-04-25 2023-05-26 之江实验室 Service processing method and device based on hybrid precision model acceleration
CN116484226A (en) * 2023-05-04 2023-07-25 乳山市海洋经济发展中心 Method and device for building fishery culture model through neural network

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113408634B (en) * 2021-06-29 2022-07-05 深圳市商汤科技有限公司 Model recommendation method and device, equipment and computer storage medium
CN114117010A (en) * 2021-11-30 2022-03-01 中国平安人寿保险股份有限公司 NLP task processing method and device, terminal equipment and storage medium
CN114334092B (en) * 2021-12-22 2023-04-07 四川大学华西医院 Medical image AI model management method and equipment
US20230252292A1 (en) 2022-02-10 2023-08-10 Nota, Inc. Method of providing information on neural network model and electronic apparatus for performing the same
CN116776986A (en) * 2022-03-07 2023-09-19 维沃移动通信有限公司 Model accuracy determining method and device and network side equipment
CN114880995B (en) * 2022-06-30 2022-10-04 浙江大华技术股份有限公司 Algorithm scheme deployment method, related device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200193296A1 (en) * 2018-12-18 2020-06-18 Microsoft Technology Licensing, Llc Neural network architecture for attention based efficient model adaptation
CN111461827A (en) * 2020-03-31 2020-07-28 中国银行股份有限公司 Product evaluation information pushing method and device
CN111723909A (en) * 2020-06-15 2020-09-29 武汉轻工大学 Optimization method and system of fuzzy neural network model
CN112598117A (en) * 2020-12-29 2021-04-02 广州极飞科技有限公司 Neural network model design method, deployment method, electronic device and storage medium
CN113408634A (en) * 2021-06-29 2021-09-17 深圳市商汤科技有限公司 Model recommendation method and device, equipment and computer storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107766940B (en) * 2017-11-20 2021-07-23 北京百度网讯科技有限公司 Method and apparatus for generating a model
CN109376844A (en) * 2018-10-30 2019-02-22 银河水滴科技(北京)有限公司 The automatic training method of neural network and device recommended based on cloud platform and model
CN109947985A (en) * 2019-03-05 2019-06-28 腾讯科技(深圳)有限公司 Applied to the Processing with Neural Network method and device in on-line system
CN112784954A (en) * 2019-11-08 2021-05-11 华为技术有限公司 Method and device for determining neural network
CN111325338B (en) * 2020-02-12 2023-05-05 暗物智能科技(广州)有限公司 Neural network structure evaluation model construction and neural network structure searching method
CN111950702A (en) * 2020-07-16 2020-11-17 华为技术有限公司 Neural network structure determining method and device
CN112101525A (en) * 2020-09-08 2020-12-18 南方科技大学 Method, device and system for designing neural network through NAS
CN112488299A (en) * 2020-12-03 2021-03-12 华为技术有限公司 Neural network acquisition method and device
CN112560985B (en) * 2020-12-25 2024-01-12 北京百度网讯科技有限公司 Neural network searching method and device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200193296A1 (en) * 2018-12-18 2020-06-18 Microsoft Technology Licensing, Llc Neural network architecture for attention based efficient model adaptation
CN111461827A (en) * 2020-03-31 2020-07-28 中国银行股份有限公司 Product evaluation information pushing method and device
CN111723909A (en) * 2020-06-15 2020-09-29 武汉轻工大学 Optimization method and system of fuzzy neural network model
CN112598117A (en) * 2020-12-29 2021-04-02 广州极飞科技有限公司 Neural network model design method, deployment method, electronic device and storage medium
CN113408634A (en) * 2021-06-29 2021-09-17 深圳市商汤科技有限公司 Model recommendation method and device, equipment and computer storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116167431A (en) * 2023-04-25 2023-05-26 之江实验室 Service processing method and device based on hybrid precision model acceleration
CN116484226A (en) * 2023-05-04 2023-07-25 乳山市海洋经济发展中心 Method and device for building fishery culture model through neural network
CN116484226B (en) * 2023-05-04 2023-10-03 乳山市海洋经济发展中心 Method and device for building fishery culture model through neural network

Also Published As

Publication number Publication date
CN113408634A (en) 2021-09-17
CN113408634B (en) 2022-07-05

Similar Documents

Publication Publication Date Title
WO2023272987A1 (en) Model recommendation method and apparatus, and device and computer storage medium
US20180268296A1 (en) Machine learning-based network model building method and apparatus
CN112434721A (en) Image classification method, system, storage medium and terminal based on small sample learning
CN109002562B (en) Instrument recognition model training method and device and instrument recognition method and device
KR20190019892A (en) Method and apparatus for constructing a decision model, computer device and storage medium
CN111340054A (en) Data labeling method and device and data processing equipment
CN104750798A (en) Application program recommendation method and device
CN111353580B (en) Training method of target detection network, electronic equipment and storage medium
CN110969600A (en) Product defect detection method and device, electronic equipment and storage medium
CN114995729A (en) Voice drawing method and device and computer equipment
CN115997213A (en) Machine learning based generation of constraints for Computer Aided Design (CAD) components
CN112528428A (en) Method and device for displaying physical parameters of engineering structure and computer equipment
US20230401670A1 (en) Multi-scale autoencoder generation method, electronic device and readable storage medium
CN114913330B (en) Point cloud component segmentation method and device, electronic equipment and storage medium
CN116229116A (en) Process multiplexing processing method and system based on similar parts and electronic equipment
CN108229572B (en) Parameter optimization method and computing equipment
CN113255770B (en) Training method of compound attribute prediction model and compound attribute prediction method
CN115438129A (en) Structured data classification method and device and terminal equipment
CN113255769B (en) Training method of compound attribute prediction model and compound attribute prediction method
CN113627522A (en) Image classification method, device and equipment based on relational network and storage medium
Jenitha et al. Comparing the partitional and density based clustering algorithms by using WEKA tool
CN112560834A (en) Coordinate prediction model generation method and device and graph recognition method and device
TWI755176B (en) Method and device for calculating cell distribution density, electronic device, and storage unit
US20230401691A1 (en) Image defect detection method, electronic device and readable storage medium
CN111210500B (en) Three-dimensional point cloud processing method and device

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 08/04/2024)