CN117576545B - Multi-algorithm full-matching access adapter access method - Google Patents
Multi-algorithm full-matching access adapter access method Download PDFInfo
- Publication number
- CN117576545B CN117576545B CN202410058249.1A CN202410058249A CN117576545B CN 117576545 B CN117576545 B CN 117576545B CN 202410058249 A CN202410058249 A CN 202410058249A CN 117576545 B CN117576545 B CN 117576545B
- Authority
- CN
- China
- Prior art keywords
- algorithm
- parameter
- field
- algorithm model
- information
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 24
- 238000012545 processing Methods 0.000 claims abstract description 10
- 238000013507 mapping Methods 0.000 claims description 56
- 230000006978 adaptation Effects 0.000 claims description 29
- 241000208340 Araliaceae Species 0.000 claims description 5
- 235000005035 Panax pseudoginseng ssp. pseudoginseng Nutrition 0.000 claims description 5
- 235000003140 Panax quinquefolius Nutrition 0.000 claims description 5
- 235000008434 ginseng Nutrition 0.000 claims description 5
- 230000006870 function Effects 0.000 description 7
- 238000006243 chemical reaction Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000007547 defect Effects 0.000 description 2
- 235000017166 Bambusa arundinacea Nutrition 0.000 description 1
- 235000017491 Bambusa tulda Nutrition 0.000 description 1
- 244000082204 Phyllostachys viridis Species 0.000 description 1
- 235000015334 Phyllostachys viridis Nutrition 0.000 description 1
- 230000003044 adaptive effect Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 239000011425 bamboo Substances 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000004140 cleaning Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 238000000547 structure data Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/96—Management of image or video recognition tasks
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a multi-algorithm full-matching access adapter access method, and belongs to the field of computer software. An access method of a multi-algorithm full-matching access adapter, comprising: receiving request information from an application end, wherein the request information comprises a coding identifier and a picture to be processed; analyzing the request information to obtain a coding identifier; transmitting the picture to be processed to a corresponding algorithm model according to the coding identifier; and receiving a processing result of the image to be processed by the algorithm model, and returning the processing result to the application end. The invention improves the access efficiency of the whole algorithm by the way of templatizing the configuration access algorithm.
Description
Technical Field
The invention belongs to the field of computer software, and particularly relates to a multi-algorithm full-matching access adapter access method.
Background
Along with the wide application of the vision AI technology in various industries, the number of AI manufacturers is continuously increased, the scale of each manufacturer is also larger and larger, various algorithm models appear like spring bamboo shoots after raining, and the algorithm types are various. When the application platform uses the algorithm, various algorithm models are mainly accessed in two modes, one is accessed in an API interface mode, and the other is accessed in an SDK mode. The manner in which an API interfaces is the most popular. However, the request input parameters and the parameter structures of the algorithms are different due to the fact that the types of the algorithms grow faster, and the return parameters of the identification results are various. Different manufacturers of different platforms design and develop according to own interface styles, so that when the application platform uses a plurality of different algorithms, a great deal of time is required to develop one-to-one access of the algorithms. The application platform needs to spend great efforts to call and arrange the algorithm, and has high cost and huge maintenance workload, thus causing a great amount of resource waste.
The existing treatment method has the following defects:
1. the API of the existing algorithm usually adopts a one-to-one access mode, and takes longer development and test periods when facing to large-scale algorithm access;
2. the non-professional development technicians cannot operate, and very professional program developers are required to participate;
3. the application platform needs to be frequently and iteratively upgraded, and the algorithm access development and the application cannot be decoupled, so that frequent release of the production environment is caused, and the use experience is affected.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a multi-algorithm full-matching access adapter access method.
The aim of the invention is realized by the following technical scheme: an access method of a multi-algorithm full-matching access adapter, comprising:
receiving request information from an application end, wherein the request information comprises a coding identifier and a picture to be processed;
analyzing the request information to obtain a coding identifier;
transmitting the picture to be processed to a corresponding algorithm model according to the coding identifier;
and receiving a processing result of the image to be processed by the algorithm model, and returning the processing result to the application end.
Further, the configuration method of the algorithm model comprises the following steps:
configuring algorithm model information, wherein the algorithm model information comprises an algorithm model authentication mode, an algorithm model unique identifier, an algorithm model name, a minimum pixel requirement of a picture, a maximum pixel limit of the picture and an algorithm model type;
configuring algorithm model interface information, wherein the algorithm model interface information comprises an algorithm model interface name, an algorithm model interface access address, an algorithm model interface request mode, an algorithm model interface unique identifier, a calling frequency threshold value, an algorithm model unique identifier and a request data format;
configuring algorithm grouping information, wherein the algorithm grouping information comprises an algorithm model group unique identifier, an algorithm model group name, an algorithm model unique identifier array and a service scene identifier corresponding to the algorithm model group;
configuring algorithm parameter entering template information, wherein the algorithm parameter entering template information comprises a parameter entering template unique identifier, an algorithm model interface unique identifier, a template parameter entering and filling-necessary parameter field list, a template parameter entering and non-filling-necessary parameter field list, an algorithm parameter entering fixed parameter field list and a dynamic parameter mapping list;
and configuring algorithm parameter-outputting template information, wherein the algorithm parameter-outputting template information comprises parameter-outputting template unique identifiers, algorithm model interface unique identifiers and a dynamic return value mapping list.
Further, according to the coding identifier, the picture to be processed is sent to a corresponding algorithm model, which comprises the following steps:
inquiring the value of the unique identifier of the algorithm model group according to the code identifier;
matching one or more algorithm model unique identifiers according to the value of the algorithm model group unique identifier;
determining corresponding algorithm model interface information according to the unique identification of the algorithm model;
determining an access interface address corresponding to the algorithm model according to the algorithm model interface information;
determining an algorithm model authentication mode according to the unique identification of the algorithm model;
based on the access interface address and the algorithm model authentication mode, acquiring algorithm parameter entering template information and algorithm parameter exiting template information through an interface of an algorithm model;
performing algorithm access parameter adaptation according to the algorithm parameter entering template information and the algorithm parameter exiting template information;
and distributing the picture to be processed to the interface of the corresponding algorithm model after completing the access parameter adaptation.
Further, the method for adapting the ginseng comprises the following steps:
generating a template adaptation component, and configuring a parameter entering field of the template adaptation component, wherein the parameter entering field comprises a coding identifier and a picture to be processed;
the configuration algorithm parameter entering field comprises a fixed parameter entering field list and a dynamic mapping parameter entering field list;
configuring a fixed parameter field list and a dynamic mapping parameter field list into a complete json format;
acquiring a fixed parameter field list from the cache, and assembling the value of a fixed field;
judging unnecessary parameters, traversing a key value through an unnecessary parameter field list in parameter entering template information of a configured algorithm, judging whether a parameter entering field of dynamic mapping contains the key value, and if the parameter entering field exists in the dynamic mapping, rejecting the unnecessary parameters when the algorithm enters parameter assembly;
obtaining a mapping relation of a dynamic parameter field list according to parameter entering template information of a configuration algorithm, wherein the dynamic parameter field list is used for mapping parameter entering of a template adaptation component into parameter entering of the algorithm, converting, adapting and assigning parameter values of the component and parameter values of the algorithm according to the mapping relation of the fields to obtain parameter entering fields of the request algorithm, and the parameter entering fields contain layer information of the fields;
constructing algorithm parameters according to the hierarchical structure of the field in a recursively constructed tree structure mode;
splicing the corresponding token or ak/sk information in the model information table into http request header parameters;
performing request mode adaptation according to request mode configuration data in the model interface information;
configuring a request address according to the request interface address in the model interface information;
executing the request, calling httpclient, implementing the interface request, performing the parameter-output adapting flow if the request is successful, and recording the error log if the request is failed.
Further, the method for adapting the ginseng comprises the following steps:
configuring unified return parameter fields, hierarchical structures and algorithm return parameter fields of the template adaptation component;
inquiring mapping relation of parameters and fields: after the algorithm identification result is returned, a dynamic return value mapping list configured by inquiring is uniquely identified according to the algorithm model interface;
the disassembly algorithm goes out the hierarchical structure of the parameter field: traversing according to a json result returned by the algorithm in a hierarchical manner to generate a tree entity object, and marking the hierarchical level and the father-son relationship of each node;
configuring parameter outputting data of an assembly standard according to the parameter outputting structure of the algorithm and the field structure of the template adaptation component;
verifying the validity of the parameter outputting data, comparing the parameter outputting field of the algorithm with a result field of the template configuration, and if the parameter outputting field returned by the algorithm is not matched in the template field configuration, considering that the parameter outputting field is illegal and is not returned as a standard parameter;
and judging whether the identification result information is filtered and deleted or the identification result is normally returned according to the configured threshold value of the parameter outputting field.
The beneficial effects of the invention are as follows:
(1) At present, the whole vision AI field mainly comprises AI identification of three scenes: detecting and identifying the picture content, comparing and searching the picture, and directly analyzing the video content; aiming at the API access requirements of the three scenes, interfaces for accessing the algorithms in a templated configuration mode are formulated, and when the algorithms of the three scenes are required to be newly added or switched, the access can be completed only by adjusting algorithm configuration parameters in an algorithm configuration management center;
(2) The invention improves the access efficiency of the whole algorithm by the way of templated configuration of the access algorithm, which is a complete closed-loop flow from the adaptation of the input parameter to the adaptation of the output parameter, and is used for accessing the identification capability of the algorithm model in a pluggable way. The whole adapting function is mainly composed of three parts, namely a multi-algorithm routing function, and the AI identifying request can be dynamically routed to an accessed target algorithm interface. And secondly, the parameter entering and adapting function adapts standardized parameters into personalized parameter fields required by each algorithm interface. Thirdly, the parameter outputting and adapting function can adapt the personalized parameters returned by the algorithm to the standardized output parameters of the whole platform.
Drawings
FIG. 1 is a flow chart of a method for accessing a multi-algorithm full-match access adapter in accordance with the present invention;
FIG. 2 is a flow chart of the algorithm routing of the present invention;
FIG. 3 is a flow chart of the present invention for parameter adaptation;
fig. 4 is a flowchart of the present invention.
Detailed Description
The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments, and it is apparent that the described embodiments are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by a person skilled in the art without any inventive effort, are intended to be within the scope of the present invention, based on the embodiments of the present invention.
Referring to fig. 1 to 4, the present invention provides a multi-algorithm full-matching access adapter access method:
a multi-algorithm full-matching access adapter access method, as shown in FIG. 1, comprises S100 to S400.
S100, receiving request information from an application end, wherein the request information comprises a coding identifier and a picture to be processed.
S200, analyzing the request information to obtain a coding identifier.
S300, sending the picture to be processed to a corresponding algorithm model according to the coding identifier.
In some embodiments, the configuration of the algorithm model includes configuration algorithm model information, configuration algorithm model interface information, configuration algorithm grouping information, configuration algorithm entry template information, and configuration algorithm exit template information. After the specific data information of the algorithm model is configured, the configuration data is synchronously written into the cache so as to improve the access performance of the whole processing.
The configuration of the algorithm model information mainly comprises the steps of configuring an authentication mode related to the algorithm model, solving pixels of a picture by an algorithm, and the like. As shown in table 1, the algorithm model information includes an algorithm model authentication mode, an algorithm model unique identifier, an algorithm model name, a minimum pixel requirement of a picture, a maximum pixel limit of the picture and an algorithm model type.
TABLE 1
The configuration of the algorithm model interface information is mainly to configure and access the related fields of the algorithm interface address for the calling of the interface. And defining an algorithm model interface unique identifier by configuring access interface address information corresponding to the algorithm model, binding the algorithm model interface information with the algorithm model supported by the algorithm model interface information through the algorithm model unique identifier (ModelId), and establishing an association relation. As shown in table 2, the algorithm model interface information includes an algorithm model interface name, an algorithm model interface access address, an algorithm model interface request mode, an algorithm model interface unique identifier, a call number threshold, an algorithm model unique identifier, and a request data format.
TABLE 2
The configuration of the algorithm grouping information mainly comprises the steps of configuring an algorithm model group, mapping the algorithm model group and an algorithm model, and establishing a one-to-many relation of an algorithm scene; that is, one algorithm model group may correspond to one or more algorithm models. The algorithm model group unique identification (ModelGroupID) is defined, and the algorithm model group is associated and bound with the algorithm model unique identification (ModelId) in a many-to-many mode. A canonical character string (such as FC001, representing a face recognition scene) is defined as a scene identification ID provided for an application platform to use by a component algorithm interface through configuring a business scene identification (business scene) in an algorithm model group. And grouping by one algorithm model according to the service scene IDs. As shown in table 3, the algorithm grouping information includes an algorithm model group unique identifier, an algorithm model group name, an algorithm model unique identifier array, and a service scene identifier corresponding to the algorithm model group.
TABLE 3 Table 3
The configuration of the algorithm parameter entering template information mainly configures an application to use a unified parameter entering mapping template of an algorithm interface to map an application request into parameters required by a participation algorithm. The parameter entry fields of the present template adaptation component are configured for application of standardized parameter entries (mainly the non-fill parameter fields apiExclude and the fill parameter fields apiInclude). A fixed parameter field list (FixParam) and a dynamic mapping parameter field list (ParamMatching) of the algorithm are configured for mapping packaging of the parameter of the algorithm when the algorithm is requested. As shown in table 4, the algorithm parameter entering template information comprises a parameter entering template unique identifier, an algorithm model interface unique identifier, a parameter field list of the parameter which needs to be filled by the template parameter entering, a parameter field list of the parameter which needs not to be filled by the template parameter entering, a fixed parameter field list of the parameter which needs to be filled by the algorithm entering and a dynamic parameter mapping list.
TABLE 4 Table 4
The configuration of the algorithm parameter outputting template information mainly configures a unified parameter outputting mapping template of the component to the algorithm interface, and maps and converts the identification result parameter outputting unification of the algorithm into an output parameter field of the component template standard. The out-parameter field of the template component and the out-parameter field mapping list (OutPutMatching) of the algorithm are configured. As shown in table 5, the algorithm parameter-exiting template information includes a parameter-exiting template unique identifier, an algorithm model interface unique identifier, and a dynamic return value mapping list.
TABLE 5
In some embodiments, as shown in fig. 2, the sending the to-be-processed picture to the corresponding algorithm model according to the coding identifier includes:
and inquiring the value of the unique identifier of the algorithm model group according to the code identifier.
Matching one or more algorithm model unique identifiers according to the value of the algorithm model group unique identifier;
determining corresponding algorithm model interface information according to the unique identification of the algorithm model;
determining an access interface address corresponding to the algorithm model according to the algorithm model interface information;
determining an algorithm model authentication mode (token, ak/sk and the like) according to the unique identification of the algorithm model;
acquiring algorithm parameter entering template information and algorithm parameter exiting template information (a fixed parameter field list and a dynamic parameter mapping field list) through an algorithm model interface based on an access interface address and an algorithm model authentication mode;
performing algorithm access parameter adaptation according to the algorithm parameter entering template information and the algorithm parameter exiting template information;
and distributing the picture to be processed to the interface of the corresponding algorithm model after completing the access parameter adaptation.
In some embodiments, as shown in fig. 3, the process of the join adaptation is:
configuring a parameter entering field of the template adapting component for applying standardized parameter entering, and mainly configuring a parameter list field (ApiIninclude) to be filled and a parameter list field (ApiExinclude) to be not filled; configuration is performed by adding fields, and configuration result generation examples are as follows:
{"ApiInclude":["image","BusinessSceneId"],"ApiExclude":["score",]}
where the application uses the component, the "image" field and "business sceneid" are the mandatory fields, and the "score" field is the non-mandatory field. The "image" field is a picture, "business sceneid" is a scene identification id, and "score" is a confidence threshold.
The parameter entering field of the algorithm is configured, and the parameter entering field is used for generating request parameters when the algorithm is requested. The algorithm model interface identification corresponds to the algorithm parameter entering template information, and the configuration algorithm parameter entering field comprises a configuration fixed parameter entering field list (FixParam) and a dynamic mapping parameter entering field list (ParamMatching);
the fixed-entry field list is configured in a complete json format, with the configuration examples being as follows:
{"project_id":"RTJGNLFWJK003","province_code":"851","DID":"1234567890123456789"}
the project_id is the project ID required by the algorithm platform, and usually, a fixed value is generated by one project when the project is accessed, and the project is required to be transmitted as well each time, and the project is not required to be changed; similarly, "program_code" is the algorithm using provincial code, and "DID" is the unique identification system used.
The dynamic mapping parameter field list is also configured into a complete json format, the key at this time encodes the parameter field received by the component, the value encodes the algorithm field to be mapped, and the configuration example is as follows:
{"image":"params-picture","score":"params-score","enable":"params-quality_check-enable"}
the image is a picture field which needs to be transmitted when the application received by the component calls, and the picture field which is needed by the algorithm is picture. In the parameter-entering adaptive conversion, the value carried by the image field is required to be assigned to the picture field required by the algorithm parameter-entering. Similarly, the value of the "score" field received by the component needs to be assigned to the "score" field required by the algorithm. The value received by the component 'enable' is required to be assigned to an 'enable' field under the quality_check node required by the algorithm.
The parameter field configuration (FixParam) is obtained from the cache, and the values of the fixed fields are assembled.
And judging unnecessary parameters (ApiExclude), and traversing key values in a dynamic mapping parameter field list when the parameter fields are received by the component and are parameter fields configured for the ApiExclude part. If the dynamic mapping is not matched, the parameter entering field is needed, unnecessary parameters are removed when the algorithm is assembled, namely, the values of the field are not assigned to any field needed by the algorithm.
The method comprises the steps of obtaining a mapping relation of a dynamic parameter field list, wherein the dynamic parameter field list is mainly used for mapping the parameter entering of a template adaptation component into the parameter entering of an algorithm, and converting, adapting and assigning the parameter value of the component and the parameter value of the algorithm according to the mapping relation of the fields to obtain the parameter entering field of the request algorithm. I.e. the field names of the mapping keys to be configured. Assigning a field name represented by a value corresponding to the key.
The mapping relation of the parameter field list configured, for example, is as follows (where "params" represents level 0 in the structure "-" joins the last level and the next level of the tree structure):
{"image":"params-picture","score":"params-score","enable":"params-quality_check-enable"}
the parameter content received by the component interface is as follows:
{"image":"data:image/jpeg;base64,/9j/4STKRXhpZgAATU0AKgAA...","score":"0.6","enable":"true"}。
and assigning values through the mapping relation. The dynamic parameter content required by the generation algorithm is as follows:
{"picture":"data:image/jpeg;base64,/9j/4STKRXhpZgAATU0AKgAA...","score": "0.6","quality_check": {"enable":"true"}}。
the parameter field contains the level information of the field, wherein 'params' represents the 0 th level in the structure; the "-" represents the json hierarchy plus one layer, the "-" is preceded by the content of the upper json structure, the "-" is connected with the fields of the next json structure, and the algorithm is built into the parameters by recursively constructing a tree structure according to the hierarchy of the fields.
And constructing request header parameters according to the interface request header parameter configuration. And acquiring corresponding token or ak/sk information in the model information table, and splicing the corresponding token or ak/sk information into a request header parameter (content in a header) of the http.
Performing request mode adaptation according to interface request mode configuration data; values configured according to the model interface request mode: post, delete, put, get selects a specific method of performing request encapsulation, calls a Post request if Post is configured, and accesses an algorithm interface using a get request if get is configured. And splicing corresponding parameter formats according to the requirements of the algorithm data formats (only support json and form submission formats), and configuring json. The parameter field after the adaptation will be entered. Converted to json format. If the form is the map data format, the map data format is maintained, and the map data format is converted into form data.
And acquiring the request interface address, and inquiring the algorithm interface address which needs to be accessed by the identification request according to the routing logic expressed in the foregoing.
Executing the request, calling httpclient, implementing the interface request, performing the parameter-output adapting flow if the request is successful, and recording the error log if the request is failed.
The entry adaptation weight point is the adaptation and conversion of the fixed parameters and parameters received by the system API interface. And after the fixed parameters and the parameters received by the API are adapted and converted, the parameters are combined to form a final request parameter body.
For example, a MAP set is created, fixed parameters (FixParam) are stored in the MAP set object, and the fixed parameters are stored in the form of key-value; examples:
{ "project_id" = "RTJGNLFWJK003", "program_code" = "851", "DID" = "1234567890123456789" }. ("=" preceding are keys and following are values)
Dividing parameters received by the API into necessary parameters and unnecessary parameters; the field received by the API is compared with the configured necessary parameter field and the unnecessary parameter field, if the field is positioned in the ApiInclude set, the field is the necessary field, and if the field is positioned in the ApiExclude set, the field is the unnecessary field. If the field is not configured in the database, it is an illegal field.
Selecting the necessary parameter types of the algorithm model by traversing the parameter entering field; the same field as the field in the ApiInclude set is the necessary field for the algorithm model interface.
Eliminating unnecessary parameters of the algorithm model received by the API; and traversing the key value in the dynamic mapping parameter field list according to the parameter fields configured by the component receiving parameter fields for the ApiExclude part. If the dynamic mapping is not matched and the parameter entering field is needed, unnecessary parameters are removed when the algorithm is assembled, namely, the values of the fields are not assigned to any field needed by the algorithm;
mapping the rest fields received by the API with algorithm parameter entering fields configured by the algorithm model one by one, and storing the mapping result in a memory set object; and obtaining a mapping relation of the dynamic parameter field list, converting and adapting the parameter value and the parameter value according to the mapping relation of the fields, and assigning the value, namely, entering the parameter value received by the field name of the configured mapping relation key. Assigning a field name represented by a value corresponding to the key. After the assignment, the field name represented by the value is stored in a new set, and the field name is stored in the new set by using a key, and the value stores the assigned value.
And merging the set object of the fixed parameter and the key-value set object of the algorithm parameter-entering mapping. And (3) combining the MAP set elements with fixed parameters with MAP set elements generated after the algorithm is subjected to parameter mapping to form an integral set element. This set is then the field name and corresponding value of the complete set of parameters required by the algorithm.
And (3) carrying out one-to-one disassembly on the combined key-value set objects to construct an algorithm ginseng tree entering structure. And traversing the key and the value of the MAP set. The field names of the keys are divided through the 'connector', the field in the upper layer is in front of the 'connector, the field in the lower layer is behind the' connector, calculation is carried out sequentially, the layer of the tree structure where each field is located is judged, and the parent-child relationship of the field is stored to form tree structure data.
And converting the ginseng tree structure into an algorithm request parameter json format or a form structure.
The parameter adapting function of the embodiment corresponds to the parameter adapting function, the parameter adapting is mainly responsible for parameter adapting conversion when the algorithm model is requested, and the parameter adapting is corresponding to mapping the variable name returned by the algorithm model to the variable name output by the system unified configuration.
In some embodiments, as shown in fig. 4, the process of adapting is shown as:
the unified return parameter field, the hierarchical structure and the algorithm return parameter field of the configuration template adaptation component are used for standardized output (namely, the configuration algorithm outputs mapping list information required by the OutPutMatching field in the parameter template information configuration table-1); standard result data for mapping return values of an algorithm to components, examples: { "params-bbox": "bbox" }, symbol x: the field type is Array, defaults to Object, symbol-representation: bbox is a subset of params, where params is the algorithm return field, bbox is the unified standard field that the component is to return, for example:
{'data-faces*-box_score':'score','data-faces*-x1':'x1','data-faces*-y1':'y1','data-faces*-x2':'x2','data-faces*-y2':'y2','desc':'msg','code':'code'}
inquiring mapping relation of parameters and fields: and after the algorithm identification result is returned, inquiring the configured OutPutMatching list information according to the algorithm interface ID.
Disassembling the hierarchical structure of the parameter field; traversing according to the json result returned by the algorithm in a hierarchical manner, generating a tree entity object, marking the hierarchical level and the parent-child relationship of each node. (refer to the data structure processing of java, here without expansion)
And configuring parameter outputting data of the assembly standard according to the parameter outputting structure of the algorithm and the field structure of the template assembly. And configuring the template fields of the algorithm parameter-outputting configuration, and carrying out' connection Fu Qiege to generate a parameter-outputting template field tree structure. Its elements are in the form of MAP, key as template configuration field. Value is the standard out-of-reference field of the map. And comparing the field name of the key of the template with the field name of the algorithm parameter. When the values of the parameter fields are compared with the same field names and the paths are the same, the Value result Value of the parameter fields is assigned to the Value of the template standardized parameter Value field (at the moment, a new set is created, the Value of the template is a key of the new set, and the Value corresponding to the key is an assigned identification result Value).
For example, the algorithm out-template configuration data is as follows:
{'data-faces*-box_score':'score','data-faces*-x1':'x1','data-faces*-y1':'y1','data-faces*-x2':'x2','data-faces*-y2':'y2','desc':'msg','code':'code'}
the algorithm return data structure is as follows:
{ "data" { "faces" { "box_score": 0.6"}, {" x1": 10" }, { "y1": 11"}, {" x2": 20" }, { "y2": 22"}," desc ": zhang Sano", "code": 200"}
The assigned standard parameter structure is as follows: { "score": "0.6", "msg": "Zhang Sanj", "code": "200", "x1": "10", "y1": "11", "x2": "20", "y2": "22" }
And verifying the validity of the parameter according to the configuration, and when the parameter outputting field is compared with the result field of the template configuration according to the algorithm, if the parameter outputting field returned by the algorithm is not matched in the template field configuration, the parameter outputting field is considered to be illegal and is not required to be returned as a standard parameter.
And judging whether the identification result information is filtered and deleted or returned normally according to the threshold configuration of the parameter outputting field. And acquiring the configured threshold value data. For example: score was configured to be 0.5. The score value is less than 0.5 and no parameter return is made. When the score value is greater than 0.5, the data is returned. And returning a valid result identified.
The out-fitting weight point function is to recursively convert the data structure returned by the algorithm into a standard data structure of the template configuration and logic control of the threshold value.
For example, the return value is stored in a key-value map set object of the memory;
it is determined whether the return data structure is an array. The first layer structure is an array, and the data is traversed and disassembled into a single object structure.
And performing parameter-out field mapping on the single object data structure, and mapping variables returned by the algorithm into uniformly output variables and structural forms configured in the component.
And calculating the value carried by the variable to be uniformly output and the configured threshold value, and using the operation rule configured by the component. And (5) the next step of returning the assembly of the data body is performed after the condition is met. Otherwise, cleaning the data and uniformly returning a preset error code. The AI analysis fails once.
And (3) uniformly constructing AI identification result data meeting a threshold value into a tree structure, and converting the tree structure into json form to form a final AI identification result message body.
S400, receiving a processing result of the image to be processed by the algorithm model, and returning the processing result to the application end.
The foregoing is merely a preferred embodiment of the invention, and it is to be understood that the invention is not limited to the form disclosed herein but is not to be construed as excluding other embodiments, but is capable of numerous other combinations, modifications and environments and is capable of modifications within the scope of the inventive concept, either as taught or as a matter of routine skill or knowledge in the relevant art. And that modifications and variations which do not depart from the spirit and scope of the invention are intended to be within the scope of the appended claims.
Claims (2)
1. An access method of a multi-algorithm full-matching access adapter is characterized by comprising the following steps:
receiving request information from an application end, wherein the request information comprises a coding identifier and a picture to be processed;
analyzing the request information to obtain a coding identifier;
transmitting the picture to be processed to a corresponding algorithm model according to the coding identifier;
receiving a processing result of the image to be processed by the algorithm model, and returning the processing result to the application end;
the configuration method of the algorithm model comprises the following steps:
configuring algorithm model information, wherein the algorithm model information comprises an algorithm model authentication mode, an algorithm model unique identifier, an algorithm model name, a minimum pixel requirement of a picture, a maximum pixel limit of the picture and an algorithm model type;
configuring algorithm model interface information, wherein the algorithm model interface information comprises an algorithm model interface name, an algorithm model interface access address, an algorithm model interface request mode, an algorithm model interface unique identifier, a calling frequency threshold value, an algorithm model unique identifier and a request data format;
configuring algorithm grouping information, wherein the algorithm grouping information comprises an algorithm model group unique identifier, an algorithm model group name, an algorithm model unique identifier array and a service scene identifier corresponding to the algorithm model group;
configuring algorithm parameter entering template information, wherein the algorithm parameter entering template information comprises a parameter entering template unique identifier, an algorithm model interface unique identifier, a template parameter entering and filling-necessary parameter field list, a template parameter entering and non-filling-necessary parameter field list, an algorithm parameter entering fixed parameter field list and a dynamic parameter mapping list;
configuring algorithm parameter-outputting template information, wherein the algorithm parameter-outputting template information comprises a parameter-outputting template unique identifier, an algorithm model interface unique identifier and a dynamic return value mapping list;
sending the picture to be processed to a corresponding algorithm model according to the coding identifier, wherein the method comprises the following steps:
inquiring the value of the unique identifier of the algorithm model group according to the code identifier;
matching one or more algorithm model unique identifiers according to the value of the algorithm model group unique identifier;
determining corresponding algorithm model interface information according to the unique identification of the algorithm model;
determining an access interface address corresponding to the algorithm model according to the algorithm model interface information;
determining an algorithm model authentication mode according to the unique identification of the algorithm model;
based on the access interface address and the algorithm model authentication mode, acquiring algorithm parameter entering template information and algorithm parameter exiting template information through an interface of an algorithm model;
performing algorithm access parameter adaptation according to the algorithm parameter entering template information and the algorithm parameter exiting template information;
distributing the picture to be processed to the interface of the corresponding algorithm model after completing the access parameter adaptation;
the method for adapting the ginseng comprises the following steps:
generating a template adaptation component, and configuring a parameter entering field of the template adaptation component, wherein the parameter entering field comprises a coding identifier and a picture to be processed;
the configuration algorithm parameter entering field comprises a fixed parameter entering field list and a dynamic mapping parameter entering field list;
configuring a fixed parameter field list and a dynamic mapping parameter field list into a complete json format;
acquiring a fixed parameter field list from the cache, and assembling the value of a fixed field;
judging unnecessary parameters, traversing a key value through an unnecessary parameter field list in parameter entering template information of a configured algorithm, judging whether a parameter entering field of dynamic mapping contains the key value, and if the parameter entering field exists in the dynamic mapping, rejecting the unnecessary parameters when the algorithm enters parameter assembly;
obtaining a mapping relation of a dynamic parameter field list according to parameter entering template information of a configuration algorithm, wherein the dynamic parameter field list is used for mapping parameter entering of a template adaptation component into parameter entering of the algorithm, converting, adapting and assigning parameter values of the component and parameter values of the algorithm according to the mapping relation of the fields to obtain parameter entering fields of the request algorithm, and the parameter entering fields contain layer information of the fields;
constructing algorithm parameters according to the hierarchical structure of the field in a recursively constructed tree structure mode;
splicing the corresponding token or ak/sk information in the model information table into http request header parameters;
performing request mode adaptation according to request mode configuration data in the model interface information;
configuring a request address according to the request interface address in the model interface information;
executing the request, calling httpclient, implementing the interface request, performing the parameter-output adapting flow if the request is successful, and recording the error log if the request is failed.
2. The multi-algorithm full-matching access adapter access method according to claim 1, wherein the method for out-fitting is as follows:
configuring unified return parameter fields, hierarchical structures and algorithm return parameter fields of the template adaptation component; inquiring mapping relation of parameters and fields:
after the algorithm identification result is returned, a dynamic return value mapping list configured by inquiring is uniquely identified according to the algorithm model interface;
the disassembly algorithm goes out the hierarchical structure of the parameter field:
traversing according to a json result returned by the algorithm in a hierarchical manner to generate a tree entity object, and marking the hierarchical level and the father-son relationship of each node;
configuring parameter outputting data of an assembly standard according to the parameter outputting structure of the algorithm and the field structure of the template adaptation component;
verifying the validity of the parameter outputting data, comparing the parameter outputting field of the algorithm with a result field of the template configuration, and if the parameter outputting field returned by the algorithm is not matched in the template field configuration, considering that the parameter outputting field is illegal and is not returned as a standard parameter;
and judging whether the identification result information is filtered and deleted or the identification result is normally returned according to the configured threshold value of the parameter outputting field.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410058249.1A CN117576545B (en) | 2024-01-16 | 2024-01-16 | Multi-algorithm full-matching access adapter access method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410058249.1A CN117576545B (en) | 2024-01-16 | 2024-01-16 | Multi-algorithm full-matching access adapter access method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117576545A CN117576545A (en) | 2024-02-20 |
CN117576545B true CN117576545B (en) | 2024-04-05 |
Family
ID=89862788
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410058249.1A Active CN117576545B (en) | 2024-01-16 | 2024-01-16 | Multi-algorithm full-matching access adapter access method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117576545B (en) |
Citations (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020119430A1 (en) * | 2018-12-14 | 2020-06-18 | 深圳壹账通智能科技有限公司 | Protocol interface test method, device, computer device and storage medium |
CN112036558A (en) * | 2019-06-04 | 2020-12-04 | 北京京东尚科信息技术有限公司 | Model management method, electronic device, and medium |
CN113296969A (en) * | 2020-04-17 | 2021-08-24 | 阿里巴巴集团控股有限公司 | Information processing method and device and electronic equipment |
CN113742005A (en) * | 2021-01-15 | 2021-12-03 | 北京京东拓先科技有限公司 | Platform docking method and device |
WO2021244100A1 (en) * | 2020-06-05 | 2021-12-09 | 华为技术有限公司 | Access control method, apparatus and device of target operating system, and medium |
CN114138244A (en) * | 2021-12-03 | 2022-03-04 | 北京自如信息科技有限公司 | Method and device for automatically generating model files, storage medium and electronic equipment |
WO2022122997A1 (en) * | 2020-12-11 | 2022-06-16 | Telefonaktiebolaget Lm Ericsson (Publ) | Predicting random access procedure performance based on ai/ml models |
CN115374318A (en) * | 2022-09-06 | 2022-11-22 | 中国平安人寿保险股份有限公司 | Model calling method and device, computer equipment and storage medium |
CN115390944A (en) * | 2022-08-26 | 2022-11-25 | 鼎富智能科技有限公司 | Algorithm service calling method and device, electronic equipment and storage medium |
CN115509534A (en) * | 2022-08-23 | 2022-12-23 | 珠海格力电器股份有限公司 | Compiling method and device adaptive to AI model, storage medium and electronic equipment |
CN115756667A (en) * | 2022-11-22 | 2023-03-07 | 平安银行股份有限公司 | Interface contract optimization adjustment method and device |
WO2023050556A1 (en) * | 2021-09-28 | 2023-04-06 | 中诚区块链研究院(南京)有限公司 | Smart contract consensus algorithm |
CN116414751A (en) * | 2021-12-30 | 2023-07-11 | 浙江宇视科技有限公司 | Algorithm access method and device, storage medium and electronic equipment |
CN116541088A (en) * | 2022-01-26 | 2023-08-04 | 华为技术有限公司 | Model configuration method and device |
CN116627669A (en) * | 2023-05-15 | 2023-08-22 | 苏宁易购集团股份有限公司 | Method, device, equipment and medium for adapting API (application program interface) by heterogeneous cooperation |
CN116861198A (en) * | 2023-09-01 | 2023-10-10 | 北京瑞莱智慧科技有限公司 | Data processing method, device and storage medium |
CN116938739A (en) * | 2023-07-20 | 2023-10-24 | 中国联合网络通信集团有限公司 | Data processing method, device, equipment and storage medium |
CN116976457A (en) * | 2023-04-27 | 2023-10-31 | 腾讯科技(深圳)有限公司 | Model loading method, reasoning system, device and computer equipment |
-
2024
- 2024-01-16 CN CN202410058249.1A patent/CN117576545B/en active Active
Patent Citations (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020119430A1 (en) * | 2018-12-14 | 2020-06-18 | 深圳壹账通智能科技有限公司 | Protocol interface test method, device, computer device and storage medium |
CN112036558A (en) * | 2019-06-04 | 2020-12-04 | 北京京东尚科信息技术有限公司 | Model management method, electronic device, and medium |
CN113296969A (en) * | 2020-04-17 | 2021-08-24 | 阿里巴巴集团控股有限公司 | Information processing method and device and electronic equipment |
WO2021244100A1 (en) * | 2020-06-05 | 2021-12-09 | 华为技术有限公司 | Access control method, apparatus and device of target operating system, and medium |
WO2022122997A1 (en) * | 2020-12-11 | 2022-06-16 | Telefonaktiebolaget Lm Ericsson (Publ) | Predicting random access procedure performance based on ai/ml models |
CN113742005A (en) * | 2021-01-15 | 2021-12-03 | 北京京东拓先科技有限公司 | Platform docking method and device |
WO2023050556A1 (en) * | 2021-09-28 | 2023-04-06 | 中诚区块链研究院(南京)有限公司 | Smart contract consensus algorithm |
CN114138244A (en) * | 2021-12-03 | 2022-03-04 | 北京自如信息科技有限公司 | Method and device for automatically generating model files, storage medium and electronic equipment |
CN116414751A (en) * | 2021-12-30 | 2023-07-11 | 浙江宇视科技有限公司 | Algorithm access method and device, storage medium and electronic equipment |
CN116541088A (en) * | 2022-01-26 | 2023-08-04 | 华为技术有限公司 | Model configuration method and device |
CN115509534A (en) * | 2022-08-23 | 2022-12-23 | 珠海格力电器股份有限公司 | Compiling method and device adaptive to AI model, storage medium and electronic equipment |
CN115390944A (en) * | 2022-08-26 | 2022-11-25 | 鼎富智能科技有限公司 | Algorithm service calling method and device, electronic equipment and storage medium |
CN115374318A (en) * | 2022-09-06 | 2022-11-22 | 中国平安人寿保险股份有限公司 | Model calling method and device, computer equipment and storage medium |
CN115756667A (en) * | 2022-11-22 | 2023-03-07 | 平安银行股份有限公司 | Interface contract optimization adjustment method and device |
CN116976457A (en) * | 2023-04-27 | 2023-10-31 | 腾讯科技(深圳)有限公司 | Model loading method, reasoning system, device and computer equipment |
CN116627669A (en) * | 2023-05-15 | 2023-08-22 | 苏宁易购集团股份有限公司 | Method, device, equipment and medium for adapting API (application program interface) by heterogeneous cooperation |
CN116938739A (en) * | 2023-07-20 | 2023-10-24 | 中国联合网络通信集团有限公司 | Data processing method, device, equipment and storage medium |
CN116861198A (en) * | 2023-09-01 | 2023-10-10 | 北京瑞莱智慧科技有限公司 | Data processing method, device and storage medium |
Non-Patent Citations (2)
Title |
---|
Evolution management in multi-model databases;Irena Holubova 等;《Data & Knowledge Engineering》;20211007;第136卷;1-28 * |
大语言模型协同领域模型解决复杂任务的技术研究;张旭锴 等;《网络安全和信息化》;20240105;53-56 * |
Also Published As
Publication number | Publication date |
---|---|
CN117576545A (en) | 2024-02-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11411897B2 (en) | Communication method and communication apparatus for message queue telemetry transport | |
CN110704518B (en) | Business data processing method and device based on Flink engine | |
CN110598280B (en) | Equipment simulation system and method and computer readable storage medium | |
CN113079198B (en) | Method and device for converting cloud platform interface protocol | |
CN110474794B (en) | Information conversion method and system of SDN framework | |
CN111694547A (en) | Automatic coding data processing application design tool based on data state change | |
CN110636127B (en) | Communication processing method and system between information data | |
RU2697648C2 (en) | Traffic classification system | |
CN113806037A (en) | Service calling method and device, storage medium and electronic equipment | |
CN113448988B (en) | Training method and device of algorithm model, electronic equipment and storage medium | |
CN114006928A (en) | Internet of things data processing method based on multi-protocol real-time communication | |
CN118017564B (en) | Energy storage method based on open source hong Meng system | |
WO2023029881A1 (en) | Device control method and apparatus | |
KR20200073749A (en) | Method and system for testing it system | |
CN116466930A (en) | Construction method, message processing method and device of intelligent customer service model and electronic equipment | |
CN110888672B (en) | Expression engine implementation method and system based on metadata architecture | |
CN112395339B (en) | Intersystem data admission verification method, device, computer equipment and storage medium | |
CN111078573A (en) | Test message generation method and device | |
CN117576545B (en) | Multi-algorithm full-matching access adapter access method | |
CN114039997A (en) | Data processing method and device | |
CN114285852A (en) | Service calling method and device based on multi-stage service platform | |
CN111614726B (en) | Data forwarding method, cluster system and storage medium | |
WO2020220272A1 (en) | Method and system for changing resource state, terminal, and storage medium | |
CN115348320B (en) | Communication data conversion method and device and electronic equipment | |
CN115333943A (en) | Deterministic network resource configuration system, method, device and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |