CN116643755A - Code generation method, code generation device, visualization platform and electronic equipment - Google Patents

Code generation method, code generation device, visualization platform and electronic equipment Download PDF

Info

Publication number
CN116643755A
CN116643755A CN202310573985.6A CN202310573985A CN116643755A CN 116643755 A CN116643755 A CN 116643755A CN 202310573985 A CN202310573985 A CN 202310573985A CN 116643755 A CN116643755 A CN 116643755A
Authority
CN
China
Prior art keywords
code
data processing
processing application
engineering
application scheme
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202310573985.6A
Other languages
Chinese (zh)
Inventor
冯华鹏
胡景翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikrobot Co Ltd
Original Assignee
Hangzhou Hikrobot Co Ltd
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 Hangzhou Hikrobot Co Ltd filed Critical Hangzhou Hikrobot Co Ltd
Priority to CN202310573985.6A priority Critical patent/CN116643755A/en
Publication of CN116643755A publication Critical patent/CN116643755A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a code generation method, a code generation device, a visualization platform and electronic equipment, and relates to the technical field of machine vision. The method is applied to a code generation device in a code generation system, and the system further comprises a visualization platform for building a data processing application scheme. Acquiring description data of a target data processing application scheme; the target data processing application scheme is generated by the visualization platform based on the appointed operation of a user on each appointed algorithm module related to the preset data processing method in the visualization platform; analyzing the description data to obtain an analysis result; a source code for the target data processing application scheme is generated based on the parsing result, the predefined code fragments, and the predefined engineering template, and an engineering code for the target data processing application scheme is generated based on the source code. Compared with the related art, the technical scheme provided by the embodiment of the application can improve the code generation efficiency.

Description

Code generation method, code generation device, visualization platform and electronic equipment
Technical Field
The present application relates to the field of machine vision, and in particular, to a code generation method, a code generation apparatus, a visualization platform, and an electronic device.
Background
In the machine vision industry, the image processing methods used are different for different detection scenarios. Moreover, the processing logic and the module calling order of each image processing method are different, so that different codes need to be written for different image processing methods.
In the actual production process, when detecting a scene change, it is necessary to change the image processing method and generate a code of the image processing method suitable for a new detected scene. In this way, when there are a plurality of detection scenes, a technician needs to write and debug a large amount of codes, and the code generation period of the image processing method applicable to the scene is long for each detection scene, thereby making the code generation efficiency low.
Disclosure of Invention
The embodiment of the application aims to provide a code generation method, a code generation device, a visualization platform and electronic equipment so as to improve the code generation efficiency. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a code generating method, applied to a code generating device in a code generating system, where the system further includes a visualization platform for building a data processing application scheme, and the method includes:
Acquiring description data of a target data processing application scheme; the target data processing application scheme is generated by the visual platform based on the appointed operation of a user on each appointed algorithm module of the visual platform about a preset data processing method; the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
analyzing the description data to obtain an analysis result;
generating source codes of the target data processing application scheme based on the analysis result, the predefined code fragments and the predefined engineering templates, and generating engineering codes related to the target data processing application scheme based on the source codes.
Optionally, in a specific implementation manner, the method is applied to an implementation layer of the code generating device; the code generating device also comprises an interface layer and a data layer;
the acquiring the description data of the target data processing application scheme includes:
acquiring description data of a target data processing application scheme sent by the visual platform through the interface layer;
the method further comprises the steps of:
Storing the analysis result to the data layer;
the generating the source code of the target data processing application scheme based on the analysis result, the predefined code segment and the predefined engineering template, and generating the engineering code related to the target data processing application scheme based on the source code, including:
reading the analysis result from the data layer, generating a source code of the target data processing application scheme based on the analysis result, the predefined code segments and the predefined engineering template, and generating engineering codes related to the target data processing application scheme based on the source code.
Optionally, in a specific implementation manner, the implementation layer includes a source code generator, an engineering code generator and a predefined code segment; the data layer stores engineering template files, and the analysis result comprises a flow topological structure, an algorithm module description, an SDK interface description and an algorithm module and SDK mapping;
the reading the analysis result from the data layer, generating a source code of the target data processing application scheme based on the analysis result, a predefined code segment and a predefined engineering template, and generating an engineering code related to the target data processing application scheme based on the source code, including:
Reading the analysis result and the engineering template file from the data layer; invoking the source code generator to generate source code for the target data processing application scheme using the algorithm module and SDK map, the algorithm module description, the SDK interface description, the predefined code fragments, predefined engineering templates in the engineering template file, and the flow topology; and calling the engineering code generator, and generating engineering codes related to the target data processing application scheme by utilizing the source codes.
Optionally, in a specific implementation manner, before the parsing the description data to obtain a parsing result, the method further includes:
checking the description data to obtain a checking result;
and if the verification result represents that the description data passes the verification, analyzing the result data to obtain an analysis result.
Optionally, in a specific implementation manner, the method further includes:
and storing the engineering codes in a designated storage space.
In a second aspect, an embodiment of the present application provides a code generation method, which is applied to a visualization platform for building an engineering scheme in a code generation system, where the system further includes a code generation device, and the method includes:
Generating a target data processing application scheme based on the specified operation of a user on each specified algorithm module of a preset data processing method in the visual platform;
when a code generation instruction is detected, generating description data of the target data processing application according to the target data processing application scheme; wherein the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
and sending the description data to the code generation device so that the code generation device analyzes the description data to obtain an analysis result, generating source codes of the target data processing application scheme based on the analysis result, the predefined code segments and the predefined engineering templates, and generating engineering codes related to the target data processing application scheme based on the source codes.
Optionally, in a specific implementation manner, the method further includes:
and displaying the target data processing application scheme on a preset display interface.
In a third aspect, an embodiment of the present application provides a code generating device in a code generating system, where the system further includes a visualization platform for building a data processing application scheme, and the device includes:
The data acquisition module acquires description data of a target data processing application scheme; the target data processing application scheme is generated by the visualization platform based on the appointed operation of a user on each appointed algorithm module of a preset data processing device in the visualization platform; the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
the analysis module is used for analyzing the description data to obtain an analysis result;
and the code generation module is used for generating a source code of the target data processing application scheme based on the analysis result, the predefined code segment and the predefined engineering template, and generating engineering codes related to the target data processing application scheme based on the source code.
Optionally, in a specific implementation manner, the device includes: an interface layer, an implementation layer and a data layer; the functions of the data acquisition module, the analysis module and the code generation module are realized by the realization layer;
the data acquisition module is specifically used for acquiring description data of a target data processing application scheme sent by the visual platform through calling the interface layer;
The analysis module is further used for storing the analysis result to the data layer;
the code generation module is specifically configured to read the analysis result from the data layer, generate a source code of the target data processing application scheme based on the analysis result, a predefined code segment and a predefined engineering template, and generate an engineering code related to the target data processing application scheme based on the source code.
Optionally, in a specific implementation manner, the implementation layer includes a source code generator, an engineering code generator and a predefined code segment; the data layer stores engineering template files, and the analysis result comprises a flow topological structure, an algorithm module description, an SDK interface description and an algorithm module and SDK mapping;
the code generation module is specifically used for reading the analysis result and the engineering template file from the data layer; invoking the source code generator to generate source code for the target data processing application scheme using the algorithm module and SDK map, the algorithm module description, the SDK interface description, the predefined code fragments, predefined engineering templates in the engineering template file, and the flow topology; and calling the engineering code generator, and generating engineering codes related to the target data processing application scheme by utilizing the source codes.
Optionally, in a specific implementation manner, the apparatus further includes:
the verification module is used for verifying the description data before the description data is analyzed to obtain an analysis result, so as to obtain a verification result; and if the verification result represents that the description data passes the verification, triggering the analysis module.
Optionally, in a specific implementation manner, the apparatus further includes:
and the storage module is used for storing the engineering codes in the appointed storage space.
In a fourth aspect, an embodiment of the present application provides a visualization platform, applied to a code generation system, where the system further includes a code generation apparatus, where the visualization platform is used to build an engineering solution, and the platform includes:
a scheme generation module for generating a target data processing application scheme based on a user's specified operation with respect to each specified algorithm module of a preset data processing apparatus in the visualization platform;
the data generation module is used for generating description data of the target data processing application according to the target data processing application scheme when the code generation instruction is detected; wherein the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
And the data sending module is used for sending the description data to the code generating device so that the code generating device analyzes the description data to obtain an analysis result, generating a source code of the target data processing application scheme based on the analysis result, the predefined code segment and the predefined engineering template, and generating an engineering code related to the target data processing application scheme based on the source code.
Optionally, in a specific implementation manner, the platform further includes:
and the display module is used for displaying the target data processing application scheme on a preset display interface.
In a fifth aspect, an embodiment of the present application provides an electronic device, including:
a memory for storing a computer program;
a processor configured to implement the method according to any one of the first aspect or the second aspect when executing a program stored on a memory.
In a sixth aspect, embodiments of the present application provide a computer readable storage medium having a computer program stored therein, which when executed by a processor implements the method according to any one of the first or second aspects.
In a seventh aspect, embodiments of the present application also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the steps of any of the method embodiments described above.
The embodiment of the application has the beneficial effects that:
the embodiment of the application provides a code generation method which is applied to a code generation device in a code generation system, and the system further comprises a visualization platform for building a data processing application scheme. The visualization platform may generate a target data processing application scenario based on a user's specified operation with respect to each specified algorithm module of the preset data processing method in the visualization platform, and then the code generating device may acquire description data of the target data processing application scenario, which may include module parameters of each specified algorithm module and interaction parameters characterizing interaction relationships between each specified algorithm module. Then, the code generating device may parse the description data to obtain a parsing result, generate a source code of the target data processing application scheme based on the parsing result, the predefined code segment and the predefined engineering template, and generate an engineering code related to the target data processing application scheme based on the source code.
Based on the scheme provided by the embodiment of the application, the code segments and the engineering templates can be predefined, so that the code generation device can generate engineering codes based on the description data of the target data processing application scheme built by the visualization platform by utilizing the code segments and the engineering templates, and the engineering codes of the target data processing application scheme do not need to be manually written, thereby reducing the code writing amount and improving the code generation efficiency.
In addition, as the data processing application scheme is generated by the visualization platform, the data processing application scheme is changed in the data processing scene, and a new data processing application scheme can be generated by only modifying the data processing application scheme in the visualization platform, and further, the code generating device can generate a corresponding engineering code based on the description data of the new data processing application scheme, and the new engineering code does not need to be rewritten every time the data processing scene is changed, so that the code generating efficiency can be further improved.
Of course, it is not necessary for any one product or method of practicing the application to achieve all of the advantages set forth above at the same time.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the application, and other embodiments may be obtained according to these drawings to those skilled in the art.
FIG. 1 is a schematic diagram of a code generation system according to an embodiment of the present application;
fig. 2 is a schematic flow chart of a code generating method applied to a code generating device according to an embodiment of the present application;
FIG. 3 is a flowchart of another code generating method applied to a code generating device according to an embodiment of the present application;
fig. 4 is a flowchart of yet another code generating method applied to a code generating device according to an embodiment of the present application;
fig. 5 is a flowchart of yet another code generating method applied to a code generating device according to an embodiment of the present application;
fig. 6 is a schematic diagram of a software architecture of a code generating device according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a file directory of a code generating device according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a mapping relationship between an algorithm module and an SDK function operator according to an embodiment of the present application;
FIG. 9 is a schematic diagram of a script directory according to an embodiment of the present application;
FIG. 10 is a schematic diagram of a template directory according to an embodiment of the present application;
FIG. 11 is a flowchart of a code generation method applied to a visualization platform according to an embodiment of the present application;
FIG. 12 is a flowchart of another code generation method applied to a visualization platform according to an embodiment of the present application;
Fig. 13 is an exemplary diagram of a code generation method according to an embodiment of the present application;
FIG. 14 is a flowchart of an example of a code generation method according to an embodiment of the present application;
fig. 15 is a schematic diagram of another example of a code generating method according to an embodiment of the present application;
fig. 16 is a schematic structural diagram of a code generating device in a code generating system according to an embodiment of the present application;
FIG. 17 is a schematic structural diagram of a visualization platform according to an embodiment of the present application;
fig. 18 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 19 is a schematic structural diagram of another electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. Based on the embodiments of the present application, all other embodiments obtained by the person skilled in the art based on the present application are included in the scope of protection of the present application.
In the actual production process, when detecting a scene change, it is necessary to change the image processing method and generate a code of the image processing method suitable for a new detected scene. In this way, when there are a plurality of detection scenes, a technician needs to write and debug a large amount of codes, and the code generation period of the image processing method applicable to the scene is long for each detection scene, thereby making the code generation efficiency low.
In order to solve the above technical problems, an embodiment of the present application provides a code generation method, which is applied to a code generation system, as shown in fig. 1, where the code generation system may include a code generation apparatus 100 and a visualization platform 200, where the visualization platform 200 may be used to build a data processing application scheme.
The visualization platform 200 integrates a plurality of algorithm modules, and the visualization platform may include a UI (User Interface), and the UI may be provided with identifiers of the plurality of algorithm modules. When the data processing application scheme is built, a user can execute specified operation on each algorithm module on the UI based on a preset data processing flow, so that the visualization platform can combine each algorithm module into the data processing application scheme based on the specified operation of the user on each algorithm module.
Optionally, when the operation interfaces set by the visualization platform 200 are different, the specified operation may be different, for example, when the operation interface of the visualization platform 200 is an interface for building a data processing application scheme for a drag module, the drag module may drag each algorithm module to a specified position to build the data processing application scheme; when the above-mentioned visualization platform 200 displays the identifiers of the respective algorithm modules, it is reasonable to construct the data processing application scheme by inputting the identifiers of the respective algorithm modules into the designated positions of the data processing application scheme, which is not specifically limited in the embodiment of the present application.
After generating the above-described data processing application scenario, the visualization platform 200 may generate description data regarding the above-described data processing application scenario upon receiving a code generation instruction, and transmit the above-described description data to the code generation apparatus 100. Thus, the code generating apparatus 100 can acquire the description data, and generate the engineering code for the data processing application scheme using a preset SDK (Software Development Kit ) based on the description data.
The scheme provided by the embodiment of the application can be suitable for various scenes needing to generate engineering codes for executing the data processing flow, for example, the engineering codes for realizing the processing flow can be generated when the processing flow of preprocessing the image, identifying the object and extracting the characteristics is carried out; in the process of locating and identifying the numbers in the image, engineering codes or the like for realizing the locating and identifying processes may be generated.
The visualization platform and the code generating device in the system can be arranged on various electronic devices, such as mobile phones, computers and the like; the visualization platform and the code generation apparatus may be provided in the same electronic device or in different electronic devices.
Based on this, the embodiment of the present application does not specifically limit the application scenario and execution subject of the method.
The code generation method applied to the code generation device in the code generation system provided by the embodiment of the application can comprise the following steps:
acquiring description data of a target data processing application scheme; the target data processing application scheme is generated by the visual platform based on the appointed operation of a user on each appointed algorithm module of the visual platform about a preset data processing method; the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
analyzing the description data to obtain an analysis result;
generating source codes of the target data processing application scheme based on the analysis result, the predefined code fragments and the predefined engineering templates, and generating engineering codes related to the target data processing application scheme based on the source codes.
The embodiment of the application provides a code generation method which is applied to a code generation device in a code generation system, and the system further comprises a visualization platform for building a data processing application scheme. The visualization platform may generate a target data processing application scenario based on a user's specified operation with respect to each specified algorithm module of the preset data processing method in the visualization platform, and then the code generating device may acquire description data of the target data processing application scenario, which may include module parameters of each specified algorithm module and interaction parameters characterizing interaction relationships between each specified algorithm module. Then, the code generating device may parse the description data to obtain a parsing result, generate a source code of the target data processing application scheme based on the parsing result, the predefined code segment and the predefined engineering template, and generate an engineering code related to the target data processing application scheme based on the source code.
Based on the scheme provided by the embodiment of the application, the code segments and the engineering templates can be predefined, so that the code generation device can generate engineering codes based on the description data of the target data processing application scheme built by the visualization platform by utilizing the code segments and the engineering templates, and the engineering codes of the target data processing application scheme do not need to be manually written, thereby reducing the code writing amount and improving the code generation efficiency.
In addition, as the data processing application scheme is generated by the visualization platform, the data processing application scheme is changed in the data processing scene, and a new data processing application scheme can be generated by only modifying the data processing application scheme in the visualization platform, and further, the code generating device can generate a corresponding engineering code based on the description data of the new data processing application scheme, and the new engineering code does not need to be rewritten every time the data processing scene is changed, so that the code generating efficiency can be further improved.
A code generation method applied to a code generation apparatus in a code generation system according to an embodiment of the present application will be specifically described with reference to the accompanying drawings.
Fig. 2 is a flow chart of a code generation method according to an embodiment of the present application, as shown in fig. 2, the method may include the following steps S201 to S203:
s201: acquiring description data of a target data processing application scheme;
the target data processing application scheme is generated by the visualization platform based on the appointed operation of a user on each appointed algorithm module related to the preset data processing method in the visualization platform; the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
in actual operation, when data needs to be processed, a data processing flow for processing the data may be determined first based on the data type of the data to be processed and each step to be executed for processing the data. Further, based on the data processing flow, the algorithm modules for implementing each step in the data processing flow may be subjected to a specified operation in the visualization platform, so that the visualization platform may generate a data processing application scheme corresponding to the data processing flow based on the specified operation for each algorithm module, and further, may generate description data of the data processing scenario application scheme based on each algorithm module included in the data processing scheme, an execution order of each algorithm module, and a connection relationship between each algorithm module.
Based on this, in order to process target data, a user may first determine a target data processing flow to process the target data, and then perform a specified operation for each specified algorithm module in the above-described visualization platform based on the target data processing flow. In this way, the visualization platform may generate a target data processing application scenario based on the specified operation and generate description data of the target data processing application scenario.
Each algorithm module has module parameters, such as the running operation of the algorithm module, the interested area processed by the algorithm module, the shielding area not processed by the algorithm module, the module name of the algorithm module, the module number and other parameters; thus, the description data of the target data processing application scheme may include module parameters of each of the specified algorithm modules; in addition, the connection sequence, the flow topology such as the interaction relationship of input data and output data, and subscription information exist among the algorithm modules forming the same target data processing application scheme, so that the description data of the target data processing application scheme can further comprise interaction parameters representing the interaction relationship among the specified algorithm modules.
Based on this, the description data of the target data processing application may include module parameters of each of the specified algorithm modules and interaction parameters characterizing interaction relationships between each of the specified algorithm modules, and the module parameters of each of the specified algorithm modules may include module information, ROI (Region Of Interest ) and mask region, module operation parameters, etc., and the interaction parameters may include flow topology, subscription information, etc.
In this way, when generating the engineering code regarding the target data processing application, the code generating means may first acquire the description data of the target data processing application generated by the visualization platform, and further generate the engineering code regarding the target data processing application based on the description data.
S202: analyzing the description data to obtain an analysis result;
after the code generating device obtains the description data of the target data processing application scheme, the description data can be analyzed, so that an analysis result of the description data of the target data processing application scheme is obtained.
Optionally, the parsing result may include a flow topology structure, an algorithm module ROI and a mask area, module operation parameters and subscription information in description data of the target data processing application scheme dynamically generated in the parsing process, and a predefined algorithm module description, a predefined SDK interface description and a mapping of the predefined algorithm module and the SDK;
The flow topological structure and the subscription information are used for representing the connection sequence, the interaction relationship of input data, output data and the like among all algorithm modules in the target data processing application scheme; the algorithm module ROI and the mask area, and the module operation parameters are used for representing the operation of each appointed algorithm module, the region of interest to be processed, the mask area to be not processed, the module name, the module number and other module parameters; the predefined algorithm module describes description information such as input data and output data for describing each algorithm module; the predefined SDK interface described above is described as a set of a plurality of SDK functional operators; the predefined algorithm module and SDK mapping is used to characterize mapping information of each algorithm module and each SDK functional operator in the target data processing application scheme.
S203: a source code for the target data processing application scheme is generated based on the parsing result, the predefined code fragments, and the predefined engineering template, and an engineering code for the target data processing application scheme is generated based on the source code.
The code generating device is provided with predefined code segments and predefined engineering templates for each application scheme which can be generated by the visualization platform in advance, so that after the description data of the target data processing application scheme is analyzed to obtain an analysis result, the source code of the target data processing application scheme can be generated by utilizing the predefined codes and the predefined engineering templates according to the flow topological structure among each algorithm module in the target data processing application scheme, and further, the engineering code related to the target data processing application scheme is generated based on the source code.
Optionally, the engineering template may include a script implementation of the engineering code, and when the code generating device generates the engineering code of the target data processing application scheme, the code generating device may generate the corresponding engineering code by using the script implementation.
The implementation of the script may be Python script, or other scripts, which are all reasonable, and the embodiment of the present application is not limited specifically.
Optionally, in a specific implementation manner, as shown in fig. 3, a code generating method provided by an embodiment of the present application may further include the following step S204:
s204: the engineering code is stored in a designated memory space.
In this embodiment, after the code generating device generates the engineering code, the code generating device may store the engineering code in a preset designated storage space, so that a user may acquire the engineering code in the designated storage space, and perform a subsequent operation on the engineering code.
For example, the user may obtain the engineering code in the designated storage space, compile and run the engineering code;
for another example, the user may obtain the engineering code in the designated storage space, compile the engineering code, debug the engineering code, so as to detect whether the engineering code has an error;
For another example, the user can acquire the engineering code in the designated storage space, compile the engineering code when there is a need for secondary development, and perform secondary development on the basis of the engineering code, so that complete code writing work is not required again, and code writing time is shortened.
The technical scheme provided by the embodiment of the application can be used for predefining the code segments and the engineering templates, so that the code generating device can generate engineering codes based on the description data of the target data processing application scheme built by the visualization platform by utilizing the code segments and the engineering templates, and the engineering codes of the target data processing application scheme do not need to be manually written, thereby reducing the code writing quantity and improving the code generating efficiency.
In addition, as the data processing application scheme is generated by the visualization platform, the data processing application scheme is changed in the data processing scene, and a new data processing application scheme can be generated by only modifying the data processing application scheme in the visualization platform, and further, the code generating device can generate a corresponding engineering code based on the description data of the new data processing application scheme, and the new engineering code does not need to be rewritten every time the data processing scene is changed, so that the code generating efficiency can be further improved.
When the visualization platform does not match the code generation apparatus version, the predefined SDK interface description included in the code generation apparatus may not support the functionality of a portion of the algorithm modules in the target data processing application solution generated by the visualization platform, and thus, the corresponding source code may not be generated. For example, the visualization platform is an open structure, and the user can customize a part of algorithm modules on the visualization platform, and the code generating device cannot support the function of realizing the user-defined algorithm modules because the realization logic of the user-defined algorithm modules cannot be obtained. Based on this, when the description data of the target data processing application scheme is acquired, the description data may be first checked, and after the description data is checked successfully, the description data may be parsed.
Optionally, in a specific implementation manner, as shown in fig. 4, a code generating method provided by an embodiment of the present application may further include the following step S205:
s205: checking the description data to obtain a checking result;
accordingly, in this embodiment, the step S202 of analyzing the description data to obtain an analysis result may include the following step S2021:
S2021: and if the verification result represents that the description data passes the verification, analyzing the description data to obtain an analysis result.
In this embodiment, after the description data is obtained, the code generating device may first check whether each algorithm module in the description data is a predefined algorithm module in the code generating device, that is, determine whether the predefined SDK interface description included in the code generating device supports the function of implementing each algorithm module in the description data, so as to obtain a check result of the description data.
If the verification result represents that the description data passes verification, the description data can be analyzed to obtain an analysis result; otherwise, if the verification result indicates that the verification of the description data fails, a notification message indicating that the verification of the description data fails may be output to prompt a relevant staff that the verification of the description data fails, and the code generation flow related to the target data processing application scheme is terminated.
Optionally, if the verification result indicates that the description data is not verified, an API (Application Programming Interface, application program interface) is called to output a notification message for indicating that the description data is not verified, and the code generation process is terminated.
Optionally, when the code generating device includes multiple sets of predefined SDK interface descriptions, if any one of the multiple sets of predefined SDK interface descriptions included in the code generating device can support the implementation of the functions of each algorithm module in the description data, the verification of the description data is passed; if none of the plurality of predefined SDK interface descriptions support the implementation of the functions of each algorithm module in the description data, the description data is not verified.
Optionally, the code generating methods applied to the code generating device in the code generating system provided by the embodiment of the application are all applied to the implementation layer in the code generating device, that is, the code generating methods applied to the code generating device in the code generating system are all implemented by the implementation layer in the code generating device. In addition, the code generating device may further include an interface layer and a data layer, and in the code generating device, a hierarchy order of the three hierarchies is as follows from top to bottom: interface layer, implementation layer and data layer.
The interface layer of the code generating device can be used for providing various service interfaces for the outside for other devices or platforms to call; and the data layer of the code generating device can be used for storing various types of data.
Optionally, in a specific implementation manner, the code generation method applied to the code generation device in the code generation system provided by the embodiment of the present application is applied to an implementation layer in the code generation device, as shown in fig. 5, in the step S201, the obtaining description data of the target data processing application scheme may include the following step S2011:
s2011: acquiring description data of a target data processing application scheme sent by a visual platform through a calling interface layer;
the code generation method provided by the embodiment of the application further comprises the following step S206:
s206: storing the analysis result to a data layer;
accordingly, in this specific implementation manner, the step S203, which generates the source code of the target data processing application scheme based on the analysis result, the predefined code segment and the predefined engineering template, and generates the engineering code related to the target data processing application scheme based on the source code, may include the following step S2031:
s2031: reading the analysis result from the data layer, generating source codes of the target data processing application scheme based on the analysis result, the predefined code segments and the predefined engineering templates, and generating engineering codes related to the target data processing application scheme based on the source codes.
In this specific implementation manner, the code generating methods applied to the code generating device in the code generating system are all applied to an implementation layer in the code generating device, and the code generating device may further include an interface layer and a data layer. After generating the description data of the target data processing application scheme, the visualization platform can call the interface layer and transmit the description data to the implementation layer. In this way, the implementation layer can acquire the description data of the target data application scheme sent by the visual platform through calling the interface layer, analyze the description data to obtain an analysis result, and then store the analysis result into the data layer.
Further, the implementation layer may read the analysis result from the data layer, and then generate a source code of the target data processing application scheme based on the analysis result, the predefined code segment, and the predefined engineering template, and further generate an engineering code regarding the target data processing application scheme based on the source code.
Optionally, as shown in fig. 6, the software architecture of the code generating device may include an external API interface;
wherein, optionally, the interface layer may include an API; the step S2011 of obtaining the description data of the target data processing application scheme sent by the visualization platform through the calling interface layer may include the following step 11:
Step 11: and acquiring the description data of the target data processing application scheme sent by the visualization platform through calling the API.
In this particular implementation, the code generation apparatus may provide APIs to respective apparatuses or platforms for data interaction with the respective apparatuses or platforms. After generating the description data of the target data processing application scheme, the visualization platform can transfer the description data of the target data processing application scheme to an implementation layer through calling the API, so that the implementation layer can receive the description data of the target data processing application scheme sent by the visualization platform through calling the API.
Optionally, as shown in fig. 6, the data layer may store a parsing result of the description data of the engineering template file and the target data processing application scheme, and the parsing result may include a flow topology structure, an algorithm module description, an SDK interface description, an algorithm module and SDK mapping, an ROI and a mask region, and a module operation parameter, so that the data layer may store the engineering template file, the flow topology structure, the algorithm module description, the SDK interface description, the algorithm module and SDK mapping, the ROI and the mask region, and the module operation parameter.
Optionally, as shown in fig. 6, the implementation layer is used for implementing the engineering code, and may include an engineering code generator, a source code generator, a predefined code segment, a data parsing and manager, a module object manager, an SDK object manager, an ROI and mask region manager, a flow topology manager, and a subscription information manager.
Optionally, in a specific implementation manner, the code generation method applied to the code generation device in the code generation system provided by the embodiment of the present application is applied to an implementation layer in the code generation device, and the step S202 of analyzing the description data to obtain an analysis result may include the following step 21:
step 21: and analyzing the description data by utilizing a data analysis and management device to obtain an analysis result.
In this embodiment, after the implementation layer obtains the description data of the target data processing application scheme, the data analysis and manager may analyze the description data, so as to obtain an analysis result of the description data of the target data processing application scheme.
Alternatively, in one embodiment,
step S2031, which reads the analysis result from the data layer, generates the source code of the target data processing application scheme based on the analysis result, the predefined code segment, and the predefined engineering template, and generates the engineering code related to the target data processing application scheme based on the source code, may include the following steps 31 to 33:
Step 31: reading an analysis result and an engineering template file from the data layer;
step 32: invoking a source code generator, and generating a source code related to a target data processing application scheme by utilizing an algorithm module and SDK mapping, an algorithm module description, an SDK interface description, a predefined code segment, a predefined engineering template in an engineering template file and a flow topological structure;
step 33: an engineering code generator is invoked to generate engineering code for the target data processing application scenario using the source code.
In this specific implementation manner, the implementation layer may read the parsing result and the engineering template file from the data layer, and then, the implementation layer may call the source code generator to generate the source code related to the target data processing application scheme by using the flow topology structure between each algorithm module in the parsing result, the SDK interface description, the algorithm module description, the mapping between the algorithm module and the SDK, the predefined code segment, and the predefined engineering template in the engineering template file. Further, the implementation layer may continue to invoke the engineering code generator to generate engineering code for the target data processing application scenario using the source code for the target data processing application scenario described above.
Optionally, when multiple sets of predefined SDK interface descriptions are included in the data layer, the implementation layer may generate source code for the target data processing application scheme based on the set of SDK interface descriptions for each set of predefined SDK interface descriptions included in the data layer.
For example, if the data layer includes two sets of predefined SDK interface descriptions, the implementation layer may call the source code generator to generate the source code of the target data processing application scheme corresponding to each set of SDK interface descriptions by using the description data of the target data processing application scheme and the two sets of SDK interface descriptions. Further, the implementation layer may continue to call the engineering code generator to generate the engineering code for the target data processing application scheme, so that two sets of engineering codes may be generated eventually.
Optionally, when the data layer includes multiple sets of predefined SDK interface descriptions, the implementation layer may select a target SDK interface description from the multiple sets of SDK interface descriptions based on a preset selection rule, and call a source code generator, and generate a source code of the target data processing application scheme using the target SDK interface description.
The preset selection rule may be a target SDK interface description selected based on a user operation, or a SDK interface description with the least programming amount may be used as the target SDK interface description, or any SDK interface description may be randomly selected as the target SDK interface description, which is reasonable, and the embodiment of the present application is not limited specifically.
For example, the implementation layer may select any set of SDK interface descriptions from the SDK interface descriptions described above as the target SDK interface description. The implementation layer may then invoke a source code generator to generate source code for the target data processing application schema using the target SDK interface description. Furthermore, the implementation layer can continue to call the engineering code generator to generate the engineering code of the target data processing application scheme, that is, finally generate a set of engineering codes corresponding to the target SDK interface description.
When the code generating device is mounted in any one of the electronic devices, the electronic device may include a file directory of the code generating device. Based on this, fig. 7 is an alternative, code generating device file directory, and as shown in fig. 7, the code generating device file directory may include two parts, namely a components directory and c_api. c_api. Dll is an external API of the code generating apparatus, and components directory may include a data directory, a script directory, and a template directory.
The data catalog is used for storing various predefined information of the code generating device, such as predefined SDK interface description, algorithm module and SDK mapping, algorithm module description and the like; because the functions corresponding to the algorithm modules are different, the mapping relation between each algorithm module and the SDK function operator uniquely corresponding to each algorithm module can be established in advance, and the mapping relation is stored in the code generating device.
Fig. 8 is a schematic diagram illustrating a mapping relationship between the algorithm modules and the SDK functional operator, and as shown in fig. 8, each algorithm module may include a module name, a module input list, an ROI, a mask region, and a module output list, and a plurality of algorithm modules may be collected into one algorithm module description; each functional operator may implement an algorithm function of one algorithm module, and each functional operator may include an operator name, a namespace, a dependency header file, a dependency header library file, an instance object name, a result object name, a creation interface, and a destruction interface, and multiple SDK functional operators may be aggregated into one SDK interface description. And establishing a mapping relation between the description of the algorithm module and the description of the SDK interface to obtain the mapping between the algorithm module and the SDK interface, wherein the mapping between the algorithm module and the SDK interface comprises a plurality of mapping information pairs, and each mapping information pair can be recorded with the name of the algorithm module and the name of the SDK function operator which are mapped mutually.
The script directory is used for storing various script files in the code generating device, such as an API script file, an application scheme engineering code generating script, an application scheme source code generating script, an SDK function operator script, an algorithm module script, a data analysis and management script, a flow topology management script, and the like. The script files may be implemented by various scripts, for example, python script, which is reasonable, and in the embodiment of the present application, specific script implementations of the script files are not limited.
Illustratively, as shown in FIG. 9, the script directory may include API script files and subdirectories.
Wherein the API script may include an initialization file and an API interface file to provide the API script to a different device or platform. When providing the API script outwards, c_api.dll calls the API script file in the script catalog, and the called APIs are different in description files of different visual platforms and different programming languages generated by the visual platforms;
the subdirectory may contain a specific implementation script for generating engineering codes, for example, an application project code script, an application project source code script, an SDK function operator script, an algorithm module script, a data analysis and management script, a flow topology management script, etc., and each file in the subdirectory may be dynamically replaced to repair a problem and expand a function.
The template catalog is used for storing a predefined engineering template to support engineering software using the engineering template to run engineering codes generated by the engineering template, and the engineering codes are codes related to the target data processing application scheme.
As shown in fig. 10, the template directory may include two parts, a flow code template and an application scheme engineering template, the flow code template defining a basic code format of a source code of a generated data processing application scheme, and the flow code template may include a template interface 1 for performing creation of an SDK function operator instance, a template interface 2 for performing call SDK function operator execution according to a topological relation inside a flow, and a template interface 3 for performing destruction of the SDK function operator instance; the application scheme engineering template may include a file 1 for storing application scheme engineering configuration, a file 2 for storing common function implementation source codes, and a file 3 for storing common data structure definitions;
The application scheme engineering configuration can define configuration options when engineering codes are generated; the common function implementation source code can define the implementation of a common basic function; whereas the common data structure definition described above may define a basic data interface, e.g. an interface for an image object, an interface for a graphical object, etc.
FIG. 11 is a diagram of a method for generating a visual platform code for building an engineering scheme, which is applied to a code generation system and provided by an embodiment of the application; the code generation system may further include: code generating means; as shown in fig. 11, the method may include the following steps S1101 to S1103:
s1101: generating a target data processing application scheme based on the specified operation of a user on each specified algorithm module related to a preset data processing method in the visual platform;
s1102: when a code generation instruction is detected, generating description data of a target data processing application according to a target data processing application scheme; wherein the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
s1103: the description data is sent to the code generating device, so that the code generating device analyzes the description data to obtain an analysis result, generates a source code of the target data processing application scheme based on the analysis result, the predefined code segment and the predefined engineering template, and generates an engineering code related to the target data processing application scheme based on the source code.
The visualization platform comprises a plurality of algorithm modules, and when the visualization platform receives the specified operation for each calibration algorithm module, the visualization platform can generate a data processing application scheme comprising each calibration algorithm module.
Based on this, after determining the target data processing method, the user may perform a designating operation on each designated algorithm module for implementing each step included in the target data processing method in the visualization platform, so that the visualization platform may generate the target data processing application scheme based on the designating operation of the user on each designated algorithm module.
After generating the target data processing application scenario described above using the visualization platform, the user may send code generation instructions for the target data processing application scenario to the visualization platform to cause the code generation system to generate engineering code for the target data processing application scenario. In this way, the visualization platform can generate the description data of the target data processing application according to the target data processing application scheme when detecting the code generation instruction.
Wherein the descriptive data may include module parameters for each of the specified algorithm modules and interaction parameters characterizing interaction relationships between each of the specified algorithm modules.
The visualization platform may then send the description data to the code generation apparatus, so that the code generation apparatus parses the description data to obtain a parsing result, generates a source code of the target data processing application scheme based on the parsing result, the predefined code segment, and the predefined engineering template, and generates an engineering code for the target data processing application scheme based on the source code.
The technical scheme provided by the embodiment of the application can be used for predefining the code segments and the engineering templates, so that the code generating device can generate engineering codes based on the description data of the target data processing application scheme built by the visualization platform by utilizing the code segments and the engineering templates, and the engineering codes of the target data processing application scheme do not need to be manually written, thereby reducing the code writing quantity and improving the code generating efficiency.
In addition, as the data processing application scheme is generated by the visualization platform, the data processing application scheme is changed in the data processing scene, and a new data processing application scheme can be generated by only modifying the data processing application scheme in the visualization platform, and further, the code generating device can generate a corresponding engineering code based on the description data of the new data processing application scheme, and the new engineering code does not need to be rewritten every time the data processing scene is changed, so that the code generating efficiency can be further improved.
Optionally, in a specific implementation manner, as shown in fig. 12, the method for generating a code provided in the embodiment of the present application may further include the following step S1104:
s1104: and displaying the target data processing application scheme on a preset display interface.
In this embodiment, after the target data processing application scheme is generated by the visualization platform, the target data processing application scheme may be displayed to the user on a preset display interface, so that the user may more intuitively check the target data processing application scheme, and when an error exists in the target data processing application scheme, modify the target data processing application scheme on the visualization platform.
For example, as shown in the example flow of fig. 13, the user may drag the image acquisition, high-precision matching, position correction, circle finding, and straight line finding algorithm modules on the visualization platform, so that the above-mentioned visualization platform generates an example flow of the target data processing application scheme based on the drag operation of the user and various operation parameters such as the drag sequence for each algorithm module, the termination position of dragging each algorithm module, and the like, and presents the above-mentioned example flow on the UI. Thereafter, the user may send instructions to the visualization platform regarding the generation of the engineering code for the target data processing application scheme, such that an export engineering dialog may appear on the UI of the visualization platform, in which the user may select the language of the engineering code to be generated, e.g., c++; selecting a compiling platform, for example, an A platform; inputting and exporting the name of the project; and selecting a storage catalog of the export engineering, and clicking an export key to generate engineering codes about the target data processing application scheme by the export code generating device.
In order to facilitate understanding of the code generation method provided in the embodiment of the present application, a detailed description will be given below of a specific flow of the code generation method in conjunction with specific exemplary diagrams of fig. 14 and 15.
Fig. 14 is a schematic flow chart of a code generating method, as shown in fig. 14, where a visual application platform UI in the fig. is a UI of a visualization platform in an embodiment of the present application, a solution in the fig. is a target data processing application solution in the embodiment of the present application, and a code generating component device in the fig. is a code generating device in the embodiment of the present application, and a specific flow of the code generating method may include steps S1401-S1411:
s1401: constructing a solution;
s1402: starting to generate a solution engineering code;
s1403: constructing a solution;
s1404: storing solution description data;
s1405: reading and analyzing solution description data;
s1406: generating a source code file;
s1407: generating an engineering code file;
s1408: writing to a user-specified directory;
s1409: opening and editing engineering codes;
s1410: compiling engineering;
s1411: and (5) running.
The visual application platform UI builds a solution based on the specified operations of the user for each specified algorithm module. Then, when the user click on the key for generating the solution engineering code is detected, the visual application platform can generate visual scheme description data comprising intermediate data such as flow topology, module information, subscription information, ROI and shielding area, module operation parameters and the like, and store the solution description data.
The generating code component means may then read the solution description data, parse the solution description data, and generate a source code file for the solution based on the solution description data. The code component generating means may then generate an engineering code file for the solution based on the source code file and write the engineering code file to a user-specified directory.
Thus, the user can obtain the engineering code from the appointed directory, and then, the engineering code can be opened and edited, and when the engineering code needs to be operated, the engineering code is compiled and operated by compiling engineering.
The specific flow of the generation of the engineering code by the code generation apparatus will be described below.
Fig. 15 is a schematic diagram of an example of an engineering code method in which the code generating apparatus generates a solution, and as shown in fig. 15, a user may first initialize a UI of the above-described visualization platform, and then perform a specified operation on each specified algorithm module on the above-described visualization platform, so that the above-described visualization platform generates a solution, and generates description data about the solution.
The visual platform calls an interface layer of the code generating device to send the description data to the code generating device, so that the code generating device can receive the description data, and the description data is checked to obtain a check result.
When the verification result represents that the description data passes verification, the realization layer of the code generating device can receive the description data, analyze the description data by utilizing a data analysis and manager to obtain analysis data of the description data comprising the solution, and store the analysis data into a data layer.
Then, the realization layer of the code generating device can read the flow topology, the SDK interface data and the algorithm module data from the data layer; the flow topology comprises a flow topology structure and subscription information; the SDK interface data comprises SDK interface description and SDK and algorithm module mapping; the algorithm module data comprises an algorithm module ROI and a mask area, an algorithm module description and an operation parameter.
The code generating means may then invoke a source code generator for generating source code for the solution by combining the predefined code fragments using the parsing data and parsing the predefined engineering templates. Further, the implementation layer of the code generation apparatus may call an engineering code generator, generate an engineering code of the solution using the source code, and save an engineering code file storing the engineering code at a specified location, so that a user opens the engineering file to edit the engineering, and further perform a compiling engineering.
Based on the same inventive concept, the embodiment of the application also provides a code generating device in the code generating system, corresponding to the code generating method applied to the code generating device in the code generating system shown in fig. 2 provided by the embodiment of the application.
Fig. 16 is a schematic structural diagram of a code generating device in a code generating system according to an embodiment of the present application, where, as shown in fig. 16, the device may include the following modules:
a data acquisition module 1610, for acquiring description data of the target data processing application scheme; the target data processing application scheme is generated by the visualization platform based on the appointed operation of a user on each appointed algorithm module of a preset data processing device in the visualization platform; the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
the parsing module 1620 is configured to parse the description data to obtain a parsing result;
a code generating module 1630, configured to generate a source code of the target data processing application scheme based on the analysis result, the predefined code segment, and the predefined engineering template, and generate an engineering code related to the target data processing application scheme based on the source code.
The technical scheme provided by the embodiment of the application can be used for predefining the code segments and the engineering templates, so that the code generating device can generate engineering codes based on the description data of the target data processing application scheme built by the visualization platform by utilizing the code segments and the engineering templates, and the engineering codes of the target data processing application scheme do not need to be manually written, thereby reducing the code writing quantity and improving the code generating efficiency.
In addition, as the data processing application scheme is generated by the visualization platform, the data processing application scheme is changed in the data processing scene, and a new data processing application scheme can be generated by only modifying the data processing application scheme in the visualization platform, and further, the code generating device can generate a corresponding engineering code based on the description data of the new data processing application scheme, and the new engineering code does not need to be rewritten every time the data processing scene is changed, so that the code generating efficiency can be further improved.
Optionally, in a specific implementation manner, the device includes: an interface layer, an implementation layer and a data layer; the functions of the data acquisition module 1610, the parsing module 1620 and the code generation module 1630 are all implemented by the implementation layer;
The data acquisition module 1610 is specifically configured to acquire description data of a target data processing application scheme sent by the visualization platform through invoking the interface layer;
the parsing module 1620 is further configured to store the parsing result to the data layer;
the code generating module 1630 is specifically configured to read the parsing result from the data layer, generate a source code of the target data processing application scheme based on the parsing result, a predefined code segment, and a predefined engineering template, and generate an engineering code related to the target data processing application scheme based on the source code.
Optionally, in a specific implementation manner, the implementation layer includes a source code generator, an engineering code generator and a predefined code segment; the data layer stores engineering template files, and the analysis result comprises a flow topological structure, an algorithm module description, an SDK interface description and an algorithm module and SDK mapping;
the code generating module 1630 is specifically configured to read the analysis result and the engineering template file from the data layer; invoking a source code generator to generate source code for the target data processing application scheme using the algorithm module and SDK map, the algorithm module description, the SDK interface description, the predefined code segments, predefined engineering templates in the engineering template file, and the flow topology; and calling an engineering code generator, and generating engineering codes related to the target data processing application scheme by using the source codes.
Optionally, in a specific implementation manner, the apparatus further includes:
the verification module is used for verifying the description data before the description data is analyzed to obtain an analysis result, so as to obtain a verification result; and if the verification result represents that the description data passes the verification, triggering the analysis module.
Optionally, in a specific implementation manner, the apparatus further includes:
and the storage module is used for storing the engineering codes in the appointed storage space.
Based on the same inventive concept, the embodiment of the application also provides a visualization platform for generating a data processing application scheme in the code generation system, which corresponds to the code generation method applied to the visualization platform in the code generation system shown in fig. 11 and provided by the embodiment of the application.
Fig. 17 is a schematic structural diagram of a visualization platform according to an embodiment of the present application, as shown in fig. 17, where the visualization platform may include the following modules:
a scenario generation module 1710, configured to generate a target data processing application scenario based on a user's specified operation with respect to each specified algorithm module of a preset data processing apparatus in the visualization platform;
A data generation module 1720, configured to generate, when a code generation instruction is detected, description data of the target data processing application according to the target data processing application scheme; wherein the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
the data transmitting module 1730 is configured to transmit the description data to the code generating device, so that the code generating device parses the description data to obtain a parsing result, generate a source code of the target data processing application scheme based on the parsing result, a predefined code segment, and a predefined engineering template, and generate an engineering code related to the target data processing application scheme based on the source code.
The technical scheme provided by the embodiment of the application can be used for predefining the code segments and the engineering templates, so that the code generating device can generate engineering codes based on the description data of the target data processing application scheme built by the visualization platform by utilizing the code segments and the engineering templates, and the engineering codes of the target data processing application scheme do not need to be manually written, thereby reducing the code writing quantity and improving the code generating efficiency.
In addition, as the data processing application scheme is generated by the visualization platform, the data processing application scheme is changed in the data processing scene, and a new data processing application scheme can be generated by only modifying the data processing application scheme in the visualization platform, and further, the code generating device can generate a corresponding engineering code based on the description data of the new data processing application scheme, and the new engineering code does not need to be rewritten every time the data processing scene is changed, so that the code generating efficiency can be further improved.
Optionally, in a specific implementation manner, the platform further includes:
and the display module is used for displaying the target data processing application scheme on a preset display interface.
The embodiment of the application also provides an electronic device, as shown in fig. 18, including:
a memory 1801 for storing a computer program;
the processor 1802 is configured to implement the steps of any one of the code generating methods applied to the code generating apparatus in the code generating system provided in the embodiment of the present application described above when executing the program stored in the memory 1801.
And the electronic device may further include a communication bus and/or a communication interface through which the processor 1802, the communication interface, and the memory 18001 communicate with each other.
The embodiment of the application also provides an electronic device, as shown in fig. 19, including:
a memory 1901 for storing a computer program;
the processor 1902 is configured to implement any of the steps of the code generation method applied to the visualization platform in the code generation system provided in the embodiment of the present application when executing the program stored in the memory 1901.
And the electronic device may further include a communication bus and/or a communication interface, where the processor 1902, the communication interface, and the memory 1901 communicate with each other via the communication bus.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment of the present application, there is also provided a computer-readable storage medium having stored therein a computer program which, when executed by a processor, implements the steps of any of the code generation methods described above.
In yet another embodiment of the present application, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the code generation methods of the above embodiments.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), etc.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for code generating apparatus embodiments, visualization platform embodiments, electronic device embodiments, computer readable storage medium embodiments, and computer program product embodiments, the description is relatively simple as it is substantially similar to method embodiments, as relevant to the description of method embodiments.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (13)

1. A code generation method, characterized by being applied to a code generation device in a code generation system, the system further comprising a visualization platform for building a data processing application scheme, the method comprising:
acquiring description data of a target data processing application scheme; the target data processing application scheme is generated by the visual platform based on the appointed operation of a user on each appointed algorithm module of the visual platform about a preset data processing method; the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
analyzing the description data to obtain an analysis result;
generating source codes of the target data processing application scheme based on the analysis result, the predefined code fragments and the predefined engineering templates, and generating engineering codes related to the target data processing application scheme based on the source codes.
2. The method according to claim 1, wherein the method is applied to an implementation layer of the code generating means; the code generating device also comprises an interface layer and a data layer;
the acquiring the description data of the target data processing application scheme includes:
acquiring description data of a target data processing application scheme sent by the visual platform through the interface layer;
the method further comprises the steps of:
storing the analysis result to the data layer;
the generating the source code of the target data processing application scheme based on the analysis result, the predefined code segment and the predefined engineering template, and generating the engineering code related to the target data processing application scheme based on the source code, including:
reading the analysis result from the data layer, generating a source code of the target data processing application scheme based on the analysis result, the predefined code segments and the predefined engineering template, and generating engineering codes related to the target data processing application scheme based on the source code.
3. The method of claim 2, wherein the implementation layer comprises a source code generator, an engineering code generator, and a predefined code segment; the data layer stores engineering template files, and the analysis result comprises a flow topological structure, an algorithm module description, an SDK interface description and an algorithm module and SDK mapping;
The reading the analysis result from the data layer, generating a source code of the target data processing application scheme based on the analysis result, a predefined code segment and a predefined engineering template, and generating an engineering code related to the target data processing application scheme based on the source code, including:
reading the analysis result and the engineering template file from the data layer; invoking the source code generator to generate source code for the target data processing application scheme using the algorithm module and SDK map, the algorithm module description, the SDK interface description, the predefined code fragments, predefined engineering templates in the engineering template file, and the flow topology; and calling the engineering code generator, and generating engineering codes related to the target data processing application scheme by utilizing the source codes.
4. The method of claim 1, wherein prior to said parsing the description data to obtain a parsed result, the method further comprises:
checking the description data to obtain a checking result;
and if the verification result represents that the description data passes the verification, analyzing the description data to obtain an analysis result.
5. The method according to claim 1, wherein the method further comprises:
and storing the engineering codes in a designated storage space.
6. A code generation method, characterized in that it is applied to a visualization platform for building engineering projects in a code generation system, the system further comprising a code generation device, the method comprising:
generating a target data processing application scheme based on the specified operation of a user on each specified algorithm module of a preset data processing method in the visual platform;
when a code generation instruction is detected, generating description data of the target data processing application according to the target data processing application scheme; wherein the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
and sending the description data to the code generation device so that the code generation device analyzes the description data to obtain an analysis result, generating source codes of the target data processing application scheme based on the analysis result, the predefined code segments and the predefined engineering templates, and generating engineering codes related to the target data processing application scheme based on the source codes.
7. The method of claim 6, wherein the method further comprises:
and displaying the target data processing application scheme on a preset display interface.
8. A code generation apparatus in a code generation system, the system further comprising a visualization platform for building a data processing application, the apparatus comprising:
the data acquisition module acquires description data of a target data processing application scheme; the target data processing application scheme is generated by the visualization platform based on the appointed operation of a user on each appointed algorithm module of a preset data processing device in the visualization platform; the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
the analysis module is used for analyzing the description data to obtain an analysis result;
and the code generation module is used for generating a source code of the target data processing application scheme based on the analysis result, the predefined code segment and the predefined engineering template, and generating engineering codes related to the target data processing application scheme based on the source code.
9. The apparatus of claim 8, wherein the device comprises a plurality of sensors,
the device comprises: an interface layer, an implementation layer and a data layer; the functions of the data acquisition module, the analysis module and the code generation module are realized by the realization layer;
the data acquisition module is specifically used for acquiring description data of a target data processing application scheme sent by the visual platform through calling the interface layer;
the analysis module is further used for storing the analysis result to the data layer;
the code generation module is specifically configured to read the analysis result from the data layer, generate a source code of the target data processing application scheme based on the analysis result, a predefined code segment and a predefined engineering template, and generate an engineering code related to the target data processing application scheme based on the source code;
and/or the number of the groups of groups,
the implementation layer comprises a source code generator, an engineering code generator and a predefined code segment; the data layer stores engineering template files, and the analysis result comprises a flow topological structure, an algorithm module description, an SDK interface description and an algorithm module and SDK mapping;
The code generation module is specifically used for reading the analysis result and the engineering template file from the data layer; invoking the source code generator to generate source code for the target data processing application scheme using the algorithm module and SDK map, the algorithm module description, the SDK interface description, the predefined code fragments, predefined engineering templates in the engineering template file, and the flow topology; invoking the engineering code generator to generate engineering code for the target data processing application scheme using the source code;
and/or the number of the groups of groups,
the apparatus further comprises:
the verification module is used for verifying the description data before the description data is analyzed to obtain an analysis result, so as to obtain a verification result; if the verification result represents that the description data passes verification, triggering the analysis module;
and/or the number of the groups of groups,
the apparatus further comprises:
and the storage module is used for storing the engineering codes in the appointed storage space.
10. A visualization platform for use in a code generation system, the system further comprising a code generation apparatus, the visualization platform for use in building an engineering solution, the platform comprising:
A scheme generation module for generating a target data processing application scheme based on a user's specified operation with respect to each specified algorithm module of a preset data processing apparatus in the visualization platform;
the data generation module is used for generating description data of the target data processing application according to the target data processing application scheme when the code generation instruction is detected; wherein the description data includes: module parameters of each specified algorithm module and interaction parameters representing interaction relations between each specified algorithm module;
and the data sending module is used for sending the description data to the code generating device so that the code generating device analyzes the description data to obtain an analysis result, generating a source code of the target data processing application scheme based on the analysis result, the predefined code segment and the predefined engineering template, and generating an engineering code related to the target data processing application scheme based on the source code.
11. The platform of claim 10, further comprising:
and the display module is used for displaying the target data processing application scheme on a preset display interface.
12. An electronic device, comprising:
a memory for storing a computer program;
a processor for implementing the method of any one of claims 1-5 or 6-7 when executing a program stored on a memory.
13. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program which, when executed by a processor, implements the method of any of claims 1-5 or 6-7.
CN202310573985.6A 2023-05-18 2023-05-18 Code generation method, code generation device, visualization platform and electronic equipment Pending CN116643755A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310573985.6A CN116643755A (en) 2023-05-18 2023-05-18 Code generation method, code generation device, visualization platform and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310573985.6A CN116643755A (en) 2023-05-18 2023-05-18 Code generation method, code generation device, visualization platform and electronic equipment

Publications (1)

Publication Number Publication Date
CN116643755A true CN116643755A (en) 2023-08-25

Family

ID=87618120

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310573985.6A Pending CN116643755A (en) 2023-05-18 2023-05-18 Code generation method, code generation device, visualization platform and electronic equipment

Country Status (1)

Country Link
CN (1) CN116643755A (en)

Similar Documents

Publication Publication Date Title
US10545856B2 (en) Test case generation system
US8490050B2 (en) Automatic generation of user interfaces
US10048946B2 (en) Converting visual diagrams into code
CN105094783B (en) method and device for testing stability of android application
CN110221968A (en) Method for testing software and Related product
US20110035729A1 (en) Generating and resolving component names in an integrated development environment
CN103970659A (en) Android application software automation testing method based on pile pitching technology
CN112199093B (en) Resource checking method, device, equipment and computer readable storage medium
CN111581920A (en) Document conversion method, device, equipment and computer storage medium
CN106371997A (en) Code checking method and device
CN112947914A (en) Code generation method and device based on model, computer equipment and medium
CN112905441A (en) Test case generation method, test method, device and equipment
EP2105837A2 (en) Test script transformation analyzer with change guide engine
CN112506492A (en) Visual point burying method supporting dynamic scene configuration
CN115048104A (en) Code generation method and device based on syntax tree and electronic equipment
CN111159301A (en) Data creating method, device, equipment and storage medium based on intelligent contract
CN117632710A (en) Method, device, equipment and storage medium for generating test code
CN115618363B (en) Vulnerability path mining method and related equipment
US20160292067A1 (en) System and method for keyword based testing of custom components
CN116643755A (en) Code generation method, code generation device, visualization platform and electronic equipment
US11544179B2 (en) Source traceability-based impact analysis
CN114579466A (en) Method, device, equipment and medium for constructing test case and code test
CN113805861A (en) Code generation method based on machine learning, code editing system and storage medium
CN113419739B (en) Node map difference detection method and device, electronic equipment and storage medium
US11995146B1 (en) System and method for displaying real-time code of embedded code in a browser-window of a software application

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination