[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN116434349A - Living body detection method, electronic device, storage medium, and program product - Google Patents

Living body detection method, electronic device, storage medium, and program product Download PDF

Info

Publication number
CN116434349A
CN116434349A CN202310306903.1A CN202310306903A CN116434349A CN 116434349 A CN116434349 A CN 116434349A CN 202310306903 A CN202310306903 A CN 202310306903A CN 116434349 A CN116434349 A CN 116434349A
Authority
CN
China
Prior art keywords
sequence
illumination
target
video frame
video
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310306903.1A
Other languages
Chinese (zh)
Inventor
马志明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kuangshi Technology Co Ltd
Original Assignee
Beijing Kuangshi Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kuangshi Technology Co Ltd filed Critical Beijing Kuangshi Technology Co Ltd
Priority to CN202310306903.1A priority Critical patent/CN116434349A/en
Priority to PCT/CN2023/094603 priority patent/WO2023221996A1/en
Publication of CN116434349A publication Critical patent/CN116434349A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/40Spoof detection, e.g. liveness detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/88Image or video recognition using optical means, e.g. reference filters, holographic masks, frequency domain filters or spatial domain filters
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02BCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO BUILDINGS, e.g. HOUSING, HOUSE APPLIANCES OR RELATED END-USER APPLICATIONS
    • Y02B20/00Energy efficient lighting technologies, e.g. halogen lamps or gas discharge lamps
    • Y02B20/40Control techniques providing energy savings, e.g. smart controller or presence detection

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the application provides a living body detection method, electronic equipment, a storage medium and a program product. The method comprises the following steps: obtaining a video to be detected, wherein the video to be detected is as follows: during the irradiation of the object to be detected according to the first illumination sequence, the acquired video of the object to be detected; extracting a video frame sequence of a target frame number from the video to be detected, and determining a second illumination sequence according to each video frame in the video frame sequence, wherein the second illumination sequence represents reflected light of each physical position point of the object to be detected; extracting a plurality of candidate illumination sequences from the first illumination sequence according to the sequence number information of each video frame in the video frame sequence and the index information of each illumination element in the first illumination sequence, wherein the index information of each element in each candidate illumination sequence and the sequence number information of each video frame in the video frame sequence meet different matching relations; and acquiring a living body detection result of the object to be detected according to the plurality of candidate illumination sequences and the second illumination sequence.

Description

Living body detection method, electronic device, storage medium, and program product
Technical Field
The present invention relates to the field of living body detection technology, and in particular, to a living body detection method, an electronic device, a storage medium, and a program product.
Background
The glare light sequence detection is an important ring in a living body detection algorithm, when a living body detection video is recorded, a terminal can emit light with various colors according to a issuing strategy, and an object to be detected reflects the light with various colors and is recorded in the living body detection video. Extracting light reflected by an object to be detected from each video frame of the living body detection video, and judging whether a camera hijacking exists or not by comparing the sequence of the light reflected by the object to be detected with the issued illumination sequence. However, there is a problem in that the calculation amount is large and the time is long by comparing the sequence of reflected light with the sequence of emitted light.
Disclosure of Invention
In view of the above, embodiments of the present application provide a biopsy method, an electronic device, a storage medium, and a program product to overcome or at least partially solve the above.
In a first aspect of an embodiment of the present application, there is provided a living body detection method, including:
obtaining a video to be detected, wherein the video to be detected is: during the irradiation of the object to be detected according to the first illumination sequence, the acquired video of the object to be detected;
Extracting a video frame sequence of a target frame number from the video to be detected, and determining a second illumination sequence according to each video frame in the video frame sequence, wherein the second illumination sequence represents reflected light of each physical position point of the object to be detected;
extracting a plurality of candidate illumination sequences from the first illumination sequence according to the sequence number information of each video frame in the video frame sequence and the index information of each illumination element in the first illumination sequence, wherein the index information of each element in each candidate illumination sequence and the sequence number information of each video frame in the video frame sequence meet different matching relations;
and acquiring a living body detection result of the object to be detected according to the plurality of candidate illumination sequences and the second illumination sequence.
Optionally, the matching relationship is determined based on the target video and the target illumination sequence;
the target video is the video to be detected, and the target illumination sequence is the first illumination sequence;
or the target video is a sample video, and the target illumination sequence is a sample illumination sequence with the same length as the first illumination sequence.
Optionally, the matching relationship is determined by the following procedure:
acquiring the target video and the target illumination sequence, wherein the target video comprises a plurality of original video frames;
determining a corresponding relation between a target sequence number of a target video frame extracted from the target video and a frame sequence number of an original video frame of the target video;
performing sliding matching on the original video frame and the target illumination sequence, and determining a plurality of offset distances;
and determining a plurality of matching relations according to the corresponding relation and the plurality of offset distances.
Optionally, the determining a correspondence between the sequence number of the target video frame extracted from the target video and the frame sequence number of the original video frame of the target video includes:
acquiring a plurality of assumed total frames of the target video;
for each assumed total frame number, determining a corresponding relation between a target sequence number of the target video frame and a frame sequence number of the original video frame;
the determining a plurality of matching relationships according to the corresponding relationship and the plurality of offset distances includes:
and determining a plurality of matching relations according to the plurality of corresponding relations and the plurality of offset distances.
Optionally, before the sliding matching the original video frame with the target illumination sequence and determining the plurality of offset distances, the method further includes:
removing illumination elements at the head end and the tail end of the target illumination sequence;
the sliding matching the original video frame with the target illumination sequence, and determining a plurality of offset distances, including:
and performing sliding matching on the original video frame and a target illumination sequence with illumination elements at the head end and the tail end removed, and determining a plurality of offset distances.
Optionally, the determining a plurality of matching relationships according to the correspondence relationship and the offset distances includes:
determining a target index of an illumination element matched with the target sequence number of each target video frame in the target illumination sequence under each corresponding relation and each offset distance;
and obtaining the multiple matching relations based on the target indexes matched with each target sequence number under each corresponding relation and each offset distance.
Optionally, the obtaining the multiple matching relationships based on the target index matched with each target sequence number under each corresponding relationship and each offset distance includes:
Under any corresponding relation and any offset distance, marking the target index matched with the target sequence number of the target video frame as an empty target index under the condition that the target index matched with the target sequence number of any target video frame is smaller than 1 or larger than the length of the target illumination sequence corresponding to the target index;
and determining the corresponding relation and the matching relation under the offset distance according to the empty target index matched with the target video frame and the target indexes matched with other target video frames.
Optionally, the multiple correspondence between the target sequence number of each target video frame and the frame sequence number of the original video frame is s, where i '=s (i), i is the target sequence number, and i' is the frame sequence number corresponding to the target sequence number i;
under the multiple corresponding relations and the multiple offset distances, the target index matched with the target sequence number i of each target video frame is s (i) -dt, wherein dt is the offset distance;
under the plurality of corresponding relations and the plurality of offset distances, the plurality of matching relations are f, wherein f (i) =s (i) -dt=i' -dt.
Optionally, the frame number of the target video frame is m;
The corresponding relation between the target serial number of each target video frame and the frame serial number of the original video frame is s;
where i' =s (i) =ceil (c/2+c ×i), c=n/m, n is the assumed total frame number of the target video, ceil is an upward rounding function, i=1, 2, …, m, and each target sequence number of the m target video frames is characterized.
Optionally, the extracting a plurality of candidate illumination sequences from the first illumination sequence according to the sequence number information of each video frame in the video frame sequence and the index information of each illumination element in the first illumination sequence includes:
for each matching relation, determining an empty element with an index of which the index is empty, of illumination elements matched with the sequence number of any video frame in the first illumination sequence under the matching relation;
determining other illumination elements according to the sequence numbers of other video frames in the video frame sequence and the index information of each illumination element in the first illumination sequence;
and generating the candidate illumination sequence under the matching relation according to the empty element and the other illumination elements.
Optionally, acquiring the living body detection result of the object to be detected according to the plurality of candidate illumination sequences and the second illumination sequence includes:
Respectively obtaining similarity values of each candidate illumination sequence and the second illumination sequence;
determining a target candidate illumination sequence according to the similarity value of each candidate illumination sequence and the second illumination sequence;
generating a response graph of the object to be detected according to the second illumination sequence and the target candidate illumination sequence, wherein the response intensity of each pixel point in the response graph is characterized by: similarity between the second illumination sequence reflected by the entity position point corresponding to the pixel point and the first illumination sequence;
and determining a living body detection result of the object to be detected according to the response diagram.
Optionally, the obtaining similarity values of the candidate illumination sequences and the second illumination sequence respectively includes:
determining target illumination elements in the second illumination sequence corresponding to the positions of the non-empty elements in the candidate illumination sequence according to each candidate illumination sequence;
calculating the similarity of each non-empty element and the target illumination element corresponding to the position;
and determining an average value of the similarity of each non-empty element and the target illumination element corresponding to the position as a similarity value between the candidate illumination sequence and the second illumination sequence.
In a second aspect of the embodiments of the present application, there is provided an electronic device, including a memory, a processor and a computer program stored on the memory, the processor executing the computer program to implement the living body detection method according to the first aspect.
In a third aspect of embodiments of the present application, there is provided a computer readable storage medium having stored thereon a computer program/instruction which, when executed by a processor, implements the living body detection method as described in the first aspect.
In a fourth aspect of embodiments of the present application, there is provided a computer program product comprising a computer program/instruction which, when executed by a processor, implements the in vivo detection method as described in the first aspect.
Embodiments of the present application include the following advantages:
in this embodiment, the second illumination sequence characterizes reflected light of each physical location point of the object to be detected in each video frame in the video frame sequence, so that the length of the second illumination sequence is the same as the length of the video frame sequence and is smaller than the number of original video frames of the video to be detected. And extracting a plurality of candidate illumination sequences from the first illumination sequence according to the sequence number information of each video frame in the video frame sequence and the index information of each illumination element in the first illumination sequence, so that the length of the candidate illumination sequences is the same as that of the video frame sequence. Therefore, compared with the sequence of reflected light and the first illumination sequence based on each physical location point of the object to be detected in each video frame of the video to be detected, the living body detection result of the object to be detected is obtained, and the living body detection result of the object to be detected is obtained according to the second illumination sequence and the candidate illumination sequence in the embodiment, the method has the advantages of being small in calculation amount and short in time consumption. In addition, because the candidate illumination sequence and the second illumination sequence have the same length, the determined living body detection result of the object to be detected is more accurate.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments of the present application will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of steps of a method for in-vivo detection in an embodiment of the present application;
FIG. 2 is a flow chart of a method of in-vivo detection in an embodiment of the present application;
FIG. 3 is a schematic view showing the structure of a living body detecting device according to the embodiment of the present application;
fig. 4 is a schematic diagram of an electronic device in an embodiment of the present application.
Detailed Description
In order that the above-recited objects, features and advantages of the present application will become more readily apparent, a more particular description of the invention briefly described above will be rendered by reference to specific embodiments that are illustrated in the appended drawings.
In recent years, technology research such as computer vision, deep learning, machine learning, image processing, image recognition and the like based on artificial intelligence has been advanced significantly. Artificial intelligence (Artificial Intelligence, AI) is an emerging scientific technology for studying and developing theories, methods, techniques and application systems for simulating and extending human intelligence. The artificial intelligence discipline is a comprehensive discipline and relates to various technical categories such as chips, big data, cloud computing, internet of things, distributed storage, deep learning, machine learning, neural networks and the like. Computer vision is an important branch of artificial intelligence, and specifically, machine recognition is a world, and computer vision technologies generally include technologies such as face recognition, living body detection, fingerprint recognition and anti-counterfeit verification, biometric feature recognition, face detection, pedestrian detection, object detection, pedestrian recognition, image processing, image recognition, image semantic understanding, image retrieval, word recognition, video processing, video content recognition, three-dimensional reconstruction, virtual reality, augmented reality, synchronous positioning and map construction (SLAM), computational photography, robot navigation and positioning, and the like. With research and progress of artificial intelligence technology, the technology expands application in various fields, such as fields of security prevention and control, city management, traffic management, building management, park management, face passing, face attendance, logistics management, warehouse management, robots, intelligent marketing, computed photography, mobile phone images, cloud services, intelligent home, wearable equipment, unmanned driving, automatic driving, intelligent medical treatment, face payment, face unlocking, fingerprint unlocking, personnel verification, intelligent screen, intelligent television, camera, mobile internet, network living broadcast, beauty, cosmetic, medical beauty, intelligent temperature measurement and the like.
When in living detection, the similarity between the emitted illumination sequence (for example, a dazzle light sequence) and the reflected illumination sequence of the object in the collected video is required to be compared, and when the similarity is lower than a certain threshold value, the collected video is considered to be an attack video directly sent to a server through a camera hijacking technology, and is not collected by a terminal.
Calculating the similarity between the emitted illumination sequence and the reflected illumination sequence requires ensuring a strict alignment between the emitted illumination sequence and the reflected illumination sequence. However, the acquired video may be lost in frames, multiple frames, or out of sync, resulting in misalignment between the emitted illumination sequence and the reflected illumination sequence. For example, assume that the emitted illumination sequence has 24 illumination elements, each illumination element corresponding to a video frame; when the 2 nd illumination element of the illumination sequence emits light to illuminate the object to be detected, video acquisition is started, only 23 video frames of the acquired video can be caused, and the acquired video has the condition of frame loss; when the object to be detected is not irradiated by light, video acquisition is started, the 1 st illumination element of the illumination sequence corresponds to the 2 nd video frame of the video, 25 frames of the acquired video can be possibly caused, and the acquired video has multiple frames; the video acquisition is started when the object to be detected is irradiated by the light emitted by the 2 nd illumination element of the illumination sequence, and the video frame acquired when the object to be detected is irradiated by the 24 th illumination element of the illumination sequence is the next to last video frame, and the acquired video has 24 video frames, but the problem of asynchronism exists.
Under the condition that the emitted illumination sequence and the reflected illumination sequence are not aligned, even if the camera hijacking attack is not performed, the similarity between the emitted illumination sequence and the reflected illumination sequence is lower than a threshold value, so that the camera hijacking attack is misjudged.
In addition, each video frame of the acquired video is processed, and the length of the obtained reflected illumination sequence is equal to the frame number of the video frame, so that the calculated amount is larger when the similarity between the reflected illumination sequence and the issued illumination sequence is calculated.
The living body detection method proposed by the related art utilizes the information that the living body face and the screen/printing paper have different reflection modes to improve the accuracy of living body detection. Specifically, the face is uneven, the light reflected by different areas is different, the face is turned over by a screen/printing paper and the like, and the screen/printing paper and the like are smooth and even, so that the reflected light is uniform and regular. The method needs to generate different reflected illumination sequences aiming at different areas of an object to be detected, calculate the similarity between the transmitted illumination sequences and the different reflected illumination sequences, further generate a response chart, and determine a living body detection result according to the response chart. Because of the presence of multiple sequences of reflected light, this method of living detection is particularly computationally intensive and takes a relatively long time to obtain a living detection result.
Referring to fig. 1, a flowchart illustrating steps of a living body detection method according to an embodiment of the present application is shown, and as shown in fig. 1, the living body detection method includes the steps of:
step S11: obtaining a video to be detected, wherein the video to be detected is: during the irradiation of the object to be detected according to the first illumination sequence, the acquired video of the object to be detected;
step S12: extracting a video frame sequence of a target frame number from the video to be detected, and determining a second illumination sequence according to each video frame in the video frame sequence, wherein the second illumination sequence represents reflected light of each physical position point of the object to be detected;
step S13: extracting a plurality of candidate illumination sequences from the first illumination sequence according to the sequence number information of each video frame in the video frame sequence and the index information of each illumination element in the first illumination sequence, wherein the index information of each element in each candidate illumination sequence and the sequence number information of each video frame in the video frame sequence meet different matching relations;
step S14: and acquiring a living body detection result of the object to be detected according to the plurality of candidate illumination sequences and the second illumination sequence.
The terminal irradiates the object to be detected with light of different colors and/or different illumination intensities according to the first illumination sequence, and collects the video to be detected of the object to be detected during the irradiation of the object to be detected with light according to the first illumination sequence. The object to be detected is an object acquired by a camera of the terminal. The first illumination sequence may be an illumination sequence generated by the terminal itself, or may be an illumination sequence issued by the server to the terminal.
And extracting video frames with target frames from the video to be detected, and generating a video frame sequence according to the video frames with the target frames. The video to be detected comprises a plurality of original video frames, the video frames of the extracted target frames are part of the video frames in the original video frames, and the target frames of the extracted video frames are smaller than the frames of the original video frames. The sequence of each video frame in the video frame sequence follows the sequence of each video frame in the video to be detected.
The extraction rule can be set according to the requirement, and the extraction rule can be uniform extraction or nonuniform extraction. The target frame number may be a predetermined frame number, but because there may be a frame loss or a multi-frame condition in the video to be detected, even if video frame extraction is performed according to the same rule, the frame number of the original video frame corresponding to each extracted video frame may be different. For example, the extraction rules are all uniform extraction, the target frame number is 8, the 4 th extracted video frame may be the 14 th video frame in the original video frames in the case that the total frame number of the original video frames included in the video to be detected is 24 frames, and the 4 th extracted video frame may be the 13 th video frame in the original video frames in the case that the total frame number of the original video frames included in the video to be detected is 23 frames.
Processing each video frame in the video frame sequence, determining a corresponding pixel point of an entity position point of an object to be detected in each video frame in the video frame sequence, and obtaining a pixel value of the corresponding pixel point of each entity position point in each video frame, so as to obtain reflected light of each entity position point in each video frame in the video frame sequence, and further obtain a second illumination sequence. The physical location point of the object to be detected refers to a point where the object to be detected actually exists, for example, when the object to be detected is a face, the physical location point of the object to be detected may be a point on a nose of the face, and the size of the point is the size represented by one pixel point in the video. Because each illumination element in the second illumination sequence characterizes the reflected light in one video frame, the length of the second illumination sequence is the same as the length of the video frame sequence.
The illumination elements are elements in the illumination sequence, and can represent information such as color, intensity and the like of light. For example, the terminal emits red light, blue light and green light in sequence, and the corresponding illumination sequence may be (red, blue and green), and "red" in the illumination sequence may be an illumination element, where the illumination element characterizes the color of the light.
When the problem of frame loss, multi-frame or asynchronous video to be detected does not exist, the matching relation between the illumination elements in the second illumination sequence and the illumination elements in the first illumination sequence accords with the corresponding relation between each video frame in the video frame sequence and the original video frame of the video to be detected. For example, if the 2 nd video frame in the video frame sequence is the 5 th original video frame of the video to be detected, the 2 nd illumination element in the second illumination sequence is matched with the 5 th illumination element in the first illumination sequence.
When the video to be detected has the problems of frame loss, multi-frame or asynchronism, the matching relationship between the illumination elements in the second illumination sequence and the illumination elements in the first illumination sequence may not conform to the corresponding relationship between each video frame in the video frame sequence and the original video frame of the video to be detected. For example, the 2 nd video frame in the video frame sequence is the 5 th video frame in the original video frame, because the video to be detected has the problem of frame loss, multi-frame or asynchronous, a one-step offset distance exists between the video frame of the video to be detected and the first illumination sequence, and the light reflected by the 5 th video frame in the video to be detected corresponds to the 6 th illumination element of the first illumination sequence, so that the 2 nd illumination element in the second illumination sequence should be matched with the 6 th illumination element in the first illumination sequence.
As can be seen from the above examples, each illumination element in the second illumination sequence should match with which illumination element in the first illumination sequence, respectively, on the one hand depends on the correspondence of the extracted video frame to the original video frame and on the other hand on the offset distance between the sequence of light reflected by the video to be detected and the first illumination sequence.
And obtaining a plurality of matching relations, wherein each matching relation corresponds to a corresponding relation and an offset distance, the corresponding relation is a corresponding relation between the sequence number of each video frame in the video frame sequence and the frame sequence number of the original video frame, and the offset distance represents the offset distance for sliding matching between the sequence of the reflected light of the video to be detected and the first illumination sequence. The corresponding relation is related to the total frame number of the original video frames and the extraction rule for extracting the video frame sequence from the video to be detected, and the offset distance is related to the problems of frame loss, multi-frame or asynchronous of the video to be detected.
The matching relationship characterizes a one-to-one matching relationship between the sequence number information of each video frame in the video frame sequence and the index information of each illumination element in the first illumination sequence in each candidate illumination sequence, so that according to the sequence number information of each video frame in the video frame sequence and the index information of each illumination element in the first illumination sequence, multiple candidate illumination sequences can be extracted from the first illumination sequence, and the length of each candidate illumination sequence is the same as that of the video frame sequence. And under the condition that the index of the 1 st video frame in the video frame sequence and the 1 st illumination element in the candidate illumination sequence in the first illumination sequence is 5, taking the 5 th illumination element in the first illumination sequence as the 1 st illumination element of the candidate illumination sequence, and the like, so as to obtain each illumination element in the candidate illumination sequence.
Each matching relationship corresponds to a corresponding relationship and an offset distance, the target frame number and the extraction rule are determined when in living detection, and the total frame number of the original video frames is uncertain, so the corresponding relationship comprises the uncertain total frame number of the original video frames; because the offset distance is also uncertain, each matching relationship may include both the total number of frames of the original video frame and the offset distance unknowns. The possible values of the total frame number and the offset distance of the original video frame can be exhausted, so that various matching relations can be obtained. For example, the length of the first illumination sequence is 24, and since the video to be detected usually only has a plurality of frames of one or two frames or fewer frames, the value of the total frame number of the video to be detected may be 22, 23, 24, 25 or 26. The minimum value of the offset distance is 0 and the maximum value will be described in detail later.
It can be appreciated that, of the plurality of matching relationships, at most only one matching relationship is a true matching relationship. Therefore, the similarity values of the plurality of candidate illumination sequences and the second illumination sequence can be respectively selected, and the target candidate illumination sequence is selected from the plurality of candidate illumination sequences according to the similarity values of the candidate illumination sequences and the second illumination sequence. In some embodiments, the candidate illumination sequence having the greatest similarity with the second illumination sequence may be determined as the target candidate illumination sequence.
According to the second illumination sequence and the target candidate illumination sequence, a response diagram of the object to be detected can be generated, and then a living body detection result of the object to be detected is determined according to the response diagram. The response intensity of each pixel point in the response graph is characterized by: and the similarity between the second illumination sequence reflected by the entity position point corresponding to the pixel point and the first illumination sequence.
And inputting the response diagram of the object to be detected into a living body detection model, and performing living body detection on the object to be detected according to the response diagram of the object to be detected by the living body detection model, so that a living body detection result of the object to be detected can be obtained. The living body detection model is a model which learns the image characteristics of the response image of the living body face through supervised training, and can distinguish the response image of the living body face from the response image of other attacks (such as a flap attack), so that the living body detection model can obtain the living body detection result of the object to be detected through the response image of the object to be detected. Wherein, the supervised training performed by the living body detection model can be as follows: acquiring response graphs of a plurality of sample objects (including living human faces and other objects), inputting the response graphs of the sample objects into a living body detection model to be trained, and obtaining the prediction probability of the sample objects as living bodies; and establishing a loss function according to the prediction probability and whether the sample object is a living body or not, and updating model parameters of the living body detection model to be trained based on the loss function to obtain the living body detection model. In this way, the living body detection model can learn the response map of the living body face. The method for acquiring the response map of the sample object may refer to a method for acquiring the response map of the object to be detected.
It can be understood that the candidate illumination sequence with the highest similarity value with the second illumination sequence is the candidate illumination sequence corresponding to the real matching relationship. Therefore, each illumination element in the target candidate illumination sequence is screened out according to the similarity value, and corresponds to each illumination element in the second illumination sequence one by one. Therefore, according to the second illumination sequence and the target candidate illumination sequence, the obtained living body detection result of the object to be detected is more accurate.
By adopting the technical scheme of the embodiment of the application, the second illumination sequence represents the reflected light of each physical position point of the object to be detected in each video frame in the video frame sequence, so that the length of the second illumination sequence is the same as that of the video frame sequence and is smaller than the number of the original video frames of the video to be detected. And extracting a plurality of candidate illumination sequences from the first illumination sequence according to the sequence number information of each video frame in the video frame sequence and the index information of each illumination element in the first illumination sequence, so that the length of the candidate illumination sequences is the same as that of the video frame sequence. Therefore, compared with the sequence of reflected light and the first illumination sequence based on each physical location point of the object to be detected in each video frame of the video to be detected, the living body detection result of the object to be detected is obtained, and the living body detection result of the object to be detected is obtained according to the second illumination sequence and the candidate illumination sequence in the embodiment, the method has the advantages of being small in calculation amount and short in time consumption. In addition, because the candidate illumination sequence and the second illumination sequence have the same length, the determined living body detection result of the object to be detected is more accurate.
On the basis of the technical scheme, the matching relationship can be determined based on the target video and the target illumination sequence. The target video can be a video to be detected, and the target illumination sequence is a first illumination sequence; or the target video is a sample video, and the target illumination sequence is a sample illumination sequence with the same length as the first illumination sequence.
After the video to be detected and the first illumination sequence are acquired, various matching relations are determined according to the video to be detected and the first illumination sequence.
Or determining multiple matching relations in advance according to the sample video and the sample illumination sequence with the same length as the first illumination sequence, and directly acquiring multiple candidate illumination sequences according to the multiple matching relations generated in advance when in living detection. The sample illumination sequence may be any illumination sequence. The first illumination sequence is an illumination sequence issued according to an issuing strategy, so that the length of the first illumination sequence can be obtained before the first illumination sequence is issued. The sample video may be any video because the total number of video frames of the sample video may be the assumed total number of frames of the video to be detected.
And determining multiple matching relations according to the sample video and the sample illumination sequence with the same length as the first illumination sequence in advance, and directly using the multiple matching relations when in living body detection, so that the time for acquiring the living body detection result can be shortened, the instantaneity of the living body detection result is ensured, and the living body detection efficiency is improved.
Based on the above technical solution, various matching relations may be determined through the following procedure.
Acquiring a target video frame of which the target frame number is extracted from a target video; in the case where the target video is a video to be detected, the target video frame is a video frame in a sequence of video frames. When the target video is a sample video, the target video frame is a video frame extracted from the sample video, and the extraction rule adopted when the target video frame is extracted from the target video is the same as the extraction rule adopted when the video frame is extracted from the video to be detected.
Under the condition that the extraction rule, the target frame number and the total frame number of the original video frame of the target video are all determined, the corresponding relation between the target sequence number of the target video frame and the frame sequence number of the original video frame can be determined.
However, in actual situations, the total frame number of the original video frame is usually uncertain, and therefore, in the case that the extraction rule and the target frame number are both determined, and the total frame number of the original video frame is uncertain, various correspondence between the target sequence number of the target video frame and the frame sequence number of the original video frame may be obtained by taking different values for the total frame number of the original video frame. The method can acquire a plurality of assumed total frames of the target video, and determine the corresponding relation between the target serial number of the target video frame and the frame serial number of the original video frame according to each assumed total frame. Target sequence number characterization of target video frames: the target video frame is in an order of a plurality of target video frames.
Therefore, the matching relations corresponding to different corresponding relations can be contained among the plurality of matching relations obtained later. And under the condition that the number of the original video frames contained in each video to be detected is different, at least the matching relation which is matched with the real number of the original video frames contained in each video to be detected exists in the multiple matching relations.
After the corresponding relation between the target sequence number of the target video frame and the frame sequence number of the original video frame is obtained, the original video frame and the target illumination sequence can be subjected to sliding matching, and a plurality of offset distances are determined. The original video frame is matched with the target illumination sequence in a sliding way, so that the original video frame and the target illumination sequence can be matched under the offset distance, and the value range of the offset distance is determined.
Under the condition that the value ranges of the corresponding relations and the offset distances are determined, the corresponding relations and the offset distances can be traversed, so that the matching relations are determined. How to determine the plurality of matching relationships according to the correspondence relationship and the offset distance will be described later. When a plurality of original video frames are regarded as a sequence and slide matching is carried out, the length of a sliding window is the length of a shorter sequence, the sliding step length is one step, the minimum value of the offset distance is 0, and the maximum value is the absolute value of the difference value between the total frame number of the original video frames and the length of a target illumination sequence.
In some embodiments, the illumination elements at the head and tail ends of the target illumination sequence may be removed, so as to obtain the target illumination sequence with the illumination elements at the head and tail ends removed. The number of lighting elements removed at each end can be set as desired. For example, if the number of glare corresponding to the target illumination sequence is p and the lights of each color are q frames, the length of the target illumination sequence is p×q, and the number of removed illumination elements at each end may be q/2. When the illumination elements are removed, it should be ensured that the illumination elements with the same color in the whole segment are not removed, for example, the first 3 illumination elements in the target illumination sequence are all red light, the 4 th illumination element is blue light, and the number of the removed illumination elements can be 1 or 2.
In this embodiment, the determined plurality of offset distances may be sliding matching of the original sample video frame with the target illumination sequence with the illumination elements at the head and tail ends removed.
Because the frame loss and the multi-frame problem of the video to be detected exist at the head end and the tail end of the video to be detected. Therefore, by removing the illumination elements at the head and tail ends of the target illumination sequence, and then performing sliding matching on the target illumination sequence with the illumination elements at the head and tail ends and the original video frame, the obtained matching relationship does not consider the head and tail ends of the video to be detected and the first illumination sequence. Furthermore, when the candidate illumination sequence is obtained according to the matching relation and the similarity between the candidate illumination sequence and the first illumination sequence is calculated, the head end and the tail end are not considered, so that the problem of low similarity caused by frame loss and multiple frames is solved.
Optionally, determining a plurality of matching relationships according to the correspondence relationship and each offset distance may include: determining a target index matched with a target sequence number of each target video frame under each corresponding relation and each offset distance; based on the target index matched with the target sequence number of each target video frame under each corresponding relation and each offset distance, multiple matching relations are obtained.
For example, the target sequence numbers 1, 2 and 3 of the target video frames correspond to the frame sequence numbers 5, 10 and 15 of the original video frames respectively, and the offset distance is 2, then the target index matched with the target sequence number 1 is 5-2=3, the target index matched with the target sequence number 2 is 8, and the target index matched with the target sequence number 3 is 13; thus, the matching relationship can be determined as: (1-3,2-7,3-13). Based on the matching relationship, when the candidate illumination sequence is extracted from the first illumination sequence, the candidate illumination sequence can be generated according to the 3 rd, 7 th and 13 th illumination elements in the first illumination sequence.
For example, the correspondence between the target sequence number of the target video frame and the frame sequence number of the original video frame is i '=3i, where i is the target sequence number and i' is the frame sequence number corresponding to the target sequence number i. The offset distance is dt, and the value of dt is a positive integer ranging from 0 to 3, so that the matching relation r (i) =i' -dt=3i-dt can be obtained. When i=1, dt=1, r (i) =2 can be solved. If the correspondence is i' =3i and the offset distance is 1, the target index matching the target sequence number 1 of the target video frame is 2. Wherein, by substituting different dt values, a plurality of matching relations can be obtained.
Thus, according to the sequence number of the target video frame, the target index of the illumination element matched with the target sequence number of the target video frame in the target illumination sequence can be determined, and the matching relation between the target sequence number of the target video frame and the target index of the illumination element in the illumination sequence is obtained, wherein the matching relation is the same as the matching relation between the sequence number of the video frame and the index of the illumination element in the first illumination sequence, so that the matching relation between the sequence number of each video frame in the video frame sequence and the index of each illumination element in each candidate illumination sequence in the first illumination sequence can be obtained.
Based on the above technical solution, under any one of the correspondence and any one of the offset distances, if a target index matching with a target sequence number of any one of the target video frames is smaller than 1 or greater than a length of a target illumination sequence corresponding to the target index, the target index matching with the target sequence number is marked as an empty target index in the correspondence and the matching relationship under the offset distance.
The minimum value of the target index is 1, and the maximum value is the length of the target illumination sequence. Therefore, in any determined matching relationship, if the target index matched with any target sequence number is smaller than 1 or larger than the length of the target illumination sequence corresponding to the target index, the target index corresponding to the target sequence number is empty. At this time, the matching relationship may be marked, where the target sequence number corresponds to a null element, and the null element occupies an element position.
When a plurality of candidate illumination sequences are extracted from the first illumination sequence according to the sequence number information of each video frame in the video frame sequence and the index information of each illumination element in the first illumination sequence, determining, for each matching relation, an empty element with an index of the illumination element matched with the sequence number of any video frame in the first illumination sequence being empty under the matching relation. And determining other illumination elements according to the sequence numbers of other video frames in the video frame sequence and the index information of each illumination element in the first illumination sequence. And generating a candidate illumination sequence under the matching relation according to the null element and other illumination elements.
If a matching relation is marked with a null element corresponding to the target sequence number 3, when the candidate illumination sequence is extracted according to the matching relation, the 3 rd illumination element in the extracted candidate illumination sequence is the null element.
Determining target illumination elements corresponding to the positions of all non-empty elements in the candidate illumination sequence in the second illumination sequence when calculating the similarity value of the second illumination sequence and the candidate illumination sequence; calculating the similarity of each non-empty element and the target illumination element corresponding to the position; and determining an average value of the similarity of each non-empty element and the target illumination element corresponding to the position as a similarity value between the candidate illumination sequence and the second illumination sequence.
And calculating the similarity between the candidate illumination sequence and the second illumination sequence according to the non-null elements in the candidate illumination sequence and the illumination elements in the second illumination sequence corresponding to each non-null element.
Deleting the empty element in the candidate illumination sequence to obtain a new candidate illumination sequence under the condition that any candidate illumination sequence comprises the empty element; deleting the illumination elements which are positioned at the corresponding element positions with the empty elements in the second illumination sequence according to the element positions of the empty elements to obtain a new second illumination sequence; and determining the similarity value between the new candidate illumination sequence and the new second illumination sequence as the similarity value between the candidate illumination sequence and the second illumination sequence.
For example, if a matching relationship is (1-4, 2-7, 3-null), then candidate illumination sequences may be generated based on the 4 th and 7 th elements in the first illumination sequence, and a null element. Because the null element occupies one element position, the candidate illumination sequence has a length of 3. Deleting empty elements in the candidate illumination sequence when the similarity between the candidate illumination sequence and the second illumination sequence is calculated, so as to obtain a new candidate illumination sequence; and deleting the 3 rd illumination element in the second illumination sequence to obtain a new second illumination sequence. And calculating the similarity between the new candidate illumination sequence and the new second illumination sequence, and determining the similarity as the similarity between the candidate illumination sequence and the second illumination sequence.
Thus, consider the case where the index of the illumination element matching the video frame in the illumination sequence is out of range of the illumination sequence when there is an offset. When the candidate illumination sequence is extracted from the first illumination sequence according to the matching relation, the length of the obtained candidate illumination sequence is identical to that of the second illumination sequence by setting the empty element occupying the element position, and the illumination element needing to calculate the similarity in the second illumination sequence can be determined according to the element position occupied by the empty element.
In some embodiments, as shown in fig. 2, a video to be detected is acquired, where the number of original video frames included in the video to be detected is set to n, and the original video frames included in the video to be detected are v= (V) 1 ,…,v n ). Obtain a first illumination sequence y= (y) 1 ,…,y N ) The first illumination sequence has a length of N.
Uniformly extracting m video frames from the video to be detected to obtain a video frame sequence V ' = (V ') ' 1 ,…,v' m ). Let c=n/m, the i-th video frame in the sequence of video frames be the i 'th original video frame in the original video, i' =s (i) =ceil (c/2+c ×i) =ceil (n/2m+i×n/m), ceil being an upward rounding function; i=1, 2, …, m, characterizing the sequence numbers of each of the m video frames. Then the video frame sequence V '= (V' 1 ,…,v' m )=(v s(1) ,…,v s(m) )。
Processing each video frame in the video frame sequence, determining a corresponding pixel point of an entity position point of an object to be detected in each video frame in the video frame sequence, obtaining a corresponding pixel point of one entity position point in each video frame, and reflecting light in each video frame in the video frame sequence respectively, so as to obtain a second illumination sequence. The physical location point of the object to be detected refers to a point where the object to be detected actually exists, for example, when the object to be detected is a face, the physical location point of the object to be detected may be a point on a nose of the face, and the size of the point is the size represented by one pixel point in the video. Because each illumination element in the second illumination sequence characterizes light reflected from one video frame, the length of the second illumination sequence is the same as the length of the video frame sequence, both being m.
The correspondence between the sequence numbers of video frames in the sequence of video frames and the frame numbers of the original video frames can be characterized as s, where i' =s (i) =ceil (c/2+c ×i) =ceil (n/2m+i×n/m). The correspondence may also characterize an extraction rule for extracting video frames from the video to be detected, which is related to the value of n, since the value of m is determined. Under such extraction rules, the correspondence s is therefore related to the number n of original video frames contained in the video to be detected.
A plurality of matching relationships may be obtained, and the plurality of matching relationships may be determined as follows.
And obtaining a target video, and extracting m target video frames from the target video. The extraction rule for extracting the target video frame from the original video is the same as the extraction rule for extracting the video frame from the target video, so that the corresponding relation between the target sequence number of the target video frame and the frame sequence number of the original video frame is s, and the corresponding relation between the sequence number of the video frame in the video frame sequence and the frame sequence number of the original video frame is the same.
And acquiring a target illumination sequence, wherein the length of the target illumination sequence is the same as that of the first illumination sequence. Let n=p×q be the case when p colors of light are used in total in the target illumination sequence, and each color of light occupies q element positions. The index sequence corresponding to the target illumination sequence is index y = (1., where, N). Removing illumination elements at the head and tail ends of the index sequence, wherein the number of the removed illumination elements can be set according to requirements, d=floor (q/2) which is a downward rounding function, and a new index sequence index is obtained y '= (d, d+1,) N-d, where the length of the new index sequence is N' =n-floor (q/2) ×2. In general, N' is not equal to N, i.e. the length of the sequence formed by the target illumination sequence with the illumination elements at the head and tail ends removed is different from that of the sequence formed by the original video frames.
And carrying out sliding matching on a sequence formed by the target illumination sequence and the original video frames in a sliding window mode, and recording the corresponding relation between each original video frame and illumination elements in the target illumination sequence under different offset distances. The offset distance is characterized by dt, then offset distance dt=0, 1. The N' -N is the absolute value of the difference between the length of the new index sequence and the length of the sequence of original video frames. At this time, the index of the i 'th original video frame in the new index sequence is r (i')=i '-dt, i' =0, 1,.. thus, the index of i of the target video frames in the new index sequence is r (i) =s (i) -dt, i=0, 1.
From the index r (i) =s (i) -dt of i target video frames in the new index sequence, a matching relationship f, f (i) =i' -dt=s (i) -dt=ceil (n/2m+i×n/m) -dt can be obtained. When n and dt take different values, a plurality of matching relations can be obtained.
Limited by the length of the new index sequence, therefore, when r (i) < 1 or r (i) is greater than N', then the target video frame is considered to have no corresponding illumination element in the target illumination sequence. Where r (i) < 1 or r (i) is greater than N', f can be recorded separately i =null。
And removing repeated items in the multiple matching relations, so that a plurality of final matching relations can be obtained.
When in living body detection, a plurality of candidate illumination sequences can be obtained from the first illumination sequence directly according to a plurality of matching relations. For example, if m=5, n=20, and dt=1, the matching relationship f (i) =ceil [20 ]/(2×5) +i×20 ]/5 ] -1.i has values of 1, 2, 3, 4 and 5, respectively, and f (i) corresponding to the values of 5, 9, 13, 17 and 21, respectively. Thus, a candidate illumination sequence may be generated from the 5 th, 9 th, 13 th, 17 th, 21 st illumination element in the first illumination sequence.
When n and dt take other values, other matching relations can be obtained, and other candidate illumination sequences are generated according to the obtained other matching relations.
The possible values of n and dt are traversed, and the obtained matching relations cover the various possibilities of the original video frame number of the video to be detected and the conditions of various step numbers of asynchronous between the video to be detected and the first illumination sequence. However, from among the plurality of matching relationships, there is one matching relationship conforming to the actual situation. It can be understood that, in the matching relationship conforming to the actual situation, the similarity between the candidate illumination sequence and the second illumination sequence is the highest. Thus, the target candidate illumination sequence may be selected from the plurality of candidate illumination sequences based on a similarity between each candidate illumination sequence and the second illumination sequence.
Generating a response diagram of the object to be detected according to the second illumination sequence and the target candidate illumination sequence, wherein the response intensity of each pixel point in the response diagram is characterized by: similarity between the second illumination sequence reflected by the entity position point corresponding to the pixel point and the first illumination sequence; and acquiring a living body detection result of the object to be detected according to the response diagram.
By adopting the technical scheme of the embodiment of the application, the method has the following advantages:
1. the length of the target illumination sequence is the same as that of the first illumination sequence, the number of target video frames extracted from the original video is the same as that of video frames extracted from the video to be detected, and the extraction rule is also the same, so that various matching relations suitable for the video to be detected and the first illumination sequence can be calculated in advance according to the target illumination sequence, the original video, the target video frames and the like, and the living body detection efficiency is improved.
2. The matching relation comprises the unknown expected total frame number of the original video, so that various matching relations comprise the matching relation applicable to the condition of frame loss or multiframe of the video to be detected. The matching relationship includes unknown offset distances, and therefore, the plurality of matching relationships includes a matching relationship suitable for when the video to be detected and the first illumination sequence have an unsynchronized number of unsynchronized states.
3. The frame loss or frames of the video to be detected are usually due to the frame loss or frames of the video frames at the end-to-end. When the matching relationship is determined, the illumination elements at the head end and the tail end of the target illumination sequence are removed. Therefore, when the candidate illumination sequences are extracted according to the matching relation, illumination elements at the head end and the tail end of the first illumination sequence are also eliminated, so that the similarity at the head end and the tail end is eliminated when the similarity is calculated.
4. Compared with the method for calculating the similarity according to each video frame of the video to be detected, the method for calculating the similarity according to the video frames of the target frame number only needs to be used for calculating the similarity, so that the calculated amount is greatly reduced, and the time-consuming time of living body detection is shortened.
5. The number of assumed total frames and offset distances of the original video frames are exhausted in the various matching relations, so that the various candidate illumination sequences extracted based on the various matching relations cover various possibilities of the original video frames of the video to be detected and the corresponding candidate illumination sequences under each condition that various step-number dyssynchrony exists between the video to be detected and the first illumination sequence. Therefore, the target candidate illumination sequence which is matched with the video frame sequence and accords with the real matching relation can be screened from a plurality of candidate illumination sequences. Thus, the obtained living body detection result is also more accurate.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts described, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are all preferred embodiments and that the acts referred to are not necessarily required by the embodiments of the present application.
Fig. 3 is a schematic structural diagram of a living body detection apparatus according to an embodiment of the present application, and as shown in fig. 3, the living body detection apparatus includes a video acquisition module 31, a video extraction module 32, a sequence extraction module 33, and a result acquisition module 34, wherein:
the video acquisition module 31 is configured to acquire a video to be detected, where the video to be detected is: during the irradiation of the object to be detected according to the first illumination sequence, the acquired video of the object to be detected;
a video extraction module 32, configured to extract a video frame sequence of a target frame number from the video to be detected, and determine a second illumination sequence according to each video frame in the video frame sequence, where the second illumination sequence represents reflected light of each physical location point of the object to be detected;
A sequence extracting module 33, configured to extract a plurality of candidate illumination sequences from the first illumination sequence according to sequence number information of each video frame in the video frame sequence and index information of each illumination element in the first illumination sequence, where the index information of each element in each candidate illumination sequence and the sequence number information of each video frame in the video frame sequence satisfy different matching relations;
and a result obtaining module 34, configured to obtain a living body detection result of the object to be detected according to the multiple candidate illumination sequences and the second illumination sequence.
Optionally, the matching relationship is determined based on the target video and the target illumination sequence;
the target video is the video to be detected, and the target illumination sequence is the first illumination sequence;
or the target video is a sample video, and the target illumination sequence is a sample illumination sequence with the same length as the first illumination sequence.
Optionally, the matching relationship is determined by the following procedure:
acquiring the target video and the target illumination sequence, wherein the target video comprises a plurality of original video frames;
Determining a corresponding relation between a target sequence number of a target video frame extracted from the target video and a frame sequence number of an original video frame of the target video;
performing sliding matching on the original video frame and the target illumination sequence, and determining a plurality of offset distances;
and determining a plurality of matching relations according to the corresponding relation and the plurality of offset distances.
Optionally, the determining a correspondence between the sequence number of the target video frame extracted from the target video and the frame sequence number of the original video frame of the target video includes:
acquiring a plurality of assumed total frames of the target video;
for each assumed total frame number, determining a corresponding relation between a target sequence number of the target video frame and a frame sequence number of the original video frame;
the determining a plurality of matching relationships according to the corresponding relationship and the plurality of offset distances includes:
and determining a plurality of matching relations according to the plurality of corresponding relations and the plurality of offset distances.
Optionally, before the sliding matching the original video frame with the target illumination sequence and determining the plurality of offset distances, the method further includes:
Removing illumination elements at the head end and the tail end of the target illumination sequence;
the sliding matching the original video frame with the target illumination sequence, and determining a plurality of offset distances, including:
and performing sliding matching on the original video frame and a target illumination sequence with illumination elements at the head end and the tail end removed, and determining a plurality of offset distances.
Optionally, the determining a plurality of matching relationships according to the correspondence relationship and the offset distances includes:
determining a target index of an illumination element matched with the target sequence number of each target video frame in the target illumination sequence under each corresponding relation and each offset distance;
and obtaining the multiple matching relations based on the target indexes matched with each target sequence number under each corresponding relation and each offset distance.
Optionally, the obtaining the multiple matching relationships based on the target index matched with each target sequence number under each corresponding relationship and each offset distance includes:
under any corresponding relation and any offset distance, marking the target index matched with the target sequence number of the target video frame as an empty target index under the condition that the target index matched with the target sequence number of any target video frame is smaller than 1 or larger than the length of the target illumination sequence corresponding to the target index;
And determining the corresponding relation and the matching relation under the offset distance according to the empty target index matched with the target video frame and the target indexes matched with other target video frames.
Optionally, the multiple correspondence between the target sequence number of each target video frame and the frame sequence number of the original video frame is s, where i '=s (i), i is the target sequence number, and i' is the frame sequence number corresponding to the target sequence number i;
under the multiple corresponding relations and the multiple offset distances, the target index matched with the target sequence number i of each target video frame is s (i) -dt, wherein dt is the offset distance;
under the plurality of corresponding relations and the plurality of offset distances, the plurality of matching relations are f, wherein f (i) =s (i) -dt=i' -dt.
Optionally, the frame number of the target video frame is m;
the corresponding relation between the target serial number of each target video frame and the frame serial number of the original video frame is s;
where i' =s (i) =ceil (c/2+c ×i), c=n/m, n is the assumed total frame number of the target video, ceil is an upward rounding function, i=1, 2, …, m, and each target sequence number of the m target video frames is characterized.
Optionally, the sequence extraction module 33 is specifically configured to perform:
for each matching relation, determining an empty element with an index of which the index is empty, of illumination elements matched with the sequence number of any video frame in the first illumination sequence under the matching relation;
determining other illumination elements according to the sequence numbers of other video frames in the video frame sequence and the index information of each illumination element in the first illumination sequence;
and generating the candidate illumination sequence under the matching relation according to the empty element and the other illumination elements.
Optionally, the result obtaining module 34 is specifically configured to perform:
respectively obtaining similarity values of each candidate illumination sequence and the second illumination sequence;
determining a target candidate illumination sequence according to the similarity value of each candidate illumination sequence and the second illumination sequence;
generating a response graph of the object to be detected according to the second illumination sequence and the target candidate illumination sequence, wherein the response intensity of each pixel point in the response graph is characterized by: similarity between the second illumination sequence reflected by the entity position point corresponding to the pixel point and the first illumination sequence;
and determining a living body detection result of the object to be detected according to the response diagram.
Optionally, the obtaining similarity values of the candidate illumination sequences and the second illumination sequence respectively includes:
determining target illumination elements in the second illumination sequence corresponding to the positions of the non-empty elements in the candidate illumination sequence according to each candidate illumination sequence;
calculating the similarity of each non-empty element and the target illumination element corresponding to the position;
and determining an average value of the similarity of each non-empty element and the target illumination element corresponding to the position as a similarity value between the candidate illumination sequence and the second illumination sequence.
It should be noted that, the device embodiment is similar to the method embodiment, so the description is simpler, and the relevant places refer to the method embodiment.
The embodiment of the application also provides an electronic device, and referring to fig. 4, fig. 4 is a schematic diagram of the electronic device according to the embodiment of the application. As shown in fig. 4, the electronic device 100 includes: the memory 110 and the processor 120 are connected through a bus communication, and a computer program is stored in the memory 110 and can run on the processor 120, so that the steps in the living body detection method disclosed in the embodiment of the application are realized.
The embodiments also provide a computer readable storage medium having stored thereon a computer program/instruction which, when executed by a processor, implements a living body detection method as disclosed in the embodiments of the present application.
Embodiments of the present application also provide a computer program product comprising a computer program/instruction which, when executed by a processor, implements the biopsy method as disclosed in embodiments of the present application.
The embodiment of the application also provides a computer program which can realize the living body detection method disclosed by the embodiment of the application when being executed.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present application may be provided as a method, apparatus, or computer program product. Accordingly, the present embodiments may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus, electronic devices, and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present embodiments have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the present application.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or terminal device comprising the element.
The foregoing has described in detail a living body detection method, an electronic device, a storage medium and a program product provided by the present application, and specific examples have been applied herein to illustrate the principles and embodiments of the present application, and the above examples are only used to help understand the method and core idea of the present application; meanwhile, as those skilled in the art will have modifications in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (15)

1. A living body detecting method, characterized by comprising:
obtaining a video to be detected, wherein the video to be detected is: during the irradiation of the object to be detected according to the first illumination sequence, the acquired video of the object to be detected;
extracting a video frame sequence of a target frame number from the video to be detected, and determining a second illumination sequence according to each video frame in the video frame sequence, wherein the second illumination sequence represents reflected light of each physical position point of the object to be detected;
extracting a plurality of candidate illumination sequences from the first illumination sequence according to the sequence number information of each video frame in the video frame sequence and the index information of each illumination element in the first illumination sequence, wherein the index information of each element in each candidate illumination sequence and the sequence number information of each video frame in the video frame sequence meet different matching relations;
And acquiring a living body detection result of the object to be detected according to the plurality of candidate illumination sequences and the second illumination sequence.
2. The method of claim 1, wherein the matching relationship is determined based on a target video and a target illumination sequence;
the target video is the video to be detected, and the target illumination sequence is the first illumination sequence;
or the target video is a sample video, and the target illumination sequence is a sample illumination sequence with the same length as the first illumination sequence.
3. The method of claim 2, wherein the matching relationship is determined by:
acquiring the target video and the target illumination sequence, wherein the target video comprises a plurality of original video frames;
determining a corresponding relation between a target sequence number of a target video frame extracted from the target video and a frame sequence number of an original video frame of the target video;
performing sliding matching on the original video frame and the target illumination sequence, and determining a plurality of offset distances;
and determining a plurality of matching relations according to the corresponding relation and the plurality of offset distances.
4. The method of claim 3, wherein determining a correspondence between a sequence number of a target video frame extracted from the target video and a frame sequence number of an original video frame of the target video comprises:
acquiring a plurality of assumed total frames of the target video;
for each assumed total frame number, determining a corresponding relation between a target sequence number of the target video frame and a frame sequence number of the original video frame;
the determining a plurality of matching relationships according to the corresponding relationship and the plurality of offset distances includes:
and determining a plurality of matching relations according to the plurality of corresponding relations and the plurality of offset distances.
5. The method of claim 3, wherein before sliding matching the original video frame to the target illumination sequence and determining a plurality of offset distances, the method further comprises:
removing illumination elements at the head end and the tail end of the target illumination sequence;
the sliding matching the original video frame with the target illumination sequence, and determining a plurality of offset distances, including:
and performing sliding matching on the original video frame and a target illumination sequence with illumination elements at the head end and the tail end removed, and determining a plurality of offset distances.
6. The method according to any one of claims 3-5, wherein determining a plurality of matching relationships based on the correspondence and the plurality of offset distances comprises:
determining a target index of an illumination element matched with the target sequence number of each target video frame in the target illumination sequence under each corresponding relation and each offset distance;
and obtaining the multiple matching relations based on the target indexes matched with each target sequence number under each corresponding relation and each offset distance.
7. The method of claim 6, wherein the obtaining the plurality of matching relationships based on the target index matching each target sequence number at each of the correspondence relationships and each of the offset distances comprises:
under any corresponding relation and any offset distance, marking the target index matched with the target sequence number of the target video frame as an empty target index under the condition that the target index matched with the target sequence number of any target video frame is smaller than 1 or larger than the length of the target illumination sequence corresponding to the target index;
And determining the corresponding relation and the matching relation under the offset distance according to the empty target index matched with the target video frame and the target indexes matched with other target video frames.
8. The method according to any one of claims 3-5, wherein the plurality of correspondence between the target sequence number of each target video frame and the frame sequence number of the original video frame is s, where i '=s (i), i is the target sequence number, and i' is the frame sequence number corresponding to the target sequence number i;
under the multiple corresponding relations and the multiple offset distances, the target index matched with the target sequence number i of each target video frame is s (i) -dt, wherein dt is the offset distance;
under the plurality of corresponding relations and the plurality of offset distances, the plurality of matching relations are f, wherein f (i) =s (i) -dt=i' -dt.
9. The method of any of claims 3-5, wherein the number of frames of the target video frame is m;
the corresponding relation between the target serial number of each target video frame and the frame serial number of the original video frame is s;
where i' =s (i) =ceil (c/2+c ×i), c=n/m, n is the assumed total frame number of the target video, ceil is an upward rounding function, i=1, 2, …, m, and each target sequence number of the m target video frames is characterized.
10. The method according to any one of claims 1-5, wherein the extracting a plurality of candidate illumination sequences from the first illumination sequence according to the sequence number information of each video frame in the video frame sequence and the index information of each illumination element in the first illumination sequence includes:
for each matching relation, determining an empty element with an index of which the index is empty, of illumination elements matched with the sequence number of any video frame in the first illumination sequence under the matching relation;
determining other illumination elements according to the sequence numbers of other video frames in the video frame sequence and the index information of each illumination element in the first illumination sequence;
and generating the candidate illumination sequence under the matching relation according to the empty element and the other illumination elements.
11. The method according to any one of claims 1-5, wherein obtaining the living body detection result of the object to be detected according to the plurality of candidate illumination sequences and the second illumination sequence comprises:
respectively obtaining similarity values of each candidate illumination sequence and the second illumination sequence;
determining a target candidate illumination sequence according to the similarity value of each candidate illumination sequence and the second illumination sequence;
Generating a response graph of the object to be detected according to the second illumination sequence and the target candidate illumination sequence, wherein the response intensity of each pixel point in the response graph is characterized by: similarity between the second illumination sequence reflected by the entity position point corresponding to the pixel point and the first illumination sequence;
and determining a living body detection result of the object to be detected according to the response diagram.
12. The method according to claim 11, wherein the obtaining similarity values of the candidate illumination sequences and the second illumination sequence, respectively, comprises:
determining target illumination elements in the second illumination sequence corresponding to the positions of the non-empty elements in the candidate illumination sequence according to each candidate illumination sequence;
calculating the similarity of each non-empty element and the target illumination element corresponding to the position;
and determining an average value of the similarity of each non-empty element and the target illumination element corresponding to the position as a similarity value between the candidate illumination sequence and the second illumination sequence.
13. An electronic device comprising a memory, a processor and a computer program stored on the memory, characterized in that the processor executes the computer program to implement the living body detection method of any one of claims 1 to 12.
14. A computer readable storage medium having stored thereon a computer program/instruction which, when executed by a processor, implements the living body detection method according to any of claims 1 to 12.
15. A computer program product comprising computer program/instructions which, when executed by a processor, implements the in vivo detection method according to any one of claims 1 to 12.
CN202310306903.1A 2022-05-16 2023-03-24 Living body detection method, electronic device, storage medium, and program product Pending CN116434349A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202310306903.1A CN116434349A (en) 2023-03-24 2023-03-24 Living body detection method, electronic device, storage medium, and program product
PCT/CN2023/094603 WO2023221996A1 (en) 2022-05-16 2023-05-16 Living body detection method, electronic device, storage medium, and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310306903.1A CN116434349A (en) 2023-03-24 2023-03-24 Living body detection method, electronic device, storage medium, and program product

Publications (1)

Publication Number Publication Date
CN116434349A true CN116434349A (en) 2023-07-14

Family

ID=87088282

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310306903.1A Pending CN116434349A (en) 2022-05-16 2023-03-24 Living body detection method, electronic device, storage medium, and program product

Country Status (1)

Country Link
CN (1) CN116434349A (en)

Similar Documents

Publication Publication Date Title
CN110765923B (en) Face living body detection method, device, equipment and storage medium
CN110163078A (en) The service system of biopsy method, device and application biopsy method
CN107590473B (en) Human face living body detection method, medium and related device
CN112419295B (en) Medical image processing method, medical image processing device, computer equipment and storage medium
CN110532746B (en) Face checking method, device, server and readable storage medium
CN113111806B (en) Method and system for target recognition
CN112102424A (en) License plate image generation model construction method, generation method and device
CN112818821B (en) Human face acquisition source detection method and device based on visible light and infrared light
CN113033305B (en) Living body detection method, living body detection device, terminal equipment and storage medium
CN113569627A (en) Human body posture prediction model training method, human body posture prediction method and device
CN115147936A (en) Living body detection method, electronic device, storage medium, and program product
CN113111810B (en) Target identification method and system
CN116434349A (en) Living body detection method, electronic device, storage medium, and program product
CN118038494A (en) Cross-modal pedestrian re-identification method for damage scene robustness
CN111738062A (en) Automatic re-identification method and system based on embedded platform
CN116777766A (en) Image enhancement method, electronic device and storage medium
CN114862868B (en) Cerebral apoplexy final infarction area division method based on CT perfusion source data
CN114445898B (en) Face living body detection method, device, equipment, storage medium and program product
CN114565544A (en) Image fusion method, device, product and medium
CN114299572A (en) Face age estimation method and device and electronic equipment
WO2023221996A1 (en) Living body detection method, electronic device, storage medium, and program product
CN114972881A (en) Image segmentation data labeling method and device
CN113887353A (en) Visible light-infrared pedestrian re-identification method and system
CN114581978A (en) Face recognition method and system
CN118212697B (en) Feature extraction method, gait analysis method, recognition method, device and medium

Legal Events

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