Business processing method, device, electronic device and computer-readable storage medium
Through the business processing method of matching face data between a temporary database and a complete database, the problems of slow face recognition speed and low accuracy in the prior art are solved, and more efficient and accurate face retrieval results are achieved.
Patent Information
- Application Number
- CN202010496795.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-03
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2040-06-03
AI Technical Summary
The existing customer-on-site reminder solution has problems such as poor algorithm performance and slow retrieval speed during the face recognition process, especially when the number of faces increases, resulting in a decrease in recognition accuracy and real-time challenges.
A business processing method is adopted to obtain face data and match it in a preset temporary database. If the match is successful, the temporary database and the complete database are updated. If the match fails, the match is matched in the complete database to ensure the accuracy and efficiency of the search results.
By first performing face search in a temporary database updated in real-time, and then searching in a complete database including all face data when the search fails, the search efficiency and accuracy are significantly improved, and the problems of slow face recognition speed and low accuracy in the prior art are solved.
Smart Images

Figure CN111666443B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of big data technology. Specifically, this application relates to a service processing method, apparatus, electronic device, and computer-readable storage medium. Background Art
[0002] Artificial intelligence technology is currently widely used in the field of smart retail, including the promotion and implementation of applications in smart retail mall scenarios (such as customer arrival reminder solutions), empowering offline stores to create new retail.
[0003] Existing customer arrival reminder solutions include obtaining the face data of customers and then completing the arrival reminder service based on face recognition technology. However, existing arrival reminder solutions have the following disadvantages:
[0004] (1) Poor algorithm performance. During the face recognition process, as the number of faces increases, the accuracy of the face recognition algorithm will significantly decrease;
[0005] (2) Slow retrieval speed: During the face recognition process, as the number of faces increases, the recognition speed becomes slow, which will be a huge challenge for a service with high real-time requirements like reminder. Summary of the Invention
[0006] This application provides a service processing method, apparatus, electronic device, and computer-readable storage medium, which can solve the above problems. The technical solutions are as follows:
[0007] In a first aspect, a service processing method is provided, which includes:
[0008] Obtain a service processing request; the service processing request includes the face data of the object to be detected;
[0009] When the face data meets the preset detection conditions, match the face data based on a preset temporary database; the temporary database includes at least one face data obtained and stored within a preset time period;
[0010] If the match is successful, generate a first processing result of the service processing request, and update the temporary database and a preset complete database based on the face data; the complete database includes all face data obtained and stored;
[0011] If the match fails, match the face data based on the complete database to obtain a match result, generate a second processing result corresponding to the service processing request based on the match result, and update the complete database based on the face data.
[0012] Preferably, the face data includes at least one face image to be detected of the object to be detected collected;
[0013] The face data meets a preset detection condition, including:
[0014] Calculate the quality scores of all the face images to be detected, and compare all the quality scores with a first quality score threshold;
[0015] When the quality score of at least one face image exceeds the first quality score threshold, it is determined that the face data meets the preset detection condition;
[0016] Obtain each face image whose quality score exceeds the first quality score threshold, and use the face image with the highest quality score as the target face image to be detected.
[0017] Preferably, the service processing request further includes a service type; the temporary database includes at least one temporary sub-library, and each temporary sub-library has a corresponding service type;
[0018] The matching of the face data based on the preset temporary database includes:
[0019] Determine a target temporary sub-library from each temporary sub-library based on the service type, and match the target face image to be detected in the target temporary sub-library.
[0020] Preferably, each temporary sub-library includes at least one first identification information, each first identification information corresponds to a face data, and each face data includes at least one first historical face image;
[0021] The matching of the target face image to be detected in the target temporary sub-library includes:
[0022] Obtain the target face feature corresponding to the target face image to be detected;
[0023] Determine the first identification face feature corresponding to each first identification information based on each first historical face image corresponding to each first identification information;
[0024] Match the target face feature to be detected with each first identification face feature, use the first identification face feature with the highest matching degree as the first target identification face feature, and use the first identification information corresponding to the first target identification face feature as the target identification information;
[0025] Calculate the feature score of the first target identification face feature;
[0026] When the feature score of the first target identifying the face features exceeds the first feature score threshold, it is determined that the matching is successful.
[0027] Preferably, it further includes:
[0028] When the feature score of the first target face recognition feature does not exceed the first feature score threshold, it is determined that the matching fails;
[0029] Generate new identification information, establish the correspondence between the target face image to be detected and the new identification information, and use the new identification information as the target identification information.
[0030] Preferably, updating the temporary database and the complete database based on the face data includes:
[0031] When the quality score of the target face image to be detected exceeds the second quality score threshold, obtain the number of the first historical face images corresponding to the target identification information;
[0032] Update the temporary database and the complete database based on the number and the face data.
[0033] Preferably, the updating the temporary database and the complete database based on the number and the face data includes:
[0034] When the number is equal to 1, calculate the quality score of the first historical face image;
[0035] If the quality score does not exceed the third quality score threshold, replace the first historical face image in the target temporary sub - library with the target face image to be detected, and store the target face image to be detected in the complete database.
[0036] Preferably, the updating the temporary database and the complete database based on the number and the face data includes:
[0037] If the quality score exceeds the third quality score threshold, or the number is greater than 1, determine whether the score of the target face image to be detected exceeds the fourth quality score threshold;
[0038] If so, establish the correspondence between the target face image to be detected and the target identification information, store the target face image to be detected in the target temporary sub - library, and store the target face image to be detected in the complete database.
[0039] Preferably, the updating the temporary database and the complete database based on the number and the face data includes:
[0040] When the quantity is equal to 0, store the target face image to be detected in the target temporary sub-library and store the target face image to be detected in the complete database.
[0041] Preferably, the complete database includes at least one complete sub-library, and each complete sub-library has a corresponding business type;
[0042] Match the face data based on a preset complete database to obtain a matching result, including:
[0043] Determine a target complete sub-library from each of the complete sub-libraries based on the business type, and match the target face image to be detected in the target complete sub-library to obtain a matching result.
[0044] Preferably, each complete sub-library includes at least one second identification information, and each second identification information corresponds to at least one second historical face image;
[0045] Matching the target face image to be detected in the target complete sub-library includes:
[0046] Obtain new identification information and the target face image to be detected from the target temporary sub-library;
[0047] Determine the second identification face features corresponding to each second identification information based on each second historical face image corresponding to each second identification information;
[0048] Match the target face features to be detected with each second identification face feature, and use the second identification face feature with the highest matching degree as the second target identification face feature;
[0049] Calculate the feature score of the second target identification face feature;
[0050] When the feature score of the second target identification face feature exceeds the second feature score threshold, it is determined that the match is successful;
[0051] When the score of the second target face recognition feature does not exceed the third feature score threshold, it is determined that the match fails.
[0052] Preferably, generating the first processing result of the service processing request includes:
[0053] Generate a processing result that the object to be detected is a known object.
[0054] Preferably, generating the second processing result corresponding to the service processing request based on the matching result includes:
[0055] If it is determined that the match is successful, generate a processing result that the object to be detected is a known object;
[0056] If it is determined that the matching fails, a processing result is generated with the object to be detected as a new object.
[0057] Preferably, each face data has time information;
[0058] The method further includes:
[0059] Determining the face data to be deleted from the temporary database based on the time information of each face data;
[0060] Deleting the face data to be deleted from the temporary database.
[0061] Preferably, determining the face data to be deleted from the temporary database based on the time information of each face data includes:
[0062] Determining the stored time of each face data in the temporary database based on the time information of each face data;
[0063] Determining at least one face data to be deleted whose stored time exceeds the time threshold.
[0064] Preferably, determining the face data to be deleted from the temporary database based on the time information of each face data includes:
[0065] Randomly obtaining a preset number of face data from the temporary database at preset time intervals;
[0066] Determining the stored time of each obtained face data based on the time information of each face data;
[0067] Determining at least one face data to be deleted whose stored time exceeds the time threshold.
[0068] In a second aspect, a service processing device is provided, and the device includes:
[0069] An obtaining module, configured to obtain a service processing request; the service processing request includes face data of an object to be detected;
[0070] A matching module, configured to, when the face data meets a preset detection condition, match the face data based on a preset temporary database; the temporary database includes at least one face data obtained and stored within a preset time period;
[0071] A first processing module, configured to, if the matching is successful, generate a first processing result of the service processing request, and update the temporary database and a preset complete database based on the face data; the complete database includes all face data obtained and stored.
[0072] A second processing module, configured to, if the matching fails, perform matching on the face data based on the complete database to obtain a matching result, generate a second processing result corresponding to the service processing request based on the matching result, and update the complete database based on the face data.
[0073] Preferably, the face data includes at least one to-be-detected face image of a to-be-detected object collected;
[0074] The apparatus further includes a detection module, specifically configured to:
[0075] Calculate quality scores of all the to-be-detected face images, and compare all the quality scores with a first quality score threshold; when the quality score of at least one face image exceeds the first quality score threshold, determine that the face data meets a preset detection condition; obtain each face image whose quality score exceeds the first quality score threshold, and use the face image with the highest quality score as the target to-be-detected face image.
[0076] Preferably, the service processing request further includes a service type; the temporary database includes at least one temporary sub-library, and each temporary sub-library has a corresponding service type;
[0077] The matching module is specifically configured to:
[0078] Determine a target temporary sub-library from each temporary sub-library based on the service type, and perform matching on the target to-be-detected face image in the target temporary sub-library.
[0079] Preferably, each temporary sub-library includes at least one first identification information, each first identification information corresponds to a face data, and each face data includes at least one first historical face image;
[0080] The matching module includes:
[0081] A first acquisition sub-module, configured to acquire a target to-be-detected face feature corresponding to the target to-be-detected face image;
[0082] A first determination sub-module, configured to determine a first identification face feature corresponding to each first identification information based on each first historical face image corresponding to each first identification information;
[0083] A first matching sub-module, configured to match the target to-be-detected face feature with each first identification face feature, use the first identification face feature with the highest matching degree as the first target identification face feature, and use the first identification information corresponding to the first target identification face feature as the target identification information;
[0084] The first calculation sub-module is used to calculate the feature score of the first target identification face feature;
[0085] The first determination sub-module is used to determine that the matching is successful when the feature score of the first target identification face feature exceeds the first feature score threshold.
[0086] Preferably, the matching module further includes:
[0087] The first determination sub-module is further used to determine that the matching fails when the feature score of the first target face recognition feature does not exceed the first feature score threshold;
[0088] The generation sub-module is used to generate new identification information, establish the corresponding relationship between the target face image to be detected and the new identification information, and use the new identification information as the target identification information.
[0089] Preferably, the first processing module includes:
[0090] The second acquisition sub-module is used to acquire the number of the first historical face images corresponding to the target identification information when the quality score of the target face image to be detected exceeds the second quality score threshold;
[0091] The update sub-module is used to update the temporary database and the complete database based on the number and the face data.
[0092] Preferably, the update sub-module is specifically used for:
[0093] When the number is equal to 1, calculate the quality score of the first historical face image; if the quality score does not exceed the third quality score threshold, replace the first historical face image in the target temporary sub-library with the target face image to be detected, and store the target face image to be detected in the complete database.
[0094] Preferably, the update sub-module is specifically used for:
[0095] If the quality score exceeds the third quality score threshold, or the number is greater than 1, determine whether the score of the target face image to be detected exceeds the fourth quality score threshold; if so, establish the corresponding relationship between the target face image to be detected and the target identification information, store the target face image to be detected in the target temporary sub-library, and store the target face image to be detected in the complete database.
[0096] Preferably, the update sub-module is specifically used for:
[0097] When the quantity is equal to 0, store the target face image to be detected in the target temporary sub-library and store the target face image to be detected in the complete database.
[0098] Preferably, the complete database includes at least one complete sub-library, and each complete sub-library has a corresponding service type;
[0099] The second processing module is specifically used for:
[0100] Determine the target complete sub-library from each complete sub-library based on the service type, and match the target face image to be detected in the target complete sub-library to obtain a matching result.
[0101] Preferably, each complete sub-library includes at least one second identification information, and each second identification information corresponds to at least one second historical face image;
[0102] The second processing module includes:
[0103] A second acquisition sub-module, configured to acquire new identification information and the target face image to be detected from the target temporary sub-library;
[0104] A second determination sub-module, configured to determine the second identification face features corresponding to each second identification information based on each second historical face image corresponding to each second identification information;
[0105] A second matching sub-module, configured to match the target face features to be detected with each second identification face feature, and use the second identification face feature with the highest matching degree as the second target identification face feature;
[0106] A second calculation sub-module, configured to calculate the feature score of the second target identification face feature;
[0107] A second determination sub-module, configured to determine that the matching is successful when the feature score of the second target identification face feature exceeds the second feature score threshold; and determine that the matching fails when the score of the second target face recognition feature does not exceed the third feature score threshold.
[0108] Preferably, the first processing module is specifically used for:
[0109] Generate a processing result that the object to be detected is a known object.
[0110] Preferably, the second processing module is specifically used for:
[0111] If it is determined that the matching is successful, generate a processing result that the object to be detected is a known object;
[0112] If it is determined that the matching fails, generate a processing result that the object to be detected is a new object.
[0113] Preferably, each piece of face data has time information;
[0114] The device further includes:
[0115] A determination module, configured to determine, based on the time information of each piece of face data, the face data to be deleted from the temporary database;
[0116] A deletion module, configured to delete the face data to be deleted from the temporary database.
[0117] Preferably, the determination module includes:
[0118] A third calculation sub-module, configured to determine the stored time of each piece of face data in the temporary database based on the time information of each piece of face data;
[0119] A third determination sub-module, configured to determine at least one piece of face data to be deleted whose stored time exceeds the time threshold.
[0120] Preferably, the determination module includes:
[0121] A third acquisition sub-module, configured to randomly acquire a preset number of pieces of face data from the temporary database at preset time intervals;
[0122] A fourth calculation sub-module, configured to determine the stored time of each acquired piece of face data based on the time information of each piece of face data;
[0123] A fourth determination sub-module, configured to determine at least one piece of face data to be deleted whose stored time exceeds the time threshold.
[0124] In a third aspect, an electronic device is provided, and the electronic device includes:
[0125] A processor, a memory, and a bus;
[0126] The bus is used to connect the processor and the memory;
[0127] The memory is used to store operation instructions;
[0128] The processor is configured to execute, by calling the operation instructions, instructions to enable the processor to execute the operations corresponding to the service processing method shown in the first aspect of the present application.
[0129] In a fourth aspect, a computer-readable storage medium is provided, and a computer program is stored on the computer-readable storage medium. When the program is executed by a processor, the service processing method shown in the first aspect of the present application is implemented.
[0130] The beneficial effects brought by the technical solution provided in this application are as follows:
[0131] Obtain a service processing request; the service processing request includes face data of an object to be detected; when the face data meets a preset detection condition, match the face data based on a preset temporary database; the temporary database includes at least one face data obtained and stored within a preset time period; if the match is successful, generate a first processing result of the service processing request, and update the temporary database and a preset complete database based on the face data; the complete database includes all face data obtained and stored; if the match fails, match the face data based on the complete database to obtain a match result, generate a second processing result corresponding to the service processing request based on the match result, and update the complete database based on the face data. In this way, face retrieval is first performed based on the real-time updated temporary database, and when the retrieval fails, face retrieval is performed based on the complete database including all face data to obtain the final retrieval result. Compared with the prior art of directly performing retrieval based on a permanent archive, the scale of the temporary database in this application will be greatly reduced, which will greatly improve the efficiency and accuracy of retrieval, thereby improving the efficiency and accuracy of service processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0132] In order to more clearly illustrate the technical solutions in the embodiments of this application, the following will briefly introduce the drawings required for the description of the embodiments of this application.
[0133] Figure 1 System architecture diagram of service processing in this application;
[0134] Figure 2 Flow schematic diagram of a service processing method provided in an embodiment of this application;
[0135] Figure 3 Flow schematic diagram of a service processing method provided in another embodiment of this application;
[0136] Figure 4 Flow schematic diagram of retrieving the temporary database in this application;
[0137] Figure 5 Flow schematic diagram of retrieving the complete database in this application;
[0138] Figure 6 Flow schematic diagram of the management of the temporary database in this application;
[0139] Figure 7 Statistical effect diagram of this application applied to new and old customer reminders;
[0140] Figure 8-1Schematic structural diagram of a service processing device provided by another embodiment of the present application;
[0141] Figure 8-2 Schematic structural diagram of a service processing device provided by another embodiment of the present application;
[0142] Figure 9 Schematic structural diagram of an electronic device for service processing provided by another embodiment of the present application. Detailed implementation manners
[0143] The embodiments of the present application will be described in detail below. Examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary only for explaining the present application and should not be construed as limiting the present invention.
[0144] Those skilled in the art of the present technology can understand that, unless specifically stated otherwise, the singular forms "a", "an", "the", and "said" used herein may also include the plural forms. It should be further understood that the term "comprising" used in the specification of the present application means the presence of the described features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say that an element is "connected" or "coupled" to another element, it can be directly connected or coupled to other elements, or there may also be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The phrase "and / or" used herein includes all or any unit and all combinations of one or more of the associated listed items.
[0145] To make the objectives, technical solutions, and advantages of the present application clearer, the embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0146] First, several terms related to the present application will be introduced and explained:
[0147] Computer Vision Technology (CV) Computer vision is a science that studies how to enable machines to "see". More specifically, it refers to using cameras and computers to replace human eyes for tasks such as object recognition, tracking, and measurement in machine vision, and further performing image processing to make the computer-processed images more suitable for human eye observation or transmission to instrument detection. As a scientific discipline, computer vision researches related theories and technologies, attempting to build artificial intelligence systems that can obtain information from images or multi-dimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping, etc. It also includes common biometric recognition technologies such as face recognition and fingerprint recognition.
[0148] Based on the above technologies, this application can implement a business processing method, which can be specifically used for the business processing of face retrieval.
[0149] Face recognition refers to the process of extracting face features and performing similarity comparison. According to different application scenarios, face recognition is mainly divided into three categories: 1:1 face verification, 1:N face recognition, and face retrieval. Among them, 1:N face retrieval refers to finding one or more faces with the highest similarity to the face to be retrieved in a large-scale face database. The retrieval performance is related to the size of the database.
[0150] Reference Figure 1 , is the system architecture diagram of this application. The image acquisition device collects face data through the algorithm service, and then inputs the face data into the message queue. The face data preprocessing service consumes the face data from the message queue and performs CV processing on the face data through the CV microservice, including extracting the face features of the face image in the face data, calculating the quality score of the face image, and extracting user attributes. Then, the face data and the data after CV processing are cached in the Redis (Remote Dictionary Server) cluster (i.e., the temporary database), and the face data and the data after CV processing are persisted in the Mysql cluster (i.e., the complete database).
[0151] The business processing service first filters the face data based on the quality score of the face image, and then retrieves it based on the temporary database. If the retrieval is successful, it generates the corresponding business processing result and feedbacks it to the business requester, and updates the temporary database and the complete database based on the collected face data. If the retrieval fails, it retrieves based on the complete database, obtains the corresponding retrieval result, generates different business processing results based on different retrieval results and feedbacks them to the business requester, and then updates the temporary database and the complete database based on the collected face data.
[0152] Furthermore, a temporary database management strategy is also set in the business processing service to update the temporary database in real time, ensuring that the scale of the temporary database is controllable and the timeliness of the data.
[0153] This application can be applied to a server. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can interact with the terminal. The terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods, and this application does not make any restrictions here.
[0154] The business processing method, device, electronic device, and computer-readable storage medium provided by this application aim to solve the above technical problems in the prior art.
[0155] The following uses specific embodiments to elaborate in detail on the technical solution of this application and how the technical solution of this application solves the above technical problems. These several specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The following will describe the embodiments of this application with reference to the drawings.
[0156] In one embodiment, a business processing method is provided, as Figure 2 shown. This method includes:
[0157] Step S201, obtain a business processing request; the business processing request includes the face data of the object to be detected;
[0158] Among them, the service processing can be a reminder for the result of face retrieval. For example, personnel arrival reminder, security reminder, voice library detection, etc. The personnel arrival reminder can specifically include that a shopping mall or store needs to remind users entering the mall or store, which can be to remind whether the user is a new or old user, whether the user is a VIP user, or whether the user is on the blacklist (such as a thief), etc. In practical applications, it can be set according to actual needs, and the embodiments of the present invention do not limit this.
[0159] Specifically, the service processing request may include the face data of the object to be detected, that is, the face data of the user entering the shopping mall or store. The user's face data includes but is not limited to the user's movement trajectory, trajectory ID, at least one-level face image of the user collected, the collection time of each face image, the user's area information, etc.
[0160] Among them, the movement trajectory can be the movement trajectory of the user in each image acquisition device. The trajectory ID is an identifier for each movement trajectory, used to distinguish different movement trajectories. In practical applications, the form of the trajectory ID can be set according to actual needs, as long as it can distinguish different movement trajectories, it is applicable to the embodiments of the present invention, and the embodiments of the present invention do not limit this.
[0161] The user's area information is used to represent the position of the user in the shopping mall or store. Since there is more than one image acquisition device in the shopping mall or store, each image acquisition device is responsible for an area. In this way, by collecting the user's face data from different image acquisition devices, the user's area information can be determined.
[0162] Step S202, when the face data meets the preset detection conditions, match the face data based on the preset temporary database; the temporary database includes at least one face data obtained and stored within a preset time period;
[0163] Before retrieving based on the face data, it can be first determined whether the face data meets the preset detection conditions, mainly by determining whether the quality score of the face image in the face data exceeds the quality score threshold. Among them, the quality score of the face image can be calculated based on factors such as light, distance, and clarity; if it does not exceed, then the retrieval of the face image can be abandoned; if it exceeds, then the face image in the face data can be matched based on the preset temporary database. Among them, the temporary database stores the face data of at least one user collected by the image acquisition device, and moreover, the storage time of each face data in the temporary database cannot exceed the preset time threshold, that is, the face data is temporarily stored in the temporary database, thereby realizing real-time update of the face data in the temporary database.
[0164] Step S203, if the match is successful, generate a first processing result of the service processing request, and update the temporary database and the preset complete database based on the face data; the complete database includes all the face data obtained and stored.
[0165] When the face data matches successfully based on the temporary database, that is, when the target face image to be detected matches the target temporary sub-library, it means that the user has appeared within the time threshold period, and the face data of the user has been collected and stored in the temporary database. At this time, a first processing result of the service request can be generated, and the temporary database and the preset complete database can be updated based on the currently collected face data. Among them, the complete database includes all the face data that has been obtained and stored. That is to say, the face data in the temporary database is part of the data in the complete database.
[0166] Step S204, if the match fails, match the face data based on the complete database to obtain a match result, generate a second processing result corresponding to the service processing request based on the match result, and update the complete database based on the face data.
[0167] When the collected face data fails to match the temporary database, specifically, when the target face image to be detected in the face data fails to match the target temporary sub-library, the face data can be matched based on the complete database to obtain a match result of success or failure, and different second processing results corresponding to the service processing request can be generated based on different match results, and then the complete database can be updated using the face data.
[0168] In the embodiment of the present invention, a service processing request is obtained; the service processing request includes the face data of the object to be detected; when the face data meets the preset detection conditions, the face data is matched based on the preset temporary database; the temporary database includes at least one face data obtained and stored within a preset time period; if the match is successful, generate a first processing result of the service processing request, and update the temporary database and the preset complete database based on the face data; the complete database includes all the face data obtained and stored; if the match fails, match the face data based on the complete database to obtain a match result, generate a second processing result corresponding to the service processing request based on the match result, and update the complete database based on the face data. In this way, face retrieval is first performed based on the temporarily updated database, and when the retrieval fails, face retrieval is performed based on the complete data including all face data to obtain the final retrieval result. Compared with the prior art method of directly performing retrieval based on the permanent archive, the scale of the temporary database in this application will be greatly reduced, which will greatly improve the efficiency and accuracy of retrieval, thereby improving the efficiency and accuracy of service processing.
[0169] In another embodiment, a service processing method is provided. As Figure 3 shown, the method includes:
[0170] Step S301, obtaining a service processing request; the service processing request includes the face data of the object to be detected.
[0171] Among them, the service processing can be to remind of the result of face retrieval. For example, personnel arrival reminder, security reminder, voice library detection, etc. The personnel arrival reminder can specifically include that a shopping mall or store needs to remind users entering the shopping mall or store, which can be to remind whether the user is a new or old user, whether the user is a VIP user, or whether the user is a blacklist user (such as a thief), etc. In practical applications, it can be set according to actual needs, and the embodiments of the present invention do not limit this. For the convenience of description, the embodiments of the present invention will take reminding the user as a new or old user as an example for detailed description.
[0172] Specifically, the service processing request may include the face data of the object to be detected, that is, the face data of the user entering the shopping mall or store. The face data of the user includes but is not limited to the running track of the user, the track ID, at least one-level face image of the user collected, the collection time of each face image, the regional information of the user, etc.
[0173] Among them, the running track can be the movement track of the user in each image acquisition device. For example, a certain user appears in the image acquisition area of a certain image acquisition device at 20:08:35 and leaves the image acquisition area at 20:09:12. Then, during the period from 20:08:35 to 20:09:12, the image acquisition device can collect the movement track of the user and generate a corresponding track ID. The track ID is the identifier of each movement track and is used to distinguish different movement tracks. In practical applications, the form of the track ID can be set according to actual needs, as long as it can distinguish different movement tracks, it is applicable to the embodiments of the present invention, and the embodiments of the present invention do not limit this.
[0174] In practical applications, if there is a trajectory with a long stay in the motion trajectory, then the staying trajectory can be deleted from the motion trajectory. For example, a certain user appears in the image acquisition area of an image acquisition device at 20:08:35, sits still in the image acquisition area at 20:08:50, starts moving until 20:15:47, and leaves the image acquisition area at 20:16:03. Then the time interval of the collected motion trajectory is 20:08:35 - 20:16:03. Since the user is in a static state from 20:08:50 to 20:15:47, the motion trajectory during this period can be deleted. Therefore, the time intervals of the user's motion trajectory obtained are 20:08:35 - 20:08:50 and 20:15:47 - 20:16:03, and then the corresponding trajectory IDs are generated.
[0175] The regional information of the user is used to represent the position of the user in a mall or a store. Since there is more than one image acquisition device in the mall or the store, each image acquisition device is responsible for a region. In this way, by collecting the face data of the user by different image acquisition devices, the regional information of the user can be determined.
[0176] Step S302, when the face data meets the preset detection conditions, match the face data based on the preset temporary database; the temporary database includes at least one face data obtained and stored within a preset time period;
[0177] Before retrieving based on the face data, it can be first determined whether the face data meets the preset detection conditions. Mainly, it is determined whether the quality score of the face image in the face data exceeds the quality score threshold. If it does not exceed, then the retrieval of the face image can be abandoned; if it exceeds, then the face image in the face data can be matched based on the preset temporary database. Among them, the temporary database stores the face data of at least one user collected by the image acquisition device, and moreover, the storage time of each face data in the temporary database cannot exceed the preset time threshold, that is, the face data is temporarily stored in the temporary database, thereby realizing the real-time update of the face data in the temporary database.
[0178] In a preferred embodiment of the present invention, the face data includes at least one face image of the object to be detected collected;
[0179] The face data meets the preset detection conditions, including:
[0180] Calculate the quality scores of all the face images to be detected, and compare all the quality scores with the first quality score threshold;
[0181] When the quality score of at least one face image exceeds the first quality score threshold, it is determined that the face data meets the preset detection conditions;
[0182] Obtain each face image whose quality score exceeds the first quality score threshold, and use the face image with the highest quality score as the target face image to be detected.
[0183] In practical applications, for the face images in the collected face data, CV processing can be performed, including but not limited to extracting face features of the face image, calculating the quality score of the face image, extracting user attributes, etc. Among them, face features can be extracted based on face recognition, the quality score of the face image can be calculated based on factors such as light, distance, clarity, etc., and user attributes include but not limited to the user's age, gender, height, body type, etc. Then cache the face data and the data after CV processing in memory. For example, a Redis cluster can be set up in memory to store the face data and the processed data, and sort each data based on the trajectory ID and the collection time, such as: "trace 1-time 1", "trace2-time 2", etc.
[0184] Furthermore, the business processing system can continuously read data from the Redis cluster and perform business processing. Specifically, since any image acquisition device may collect more than one face image when collecting the user's face image, it is necessary to calculate the quality score of each collected face image, and then compare the quality score of each face image with the first quality score threshold. If the quality score of at least one face image exceeds the first quality score threshold, then it can be determined that the face data meets the preset detection conditions. At the same time, obtain all face images whose quality score exceeds the first quality score threshold, and then determine the face image with the highest quality score from all face images as the target face image to be detected.
[0185] Of course, in practical applications, it is also possible to first determine the face image with the highest quality score, and then compare the quality score of this face image with the first quality score threshold. If it exceeds, it is determined that the face data meets the preset detection conditions, and this face image is used as the target face image to be detected; if it does not exceed, the process ends. In practical applications, it can be set according to actual needs, and the embodiments of the present invention do not limit this.
[0186] In a preferred embodiment of the present invention, the business processing request further includes a business type; the temporary database includes at least one temporary sub-library, and each temporary sub-library has a corresponding business type;
[0187] Matching the face data based on the preset temporary database includes:
[0188] Determine a target temporary sub - library from each temporary sub - library based on the service type, and match the target face image to be detected in the target temporary sub - library.
[0189] Since the embodiments of the present invention can perform face retrieval on users entering a mall or a store, and then determine whether the user is a new user, an old user, etc., in addition to the face data of the user, the service request processing also needs to include the service type, that is, generate a reminder corresponding to the service type for the retrieval result.
[0190] Therefore, in order to improve the retrieval efficiency, the embodiments of the present invention can set multiple temporary sub - libraries in the temporary database, and each temporary sub - library corresponds to a service type. For example, the reminder for new and old customers corresponds to the new and old customer temporary sub - library, the reminder for black - listed customers corresponds to the black - list temporary sub - library, the reminder for VIP customers corresponds to the VIP temporary sub - library, etc. In this way, when retrieving face data, the target temporary sub - library to be used can be determined from each temporary sub - library based on the service type, and then the target face image to be detected is matched in the target complete sub - library to obtain a matching result, thereby improving the retrieval efficiency.
[0191] In a preferred embodiment of the present invention, each temporary sub - library includes at least one first identification information, each first identification information corresponds to a face data, and each face data includes at least one first historical face image;
[0192] Matching the target face image to be detected in the target temporary sub - library includes:
[0193] Obtain the target face feature corresponding to the target face image to be detected;
[0194] Based on each first historical face image corresponding to each first identification information, determine the first identification face feature corresponding to each first identification information;
[0195] Match the target face feature to be detected with each first identification face feature, take the first identification face feature with the highest matching degree as the first target identification face feature, and take the first identification information corresponding to the first target identification face feature as the target identification information;
[0196] Calculate the feature score of the first target identification face feature;
[0197] When the feature score of the first target identification face feature exceeds the first feature score threshold, it is determined that the match is successful.
[0198] Since the face data collected by the image acquisition device and the data after CV processing of the face image will update the temporary database, the first identification information in each temporary sub-library can also be a trajectory ID. Each trajectory ID corresponds to a face data, and each face data includes at least one historical face image. Here, the historical face image is the face image stored in the temporary sub-library after business processing of the previously collected face data. Of course, in addition to corresponding to a face data, each trajectory ID in the temporary sub-library also corresponds to the data after CV processing of the face image in the face data.
[0199] After determining the target temporary sub-library, the target face image to be detected can be matched based on the target temporary sub-library.
[0200] Specifically, first obtain the target face feature corresponding to the target face image to be detected. Since the previously collected face images have been subjected to CV processing, it can be directly obtained from the cache.
[0201] Then, based on each first historical face image corresponding to each first identification information, determine the first identification face feature corresponding to each first identification information. Specifically, for any first identification information, calculate the historical face feature corresponding to each historical face image it corresponds to, and then calculate the average historical face feature based on each historical face feature, and use the average historical face feature as the first identification face feature corresponding to the first identification information. For example, if a certain trajectory ID in the target temporary sub-library includes 100 historical face images, then first calculate the historical face feature corresponding to each of the 100 historical face images respectively, and then calculate the average historical face feature based on the 100 historical face features, and use the average historical face feature as the identification face feature corresponding to the trajectory ID. And so on, so as to obtain the first identification face feature corresponding to each first identification information in the target temporary sub-library. Of course, in practical applications, if the number of historical face images is large, it can also be set to calculate the average historical face feature through a certain number of historical face images, which can be set according to actual needs in practical applications, and the embodiments of the present invention do not limit this.
[0202] Match the target face feature to be detected with each first identification face feature, use the first identification face feature with the highest matching degree as the first target identification face feature, and use the first identification information corresponding to the first target identification face feature as the target identification information. For example, after matching the target face feature a to be detected with each first identification face feature, determine that the first identification face feature A with the highest matching degree, then use A as the first target identification face feature, and use the trajectory ID corresponding to A as the target identification information.
[0203] Calculate the feature score of the first target identification face feature. When the feature score of the first target identification face feature exceeds the first feature score threshold, it is determined that the matching is successful. That is to say, if the calculated feature score of the first target identification face feature exceeds the first feature score threshold, it can be determined that the matching is successful, that is, the target face feature to be detected and the first target identification face feature belong to the same identification information, and the object to be detected is a known object.
[0204] Further, when the feature score of the first target face recognition feature does not exceed the first feature score threshold, it is determined that the matching fails;
[0205] Generate new identification information, establish the correspondence between the target face image to be detected and the new identification information, and use the new identification information as the target identification information.
[0206] If the calculated feature score of the first target identification face feature does not exceed the first feature score threshold, it can be determined that the matching fails, that is, the target face feature to be detected and the first target identification face feature do not belong to the same identification information temporarily. This is because the data in the temporary database is updated in real time, and the storage time of each face data in the temporary database cannot exceed the preset time threshold. Therefore, it is possible that the matched first target identification face feature has been deleted from the temporary database.
[0207] For example, the time threshold set for the temporary database is 1 hour. When a certain user enters the mall at 20:00:00, the face data of the user is collected and stored in the temporary database. The user leaves the mall at 20:50:00, and the face data of the user is deleted from the temporary database at 21:00:00. When the user enters the mall again at 21:01:00 and the face data of the user is collected again, the matching of the face data through the temporary database will fail.
[0208] When it is determined that the matching fails, new identification information can be generated, establish the correspondence between the target face image to be detected and the new identification information, and use the new identification information as the target identification information.
[0209] Step S303, if the matching is successful, generate the first processing result of the service processing request, and update the temporary database and the preset complete database based on the face data; the complete database includes all the face data obtained and stored;
[0210] When the face data matching is successful based on the temporary database, that is, when the target face image to be detected matches the target temporary sub-library, it means that the user has appeared within the time period of the time threshold, and the face data of the user has been collected and stored in the temporary database. At this time, the first processing result of the service request can be generated, and the temporary database and the preset complete database can be updated based on the currently collected face data; where the complete database includes all the face data that has been obtained and stored, that is to say, the face data in the temporary database is part of the data in the complete database.
[0211] Among them, generating the first processing result of the service processing request includes:
[0212] Generate the processing result that the object to be detected is a known object.
[0213] Specifically, the generated first processing result can be whether the object to be detected belongs to the service type in the service request. For example, if the service request is a reminder for old customers, then the first processing result can be to generate a reminder for the user as an old customer and send the reminder to the requester of the service processing, such as a terminal in a store.
[0214] Furthermore, after determining that the object to be detected is a known object, since the face data of the user is collected again currently, the temporary database and the complete database can be updated based on the preset policy.
[0215] In a preferred embodiment of the present invention, updating the temporary database and the complete database based on the face data includes:
[0216] When the quality score of the target face image to be detected exceeds the second quality score threshold, obtain the number of the first historical face images corresponding to the target identification information;
[0217] Update the temporary database and the complete database based on the number and the face data.
[0218] Specifically, determine whether the quality score of the target face image to be detected exceeds the second quality score threshold. If so, determine the target identification information corresponding to the target face image to be detected, and obtain the number of all the first historical face images corresponding to the target identification information. Different numbers correspond to different update policies; if not, end the process.
[0219] In a preferred embodiment of the present invention, updating the temporary database and the complete database based on the number and the face data includes:
[0220] When the number is equal to 1, calculate the quality score of the first historical face image;
[0221] If the quality score does not exceed the third quality score threshold, replace the first historical face image in the target temporary sub-library with the target face image to be detected, and store the target face image to be detected in the complete database.
[0222] Specifically, when the number of all the first historical face images corresponding to the target identification information is equal to 1, calculate the quality score of this first historical face image. If its quality score does not exceed the third quality score threshold, replace this first historical face image in the target temporary sub-library with the target face image to be detected, and at the same time store the target face image to be detected in the complete database. That is to say, if there is only one historical face image of this user in the target temporary sub-library, and the quality score of this historical face image does not exceed the third quality score threshold, then replace this historical face image in the target temporary sub-library with the currently captured target face image to be detected, and at the same time store the target face image to be detected in the complete database.
[0223] In a preferred embodiment of the present invention, updating the temporary database and the complete database based on the quantity and face data includes:
[0224] If the quality score exceeds the third quality score threshold, or the quantity is greater than 1, then determine whether the score of the target face image to be detected exceeds the fourth quality score threshold;
[0225] If so, establish the corresponding relationship between the target face image to be detected and the target identification information, store the target face image to be detected in the target temporary sub-library, and store the target face image to be detected in the complete database.
[0226] Specifically, when the quality score of this historical face image in the target temporary sub-library exceeds the third quality score threshold, or the number of all the first historical face images corresponding to the target identification information is greater than 1, further determine whether the score of the target face image to be detected exceeds the fourth quality score threshold. If any one of the two conditions is satisfied, then establish the corresponding relationship between the target face image to be detected and the target identification information, and store the currently captured target face image to be detected in the target temporary sub-library, and at the same time store the target face image to be detected in the complete database. That is to say, when there is only one historical face image of this user in the target temporary sub-library, and the quality score of this historical face image exceeds the third quality score threshold, or there are at least two historical face images of this user in the target temporary sub-library, then further determine whether the score of the currently captured target face image to be detected exceeds the fourth quality score threshold. If so, store the target face image to be detected in the target temporary sub-library as the historical face image of this user, and at the same time store the target face image to be detected in the complete database.
[0227] In a preferred embodiment of the present invention, the temporary database and the complete database are updated based on the quantity and the face data, including:
[0228] When the quantity is equal to 0, the target face image to be detected is stored in the target temporary sub-library, and the target face image to be detected is stored in the complete database.
[0229] Specifically, since new identification information is generated when the matching fails, the new identification information has no historical face images. That is, when the quantity of the first historical face images in the target temporary sub-library is equal to 0, the target face image to be detected is first stored in the temporary database for further retrieval of the target face image to be detected through the complete database, and then the target face image to be detected is stored in the complete database according to the retrieval result.
[0230] Further, referring to Figure 4 , it is the retrieval process based on the temporary database in this application. The specific retrieval steps can refer to step S303 and will not be elaborated here.
[0231] Step S304, if the matching fails, then match the face data based on the complete database to obtain a matching result, generate a second processing result corresponding to the service processing request based on the matching result, and update the complete database based on the face data;
[0232] When the face data collected fails to match the temporary database, specifically, when the target face image to be detected in the face data fails to match the target temporary sub-library, the face data can be matched based on the complete database to obtain a matching result of success or failure, and different second processing results corresponding to the service processing request are generated based on different matching results, and then the complete database is updated with the face data.
[0233] Among them, generating a second processing result corresponding to the service processing request based on the matching result includes:
[0234] If it is determined that the matching is successful, a processing result that the object to be detected is a known object is generated;
[0235] If it is determined that the matching fails, a processing result that the object to be detected is a new object is generated.
[0236] Specifically, the generated second processing result may be whether the object to be detected belongs to the service type in the service request. If the target face image to be detected matches the complete database successfully, a processing result that the object to be detected is a known object in the service type is generated; if the target face image to be detected fails to match the complete database, a processing result that the object to be detected is a new object in the service type is generated. For example, if the service request is a reminder for new and old customers, the second processing result may be to generate a reminder that the user is an old customer or a new customer and send the reminder to the requester of the service processing, such as a terminal in a store.
[0237] In a preferred embodiment of the present invention, the complete database includes at least one complete sub-library, and each complete sub-library has a corresponding service type;
[0238] Matching the face data based on the preset complete database to obtain a matching result, including:
[0239] Determine the target complete sub-library from each complete sub-library based on the service type, and match the target face image to be detected in the target complete sub-library to obtain a matching result.
[0240] To improve the retrieval efficiency, embodiments of the present invention may set multiple complete sub-libraries in the complete database, and each complete sub-library corresponds to a service type. For example, the reminder for new and old customers corresponds to the complete sub-library of new and old customers, the reminder for blacklist customers corresponds to the complete sub-library of blacklists, the reminder for VIP customers corresponds to the complete sub-library of VIPs, and so on. In this way, when retrieving face data, the target complete sub-library to be used can be determined from each complete sub-library based on the service type, and then the target face image to be detected is matched in the target complete sub-library to obtain a matching result, thereby improving the retrieval efficiency.
[0241] In a preferred embodiment of the present invention, each complete sub-library includes at least one second identification information, and each second identification information corresponds to at least one second historical face image;
[0242] Matching the target face image to be detected in the target complete sub-library includes:
[0243] Obtain new identification information and the target face image to be detected from the target temporary sub-library;
[0244] Determine the second identification face features corresponding to each second identification information based on each second historical face image corresponding to each second identification information;
[0245] Match the target face features to be detected with each second identification face feature, and use the second identification face feature with the highest matching degree as the second target identification face feature;
[0246] Calculate the feature score of the second target-identified face feature;
[0247] When the feature score of the second target-identified face feature exceeds the second feature score threshold, it is determined that the match is successful;
[0248] When the score of the second target face recognition feature does not exceed the third feature score threshold, it is determined that the match fails.
[0249] In the embodiments of the present invention, the data stored in the temporary database is a part of the data stored in the complete database. Therefore, the form of the data stored in the temporary database is the same as that of the data stored in the complete database. That is to say, the second identification information in each complete sub-library can also be a trajectory ID. Each trajectory ID corresponds to a face data, and each face data includes at least one historical face image. Among them, the historical face image is the face image stored in the complete sub-library after business processing of the previously collected face data. Of course, in addition to corresponding to a face data, each trajectory ID in the complete sub-library also corresponds to the data obtained after CV processing of the face images in the face data.
[0250] After determining the target complete sub-library, the target face image to be detected can be matched based on the target complete sub-library.
[0251] Specifically, first obtain the new identification information from the target temporary sub-library, and the target face image to be detected corresponding to the new identification information. Then, based on each second historical face image corresponding to each second identification information in the target complete sub-library, determine the second identification face feature corresponding to each second identification information. Specifically, for any second identification information, calculate the historical face feature corresponding to each historical face image it corresponds to, then calculate the average historical face feature based on the various historical face features, and use the average historical face feature as the second identification face feature corresponding to the second identification information. And so on, so as to obtain the second identification face feature corresponding to each second identification information in the target complete sub-library. Of course, in practical applications, if the number of historical face images is large, it can also be set to determine the average historical face feature through a certain number of historical face images, which can be set according to actual needs in practical applications, and the embodiments of the present invention do not limit this.
[0252] Then, calculate the feature score of the second target identified face feature. When the feature score of the second target identified face feature exceeds the second feature score threshold, it is determined that the matching is successful; when the feature score of the second target identified face feature does not exceed the third feature score threshold, it is determined that the matching fails; when the feature score of the second target identified face feature is between the second feature score threshold and the third feature score threshold, the process ends. That is to say, if the calculated feature score of the second target identified face feature exceeds the second feature score threshold, it can be determined that the matching is successful, that is, the target face feature to be detected and the second target identified face feature belong to the same identification information, and the object to be detected is a known object; if the calculated feature score of the second target identified face feature does not exceed the third feature score threshold, it can be determined that the matching fails, that is, the target face feature to be detected and the second target identified face feature do not belong to the same identification information, and the object to be detected is a new object.
[0253] Further, if the object to be detected is a known object, then the face data of the object to be detected and the data after CV processing can be stored in the complete database, and the corresponding relationship between them and the identification information corresponding to the second target identified face feature is established; if the object to be detected is a new object, then the new identification information and the corresponding face data and the data after CV processing can be stored in the complete database.
[0254] Furthermore, referring to Figure 5 , it is the retrieval process based on the complete database in this application. The specific retrieval steps can refer to step S304, which will not be elaborated here.
[0255] Step S305, determine the face data to be deleted from the temporary database based on the time information of each face data;
[0256] Since the data in the temporary database needs to be continuously updated in real time, the face data to be deleted in the temporary database can be determined based on the time information of the face data. Among them, the time information of the face data can be the time when the face image is collected in the face data, or the generation time of the identification information.
[0257] Further, the face data to be deleted can be all the face data corresponding to the identification information and the data after CV processing. In this case, the time information of the face data can be the generation time of the identification information corresponding to the face data in the temporary database; it can also be the historical face images in the face data and the data after CV processing corresponding to the historical face images. In this case, the time information of the face data can be the collection time of each historical face image in the face data. In practical applications, it can be set according to actual needs, and the embodiments of the present invention do not limit this.
[0258] In a preferred embodiment of the present invention, determining the face data to be deleted from the temporary database based on the time information of each face data includes:
[0259] Determining the stored time of each face data in the temporary database based on the time information of each face data;
[0260] Determining at least one face data to be deleted whose stored time exceeds the time threshold.
[0261] Specifically, each time a business processing request triggers a face retrieval using the temporary database, after completing the current face retrieval, the stored time of each face data in the temporary database will be determined based on the time information of each face data, and then at least one face data whose stored time exceeds the time threshold will be used as the data to be deleted.
[0262] In a preferred embodiment of the present invention, determining the face data to be deleted from the temporary database based on the time information of each face data includes:
[0263] Randomly obtaining a preset number of face data from the temporary database at preset time intervals;
[0264] Determining the stored time of each obtained face data based on the time information of each face data;
[0265] Determining at least one face data to be deleted whose stored time exceeds the time threshold.
[0266] Specifically, a certain number of face data are randomly obtained from the temporary database at preset time intervals, then the stored time of each face data in the temporary database is determined based on the time information of the obtained face data, and then at least one face data whose stored time exceeds the time threshold is used as the data to be deleted. For example, 100 face data are randomly obtained from the temporary database every hour, then the stored time of these 100 face data is determined, and by comparison, it is determined that the stored time of 52 of these face data exceeds the time threshold, then these 52 face data are the data to be deleted.
[0267] It should be noted that before determining the face data to be deleted, if there are other business processing requests, then other business processing requests will be preferably processed. After all business processing requests are completely processed, the face data to be deleted can be determined.
[0268] Step S306, deleting the face data to be deleted from the temporary database.
[0269] After determining the face data to be deleted, the face data to be deleted can be deleted from the temporary database.
[0270] Further, referring to Figure 6 , it is the update process of the temporary database in this application. The specific update steps can refer to step S305 to step S306, which will not be elaborated here.
[0271] Furthermore, when the embodiments of the present invention are applied to the reminder of new and old customers, the daily statistical chart of new and old customers can be as Figure 7 shown.
[0272] In the embodiments of the present invention, a business processing request is obtained; the business processing request includes face data of an object to be detected; when the face data meets a preset detection condition, the face data is matched based on a preset temporary database; the temporary database includes at least one face data obtained and stored within a preset time period; if the match is successful, a first processing result of the business processing request is generated, and the temporary database and a preset complete database are updated based on the face data; the complete database includes all face data obtained and stored; if the match fails, the face data is matched based on the complete database to obtain a match result, and a second processing result corresponding to the business processing request is generated based on the match result, and the complete database is updated based on the face data. In this way, face retrieval is first performed based on the temporarily updated database in real time, and when the retrieval fails, face retrieval is performed based on the complete database including all face data to obtain the final retrieval result. Compared with the prior art method of directly performing retrieval based on a permanent archive, the scale of the temporary database in this application will be greatly reduced, which will greatly improve the efficiency and accuracy of retrieval, thereby improving the efficiency and accuracy of business processing.
[0273] Further, the temporary database is updated in real time through a preset update strategy, which ensures that the scale of the temporary database is controllable and the data is the latest, so that when retrieving based on the temporary database, the retrieval is based on the latest data, thus ensuring the latest retrieval result; at the same time, the controllable scale of the temporary database also ensures that the temporary database does not need to occupy too much hardware resources and reduces the consumption of hardware resources.
[0274] Figure 8-1 It is a schematic structural diagram of a business processing device provided by another embodiment of this application, as Figure 8-1 shown. The device of this embodiment may include:
[0275] An obtaining module 801, configured to obtain a business processing request; the business processing request includes face data of an object to be detected;
[0276] A matching module 802, configured to match face data based on a preset temporary database when the face data meets a preset detection condition; the temporary database includes at least one piece of face data acquired and stored within a preset time period;
[0277] A first processing module 803, configured to, if the matching is successful, generate a first processing result of a service processing request, and update the temporary database and a preset complete database based on the face data; the complete database includes all face data acquired and stored;
[0278] A second processing module 804, configured to, if the matching fails, match the face data based on the complete database to obtain a matching result, generate a second processing result corresponding to the service processing request based on the matching result, and update the complete database based on the face data.
[0279] In a preferred embodiment of the present invention, the face data includes at least one to-be-detected face image of a to-be-detected object acquired;
[0280] The apparatus further includes a detection module, specifically configured to:
[0281] Calculate quality scores of all to-be-detected face images, and compare all the quality scores with a first quality score threshold; when the quality score of at least one face image exceeds the first quality score threshold, determine that the face data meets the preset detection condition; acquire each face image whose quality score exceeds the first quality score threshold, and use the face image with the highest quality score as the target to-be-detected face image.
[0282] In a preferred embodiment of the present invention, the service processing request further includes a service type; the temporary database includes at least one temporary sub-library, and each temporary sub-library has a corresponding service type;
[0283] The matching module is specifically configured to:
[0284] Determine a target temporary sub-library from each temporary sub-library based on the service type, and match the target to-be-detected face image in the target temporary sub-library.
[0285] In a preferred embodiment of the present invention, each temporary sub-library includes at least one first identification information, each first identification information corresponds to a piece of face data, and each piece of face data includes at least one first historical face image;
[0286] The matching module includes:
[0287] A first acquisition sub-module, configured to acquire a target to-be-detected face feature corresponding to the target to-be-detected face image;
[0288] The first determination sub-module is used to determine the first identification face features corresponding to each first identification information based on each first historical face image corresponding to each first identification information;
[0289] The first matching sub-module is used to match the target face feature to be detected with each first identification face feature, take the first identification face feature with the highest matching degree as the first target identification face feature, and take the first identification information corresponding to the first target identification face feature as the target identification information;
[0290] The first calculation sub-module is used to calculate the feature score of the first target identification face feature;
[0291] The first determination sub-module is used to determine that the matching is successful when the feature score of the first target identification face feature exceeds the first feature score threshold.
[0292] In a preferred embodiment of the present invention, the matching module further includes:
[0293] The first determination sub-module is further used to determine that the matching fails when the feature score of the first target face recognition feature does not exceed the first feature score threshold;
[0294] The generation sub-module is used to generate new identification information, establish the correspondence between the target face image to be detected and the new identification information, and take the new identification information as the target identification information.
[0295] In a preferred embodiment of the present invention, the first processing module includes:
[0296] The second acquisition sub-module is used to acquire the number of first historical face images corresponding to the target identification information when the quality score of the target face image to be detected exceeds the second quality score threshold;
[0297] The update sub-module is used to update the temporary database and the complete database based on the quantity and the face data.
[0298] In a preferred embodiment of the present invention, the update sub-module is specifically used for:
[0299] When the quantity is equal to 1, calculate the quality score of the first historical face image; if the quality score does not exceed the third quality score threshold, replace the first historical face image in the target temporary sub-library with the target face image to be detected, and store the target face image to be detected in the complete database.
[0300] In a preferred embodiment of the present invention, the update sub-module is specifically used for:
[0301] If the quality score exceeds the third quality score threshold or the quantity is greater than 1, determine whether the score of the target face image to be detected exceeds the fourth quality score threshold; if so, establish the corresponding relationship between the target face image to be detected and the target identification information, store the target face image to be detected in the target temporary sub-library, and store the target face image to be detected in the complete database.
[0302] In a preferred embodiment of the present invention, the update sub-module is specifically used for:
[0303] When the quantity is equal to 0, store the target face image to be detected in the target temporary sub-library, and store the target face image to be detected in the complete database.
[0304] In a preferred embodiment of the present invention, the complete database includes at least one complete sub-library, and each complete sub-library has a corresponding business type;
[0305] The second processing module is specifically used for:
[0306] Determine the target complete sub-library from each complete sub-library based on the business type, and perform matching on the target face image to be detected in the target complete sub-library to obtain a matching result.
[0307] In a preferred embodiment of the present invention, each complete sub-library includes at least one second identification information, and each second identification information corresponds to at least one second historical face image;
[0308] The second processing module includes:
[0309] The second acquisition sub-module is used to acquire new identification information and the target face image to be detected from the target temporary sub-library;
[0310] The second determination sub-module is used to determine the second identification face features corresponding to each second identification information based on each second historical face image corresponding to each second identification information;
[0311] The second matching sub-module is used to match the target face features to be detected with each second identification face feature, and use the second identification face feature with the highest matching degree as the second target identification face feature;
[0312] The second calculation sub-module is used to calculate the feature score of the second target identification face feature;
[0313] The second determination sub-module is used to determine that the matching is successful when the feature score of the second target identification face feature exceeds the second feature score threshold; and determine that the matching fails when the score of the second target face recognition feature does not exceed the third feature score threshold.
[0314] In a preferred embodiment of the present invention, the first processing module is specifically used for:
[0315] Generate the processing result that the object to be detected is a known object.
[0316] In a preferred embodiment of the present invention, the second processing module is specifically configured to:
[0317] If it is determined that the matching is successful, generate the processing result that the object to be detected is a known object;
[0318] If it is determined that the matching fails, generate the processing result that the object to be detected is a new object.
[0319] In a preferred embodiment of the present invention, each face data has time information;
[0320] As Figure 8-2 shown, the device further includes:
[0321] A determination module 805, configured to determine the face data to be deleted from the temporary database based on the time information of each face data;
[0322] A deletion module 806, configured to delete the face data to be deleted from the temporary database.
[0323] In a preferred embodiment of the present invention, the determination module includes:
[0324] A third calculation sub-module, configured to determine the stored time of each face data in the temporary database based on the time information of each face data;
[0325] A third determination sub-module, configured to determine at least one face data to be deleted whose stored time exceeds the time threshold.
[0326] In a preferred embodiment of the present invention, the determination module includes:
[0327] A third acquisition sub-module, configured to randomly acquire a preset number of face data from the temporary database at each preset time interval;
[0328] A fourth calculation sub-module, configured to determine the stored time of each acquired face data based on the time information of each face data;
[0329] A fourth determination sub-module, configured to determine at least one face data to be deleted whose stored time exceeds the time threshold.
[0330] The service processing device in this embodiment can execute the service processing methods shown in the first embodiment and the second embodiment of this application, and their implementation principles are similar, so details are not described here again.
[0331] In an embodiment of the present invention, a service processing request is obtained; the service processing request includes face data of an object to be detected; when the face data meets a preset detection condition, the face data is matched based on a preset temporary database; the temporary database includes at least one face data obtained and stored within a preset time period; if the matching is successful, a first processing result of the service processing request is generated, and the temporary database and a preset complete database are updated based on the face data; the complete database includes all face data obtained and stored; if the matching fails, the face data is matched based on the complete database to obtain a matching result, a second processing result corresponding to the service processing request is generated based on the matching result, and the complete database is updated based on the face data. In this way, face retrieval is first performed based on the temporarily updated database in real time, and when the retrieval fails, face retrieval is performed based on the complete database including all face data to obtain the final retrieval result. Compared with the prior art method of directly performing retrieval based on a permanent archive, the scale of the temporary database in this application will be greatly reduced, which will greatly improve the efficiency and accuracy of retrieval, thereby improving the efficiency and accuracy of service processing.
[0332] Further, the temporary database is updated in real time through a preset update strategy, which ensures that the scale of the temporary database is controllable and the data is up-to-date, so that when retrieving based on the temporary database, the retrieval is based on the latest data, thus ensuring the latest retrieval result; at the same time, the controllable scale of the temporary database also ensures that the temporary database does not need to occupy too much hardware resources, reducing the consumption of hardware resources.
[0333] In another embodiment of the present application, an electronic device is provided. The electronic device includes: a memory and a processor; at least one program stored in the memory and used to obtain a service processing request when executed by the processor, which can be realized compared with the prior art; the service processing request includes face data of an object to be detected; when the face data meets a preset detection condition, the face data is matched based on a preset temporary database; the temporary database includes at least one face data obtained and stored within a preset time period; if the match is successful, a first processing result of the service processing request is generated, and the temporary database and a preset complete database are updated based on the face data; the complete database includes all face data obtained and stored; if the match fails, the face data is matched based on the complete database to obtain a match result, a second processing result corresponding to the service processing request is generated based on the match result, and the complete database is updated based on the face data. In this way, face retrieval is first performed based on the real-time updated temporary database, and when the retrieval fails, face retrieval is performed based on the complete database including all face data to obtain the final retrieval result. Compared with the prior art method of directly performing retrieval based on a permanent archive, the scale of the temporary database in the present application will be greatly reduced, which will greatly improve the efficiency and accuracy of retrieval, thereby improving the efficiency and accuracy of service processing.
[0334] In an alternative embodiment, an electronic device is provided, as Figure 9 shown. Figure 9 The electronic device 9000 shown includes: a processor 9001 and a memory 9003. Among them, the processor 9001 and the memory 9003 are connected, such as connected through a bus 9002. Optionally, the electronic device 9000 may further include a transceiver 9004. It should be noted that in practical applications, the transceiver 9004 is not limited to one, and the structure of the electronic device 9000 does not constitute a limitation on the embodiments of the present application.
[0335] The processor 9001 may be a CPU, a general-purpose processor, a DSP, an ASIC, an FPGA or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logical blocks, modules and circuits described in combination with the disclosure of the present application. The processor 9001 may also be a combination that realizes computing functions, such as a combination including one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0336] The bus 9002 may include a path for transmitting information between the above components. The bus 9002 may be a PCI bus or an EISA bus, etc. The bus 9002 may be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 9 only a thick line is shown in the figure, but it does not mean that there is only one bus or one type of bus.
[0337] The memory 9003 can be a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, or an EEPROM, a CD-ROM, or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0338] The memory 9003 is used to store the application program code for implementing the solution of this application and is controlled by the processor 9001 for execution. The processor 9001 is used to execute the application program code stored in the memory 9003 to implement the content shown in any of the foregoing method embodiments.
[0339] Among them, the electronic device includes but is not limited to: mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (such as in-vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc.
[0340] Another embodiment of this application provides a computer-readable storage medium with a computer program stored thereon. When it runs on a computer, it enables the computer to execute the corresponding content in the foregoing method embodiments. Compared with the prior art, obtain a service processing request; the service processing request includes face data of an object to be detected; when the face data meets a preset detection condition, match the face data based on a preset temporary database; the temporary database includes at least one piece of face data acquired and stored within a preset time period; if the match is successful, generate a first processing result of the service processing request, and update the temporary database and a preset complete database based on the face data; the complete database includes all the face data acquired and stored; if the match fails, match the face data based on the complete database to obtain a match result, generate a second processing result corresponding to the service processing request based on the match result, and update the complete database based on the face data. In this way, first perform face retrieval based on the real-time updated temporary database, and when the retrieval fails, perform face retrieval based on the complete database including all face data to obtain the final retrieval result. Compared with the prior art method of directly performing retrieval based on a permanent archive, the scale of the temporary database in this application will be significantly reduced, which will greatly improve the efficiency and accuracy of the retrieval, thereby improving the efficiency and accuracy of service processing.
[0341] It should be understood that although the steps in the flowchart of the accompanying drawings are shown sequentially as indicated by the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise clearly stated in this document, there is no strict order restriction for the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps.
[0342] The above are only some embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A business processing method, characterized in that, it includes: Obtain a business processing request; the business processing request includes a business type and face data of an object to be detected; the face data includes a track ID of a movement track of the object to be detected collected by an image acquisition device and at least one face image to be detected in the movement track; when the face data meets a preset detection condition, match the target face image to be detected in the face data based on a preset temporary database; the temporary database includes at least one face data obtained and stored within a preset time period; the temporary database includes at least one temporary sub-library, and each temporary sub-library has a corresponding business type; each temporary sub-library includes at least one first identification information and corresponding face data, and the first identification information is a track ID; If the match is successful, generate a first processing result of the business processing request, and update the temporary database and a preset complete database based on the face data; the complete database includes all face data obtained and stored; If the match fails, match the face data based on the complete database to obtain a match result, generate a second processing result corresponding to the business processing request based on the match result, and update the complete database based on the face data; Among them, the matching of the face data based on the preset temporary database includes: Obtain the target face feature of the target face image to be detected; For each first identification information in the sub-temporary library corresponding to the business type in the business processing request, determine the first identification face feature corresponding to each first identification information based on the average value of the historical face features of each first historical face image corresponding to each first identification information; Match the target face feature to be detected with each first identification face feature.
2. The business processing method according to claim 1, characterized in that, the face data meets the preset detection condition, including: Calculate the quality scores of all face images to be detected, and compare all the quality scores with a first quality score threshold; When the quality score of at least one face image exceeds the first quality score threshold, determine that the face data meets the preset detection condition; Obtain each face image whose quality score exceeds the first quality score threshold, and use the face image with the highest quality score as the target face image to be detected.
3. The business processing method according to claim 1 or 2, characterized in that, the matching of the face data based on the preset temporary database includes: Determine a target temporary sub-library from each temporary sub-library based on the business type, and match the target face image to be detected in the target temporary sub-library.
4. The business processing method according to claim 3, characterized in that, the matching of the target face image to be detected in the target temporary sub-library includes: Take the first identified face feature with the highest matching degree as the first target identified face feature, and take the first identification information corresponding to the first target identified face feature as the target identification information; Calculate the feature score of the first target identified face feature; When the feature score of the first target identified face feature exceeds the first feature score threshold, it is determined that the matching is successful.
5. The service processing method according to claim 4, wherein, further comprising: When the feature score of the first target identified face feature does not exceed the first feature score threshold, it is determined that the matching fails; Generate new identification information, establish the correspondence between the target face image to be detected and the new identification information, and use the new identification information as the target identification information.
6. The service processing method according to claim 5, wherein, Updating the temporary database and the complete database based on the face data includes: When the quality score of the target face image to be detected exceeds the second quality score threshold, obtain the number of the first historical face images corresponding to the target identification information; Update the temporary database and the complete database based on the number and the face data.
7. The service processing method according to claim 6, wherein, The updating the temporary database and the complete database based on the number and the face data includes: When the number is equal to 1, calculate the quality score of the first historical face image; If the quality score does not exceed the third quality score threshold, replace the first historical face image in the target temporary sub-library with the target face image to be detected, and store the target face image to be detected in the complete database.
8. The service processing method according to claim 7, wherein, The updating the temporary database and the complete database based on the number and the face data includes: If the quality score exceeds the third quality score threshold, or the number is greater than 1, determine whether the score of the target face image to be detected exceeds the fourth quality score threshold; If so, establish the correspondence between the target face image to be detected and the target identification information, store the target face image to be detected in the target temporary sub-library, and store the target face image to be detected in the complete database.
9. The service processing method according to claim 6, wherein, The updating the temporary database and the complete database based on the number and the face data includes: When the number is equal to 0, store the target face image to be detected in the target temporary sub-library, and store the target face image to be detected in the complete database.
10. The service processing method according to claim 1, wherein, The complete database includes at least one complete sub-library, and each complete sub-library has a corresponding service type; Based on a preset complete database, match the face data to obtain a matching result, including: Determine a target complete sub-library from the respective complete sub-libraries based on the service type, and match the target face image to be detected in the target complete sub-library to obtain a matching result.
11. The service processing method according to any one of claims 6-10, characterized in that, each complete sub-library includes at least one second identification information, and each second identification information corresponds to at least one second historical face image; matching the target face image to be detected in the target complete sub-library includes: obtaining new identification information and the target face image to be detected from the target temporary sub-library; determining second identification face features corresponding to each second identification information based on each second historical face image corresponding to each second identification information; matching the target face features to be detected with the second identification face features, and taking the second identification face feature with the highest matching degree as the second target identification face feature; calculating a feature score of the second target identification face feature; when the feature score of the second target identification face feature exceeds a second feature score threshold, it is determined that the match is successful; when the score of the second target identification face feature does not exceed a third feature score threshold, it is determined that the match fails.
12. The service processing method according to claim 1, characterized in that, each face data has time information; the method further includes: determining face data to be deleted from the temporary database based on the time information of each face data; deleting the face data to be deleted from the temporary database.
13. A service processing device, characterized in that, including: an acquisition module for acquiring a service processing request; the service processing request includes a service type and face data of an object to be detected; the face data includes a trajectory ID of a motion trajectory of the object to be detected collected by an image acquisition device and at least one face image to be detected in the motion trajectory; a matching module for, when the face data meets a preset detection condition, matching the target face image to be detected in the face data based on a preset temporary database; the temporary database includes at least one face data acquired and stored within a preset time period; a first processing module for, if the match is successful, generating a first processing result of the service processing request, and updating the temporary database and a preset complete database based on the face data; the complete database includes all face data acquired and stored; the temporary database includes at least one temporary sub-library, and each temporary sub-library has a corresponding service type; each temporary sub-library includes at least one first identification information and corresponding face data, and the first identification information is a trajectory ID; a second processing module for, if the match fails, matching the face data based on the complete database to obtain a matching result, generating a second processing result corresponding to the service processing request based on the matching result, and updating the complete database based on the face data; wherein, the matching the face data based on the preset temporary database includes: Obtain the target face feature to be detected of the target face image to be detected; For each first identification information in the sub-temporary library corresponding to the service type in the service processing request, determine the first identification face feature corresponding to each first identification information based on the average value of the historical face features of each first historical face image corresponding to each first identification information; Match the target face feature to be detected with each first identification face feature.
14. An electronic device, Characterized in that, It includes: A processor, a memory and a bus; The bus is used to connect the processor and the memory; The memory is used to store operation instructions; The processor is used to execute the service processing method described in any one of claims 1-12 above by calling the operation instructions.
15. A computer-readable storage medium, Characterized in that, The computer storage medium is used to store computer instructions, and when it runs on a computer, it enables the computer to execute the service processing method described in any one of claims 1-12 above.
Citation Information
Patent Citations
Face tracking method and device in video, computer equipment and storage medium
CN110399795A