Defect detection method, system and device based on visual software
By obtaining the process tree diagram in the visual software, confirming the detection operator and generating detection code through the reflection mechanism, the problem of long detection time and code cannot be cross-platform in the existing technology is solved, and an efficient and compatible defect detection process is achieved.
Patent Information
- Application Number
- CN202510010266.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-05-06
AI Technical Summary
When existing visualization software executes defect detection processes, the detection time is long due to interface display, dynamic analysis and reflection of code execution, and the generated code cannot cross-platform and use other programming languages.
The process tree diagram is obtained through visual software, all detection operators are confirmed, the basic program template is obtained, and the functions and parameters of the detection operator are obtained through the reflection mechanism, the basic program template is completed to generate detection code, and finally the executable file is compiled and generated.
Improves the compatibility of detection codes, enables them to run in multiple environments, reduces dependence on visualization software, and improves detection efficiency.
Smart Images

Figure CN119938020A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a method, system and device for defect detection based on visualization software. Background Art
[0002] In the fields of computer software development, image processing, and defect detection, the use of visualization software has become increasingly common. Visualization software can help users understand data and processes more intuitively, and can facilitate debugging and optimization. In the field of defect detection, by building defect detection processes with visualization software, it is easier to select and configure basic operators, and the execution time and logs of each operator can be viewed more intuitively.
[0003] Existing visualization software usually provides a graphical interface, and users can build defect detection processes by dragging and dropping. These software usually provide a rich operator library, from which users can select the required operators and configure their input and output parameters.
[0004] When executing the detection process, the detection time is long because of the interface display, dynamic parsing and reflection execution code. After the code is written, it cannot be cross-platform or used in other programming languages. Summary of the invention
[0005] In order to solve the above technical problems, the present application provides a method, system and device for defect detection based on visualization software, which are used to generate executable files that can run defect detection in multiple environments.
[0006] The technical solution provided in this application is described below:
[0007] The first aspect of the present application provides a method for defect detection based on visualization software, comprising:
[0008] Obtain a process tree diagram through visualization software;
[0009] Confirm all detection operators according to the process tree diagram;
[0010] Get the basic program template;
[0011] Obtain the functions and parameters of all the detection operators through the reflection mechanism to complete the basic program template and obtain the detection code;
[0012] Compile the detection code to generate an executable file.
[0013] Optionally, the obtaining of functions and parameters of all detection operators through a reflection mechanism, completing the basic program template, and obtaining the detection code includes:
[0014] Obtaining an input structure according to a reflection mechanism, and generating parameters of all detection operators through the input structure;
[0015] Obtain all algorithm functions of all detection operators;
[0016] Determine the parameter requirements of all the algorithm functions one by one;
[0017] When the parameter requirement is to be obtained through the input structure, the input parameters of the algorithm function are determined through the input structure;
[0018] When the parameter requirement is an output parameter of another algorithm function, the output parameter of the other algorithm function is obtained, and all output parameters are combined to generate an output structure;
[0019] Determining input parameters of the algorithm function according to the output structure;
[0020] The method names of the algorithm functions are obtained one by one, and the algorithm functions are called on the basic program template according to the method names to obtain the detection code.
[0021] Optionally, the method names of the algorithm functions are obtained one by one, and the algorithm functions are called on the basic program template according to the method names to obtain the detection code, including:
[0022] Get the algorithm function;
[0023] Determine whether the algorithm function is the algorithm function corresponding to the last detection operator among all the detection operators;
[0024] If not, obtaining the method name corresponding to the algorithm function, calling the algorithm function on the basic program template according to the method name, and obtaining the next algorithm function;
[0025] If so, obtain the method name corresponding to the algorithm function, call the algorithm function on the basic program template according to the method name, and generate a detection code.
[0026] Optionally, after confirming all detection operators according to the process tree diagram, the method further includes:
[0027] The detection operators are integrated into a string.
[0028] Optionally, before compiling the detection code to generate an executable file, the method further includes:
[0029] The character string corresponding to the detection operator is adjusted according to the flag bit of the basic program template to adjust the logical order of executing the program.
[0030] Optionally, confirming all detection operators according to the process tree diagram includes:
[0031] The detection nodes on the process tree diagram are traversed, and the detection operators corresponding to the detection nodes are determined from the visualization software to obtain all the detection operators.
[0032] Optionally, compiling the detection code to generate an executable file includes:
[0033] Convert the detection code into a preset format file to generate a project architecture;
[0034] The compiler is started according to the preset rules, and the project architecture is executed to generate an executable file.
[0035] A second aspect of the present application provides a defect detection system based on visualization software, comprising:
[0036] A first acquisition unit is used to acquire a process tree diagram through visualization software;
[0037] A confirmation unit, used for confirming all detection operators according to the process tree diagram;
[0038] A second acquisition unit, used for acquiring a basic program template;
[0039] A third acquisition unit is used to acquire the functions and parameters of all the detection operators through a reflection mechanism, complete the basic program template, and obtain the detection code;
[0040] The compiling unit is used to compile the detection code to generate an executable file.
[0041] Optionally, the third acquiring unit is specifically used for:
[0042] Obtaining an input structure according to a reflection mechanism, and generating parameters of all detection operators through the input structure;
[0043] Obtain all algorithm functions of all detection operators;
[0044] Determine the parameter requirements of all the algorithm functions one by one;
[0045] When the parameter requirement is to be obtained through the input structure, the input parameters of the algorithm function are determined through the input structure;
[0046] When the parameter requirement is an output parameter of another algorithm function, the output parameter of the other algorithm function is obtained, and all output parameters are combined to generate an output structure;
[0047] Determining input parameters of the algorithm function according to the output structure;
[0048] The method names of the algorithm functions are obtained one by one, and the algorithm functions are called on the basic program template according to the method names to obtain the detection code.
[0049] Optionally, the third acquisition unit is further configured to:
[0050] Get the algorithm function;
[0051] Determine whether the algorithm function is the algorithm function corresponding to the last detection operator among all the detection operators;
[0052] If not, obtaining the method name corresponding to the algorithm function, calling the algorithm function on the basic program template according to the method name, and obtaining the next algorithm function;
[0053] If so, obtain the method name corresponding to the algorithm function, call the algorithm function on the basic program template according to the method name, and generate a detection code.
[0054] Optionally, the system further includes:
[0055] An integration unit is used to integrate the detection operators into a character string.
[0056] Optionally, the system further includes:
[0057] The adjustment unit is used to adjust the character string corresponding to the detection operator according to the flag bit of the basic program template to adjust the logical order of executing the program.
[0058] Optionally, the confirmation unit is specifically used for:
[0059] The detection nodes on the process tree diagram are traversed, and the detection operators corresponding to the detection nodes are determined from the visualization software to obtain all the detection operators.
[0060] Optionally, the compilation unit is specifically used for:
[0061] Convert the detection code into a preset format file to generate a project architecture;
[0062] The compiler is started according to the preset rules, and the project architecture is executed to generate an executable file.
[0063] A third aspect of the present application provides a device for defect detection based on visualization software, the device comprising:
[0064] Processor, memory, input-output unit, and bus;
[0065] The processor is connected to the memory, the input and output unit, and the bus;
[0066] The memory stores a program, and the processor calls the program to execute the first aspect and any optional method in the first aspect.
[0067] A fourth aspect of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the program executes the first aspect and any optional method in the first aspect.
[0068] It can be seen from the above technical solutions that this application has the following advantages:
[0069] The detection operator is determined by each stump node in the process tree diagram generated by the visualization software, and these detection operators are called in the basic program template to obtain an executable file for executing the detection process corresponding to the current process tree diagram of the visualization software, so as to improve the compatibility of the detection code according to the characteristics of the executable file itself. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] In order to more clearly illustrate the technical solution in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0071] Figure 1 A schematic flow chart of an embodiment of a method for defect detection based on visualization software in the present application;
[0072] Figure 2a A flowchart of an embodiment of the first stage of the method for defect detection based on visualization software in the present application;
[0073] Figure 2b A flowchart of an embodiment of the second stage of the method for defect detection based on visualization software in the present application;
[0074] Figure 3 A schematic diagram of the structure of an embodiment of a system for defect detection based on visualization software in the present application;
[0075] Figure 4 It is a structural schematic diagram of another embodiment of the system for defect detection based on visualization software in the present application;
[0076] Figure 5 It is a schematic structural diagram of another embodiment of the device for defect detection based on visualization software in the present application. DETAILED DESCRIPTION
[0077] It should be noted that the visual software-based defect detection method provided in this application can be applied to a terminal, a system, or a server. For example, the terminal can be a smart phone or a computer, a tablet computer, a smart TV, a smart watch, a portable computer terminal, or a fixed terminal such as a desktop computer. For the convenience of explanation, this application uses the terminal as an example for explanation.
[0078] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0079] See also Figure 1 The present application first provides an embodiment of a method for defect detection based on visualization software, the embodiment comprising:
[0080] S101, obtaining a process tree diagram through visualization software;
[0081] Visualization software is a computer program that allows users to create, edit and manage complex data and processes through a graphical user interface (GUI) without having to write code directly. This type of software usually provides a range of tools and functions that enable non-technical users to build and operate complex systems and processes.
[0082] Generally, the detection process is edited and saved by visualization software. The content is in XML or JSON format and the data is in tree format, where each tree node is an operator, thus forming the framework of the entire detection process. That is, the detection process is edited by visualization software and displayed in the form of a tree diagram.
[0083] S102, confirming all detection operators according to the process tree diagram;
[0084] The detection operator is a core component in the defect detection process. It represents a function or module that performs specific operations during the detection process. The visualization software provides a rich operator library, from which users can select the required operator and configure its input and output parameters.
[0085] Specifically, each detection operator focuses on performing a specific task; detection operators have clear inputs and outputs. The input is the data processed by the operator, and the output is the result of the operator processing; users can configure the parameters of the operator as needed; different detection operators can be combined to form a complete detection process; each operator is independent and can be developed, tested and optimized separately; operators can be reused in different projects and processes; in visualization software, operators are usually represented in a graphical way to facilitate users to drag and connect; behind the detection operator is a specific algorithm implementation, which may be based on mathematical models, machine learning, image processing technology, etc.; in a cross-platform detection system, operators need to be able to run on different operating systems and hardware.
[0086] S103, obtaining a basic program template;
[0087] The basic program template is a predefined code framework that provides the basic structure and starting point for writing programs. It is at least a compilable but functional project framework that contains the basic environment required for the software to run. Such a template design provides great convenience for the subsequent dynamic addition of code segments and compilation. This template contains the minimum necessary code required for the program to run, allowing developers to add business logic and specific functions on this basis.
[0088] In this embodiment, the basic program template is used to execute detection operators in sequence according to the characteristics of program execution. For example, when the detection operator is an encapsulated function, the basic program template must have at least one program entry point (main function) for executing the call to the detection operator. It should be noted that for detection operators, between different detection operators, because there is a situation where the output data of one detection operator is the input data of another detection operator, there will be such associated functions in the basic program template. Marking is carried out to ensure that the detection operator with output data as input data executes the correct operation process.
[0089] S104, obtaining the functions and parameters of all detection operators through the reflection mechanism to complete the basic program template and obtain the detection code;
[0090] Specifically, the terminal obtains the function content and parameters of the detection operator one by one. The actual sorting method is consistent with the terminal's traversal of the operators in the process tree diagram. After the terminal determines the corresponding functions of all detection operators and the parameter acquisition methods, the terminal will generate a conditional sequence so that the final detection code is a code that can run completely.
[0091] S105: Compile the detection code to generate an executable file.
[0092] After determining the detection code, the terminal will compile the detection code and generate an executable file based on the compiled product file. This embodiment takes C# as an example. After C# is successfully compiled, the executable file will be directly output. Therefore, after completing the layout of the detection operator, as long as the completed basic program template is compiled, the executable file can be obtained.
[0093] The actual manifestation of an executable file is an application file with the file extension .exe. For operation, the executable file has high compatibility and is an independent program. After the detection operator is determined through the visual interface, it no longer needs to occupy the resources of the visual interface and the corresponding program, thereby improving the detection speed.
[0094] This embodiment determines the detection operator through each stump node in the process tree diagram generated by the visualization software, and calls these detection operators in the basic program template to obtain an executable file for executing the detection process corresponding to the current process tree diagram of the visualization software, so as to improve the compatibility of the detection code according to the characteristics of the executable file itself.
[0095] See also Figure 2a to Figure 2b The present application embodiment provides another embodiment of a method for defect detection based on visualization software, the embodiment comprising:
[0096] S201, obtaining a process tree diagram through visualization software;
[0097] Step S201 in this embodiment is similar to step S101 in the aforementioned embodiment, and will not be described in detail here.
[0098] S202, traversing the detection nodes on the process tree diagram, determining the detection operators corresponding to the detection nodes from the visualization software, and obtaining all the detection operators.
[0099] Read the detection process. The detection process is edited and saved by the visualization software. The content is in XML or JSON format. The data is in a tree format, where each tree node is an operator, thus forming the framework of the entire detection process.
[0100] Specifically, the process tree diagram contains all the detection steps that need to be executed in the actual detection process. During the traversal process, the terminal will obtain the detection operator corresponding to each detection node in the process tree diagram one by one. The detection operator is an encapsulated complete detection process code, that is, the source code of the detection operator.
[0101] S203: Integrate the detection operators into a character string.
[0102] After determining the source code of all detection operators, the terminal converts the source code of the detection operator into a string. Because the code segments of multiple operators need to be combined in a specific order and logic when building a complete program, integrating the code into the string can splice and combine different code fragments to dynamically generate a complete source code file.
[0103] When multiple programming languages need to be supported, the code can be integrated into the string to adjust the code format according to the grammatical rules of different languages, ensuring that the generated code is valid in different language environments or compilation environments. Strings provide a flexible way to handle different operators and process configurations. When the detection process or detection operator changes locally, the terminal can complete the detection process update by updating the corresponding code string without modifying the entire program framework.
[0104] S204, obtaining a basic program template;
[0105] Step S204 in this embodiment is similar to step S103 in the above embodiment, and will not be described in detail here.
[0106] S205, obtaining an input structure according to the reflection mechanism, and generating parameters of all detection operators through the input structure;
[0107] Specifically, the parameters of the detection operator are data determined after the terminal determines the actual content and parameter input requirements of the detection operator. While the terminal traverses the tree graph, it will obtain the input data required by the detection operators corresponding to these detection nodes, so that the terminal determines all the input data required for all detection operators.
[0108] The input structure is used to store the input parameters of all detection operators. The input structure is the data content preset in the basic program template. Therefore, when the terminal obtains the basic program template, it can update the input data of the obtained detection operator to the input structure. In order to achieve the purpose of generating the parameters of the detection operator through the input structure, it should be noted that the input structure only stores the input parameters of the detection operator.
[0109] S206, obtaining all algorithm functions of all detection operators;
[0110] In actual situations, the input data of the detection operator may be obtained directly from the object to be detected, or it may be the output data of other detection operators. In order to distinguish these two types of input parameters, the terminal will re-detect the algorithm functions of all detection operators after generating the input structure to determine the source of their input parameters.
[0111] S207, determining parameter requirements of all algorithm functions one by one;
[0112] Specifically, the parameter requirement is the source of the input parameters described above. If necessary, the parameter requirement can be reflected as an identification bit, that is, the terminal will mark the parameter source of the output data of other detection operators, and the terminal determines that the corresponding parameter source is other detection operators through the mark.
[0113] The parameter requirements include two requirements: obtaining from the device to be detected and output data of other detection operators. When the parameter requirement is obtained through the input structure, step S208 is executed; when the parameter requirement is the output parameter of other algorithm functions, step S209 is executed.
[0114] S208. When the parameter requirement is to be obtained through an input structure, the input parameters of the algorithm function are determined through the input structure;
[0115] After the terminal determines the input structure, the terminal will obtain the input parameters required by the corresponding algorithm function according to the input structure, and use the input parameters as variable inputs of the corresponding algorithm function to complete the embodiment of the algorithm function on the basic program template.
[0116] S209, when the parameter requirement is the output parameter of other algorithm functions, obtain the output parameters of other algorithm functions, and merge all the output parameters to generate an output structure;
[0117] In actual situations, the basic program template exists in an output structure similar to the input structure, which is generated simultaneously when traversing the function. Generally, only the data that is used as input parameters is retained in the output structure.
[0118] S210, determining the input parameters of the algorithm function according to the output structure;
[0119] From the above steps, it can be seen that the parameters contained in the output structure are the input parameters of other detection operators. When the terminal determines the parameter requirements, the terminal will determine the corresponding structure according to the parameter requirements, and obtain the specific pointing label of the input parameter from the corresponding structure. The pointing label is the pointer to the input parameter, which can be a pointer or a parameter in the program.
[0120] After the terminal obtains the detection operator, input structure and output structure through the process tree diagram, the terminal will build the actual detection process source code based on the above information. The terminal will obtain the method names of the algorithm functions from the string one by one, call the algorithm functions on the basic program template according to the method names, and obtain the detection code. The specific process is as follows:
[0121] S211, obtaining an algorithm function;
[0122] The algorithm function is a detection operator converted into a string. When the detection code is actually generated, the algorithm function needs to be adaptively adjusted according to the actual operating environment requirements. This involves cross-platform frameworks and libraries, which are built into the basic program template. Therefore, after the terminal determines the detection operator, it also needs to obtain the detailed content of the algorithm function corresponding to the operator and subsequently organize the content of the algorithm function.
[0123] S212, determining whether the algorithm function is the algorithm function corresponding to the last detection operator among all detection operators;
[0124] In actual situations, the terminal will determine the number of detection operators based on the process tree diagram. Therefore, when confirming the algorithm function, the terminal can obtain more than one algorithm function. To ensure that the parameter input and output relationship of the algorithm is consistent with the program operation logic, the terminal calls the algorithm function one by one through a loop function, with the last detection operator as the flag. When the terminal detects that the current detection operator is not the last detection operator, step S213 is executed; when the terminal detects the last detection operator, step S214 is executed.
[0125] S213, if not, then obtain the method name corresponding to the algorithm function, call the algorithm function on the basic program template according to the method name, and obtain the next algorithm function;
[0126] The purpose of the terminal determining the algorithm function is to call it in the basic program template to determine the actual calling order of the algorithm function. In actual situations, in order to improve the reading efficiency of the main function, in general, the function content used in the main function will be encapsulated into the function library, so that the main function calls the algorithm through the function name, improving the overall readability of the main function.
[0127] When the detection operator corresponding to the algorithm function corresponding to the method name is not the last detection operator, the terminal will continue to obtain the algorithm function corresponding to the next detection operator and call it.
[0128] S214: If yes, obtain the method name corresponding to the algorithm function, call the algorithm function on the basic program template according to the method name, and generate the detection code.
[0129] When the detection operator corresponding to the algorithm function corresponding to the method name is the last detection operator, the terminal will determine that the detection scheme corresponding to the process tree diagram has been laid out in the basic program template, so the detection code can be generated.
[0130] S215. Adjust the character string corresponding to the detection operator according to the flag bit of the basic program template to adjust the logical order of executing the program.
[0131] In the basic program template, there may be some placeholders or specific markers to indicate where the operator code should be inserted. In actual situations, some code calls require some prerequisites. For example, when performing targeted module detection, the corresponding module to be detected needs to be initialized. Therefore, after the terminal integrates the operator code into the string, it embeds the detection operator code into the correct position according to these placeholders.
[0132] S216, converting the detection code into a preset format file to generate a project architecture;
[0133] The preset format file is generally a .cs file, which is a C# source code file. The reason for generating a .cs file is that C# supports cross-platform operation, and the .cs file can be well integrated into the .NET project architecture. Project files (such as .csproj) are used to manage project dependencies, compilation options, and other build settings. In .NET projects, .cs files are the natural unit for organizing code. Each file usually contains one or more classes, which helps modularize and maintain the code.
[0134] The terminal stores the complete code segments after splicing in a .cs file and integrates it into the program template to build a complete project architecture. This process supports multi-language development and cross-platform program generation, which significantly enhances the flexibility, portability, and execution efficiency of the project.
[0135] The specific process is as follows:
[0136] Import namespace: First, you need to import the System.IO namespace, because the StreamWriter class is located in this namespace. The StreamWriter class is a class in the System.IO namespace in the .NET framework, which provides the function of writing characters to a stream. This class is often used to write strings or other character data to files or other data streams.
[0137] Fill in the file path: fill in the cs file path in the empty project.
[0138] Create StreamWriter instance: Create an instance of StreamWriter using the file path.
[0139] Write content: Use the Write method of StreamWriter to write the code to the file.
[0140] Close the StreamWriter: Once you are done writing, make sure to close the StreamWriter to free up system resources.
[0141] S217. Start the compiler according to the preset rules, execute the project architecture, and generate an executable file.
[0142] Specifically, the compilation process uses the Process class to start the Visual Studio compiler csc.exe to generate an executable file. During the compilation process, the type of the output file can be determined through the syntax / target to determine that the generated file is an executable file with the suffix .exe.
[0143] In an embodiment of the present application, after a process tree diagram is generated or obtained through visualization software, the terminal can automatically determine the detection process according to the process tree diagram, and obtain the corresponding detection operator according to the detection process, so as to determine the detection operator source code by obtaining the algorithm or corresponding function and related class corresponding to the detection operator, and after the detection operator source code is stringified, the detection operator source code is adjusted to adapt to the environment according to the environment, and the detection operator and the corresponding code are laid out with the basic program template as the framework to generate the detection code. After compilation, the detection code can output an executable file. Through the multi-platform nature of C#, the output executable file can meet the requirements of running executable files on multiple platforms. After the executable file is started, a completed detection process will be run, so that the detection can be run under the operating conditions independent of the visualization software, reducing the computing power requirements of the visualization software and improving the detection efficiency.
[0144] The above is a detailed description of the method for defect detection based on visualization software in the embodiment of the present application. The following is a detailed description of the system and device for defect detection based on visualization software.
[0145] See also Figure 3 The present application provides an embodiment of a system for defect detection based on visualization software, which includes:
[0146] A first acquisition unit 301 is used to acquire a process tree diagram through visualization software;
[0147] A confirmation unit 302, used to confirm all detection operators according to the process tree diagram;
[0148] The second acquisition unit 303 is used to acquire a basic program template;
[0149] The third acquisition unit 304 is used to acquire functions and parameters of all detection operators through a reflection mechanism, complete the basic program template, and obtain the detection code;
[0150] The compiling unit 305 is used to compile the detection code and generate an executable file.
[0151] In this embodiment, the functions of each unit are the same as those described above. Figure 1The steps in the illustrated embodiments correspond to each other and will not be described again here.
[0152] See also Figure 4 The present application provides an embodiment of a system for defect detection based on visualization software, which includes:
[0153] A first acquisition unit 401 is used to acquire a process tree diagram through visualization software;
[0154] A confirmation unit 402, used to confirm all detection operators according to the process tree diagram;
[0155] The integration unit 403 is used to integrate the detection operators into a character string.
[0156] A second acquisition unit 404 is used to acquire a basic program template;
[0157] The third acquisition unit 405 is used to acquire the functions and parameters of all detection operators through the reflection mechanism, complete the basic program template, and obtain the detection code;
[0158] The adjustment unit 406 is used to adjust the character string corresponding to the detection operator according to the flag bit of the basic program template to adjust the logical order of executing the program.
[0159] The compiling unit 407 is used to compile the detection code and generate an executable file.
[0160] Optionally, the third obtaining unit 405 is specifically configured to:
[0161] Obtain the input structure based on the reflection mechanism and generate the parameters of all detection operators through the input structure;
[0162] Get all algorithm functions of all detection operators;
[0163] Determine the parameter requirements of all algorithm functions one by one;
[0164] When the parameter requirement is to be obtained through an input structure, the input parameters of the algorithm function are determined through the input structure;
[0165] When the parameter requirement is the output parameter of other algorithm functions, obtain the output parameters of other algorithm functions, merge all output parameters to generate an output structure;
[0166] Determine the input parameters of the algorithm function based on the output structure;
[0167] The method names of the algorithm functions are obtained one by one, and the algorithm functions are called on the basic program template according to the method names to obtain the detection code.
[0168] Optionally, the third obtaining unit 405 is further configured to:
[0169] Get the algorithm function;
[0170] Determine whether the algorithm function is the algorithm function corresponding to the last detection operator among all detection operators;
[0171] If not, then obtain the method name corresponding to the algorithm function, call the algorithm function on the basic program template according to the method name, and obtain the next algorithm function;
[0172] If so, obtain the method name corresponding to the algorithm function, call the algorithm function on the basic program template according to the method name, and generate the detection code.
[0173] Optionally, the confirmation unit 402 is specifically configured to:
[0174] Traverse the detection nodes on the process tree diagram, determine the detection operators corresponding to the detection nodes from the visualization software, and obtain all detection operators.
[0175] Optionally, the compiling unit 407 is specifically used for:
[0176] Convert the detection code into a preset format file and generate the project architecture;
[0177] Start the compiler according to the preset rules, execute the project architecture, and generate executable files.
[0178] In this embodiment, the functions of each unit correspond to the steps in the embodiment shown in FIG. 2 , and will not be described in detail here.
[0179] See also Figure 5 The present application embodiment provides another embodiment of a device for defect detection based on visualization software, including:
[0180] Processor 501, memory 502, input and output unit 503, bus 504;
[0181] The processor 501 is connected to the memory 502, the input and output unit 503 and the bus 504;
[0182] Processor 501 specifically executes Figure 1 The operations corresponding to the steps in the method of FIG. 2 are not described in detail here.
[0183] The present application also relates to a computer-readable storage medium on which a program is stored, wherein when the program is run on a computer, the computer is caused to execute any of the above methods.
[0184] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0185] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0186] 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.
[0187] In addition, each functional unit in each embodiment of 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. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0188] If the integrated unit 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 all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments 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, etc. Various media that can store program codes.
Claims
1. A method for defect detection based on visualization software, characterized in that: The method comprises: Obtain a process tree diagram through visualization software; Confirm all detection operators according to the process tree diagram; Get the basic program template; Obtain the functions and parameters of all the detection operators through the reflection mechanism to complete the basic program template and obtain the detection code; Compile the detection code to generate an executable file.
2. The method according to claim 1, characterized in that The method of obtaining the functions and parameters of all detection operators through the reflection mechanism, completing the basic program template, and obtaining the detection code includes: Obtaining an input structure according to a reflection mechanism, and generating parameters of all detection operators through the input structure; Obtain all algorithm functions of all detection operators; Determine the parameter requirements of all the algorithm functions one by one; When the parameter requirement is to be obtained through the input structure, the input parameters of the algorithm function are determined through the input structure; When the parameter requirement is an output parameter of another algorithm function, the output parameter of the other algorithm function is obtained, and all output parameters are combined to generate an output structure; Determining input parameters of the algorithm function according to the output structure; The method names of the algorithm functions are obtained one by one, and the algorithm functions are called on the basic program template according to the method names to obtain the detection code.
3. The method according to claim 2, characterized in that Obtaining the method names of the algorithm functions one by one, calling the algorithm functions on the basic program template according to the method names, and obtaining the detection code, including: Get the algorithm function; Determine whether the algorithm function is the algorithm function corresponding to the last detection operator among all the detection operators; If not, obtaining the method name corresponding to the algorithm function, calling the algorithm function on the basic program template according to the method name, and obtaining the next algorithm function; If so, obtain the method name corresponding to the algorithm function, call the algorithm function on the basic program template according to the method name, and generate a detection code.
4. The method according to claim 1, characterized in that After confirming all detection operators according to the process tree diagram, the method further includes: The detection operators are integrated into a string.
5. The method according to claim 4, characterized in that Before compiling the detection code to generate an executable file, the method further includes: The character string corresponding to the detection operator is adjusted according to the flag bit of the basic program template to adjust the logical order of executing the program.
6. The method according to any one of claims 1 to 5, characterized in that The step of confirming all detection operators according to the process tree diagram includes: The detection nodes on the process tree diagram are traversed, and the detection operators corresponding to the detection nodes are determined from the visualization software to obtain all the detection operators.
7. The method according to any one of claims 1 to 5, characterized in that The compiling of the detection code to generate an executable file includes: Convert the detection code into a preset format file to generate a project architecture; The compiler is started according to the preset rules, and the project architecture is executed to generate an executable file.
8. A defect detection system based on visualization software, characterized in that: The system comprises: A first acquisition unit is used to acquire a process tree diagram through visualization software; A confirmation unit, used for confirming all detection operators according to the process tree diagram; A second acquisition unit, used for acquiring a basic program template; A third acquisition unit is used to acquire the functions and parameters of all the detection operators through a reflection mechanism, complete the basic program template, and obtain the detection code; The compiling unit is used to compile the detection code to generate an executable file.
9. A defect detection device based on visualization software, characterized in that: The device comprises: Processor, memory, input-output unit, and bus; The processor is connected to the memory, the input and output unit, and the bus; The memory stores a program, and the processor calls the program to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a program stored thereon, wherein the program, when executed on a computer, performs the method according to any one of claims 1 to 7.