Model evaluation detection method and device

By generating and running execution scripts, configuring the running environment and calling the test set according to the model parameters, the problem of long test time and low efficiency of AI model evaluation value testing is solved, and the convenient detection of the AI ​​model is realized.

CN112860539BActive Publication Date: 2024-09-13BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911211869.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-28
Publication Date
2024-09-13
Estimated Expiration
2039-11-28

AI Technical Summary

Technical Problem

In the existing technology, the testing time of AI model evaluation values ​​is long and the testing efficiency is low.

Method used

By determining the model parameters of the model to be tested, generating an execution script, configuring the running environment according to the parameters of the running environment, data source and feedback method, calling the model and test set, and running the script in response to triggering instructions, the AI ​​model can be conveniently detected.

Benefits of technology

It significantly shortens the time for AI model evaluation and detection, improves detection efficiency, and enables convenient detection of AI models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112860539B
    Figure CN112860539B
Patent Text Reader

Abstract

The present invention provides a model evaluation detection method and device, which relate to the field of data processing technology. The method comprises: determining model parameters of a model to be tested, and generating an execution script based on the operating environment parameters; running the execution script can realize convenient detection of an AI model, so as to solve the problems of long testing time and low testing efficiency of AI model evaluation values ​​existing in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a model evaluation detection method and device. Background Art

[0002] In recent years, artificial intelligence (AI) has been widely used and developed in the fields of robotics, speech recognition, image recognition, natural language processing, and expert systems. In the development process of AI models, model evaluation is an indispensable key link. By evaluating and testing AI models, more model information can be obtained, which facilitates further improvement of AI models.

[0003] Currently, the most common method for testing the evaluation value of AI models is for testers to carry test cases, collect test data, and then conduct model evaluation value tests; after the test is completed, the tester sends test reports and test anomalies to relevant personnel, resulting in a long process of model evaluation and detection and low test efficiency. Summary of the invention

[0004] The purpose of the present invention is to provide a model evaluation detection method and device to solve the problems of long testing time and low testing efficiency of model evaluation values ​​existing in the prior art.

[0005] In a first aspect, an embodiment provides a model evaluation detection method, the method comprising:

[0006] Determine model parameters of the model to be tested, wherein the model parameters include operating environment parameters, data source parameters, and feedback mode parameters;

[0007] Generate an execution script based on the operating environment parameters; the execution script is used to configure the operating environment according to the operating environment parameters, call the model to be tested and the test set according to the data source parameters, and configure the feedback mode according to the feedback mode parameters;

[0008] In response to a trigger instruction for the execution script, the execution script is run.

[0009] In an optional implementation, configuring the operating environment according to the operating environment parameters includes: selecting a server address and an interface address according to the operating environment parameters.

[0010] In an optional implementation, the data source parameters include the name of the model to be tested, the name of the test set, the execution account, and the review plan.

[0011] In an optional implementation, the execution script is further used to select a test result statistics method for test data according to the model to be tested.

[0012] In an optional implementation, the model parameters further include the number of execution threads, and the execution script is further used to configure the execution threads for testing the model to be tested according to the number of execution threads.

[0013] In an optional implementation, the feedback method parameter may include an indication of whether to send an email and / or an email address.

[0014] In a second aspect, an embodiment provides a model evaluation detection device, the device comprising:

[0015] A determination module, used to determine model parameters of the model to be tested, wherein the model parameters include operating environment parameters, data source parameters, and feedback mode parameters;

[0016] A generation module, used to generate an execution script based on the operating environment parameters; the execution script is used to configure the operating environment according to the operating environment parameters, call the model to be tested and the test set according to the data source parameters, and configure the feedback mode according to the feedback mode parameters;

[0017] The running module is used to respond to the trigger instruction for the execution script and run the execution script.

[0018] In an optional implementation, configuring the operating environment according to the operating environment parameters includes: selecting a server address and an interface address according to the operating environment parameters.

[0019] In an optional implementation, the data source parameters include the name of the model to be tested, the name of the test set, the execution account, and the review plan.

[0020] In an optional implementation, the execution script is further used to select a test result statistics method for test data according to the model to be tested.

[0021] In an optional implementation, the model parameters further include the number of execution threads, and the execution script is further used to configure the execution threads for testing the model to be tested according to the number of execution threads.

[0022] In an optional implementation, the feedback method parameter may include an indication of whether to send an email and / or an email address.

[0023] In a third aspect, an embodiment provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps of the method described in any of the aforementioned implementation methods are implemented.

[0024] In a fourth aspect, an embodiment provides a computer-readable storage medium, wherein the computer-readable storage medium stores machine-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to execute any of the methods described in the aforementioned implementation modes.

[0025] The present invention provides a model evaluation detection method and device, which determines the model parameters of the model to be tested and generates an execution script based on the operating environment parameters; running the execution script can realize convenient detection of the AI ​​model, so as to solve the problems of long testing time and low testing efficiency of the AI ​​model evaluation value existing in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0027] Figure 1 A schematic diagram of a model evaluation and detection method flow chart provided in an embodiment of the present invention;

[0028] Figure 2 An example of a model evaluation detection method provided in an embodiment of the present invention;

[0029] Figure 3 A schematic diagram of the structure of a model evaluation and detection device provided by an embodiment of the present invention;

[0030] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0032] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0033] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0034] Figure 1 A schematic diagram of a model evaluation and detection method provided by an embodiment of the present invention. Figure 1 As shown, the method includes:

[0035] S110, determining the model parameters of the model to be tested, which include operating environment parameters, data source parameters, feedback mode parameters, and the like.

[0036] The model parameters input by the tester may be received each time the model is tested. Alternatively, the model parameters corresponding to the multiple tests may be uniformly input before multiple tests, and the server may sequentially execute steps S120 to S130 based on the model parameters corresponding to the multiple tests. As an example, the tester may input the model parameters based on Jenkins, and the Jenkins may automatically build an execution script.

[0037] The data source parameters may include the name of the model to be tested, the name of the test set, the execution account, and the review plan, etc.

[0038] Among them, the model to be tested can be an image recognition model, such as an image pornography identification model, a violation and illegality identification model, an OCR identification model, etc. The test set can be an image data set and a text data set; the image data set can be used to evaluate and detect the image recognition model. For example, the name rule of the test set can be: model name_type_time, for example: pornography identification model_product_20191018.txt; the content of the test set can be: (two columns) image URL, annotation results. The text data set can be used to evaluate and detect the text classification model. The model calling environment parameter can be used to determine the server address and interface address. The execution account can be used to determine the identity of the execution model evaluation detection, and to call the model to be identified in the model corresponding to the account. The submission plan is used to prove the compliance of the test process. The feedback method parameter may include an indication of whether to send an email and / or an email address.

[0039] S120, generating an execution script based on the operating environment parameters. The execution script is used to configure the operating environment according to the operating environment parameters, call the model to be tested and the test set according to the data source parameters, and configure the feedback mode according to the feedback mode parameters.

[0040] Configuring the operating environment according to the operating environment parameters may include: selecting a server address and an interface address according to the operating environment parameters.

[0041] In addition, the execution script is also used to select a test result statistical method for the test data according to the model to be tested.

[0042] The test results may include: model precision (Precision), recall (Recall), the harmonic mean f1 of precision and recall, query per second (Query Per Second, qps), etc.

[0043] As an example, combining Figure 2 As shown, the parameters in the execution script may include the model calling environment (environment), execution account (account), submission plan (guardid), model test set (urlfile), model name (algorithm), and email parameters, etc. Among them, when the script is executed, the server address and interface address are determined according to the model calling environment, the test to be called and the model to be tested are determined according to the model name, model test set, execution account, and submission plan, and the calculation method related to the model is used to calculate the test result of the model. The test result may include precision, recall, f1, and query rate per second. When the test is completed, the email parameter is used to determine the form in which the test result is sent to the model-related personnel or personnel group.

[0044] S130, responding to a trigger instruction for executing the script, running the execution script.

[0045] The embodiment of the present invention determines the model parameters of the model to be tested and generates an execution script based on the operating environment parameters; running the execution script can realize convenient detection of the AI ​​model, so as to solve the problems of long testing time and low testing efficiency of the AI ​​model evaluation value existing in the prior art.

[0046] In some embodiments, the model parameters also include the number of execution threads, and the execution script is also used to configure the execution threads of the model to be tested according to the number of execution threads. The number of execution threads (threads) determines how many threads are used to execute the test process, and the total execution time reflects the model response speed.

[0047] In some embodiments, during the script running process, if an error message is output when testing the test model to be identified, the running of the script can be directly terminated. After the running of the script ends, the running of the next script can be performed, and the running order of each script can be predefined or default.

[0048] It should be noted that the evaluation of the model can be achieved through generalization ability. The generalization ability refers to the ability of the learning method to predict unknown data. Generally speaking, what is actually expected is a model that can perform well on new samples. In order to achieve this goal, the "general rules" applicable to all potential samples should be deduced from the training samples as much as possible, so that correct predictions can be made when encountering new samples, and the generalization ability is better.

[0049] When the learner learns the training samples "too well", it is likely that some characteristics of the training samples themselves have been regarded as general properties that all potential samples will have, which will lead to a decrease in generalization performance. This phenomenon is called overfitting in machine learning.

[0050] The set of test samples is called the "test set". The error of the model on the test set is usually called the "test error". The error on new samples is called the "generalization error".

[0051] The purpose of machine learning is to obtain a model with small generalization error. However, in practical applications, new samples are unknown, so the "test error" on the test set is used as an approximation of the generalization error, and a "test set" is used to test the model's ability to discriminate new samples. It should be noted that the test sample should not appear in the training set and has not been used in the training process. Among them, it can also be used for performance measurement, which is an evaluation standard for measuring the generalization ability of the model. The performance measure can include accuracy, precision (for example, precision, recall, F1 value, classification algorithm evaluation index, where F1 value is the harmonic mean of precision and recall), MSE (mean square error), RMSE (root mean square error), MAE (mean absolute error), R-Squared (fit) (regression algorithm evaluation index) are all indicators for evaluating the quality of the model, and there is a certain relationship between them, but the emphasis will be different. The type of model can be judged according to the name of the model, and different performance measures can be selected as evaluation criteria according to the type of model to generate evaluation results.

[0052] Among them, accuracy refers to the ratio of the number of samples correctly classified by the classifier to the total number of samples for a given test data set.

[0053] The precision is how many of the samples predicted as positive are actually positive samples.

[0054] The recall is how many positive examples in the sample are predicted correctly.

[0055] The robustness of the model can also be tested. Robustness is also called robustness. In simple terms, it refers to whether the model can perform well under some abnormal data conditions. This is the ability to handle uncertainty in the three characteristics of artificial intelligence that we mentioned at the beginning. For example, for face recognition, the model performs well in cases of blurred images, people wearing glasses, hair blocking, insufficient lighting, etc. In simple terms, the requirement for algorithm robustness is that it should be good in "good times" and not too bad in "bad times".

[0056] The model security can also be tested. The attack methods include: probing attack and adversarial attack. The model parameters can include attack parameters, and the attack parameters can include attack methods. In probing attacks, the attacker's purpose is usually to steal the model through certain methods, or to recover part of the data used to train the machine learning model through some means to infer certain sensitive information of the user. Adversarial attacks make subtle modifications to the data source, which is imperceptible to people, but the machine learning model makes wrong judgments after receiving the data.

[0057] Response speed refers to the time required from data input to model prediction output. Evaluation of algorithm running time.

[0058] Figure 3 A schematic diagram of the structure of a model evaluation and detection device provided by an embodiment of the present invention. Figure 3 As shown, the device comprises:

[0059] The determination module 301 is used to determine the model parameters of the model to be tested, wherein the model parameters include operating environment parameters, data source parameters and feedback mode parameters;

[0060] A generation module 302 is used to generate an execution script based on the operating environment parameters; the execution script is used to configure the operating environment according to the operating environment parameters, call the model to be tested and the test set according to the data source parameters, and configure the feedback mode according to the feedback mode parameters;

[0061] The running module 303 is used to respond to the trigger instruction for the execution script and run the execution script.

[0062] In some embodiments, the execution script is specifically used to: select a server address and an interface address according to the operating environment parameters.

[0063] In some embodiments, the data source parameters include the name of the model to be tested, the name of the test set, the execution account, and the review plan.

[0064] In some embodiments, the execution script is further used to select a test result statistics method for the test data according to the model to be tested.

[0065] In some embodiments, the model parameters also include the number of execution threads, and the execution script is further used to configure the execution threads of the model to be tested according to the number of execution threads.

[0066] In some embodiments, the feedback method parameter may include an indication of whether to send an email and / or an address of the email.

[0067] The model evaluation and detection device provided in the embodiment of the present application has the same technical features as the model evaluation and detection method provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.

[0068] like Figure 4 As shown, an electronic device 400 provided in an embodiment of the present application includes: a processor 401, a memory 402 and a bus, wherein the memory 402 stores machine-readable instructions executable by the processor 401, and when the electronic device is running, the processor 401 communicates with the memory 402 through the bus, and the processor 401 executes the machine-readable instructions to perform the steps of the above-mentioned model evaluation detection method.

[0069] In practical applications, the memory 402 and the processor 401 can be general-purpose memories and processors, which are not specifically limited here. When the processor 401 runs the computer program stored in the memory 402, the model evaluation and detection method can be executed.

[0070] Specifically, the electronic device may further include a communication interface, and the processor, the communication interface and the memory are connected via a bus; the processor is used to execute an executable module stored in the memory, such as a computer program.

[0071] The memory may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0072] The bus can be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0073] Among them, the memory is used to store the program, and the processor executes the program after receiving the execution instruction. The method executed by the device defined by the process disclosed in any embodiment of the present application can be applied to the processor or implemented by the processor.

[0074] The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps, and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0075] Corresponding to the above-mentioned model evaluation and detection method, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned model evaluation and detection method are executed.

[0076] The model evaluation detection device provided in the embodiment of the present application can be specific hardware on the device or software or firmware installed on the device. The device provided in the embodiment of the present application, its implementation principle and the technical effect produced are the same as those in the aforementioned method embodiment. For the sake of brief description, for the parts not mentioned in the device embodiment, reference can be made to the corresponding contents in the aforementioned method embodiment. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can all refer to the corresponding processes in the aforementioned method embodiment, and will not be repeated here.

[0077] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0078] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0079] In addition, each functional unit in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0080] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0081] If the function is implemented in the form of a software functional unit and 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 the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the mobile control method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0082] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.

[0083] Finally, it should be noted that the above-mentioned embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application. They should all be covered within the protection scope of the present application.

Claims

1. A model evaluation detection method, characterized in that: The method comprises: Determine the model parameters of the model to be tested, wherein the model parameters include operating environment parameters, data source parameters, and feedback method parameters. The data source parameters include the name of the model to be tested, the name of the test set, the execution account, and the review plan. The feedback method parameters include an indication of whether to send an email and / or an email address; Generate an execution script based on the operating environment parameters; the execution script is used to configure the operating environment according to the operating environment parameters, call the model to be tested and the test set according to the data source parameters, and configure the feedback mode according to the feedback mode parameters; In response to a trigger instruction for the execution script, the execution script is run.

2. The method according to claim 1, characterized in that Configuring the operating environment according to the operating environment parameters includes: selecting a server address and an interface address according to the operating environment parameters.

3. The method according to claim 1, characterized in that The execution script is also used to select a test result statistics method for test data according to the model to be tested.

4. The method according to claim 1, characterized in that The model parameters also include the number of execution threads, and the execution script is further used to configure the execution threads for testing the model to be tested according to the number of execution threads.

5. A model evaluation detection device, characterized in that: The device comprises: A determination module, used to determine the model parameters of the model to be tested, wherein the model parameters include operating environment parameters, data source parameters, and feedback method parameters, wherein the data source parameters include the name of the model to be tested, the name of the test set, the execution account, and the review plan, and the feedback method parameters include whether to send an email and / or the address of the email; A generation module, used to generate an execution script based on the operating environment parameters; the execution script is used to configure the operating environment according to the operating environment parameters, call the model to be tested and the test set according to the data source parameters, and configure the feedback mode according to the feedback mode parameters; The running module is used to respond to the trigger instruction for the execution script and run the execution script.

6. The device according to claim 5, characterized in that Configuring the operating environment according to the operating environment parameters includes: selecting a server address and an interface address according to the operating environment parameters.

7. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores machine executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to execute the method according to any one of claims 1 to 4.