A method and device for loading contrast information based on image recognition
By using a subscription mechanism and loading thread in the recognition terminal, image features or comparison threshold parameters can be configured directly in memory, solving the real-time problem caused by the restart of the recognition terminal and improving the loading efficiency and real-time performance of configuration parameters.
Patent Information
- Application Number
- CN202110515842.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-12
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2041-05-12
AI Technical Summary
In existing technologies, the recognition terminal needs to be restarted when its configuration parameters are modified, resulting in poor real-time loading of configuration parameters and failure to update the face recognition service process in a timely manner.
The system acquires subscription tasks through a subscription mechanism and extracts image features or comparison threshold parameters when the loading thread and recognition thread of the recognition terminal are in an inactive state. These parameters are then directly configured into memory, eliminating the need to restart and load the configuration parameters.
It improves the efficiency and real-time performance of loading configuration parameters, reduces system resource consumption, and improves the startup efficiency of the identification terminal.
Smart Images

Figure CN113159076B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of Fintech, and in particular to a method and device for loading contrast information based on image recognition. BACKGROUND
[0002] With the development of computer technology, more and more technologies (for example: blockchain, cloud computing or big data) are applied in the financial field, and the traditional financial industry is gradually changing to Fintech, and big data technology is no exception. However, due to the security and real-time requirements of the financial and payment industries, higher requirements are also put forward for the front-end execution task in identifying user identity.
[0003] At present, there are many methods for identifying user identity, such as fingerprint, palm print, fixed password and face recognition. Among them, for face recognition, there are two kinds of configuration parameters in the recognition terminal. The first kind is the comparison threshold parameter, which is used to represent the threshold of face detection size and angle, face liveness detection confidence, face comparison success score threshold, etc. in the face comparison process. The second kind is the image feature parameter, which is used to represent the comparison source face feature data, the unique number of the face, and the jpg picture of the face, etc.
[0004] In the prior art, when modifying the configuration parameters of the recognition terminal, the management personnel needs to access the Server server in the WEB browser, and the Web server service updates the modified configuration parameters to the specified directory, and then controls the recognition terminal to restart the system, so as to use the modified configuration parameters.
[0005] However, in the prior art, the modification of the configuration parameters of the recognition terminal is isolated from the current face recognition service process being executed, which causes the modified configuration parameters to be unable to be updated to the face recognition service process in real time, and excessively relies on service restart, so that the real-time performance of loading the modified configuration parameters is poor.
[0006] Therefore, there is a need for a method for loading configuration parameters, which realizes loading configuration parameters without restarting the recognition terminal, and improves the efficiency and real-time performance of loading configuration parameters. SUMMARY
[0007] The embodiments of the present application provide a method for loading contrast information based on image recognition, which is used to realize loading configuration parameters without restarting the recognition terminal, and improve the efficiency and real-time performance of loading configuration parameters.
[0008] In a first aspect, the embodiments of the present application provide a method for loading contrast information based on image recognition, comprising:
[0009] The recognition terminal obtains a first subscription task through a subscription mechanism;
[0010] The recognition terminal determines that the task type of the first subscription task is an image feature parameter type and the loading thread is in an unexecuted state, and then acquires a first recognition image corresponding to the first subscription task;
[0011] The recognition terminal extracts an image feature of the first recognition image through the loading thread, obtains first comparison information, and configures the first comparison information to a comparison information library in the memory of the recognition terminal. The comparison information in the comparison information library is used by a recognition thread of the recognition terminal when performing image recognition.
[0012] At present, a recognition terminal generally includes two different processes. One process is used to acquire original file information on a server, such as a jpg picture of a face. However, the data used by the recognition terminal when performing recognition is image feature parameters obtained by performing feature extraction on the original file information. Therefore, the original file data acquired on the server cannot be directly used in the recognition terminal.
[0013] In the present application, the image feature parameters of a user to be recognized are determined through a loading thread, so that the comparison information of the recognition terminal can be loaded without restarting the service. Moreover, since the comparison information is loaded without restarting, the comparison information can be directly used for recognition after being loaded, so as to improve the efficiency and real-time performance of loading the comparison information.
[0014] Optionally, before the image feature of the first recognition image is extracted through the loading thread, the method further includes:
[0015] The recognition terminal determines that the recognition thread is in an unexecuted state.
[0016] In the above technical solution, the recognition thread is determined to be in an unexecuted state before the image feature of the first recognition image is extracted through the loading thread. This prevents the time for extracting the image feature of the user to be recognized from being occupied by the user to be recognized when performing identity recognition, thereby avoiding a reduction in recognition efficiency.
[0017] Optionally, the method further includes:
[0018] The recognition terminal determines that the task type of the first subscription task is a comparison threshold parameter type, analyzes the task content in the first subscription task, and determines a comparison threshold parameter.
[0019] If the recognition terminal determines that the recognition thread is in an unexecuted state, the comparison threshold parameter is loaded into the memory to change the comparison threshold parameter of the recognition terminal.
[0020] In the technical solution, for a subscription task of a comparison threshold parameter type, the determined comparison threshold parameter is directly configured in the memory of the identification terminal, so as to improve the efficiency and real-time performance of loading comparison information. Before the comparison threshold parameter is loaded into the memory, it is determined whether the identification thread is in an execution state, so as to prevent the identification of a user from being affected. By dividing the subscription tasks into different types, the corresponding tasks are executed according to the types, so that the completion efficiency of the subscription tasks is improved.
[0021] Optionally, the identification terminal obtains the first subscription task through a subscription mechanism, and the method comprises the following steps.
[0022] The identification terminal obtains the first subscription task from a subscription server through the subscription mechanism.
[0023] The identification terminal obtains the first identification image corresponding to the first subscription task, and the method comprises the following steps.
[0024] The identification terminal obtains the identification image identifier, the subscription task identifier and the operation instruction on the identification image corresponding to each subscription task of an image feature parameter type from the subscription server.
[0025] In the technical solution, the subscription mechanism is used to realize the lightweight acquisition of the subscription task, so as to save the computing resources and reduce the energy consumption.
[0026] Optionally, the identification terminal extracts the image feature of the first identification image through the loading thread, obtains the first comparison information, and configures the first comparison information to the comparison information library in the memory of the identification terminal, and the method comprises the following steps.
[0027] When it is determined that the operation instruction is addition or modification, the identification terminal obtains the corresponding identification image according to the identification image identifier.
[0028] The identification terminal determines the image feature of the identification image, and obtains the first comparison information.
[0029] The identification terminal configures the first comparison information to the comparison information library in the memory of the identification terminal according to the operation instruction.
[0030] In the technical solution, after the operation instruction is determined, it is determined whether the specific identification image is requested from the server, that is, during the acquisition and processing of the subscription task, there is no identification image, so that the resource of the subscription task is small, the lightweight acquisition of the subscription task is realized, the computing resources are saved, and the energy consumption is reduced.
[0031] Optionally, after the first comparison information is configured to the comparison information library in the memory of the identification terminal, the method further comprises the following steps.
[0032] The identification terminal sends a subscription completion indication to the subscription server; the subscription completion indication comprises a subscription task identifier;
[0033] The identification terminal continues to obtain, from the subscription server, each unprocessed subscription task of the image feature parameter type.
[0034] In the above technical solution, after the subscription task is completed, a subscription completion indication is sent to the subscription server, that is, feedback is given to the subscription server, so that the task state synchronization between the identification terminal and the subscription server is realized, and the management difficulty of the subscription task is reduced.
[0035] Optionally, the method further comprises:
[0036] After the identification terminal determines that the first comparison information configuration fails, the identification terminal sends a subscription failure indication to the subscription server, wherein the subscription failure indication comprises a failure reason and a subscription task identifier; and the subscription task identifier is used for the subscription server to regenerate a subscription task.
[0037] In the above technical solution, when an error occurs in the extraction of the image feature of the first identification image of the first subscription task, the first subscription task is no longer sent to the identification terminal, and the identification terminal cannot obtain the corresponding first comparison information. By regenerating the subscription task, the overall accuracy of the identification terminal is improved.
[0038] Optionally, the identification terminal extracts the image feature of the first identification image through the loading thread, and the method comprises:
[0039] The identification terminal sets a thread pool, and determines the loading thread from the thread pool.
[0040] The identification terminal extracts the image feature of the first identification image by asynchronously executing the loading thread.
[0041] By setting the thread pool, the subscription tasks can be obtained in batches, and by asynchronously executing the loading thread, the efficiency of executing the subscription task can be improved.
[0042] In a second aspect, an embodiment of the present application provides a device for loading comparison information based on image recognition, comprising:
[0043] An obtaining module is configured to obtain a first subscription task through a subscription mechanism.
[0044] A processing module is configured to, when it is determined that the task type of the first subscription task is an image feature parameter type and a loading thread is in an unexecuted state, obtain a first identification image corresponding to the first subscription task.
[0045] extract image features of the first identification image through the loading thread to obtain first comparison information, and configure the first comparison information to a comparison information library in a memory of the identification terminal; the comparison information in the comparison information library is used by an identification thread of the identification terminal when performing image identification.
[0046] Optionally, the processing module is further configured to:
[0047] Before extracting the image features of the first identification image through the loading thread, it is determined that the identification thread is in an unexecuted state.
[0048] Optionally, the processing module is further configured to:
[0049] If it is determined that the identification thread is in the unexecuted state, the comparison threshold parameter is loaded into the memory.
[0050]
[0051] Optionally, the processing module is specifically configured to:
[0052] The first subscription task is obtained from a subscription server through the subscription mechanism.
[0053] The first identification image corresponding to the first subscription task is obtained, including:
[0054] The identification image, the subscription task identifier, and the operation instruction on the identification image corresponding to each subscription task whose task type is an image feature parameter type are obtained from the subscription server.
[0055] Optionally, the processing module is specifically configured to:
[0056] The identification terminal extracts the image features of the first identification image through the loading thread to obtain first comparison information, and configures the first comparison information to a comparison information library in a memory of the identification terminal, including:
[0057] When it is determined that the operation instruction is adding or modifying, the corresponding identification image is obtained according to the identification image identifier;
[0058] The image features of the identification image are determined to obtain first comparison information.
[0059] The first comparison information is configured to the comparison information library in the memory of the identification terminal according to the operation instruction.
[0060] Optionally, the processing module is further configured to:
[0061] After the first contrast information is configured to the contrast information library in the memory of the identification terminal, a subscription completion indication is sent to the subscription server; the subscription completion indication includes a subscription task identifier;
[0062] Continuously obtaining, from the subscription server, each unprocessed subscription task of the image feature parameter type.
[0063] Optionally, the processing module is further configured to:
[0064] After determining that the first contrast information configuration fails, a subscription failure indication is sent to the subscription server, and the subscription failure indication includes a failure reason and a subscription task identifier; the subscription task identifier is used for the subscription server to regenerate a subscription task.
[0065] Optionally, the processing module is specifically configured to:
[0066] A thread pool is set, and a loading thread is determined from the thread pool;
[0067] The image feature of the first identification image is extracted by asynchronously executing the loading thread.
[0068] In a third aspect, an embodiment of the present application further provides a computer device, comprising:
[0069] A memory is configured to store program instructions.
[0070] A processor is configured to call the program instructions stored in the memory, and execute the above-mentioned method for loading contrast information based on image identification according to obtained program execution.
[0071] In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, which stores computer executable instructions, and the computer executable instructions are used for making a computer execute the above-mentioned method for loading contrast information based on image identification. BRIEF DESCRIPTION OF DRAWINGS
[0072] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0073] Figure 1 A schematic diagram of loading configuration parameters provided by an embodiment of the present application;
[0074] Figure 2 A schematic diagram of loading configuration parameters provided by an embodiment of the present application;
[0075] Figure 3 A flowchart of a method for loading contrast information based on image recognition provided for an embodiment of the present application is shown in FIG. 1.
[0076] Figure 4 A flowchart of a method for loading contrast information based on image recognition provided for an embodiment of the present application is shown in FIG. 1.
[0077] Figure 5 A schematic diagram for determining contrast information provided for an embodiment of the present application is shown in FIG. 4.
[0078] Figure 6 A structural schematic diagram of a device for loading contrast information based on image recognition provided for an embodiment of the present application is shown in FIG. 5. DETAILED DESCRIPTION
[0079] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be described in further detail below with reference to the drawings. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.
[0080] In the existing life, recognition functions are everywhere, such as fingerprint unlocking of mobile phones, face recognition unlocking, face recognition payment, and face access control terminals, etc. In the recognition terminal, generally two kinds of data are included, which are respectively comparison threshold parameters, such as face detection size and angle in the face comparison process, threshold of face liveness detection confidence, threshold of face comparison success score, etc. Image feature parameters, such as comparison source face feature data, unique number of face, and jpg picture of face, etc.
[0081] In the prior art, the configuration parameters in the recognition terminal are modified, such as modifying image feature parameters, modifying comparison threshold parameters, adding image feature parameters, deleting image feature parameters, etc. For example, when there is a new user, the image feature parameters of the user need to be added in the recognition terminal.
[0082] However, the current recognition terminal generally uses a double-process architecture when modifying the configuration parameters. Therefore, after the current recognition terminal loads the configuration parameters, it usually needs to restart the recognition terminal to normally use the new configuration parameters.
[0083] For example, as shown in FIG. 2, when a new user is added in the recognition terminal, the image feature parameters of the new user need to be added in the recognition terminal. Figure 1 Figure 1 An exemplary schematic diagram of loading configuration parameters is shown, which identifies the terminal 100 including an identification process and a service process, wherein the identification process is used for feature extraction on the identification image (such as a JPEG picture) and then compared with the comparison information stored in the terminal, and the service process is used for obtaining the image feature parameters to be updated from the background server.
[0084] However, because the identification process uses the comparison information after feature extraction for comparison, the image feature parameters cannot be directly used after the service process obtains the image feature parameters, and the data between the processes is isolated, which causes the identification terminal to be unable to update the image feature parameters in real time, and the identification device can only extract the feature of the new image feature parameters and load them into the comparison information library when the identification terminal is restarted, so as to be used.
[0085] Therefore, there is a need for a method for loading comparison information in an identification terminal to achieve loading configuration parameters without restarting the identification terminal, thereby improving the efficiency and real-time performance of loading configuration parameters.
[0086] To solve the above technical problems, in one possible implementation, the identification process and the service process are combined to achieve loading configuration parameters without restarting the identification terminal, as follows.
[0087] Figure 2 An exemplary schematic diagram of loading configuration parameters is shown, as shown in Figure 2 A set of inter-process communication framework is built between the identification process and the service process in the identification terminal 200, and then the service process can establish a connection with the identification process to obtain the configuration parameters. Specifically, for the comparison threshold parameter, the service process loads the comparison threshold parameter into the memory of the identification terminal 200 after obtaining the comparison threshold parameter, so as to use the new comparison threshold parameter without restarting. For the image feature parameter, the service process can perform feature extraction on the image feature parameter to obtain the comparison information, and then load the comparison information into the comparison information library, so as to use the new image feature parameter without restarting.
[0088] However, the above scheme has a problem that the service process needs to add an additional feature extraction method to perform feature extraction on the image feature parameter, which means that the identification terminal has two processes that need to perform feature extraction on the image feature parameter, and thus needs to include two feature extraction methods. Therefore, the system resources of the identification terminal are greatly occupied, and the inter-process communication framework also occupies the system resources of the identification terminal, which causes the identification terminal to consume too much time for feature extraction or other tasks, and the efficiency is low.
[0089] It should be noted that the identification terminal described in the present application can be a mobile phone, a notebook computer, a face recognition device, and the like, and is not specifically limited here.
[0090] Based on the above description, Figure 3 An exemplary flowchart of a method for loading comparison information based on image recognition provided by an embodiment of the present application is shown, which can be executed by a device for loading comparison information based on image recognition.
[0091] As Figure 3 shown, the flow specifically includes:
[0092] In step 310, the identification terminal obtains a first subscription task through a subscription mechanism.
[0093] In the embodiment of the present application, the subscription mechanism can be an MQTT (Message Queue Telemetry Transport) protocol, so as to realize that the identification terminal obtains the first subscription task in the subscription server through the subscription mechanism.
[0094] In step 320, the identification terminal obtains a first identification image corresponding to the first subscription task when it is determined that the task type of the first subscription task is an image feature parameter type and a loading thread is in a non-executing state.
[0095] In the embodiment of the present application, the subscription task is classified, including an image feature parameter type and a comparison threshold parameter type, different types are implemented by different strategies, and when it is determined that the task type is the image feature parameter type, the first identification image corresponding to the first subscription task is requested from the subscription server through the transmission protocol.
[0096] In step 330, the identification terminal extracts an image feature of the first identification image through the loading thread, obtains first comparison information, and configures the first comparison information to a comparison information library in the memory of the identification terminal.
[0097] In the embodiment of the present application, the comparison information in the comparison information library is used when the identification thread of the identification terminal performs image recognition.
[0098] It should be noted that when the MQTT subscription protocol is used, an MQTT client needs to be initialized on the identification terminal, specifically, an address of an MQTT server, a product ID of the MQTT client, and an identification terminal ID configured in the MQTT client are configured, and a heartbeat time of a service event loop of the MQTT client, such as 500 milliseconds, is configured. The heartbeat time of the service event loop is used to periodically determine whether the identification terminal is in an online state.
[0099] Then the MQTT server is connected, the subscription name is obtained, and then the terminal can be identified by the subscription mechanism to obtain the first subscription task. During this period, the identification terminal also starts the service event loop of the configuration completion to periodically determine whether the identification terminal is in an online state.
[0100] It should be noted that in the embodiment of the present application, the loading thread and the identification thread are execution units of the same process, so that the loading thread and the identification thread can share the image feature parameter extraction method in the process, and the image feature parameter extraction method does not need to be set in different threads, so as to reduce the calculation resources of the identification terminal and improve the identification efficiency of the equipment terminal. The communication between threads does not need to build a framework, so it will not occupy the system resources of the identification terminal.
[0101] When starting the identification terminal, the identification thread is started first, and then the loading thread is started, so as to increase the starting efficiency of the identification terminal. The identification thread and the loading thread can also be started at the same time, which is not limited here.
[0102] In step 310, the identification terminal obtains the first subscription task through the subscription mechanism, specifically including: the identification terminal obtains the first subscription task from the subscription server through the subscription mechanism.
[0103] According to the MQTT subscription protocol, after the subscription task of the subscription server is completed, the subscription information is sent to the identification terminal through the subscription mechanism, so that the identification terminal obtains the first subscription task through the subscription mechanism. For example, after the subscription server generates the subscription task, the identification terminal ID is determined to determine the identification terminal to which the subscription message needs to be sent, and the first subscription task containing the task type information is sent to the identification terminal, that is, the identification terminal obtains the first subscription task through the subscription mechanism.
[0104] The task type includes two types, which are image feature parameter type and comparison threshold parameter type. If the first subscription task is the image feature parameter type, the content of the first subscription task only includes the image feature parameter type indication. If the first subscription task is the comparison threshold parameter type, the content of the first subscription task includes the comparison threshold parameter type indication and the corresponding task content, and the task content is the comparison threshold parameter.
[0105] In step 320, when the identification terminal determines that the task type of the first subscription task is the image feature parameter type and the loading thread is in a non-executing state, the content of the first subscription task only includes the image feature parameter type indication, so the identification terminal needs to request the first identification image of the first subscription task from the subscription server. Specifically, the identification terminal obtains the identification image corresponding to each subscription task of the image feature parameter type, the subscription task identifier, and the operation indication of the identification image from the subscription server.
[0106] That is, after determining that the task type of the first subscription task is the image feature parameter type, the recognition terminal needs to first determine whether the loading thread is executing, that is, whether the loading thread is executing a subscription task of other task type being the image feature parameter type, and when determining that the loading thread is in the unexecuting state, the recognition terminal requests the first recognition image of the first subscription task from the subscription server, and then obtains the image feature of the first recognition image through the first recognition image and the image feature parameter extraction method, so as to obtain the first comparison information of the first recognition image.
[0107] It should be noted that in step 330, before the image feature of the first recognition image is extracted by the loading thread, the recognition terminal determines that the recognition thread is in the unexecuting state.
[0108] That is, because the loading thread and the recognition thread are execution units of the same process, the image feature parameter extraction method used is the same, so before the loading thread uses the image feature parameter extraction method, it is necessary to first determine whether the recognition thread is using the image feature parameter extraction method, so as to prevent the recognition thread from not being able to extract the image feature parameter of the user to be recognized in time. Because the threads under the process commonly use the image feature parameter extraction method, the system resources of the recognition terminal can be reduced.
[0109] After the first comparison information is configured to the comparison information library in the memory of the recognition terminal, the first subscription task is distinguished according to the subscription task identifier, and a subscription completion indication is generated according to the subscription task identifier to feed back the state of the subscription task to the subscription server.
[0110] Further, after the first comparison information is configured to the comparison information library in the memory of the recognition terminal, the recognition terminal sends a subscription completion indication to the subscription server, wherein the subscription completion indication includes a subscription task identifier, and then continues to obtain each subscription task of the image feature parameter type which has not been processed from the subscription server until there is no uncompleted first subscription task in the subscription server.
[0111] Illustratively, the task type of the subscription task further includes a comparison threshold parameter type.
[0112] Further, the recognition terminal determines that the task type of the first subscription task is the comparison threshold parameter type, parses the task content in the first subscription task, determines the comparison threshold parameter, and if it is determined that the recognition thread is in the unexecuting state, the comparison threshold parameter is loaded into the memory.
[0113] In the embodiment of the present application, because the subscription task of the comparison threshold parameter type includes the comparison threshold parameter type indication and the corresponding task content, the comparison threshold parameter can be directly determined according to the task content, then the comparison threshold parameter is loaded into the memory, and after the loading is successful, the subscription completion indication is generated and sent to the subscription server through the subscription mechanism.
[0114] In order to better explain the above technical solutions, the following will be described in specific examples.
[0115] Example 1
[0116] Figure 4 An exemplary flowchart for loading comparison information based on image recognition is shown as follows. Figure 4 As shown in the figure, the device terminal communicates with the subscription server according to the address of the MQTT server in the subscription mechanism, and after the subscription task is completed, it is added to the subscription task list. The subscription task list can include an image feature parameter type subscription task list and a comparison threshold parameter type subscription task list. Obviously, the image feature parameter type subscription task list includes image feature parameter type subscription tasks, and the comparison threshold parameter type subscription task list includes comparison threshold parameter type subscription tasks.
[0117] Synchronously, the completed first subscription task is sent to the recognition terminal, wherein the first subscription task includes a task type indication. After obtaining the first subscription task, the recognition terminal can compile the task type indication into readable data according to the translation or compilation software, and then determine the task type indication.
[0118] Exemplarily, when the recognition terminal determines that the task type indication is the comparison threshold parameter type, the first subscription task further includes first task content. Then the recognition terminal parses the first task content to determine the comparison threshold parameter of the first subscription task and the subscription task indication, such as the subscription identifier a of the first subscription task. Then the recognition terminal loads the obtained comparison threshold parameter into the memory when it is determined that the recognition thread is not executed, and after the loading is completed, determines the subscription completion indication for a according to the subscription task identifier a. Finally, the subscription completion indication is sent to the subscription server through the subscription mechanism, so that the subscription server sets the subscription task of the subscription task identifier a as completed in the image feature parameter type subscription task list according to the subscription task identifier a.
[0119] Exemplarily, when the recognition terminal determines that the task type indication is the image feature parameter type, the first subscription task only includes the subscription task type indication, and then the device terminal determines whether the loading thread is in the non-executed state. If the loading thread is in the executed state, the device terminal does not process the first subscription task.
[0120] If the loading thread is in an unexecuted state, the identification image, the subscription task identifier and the operation instruction on the identification image of the first subscription task are requested from the subscription server through the subscription mechanism, then the first comparison information is determined according to the identification image, the first comparison information is configured according to the operation instruction, and after the configuration is completed, the subscription completion instruction for the subscription task identifier is determined according to the subscription task identifier, and finally the subscription completion instruction is sent to the subscription server through the subscription mechanism.
[0121] In the embodiment of the present application, before the request is initiated to the subscription server, it can also be determined whether the subscription task list of the image feature parameter type in the subscription server still has a subscription task, if not (such as the subscription task has been deleted in the subscription server), the subscription task is ended. If there is, the identification image identifier, the subscription task identifier and the operation instruction on the identification image of the first subscription task are requested from the subscription server.
[0122] After the operation instruction is obtained, it is determined according to the operation instruction whether the identification image needs to be requested, if yes, the first comparison information is determined according to the identification image identifier.
[0123] Specifically, when the operation instruction is determined to be added or modified, the identification terminal acquires the corresponding identification image according to the identification image identifier, and then determines the image feature of the identification image to obtain the first comparison information, and the first comparison information is configured to the comparison information library in the memory of the identification terminal according to the operation instruction.
[0124] The operation instruction is used for the specific operation method of the first comparison information, including adding, deleting and modifying, etc., which is not limited here. The identification image is requested according to the identification image identifier (such as user name, nickname, ID number, etc.), which is equivalent to that the identification terminal requests the identification image corresponding to the identification image identifier from the subscription server.
[0125] For example, the identification terminal sends an image request to the subscription server according to the user ID number through the http protocol (other transmission protocols can also be used, which are not limited here), obtains the JPG format image file data corresponding to the user ID number, such as the user's face picture, and then calls the image feature parameter extraction method to obtain the image feature of the JPG format image file data, and determines the image feature as the first comparison information.
[0126] Taking the above operation method as an example, when the operation instruction is determined to be added, the identification terminal requests the data of the user from the subscription server according to the user ID, obtains the face picture of the user, then performs feature extraction on the face picture to obtain the image feature corresponding to the user ID, takes the image feature as the first comparison information, and generates an adding instruction, and adds the first comparison information to the comparison information library according to the adding instruction.
[0127] When the operation instruction is determined to be modification, the terminal identifies the user ID, requests data of the user from the subscription server, obtains a face picture of the user, extracts features of the face picture, obtains image features corresponding to the user ID, takes the image features as first comparison information, and generates a modification instruction. According to the modification instruction, the original comparison information of the user ID is modified to the first comparison information in the comparison information library.
[0128] When the operation instruction is determined to be deletion, the terminal generates a deletion instruction according to the user ID, and deletes the comparison information corresponding to the user ID in the comparison information library.
[0129] In an implementable manner, if the terminal identifies that the subscription task fails, a subscription failure indication is generated to indicate the subscription server to display the failure indication of the subscription task to the tester.
[0130] In the embodiment of the application, after the terminal identifies that the first comparison information fails to be configured, a subscription failure indication is sent to the subscription server, wherein the subscription failure indication includes a failure reason and a subscription task identifier, and the subscription task identifier is used to indicate the subscription server to regenerate the subscription task.
[0131] In an implementable manner, the terminal can serially process the subscription tasks, that is, one after another.
[0132] In the embodiment of the application, in order to improve the task completion efficiency, the terminal obtains the subscription tasks in batches in the subscription server, specifically, the terminal sets a thread pool, determines a loading thread from the thread pool, and extracts image features of the first identification image by executing the loading thread asynchronously. The batch is a preset number, such as 900, 1000, etc.
[0133] The terminal obtains the subscription tasks in batches in the subscription server, that is, the thread pool includes subscription tasks of multiple image feature parameter types, and the task of any image feature parameter type includes an identification image identifier, a subscription task identifier and an operation instruction on the identification image. Therefore, the terminal obtains the identification image identifier, the subscription task identifier and the operation instruction on the identification image corresponding to each subscription task of the image feature parameter type from the subscription server.
[0134] In order to better explain the above batch obtaining and executing of the subscription tasks, the following will be described in specific examples.
[0135] Example 2
[0136] Figure 5 An exemplary schematic diagram for determining comparison information is shown as follows: Figure 5As shown, the recognition terminal determines that the task type of the first subscription task is the image feature parameter type and the thread pool is in the non-executing state, and determines that the number of tasks in the subscription task list of the image feature parameter type in the subscription server is not 0, and then establishes a plurality of loading threads a1, …, an and b1, …, bn.
[0137] The loading threads a1, …, an are used to obtain the contents of the n subscription tasks through the subscription mechanism, and the contents of the subscription tasks include a subscription task identifier, a user ID and an operation instruction. The loading threads a1, …, an respectively request corresponding JPG format face file data in the subscription server through a transmission protocol according to the user ID of the subscription task, then perform image feature parameter extraction, obtain corresponding comparison information, and generate an operation instruction according to the comparison information, the user ID and the operation instruction, and finally perform configuration in the comparison information library according to the operation instruction.
[0138] The loading threads b1, …, bn are used to generate a subscription completion instruction according to the subscription task identifier after determining that the subscription task is completed, and then release the thread when completing the respective task for any loading thread ai or bi, so as to release the system resources of the recognition terminal. Wherein, i is a positive integer, and n≥i≥1.
[0139] Finally, the recognition terminal continues to obtain a preset number of unprocessed subscription tasks of the image feature parameter type from the subscription server after determining that all threads in the thread pool are released, until there is no uncompleted first subscription task in the subscription server.
[0140] Based on the same technical concept, Figure 6 An exemplary structure diagram of a device for loading comparison information based on image recognition provided by the embodiment of the application is shown, and the device can execute the flow.
[0141] As Figure 6 shown, the device specifically includes:
[0142] The obtaining module 610 is configured to obtain a first subscription task through a subscription mechanism.
[0143] The processing module 620 is configured to, when it is determined that the task type of the first subscription task is the image feature parameter type and the loading thread is in the non-executing state, obtain a first recognition image corresponding to the first subscription task.
[0144] The first comparison information is obtained by extracting the image feature of the first recognition image through the loading thread, and the first comparison information is configured to the comparison information library in the memory of the recognition terminal. The comparison information in the comparison information library is used by the recognition thread of the recognition terminal when performing image recognition.
[0145] Optionally, the processing module 620 is further configured to:
[0146] Before the loading of the image feature of the first identification image by the thread, it is determined that the identification thread is in an unexecuted state.
[0147] Optionally, the processing module 620 is further configured to:
[0148] If the task type of the first subscription task is determined to be a comparison threshold parameter type, the task content in the first subscription task is parsed to determine a comparison threshold parameter.
[0149] If the identification thread is determined to be in an unexecuted state, the comparison threshold parameter is loaded into the memory.
[0150] Optionally, the processing module 620 is specifically configured to:
[0151] The first subscription task is obtained from a subscription server through the subscription mechanism.
[0152] The first identification image corresponding to the first subscription task is obtained, including:
[0153] The identification image, the subscription task identifier, and the operation instruction on the identification image corresponding to each subscription task with a task type of an image feature parameter type are obtained from the subscription server.
[0154] Optionally, the processing module 620 is specifically configured to:
[0155] When the operation instruction is determined to be addition or modification, the corresponding identification image is obtained according to the identification image identifier.
[0156] The image feature of the identification image is determined to obtain first comparison information.
[0157] The first comparison information is configured to a comparison information library in the memory of the identification terminal according to the operation instruction.
[0158] Optionally, the processing module 620 is further configured to:
[0159] After the first comparison information is configured to the comparison information library in the memory of the identification terminal, a subscription completion instruction is sent to the subscription server; the subscription completion instruction includes a subscription task identifier.
[0160] Each subscription task with a task type of an image feature parameter type that is not processed is continuously obtained from the subscription server.
[0161] Optionally, the processing module 620 is further configured to:
[0162] After determining that the first comparison information configuration fails, a subscription failure indication is sent to the subscription server, wherein the subscription failure indication comprises a failure cause and a subscription task identifier; the subscription task identifier is used for the subscription server to regenerate a subscription task.
[0163] Optionally, the processing module 620 is specifically configured to:
[0164] A thread pool is set, and a loading thread is determined from the thread pool;
[0165] Image features of the first identification image are extracted by executing the loading thread asynchronously.
[0166] Based on the same technical concept, the embodiment of the present application further provides a computer device, comprising:
[0167] A memory is configured to store program instructions;
[0168] A processor is configured to invoke the program instructions stored in the memory, and execute the above-mentioned method for loading comparison information based on image identification according to obtained program execution.
[0169] Based on the same technical concept, the embodiment of the present application further provides a computer readable storage medium, wherein the computer readable storage medium stores computer executable instructions, and the computer executable instructions are used for making a computer execute the above-mentioned method for loading comparison information based on image identification.
[0170] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt a computer program product in the form of one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0171] The present application is described with reference to flowcharts and / or block diagrams according to the methods, devices (systems), and computer program products of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one flow or multiple flows and / or blocks Figure 1 The functions specified in one flow or multiple flows and / or blocks
[0172] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the Figure 1 function specified in the flow or flows and / or blocks Figure 1 of the block or blocks.
[0173] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions that are executed on the computer or other programmable apparatus provide steps for implementing the Figure 1 function specified in the flow or flows and / or blocks Figure 1 of the block or blocks.
[0174] Obviously, numerous modifications and variations of the present application are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described.
Claims
1. A method for loading contrast information based on image recognition, characterized in that, include: The identification terminal obtains the first subscription task through a subscription mechanism; When the recognition terminal determines that the task type of the first subscription task is an image feature parameter type and the loading thread is in an inactive state, it acquires the first recognition image corresponding to the first subscription task. The recognition terminal, through the loading thread, obtains the image features of the first recognition image based on the first recognition image and the image feature parameter extraction method, thereby obtaining the first comparison information of the first recognition image, and configures the first comparison information into the comparison information library in the memory of the recognition terminal; the comparison information in the comparison information library is used by the recognition thread of the recognition terminal when performing image recognition; The loading thread and the recognition thread are execution units of the same process, and they jointly use the image feature parameter extraction method in the process.
2. The method as described in claim 1, characterized in that, Before extracting image features from the first recognized image via the loading thread, the process also includes: The identification terminal determines that the identification thread is in an inactive state.
3. The method as described in claim 1, characterized in that, Also includes: The identification terminal determines that the task type of the first subscription task is the comparison threshold parameter type, parses the task content in the first subscription task, and determines the comparison threshold parameter; If the identification terminal determines that the identification thread is not in an executed state, it loads the comparison threshold parameter into the memory to change the comparison threshold parameter of the identification terminal.
4. The method as described in claim 1, characterized in that, The identification terminal obtains the first subscription task through a subscription mechanism, including: The identification terminal obtains the first subscription task from the subscription server through the subscription mechanism; The recognition terminal acquires the first recognition image corresponding to the first subscription task, including: The recognition terminal obtains from the subscription server the recognition image identifier, subscription task identifier, and operation instructions for the recognition image corresponding to each subscription task whose task type is image feature parameter type.
5. The method as described in claim 4, characterized in that, The recognition terminal extracts image features from the first recognition image through the loading thread to obtain first comparison information, and configures the first comparison information into the comparison information database in the memory of the recognition terminal, including: When the recognition terminal determines that the operation instruction is to add or modify, it obtains the corresponding recognition image based on the recognition image identifier. The recognition terminal determines the image features of the recognition image to obtain first comparison information; The identification terminal configures the first comparison information into the comparison information database in the memory of the identification terminal according to the operation instructions.
6. The method as described in claim 5, characterized in that, After configuring the first comparison information into the comparison information database in the memory of the recognition terminal, the method further includes: The identification terminal sends a subscription completion indication to the subscription server; the subscription completion indication includes a subscription task identifier. The identification terminal continues to obtain unprocessed subscription tasks of the image feature parameter type from the subscription server.
7. The method according to any one of claims 1 to 6, characterized in that, The recognition terminal extracts image features from the first recognition image through the loading thread, including: The identification terminal sets up a thread pool and determines the loading thread from the thread pool; The recognition terminal extracts image features from the first recognition image by asynchronously executing the loading thread.
8. A device for loading comparison information based on image recognition, characterized in that, include: The acquisition module is used to acquire the first subscription task through a subscription mechanism; The processing module is used to obtain the first recognition image corresponding to the first subscription task when it is determined that the task type of the first subscription task is an image feature parameter type and the loading thread is in an inactive state. The loading thread obtains the image features of the first recognized image based on the first recognized image and the image feature parameter extraction method, thereby obtaining the first comparison information of the first recognized image, and configuring the first comparison information into the comparison information library in the memory of the recognition terminal; the comparison information in the comparison information library is used by the recognition thread of the recognition terminal when performing image recognition; The loading thread and the recognition thread are execution units of the same process, and they jointly use the image feature parameter extraction method in the process.
9. A computer device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Information synchronization method and device, electronic equipment and storage medium
CN110460664A