WO2018153294A1 - 人脸跟踪方法、存储介质及终端设备 - Google Patents

人脸跟踪方法、存储介质及终端设备 Download PDF

Info

Publication number
WO2018153294A1
WO2018153294A1 PCT/CN2018/076238 CN2018076238W WO2018153294A1 WO 2018153294 A1 WO2018153294 A1 WO 2018153294A1 CN 2018076238 W CN2018076238 W CN 2018076238W WO 2018153294 A1 WO2018153294 A1 WO 2018153294A1
Authority
WO
WIPO (PCT)
Prior art keywords
face
current frame
network model
key point
layer
Prior art date
Application number
PCT/CN2018/076238
Other languages
English (en)
French (fr)
Inventor
赵凌
李季檩
Original Assignee
腾讯科技(深圳)有限公司
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 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2018153294A1 publication Critical patent/WO2018153294A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/48Matching video sequences
    • 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/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation

Definitions

  • the present application relates to the field of communications technologies, and in particular, to a face tracking method, a storage medium, and a terminal device.
  • face tracking technology has been greatly developed, and in many fields, such as monitoring, video conferencing, and distance learning, specific faces need to be tracked and analyzed.
  • each layer of the network model needs to have a separate storage area.
  • the storage area can be set by a configuration file. For example, when allocating storage resources, the configuration file can be read.
  • the storage space size is calculated for the current layer, and the storage space is allocated for the current layer, and the storage area of each layer needs to be allocated independently, and there is no shared memory between the storage areas of each layer.
  • a face tracking method is provided, which is applied to a terminal device, and the method includes: acquiring a video stream that requires face tracking and a network model for deep learning; allocating memory resources to the network model, so that All layers of the network model share the same storage space; based on allocation The memory resource and the network model track the faces in the video stream.
  • a method for tracking a face is provided, which is applied to a terminal device, the method comprising: acquiring an image frame from a video stream as a current frame; acquiring the current current in the video stream a face key point coordinate of a previous frame of the frame and a confidence level corresponding to the face key point coordinate of the previous frame; and allocating a memory resource based on the memory resource, the face key point of the previous frame a coordinate and a confidence level corresponding to the face key point coordinate of the previous frame, using a depth learning based network model, determining a face key point coordinate of the current frame and a face key point coordinate of the current frame Corresponding confidence.
  • a terminal device includes: a processor and a memory; and the memory stores computer readable instructions, where the processor is configured to: obtain a video stream that requires face tracking, and deep learning a network model; allocating memory resources to the network model such that all layers of the network model share the same storage space; and tracking faces in the video stream based on the allocated memory resources and the network model.
  • a terminal device including: a processor and a memory; the memory storing computer readable instructions, the processor: causing the processor to: acquire an image frame from a video stream, and Obtaining, as a current frame, a face keypoint coordinate of a previous frame of the current frame in the video stream and a confidence corresponding to a face keypoint coordinate of the previous frame; and allocating memory resources, based on Determining a memory resource, a face key point coordinate of the previous frame, and a confidence level corresponding to the face key point coordinate of the previous frame, and determining a face key of the current frame by using a network model based on deep learning Point coordinates and a confidence level corresponding to the face key point coordinates of the current frame.
  • a non-volatile storage medium storing one or more programs, the one or more programs including instructions, when executed by a computing device, causes the computing device
  • the face tracking method according to the present application is performed.
  • the embodiment of the present application may acquire a corresponding deep learning network model, and allocate memory resources for the network model, so that all layers of the network model share the same storage space. .
  • the embodiment of the present application processes the video stream based on the allocated memory resource and the network model to implement real-time tracking of the face. Since all the layers of the network model can share the same storage space, the embodiment of the present application does not need to allocate a separate storage space for each layer of the network model, which can greatly save memory usage and improve computational efficiency. Distribution At one time, the embodiment of the present application can also greatly reduce the number of allocation operations, reduce storage fragmentation, and improve application performance. BRIEF DESCRIPTION OF THE DRAWINGS
  • FIG. 1a is a schematic diagram of a scene of a face tracking method provided by an embodiment of the present application
  • FIG. 1b is a flowchart of a face tracking method provided by an embodiment of the present application.
  • Figure lc is a schematic diagram of memory allocation in the face tracking method provided by the embodiment of the present application.
  • FIG. 1 is a schematic diagram of the use of the memory space in the face tracking method provided by the embodiment of the present application
  • FIG. 2 a is another flowchart of the face tracking method provided by the embodiment of the present application
  • FIG. 2b is a schematic diagram of various levels of a network model in a face tracking method according to an embodiment of the present disclosure
  • FIG. 3 is a schematic structural diagram of a face tracking device according to an embodiment of the present application
  • FIG. 4 is a flowchart of a face tracking method provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
  • the technical solutions in the embodiments of the present application are clearly and completely described in conjunction with the drawings in the embodiments of the present application. It is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of them. An embodiment. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without the creative work are all within the scope of the present application.
  • Embodiments of the present application provide a face tracking method and apparatus.
  • the face tracking device is specifically integrated in a terminal device such as a mobile terminal.
  • the mobile terminal may acquire a corresponding deep learning network model, and allocate memory resources for the network model at one time, so that all layers of the network model share the same storage.
  • the mobile terminal can calculate a storage space required for each layer of the network in the network model, and select a maximum value thereof as a pre-allocated storage space, and according to the network The model allocates memory resources. After the memory resource is allocated, the mobile terminal can track the face in the video stream based on the allocated memory resource and the network model, thereby saving memory usage, reducing storage fragmentation, and improving computational efficiency.
  • the face tracking device may be integrated into a terminal device such as a mobile terminal, and the mobile terminal may include a mobile phone, a tablet computer, or a smart wearing device.
  • a face tracking method includes: acquiring a video stream that requires face tracking, and a network model for deep learning, allocating memory resources for the network model, so that all layers of the network model share the same storage space, based on allocated memory The resource and the network model track the faces in the video stream.
  • the specific process of the face tracking method may include steps 101, 102, and 103.
  • step 101 a video stream that requires face tracking, and a network model of deep learning are acquired.
  • a video stream can be obtained from a local or other storage device, as well as a network model for deep learning, and the like.
  • the network model can be set according to the requirements of the actual application, and details are not described herein again.
  • the memory resource is allocated to the network model in step 102, so that all layers of the network model share the same storage space.
  • the details may be as follows:
  • a configuration file of a network model can be obtained, and the storage space required for each layer of the network in the network model is calculated according to the configuration file.
  • the details can be as follows:
  • the configuration file of the network model is read, and second, the number of parameters of each network layer is calculated according to the configuration file.
  • the number of parameters of each network layer is proportional to the number of neurons in the network layer, but is not limited thereto.
  • step 102 can obtain the input (ie, Bottom) Blob, the output (ie, Top) Blob of each layer network, and the size of the Blob (ie, temporary blob) that the layer needs to be temporarily opened according to the number of parameters.
  • step 102 can calculate the storage space required by the layer network according to the Bottom Blob, Top Blob and Temporary Blob of the layer network, for example, the size of the A+B+C area as shown in FIG.
  • Area A can be used as For the input area of this layer, it can also be used as the output area of the upper layer or the next layer.
  • the B area is the temporary area of this layer.
  • the C area can be used as the output area of this layer or as the upper layer. Or the input area of the next layer.
  • Blob is the storage unit name of the deep network model, for example, a four-dimensional matrix, which contains the dimensions of each dimension of the matrix.
  • step 102 may use the maximum value of the storage space required by each network layer as the size of the pre-allocated storage space.
  • the storage space required by the fifth layer is taken as the size of the pre-allocated storage space, and so on, etc. .
  • Step 102 may allocate a memory resource for the network model according to the size of the pre-allocated storage space. That is, it is only necessary to allocate the memory resources of the pre-allocated storage space for the network model at one time, and no other space needs to be allocated in the forward calculation.
  • the memory allocation process of the forward calculation can be as shown in Figure Id: Assume that the A area currently stores the input area of the nth layer (ie Bottom Blob) data, the B area stores the temporary data required by the current layer, and the C area stores the calculated data.
  • the output area (Top Blob) data after the nth layer calculates the output result, the output area (ie, Top Blob) pointer can be assigned to the input area of the n+1th layer (ie, Bottom Blob), and A The input area pointer of the area is assigned to the output area of the n+1th layer (ie, Top Blob) for storing the output result of the n+1th layer, and the B area is also used for storing the temporary data of the n+1th, so repeated , the entire forward network calculation can be completed, there is no other data copy and transmission, even the pointer assignment operation can be completed in the preprocessing stage.
  • the face in the video stream is tracked based on the allocated memory resources and the network model.
  • step 103 may determine an image that needs to be processed according to the video stream to obtain a current frame.
  • step 103 may acquire the coordinates of the face key points and the confidence of the image of the previous frame of the current frame.
  • the key points of the face refer to information that reflects the characteristics of the face, such as the eyes, eyebrows, nose, mouth, and contours of the face.
  • Face key coordinates refer to the coordinates of the set of these facial key points
  • the coordinates of each set of facial key points may be an array with a, for example an array (Xl, yi, x 2, y 2, x n, y n) To characterize, where ( Xl , y.) represents the coordinates of the i-th point.
  • step 103 may predict the coordinates and confidence of the face key point of the current frame based on the allocated memory resource, the network model, the face key point coordinates of the previous frame image, and the confidence, and return the execution basis.
  • the video stream determines the steps of the image that are currently to be processed until the images in the video stream are processed.
  • There may be various ways to predict the coordinates and confidence of the face key points of the current frame based on the allocated memory resources, the network model, the face key coordinates of the previous frame image, and the confidence.
  • step S103 may determine the coordinates of the face key point of the current frame and the face key of the current frame by using the allocated memory resource and the network model.
  • the confidence level corresponding to the point coordinates is used to indicate the probability that the area described by the face key point coordinates of the current frame is a face.
  • step 103 may determine coordinates corresponding to the coordinates of the face key points of the previous frame in the current frame, and determine the first reference face region in the current frame. For example, step 103 may generate a reference frame enveloping face keypoint coordinates based on the face keypoint coordinates.
  • step 103 may extract an area corresponding to the position of the reference frame as the first reference face area in the current frame. Based on this, step S103 can process the first reference face region by using the network model to obtain the face key point coordinates of the current frame and the confidence level corresponding to the face key point coordinates of the current frame.
  • the network model described above includes a public network portion, a keypoint prediction branch, and a confidence prediction branch.
  • Step 103 may perform feature extraction on the first reference face region through the public network portion to obtain a corresponding feature extraction result. On the basis of this, step 103 may process the feature extraction result by the key point prediction branch, obtain the coordinates of the face key point of the current frame, and process the feature extraction result by the confidence prediction branch to obtain the current frame. Confidence.
  • step 103 can use the method of face detection to acquire the second reference face region in the current frame.
  • step 103 may also use the method of face detection to obtain the current frame.
  • the second reference face area may also use the method of face detection to obtain the current frame.
  • step 103 may pass the face based on the allocated memory resource.
  • the detection algorithm detects the face in the current frame to determine the coordinates and confidence of the face key of the current frame.
  • the strong classifier is trained as follows: based on the face image sample, the face feature of the face image sample is calculated by the image integration map, thereby The calculated facial features construct a strong classifier that distinguishes between faces and non-human faces.
  • the embodiment of the present application may adopt an Adaboost algorithm to construct a strong classifier that distinguishes between a face and a non-face, and cascade the strong classifiers in a cascade manner.
  • the strong classifier is cascaded in the same system.
  • Adaboost is an iterative algorithm, the core idea is to train different classifiers (weak classifiers) for the same training set, and then combine these weak classifiers to form a stronger final classifier (strong classifier) ).
  • step 103 can determine the second reference face region using the strong classifier. Further, step 103 may process the second reference face region by using the network model to obtain the coordinates of the face key point of the current frame and the confidence level corresponding to the face key point of the current frame.
  • the embodiment of the present application when performing face tracking on a video stream, can acquire a corresponding deep learning network model, and allocate memory resources for the network model, so that all layers of the network model share the same storage space. Then, the video stream is processed based on the allocated memory resource and the network model to implement real-time tracking of the face.
  • all layers of the network model can share the same storage space. Therefore, it is not necessary to allocate a separate storage space for each layer of the network model, which not only can greatly save memory usage, but also improve computational efficiency. Because it only needs to be allocated once, it can also greatly reduce the number of allocation operations, reduce storage fragmentation, and improve application performance.
  • a face tracking method As shown in FIG. 2a, a face tracking method, the specific process can be as follows:
  • the mobile terminal acquires a video stream.
  • the mobile terminal may specifically receive a video stream sent by another device, or acquire a video stream from a local storage space, and the like.
  • the mobile terminal acquires a network model for deep learning.
  • the network model may be set according to the requirements of the actual application.
  • the network model may include three parts. First, the first part is a public network part, and secondly, two branches that are subsequently generated by the public network part, and the key point prediction branch And the confidence prediction branch. Where each layer The number can be determined according to requirements.
  • the public network part can include 6 convolution layers, such as convolutional layer 1, convolutional layer 2, convolutional layer 3 a convolutional layer 4, a convolutional layer 5, and a convolutional layer 6, each convolutional layer followed by a modified linear unit (Relu, Rectified linear unit) activation function, referred to as a nonlinear activation function, a partial nonlinear activation function It can also be followed by a layer-to-one pooling layer for polymerization, as shown in Figure 2b.
  • 6 convolution layers such as convolutional layer 1, convolutional layer 2, convolutional layer 3 a convolutional layer 4, a convolutional layer 5, and a convolutional layer 6, each convolutional layer followed by a modified linear unit (Relu, Rectified linear unit) activation function, referred to as a nonlinear activation function, a partial nonlinear activation function It can also be followed by a layer-to-one pooling layer for polymerization, as shown in Figure 2b.
  • the key point prediction branch may include one convolution layer and three inner product layers.
  • the convolution layer 7 the inner layer 1, the inner layer 2, and the inner layer 3 may be included.
  • Each convolutional layer and inner layer are followed by a nonlinear activation function.
  • the confidence prediction branch may include one convolution layer (ie, convolution layer 8) and five inner layers (ie inner inner layer 4, inner inner layer 5, inner inner layer 6, inner inner layer 7, and inner inner layer 8) And a flexible maximum transfer function (Softmax) layer, wherein the Softmax layer outputs two values, which are face probability and non-face probability, respectively, which are added to 1.0.
  • each convolutional layer, and every two inner layers can be connected to a nonlinear activation function.
  • the mobile terminal calculates a storage space required for each layer of the network in the network model.
  • the configuration file of the network model may be read, and the number of parameters of each network layer is calculated according to the configuration file, and the input area, the output area, and the temporary area of each layer network are obtained, and then, according to the input area,
  • the size of the A+B+C area as shown in Figure lc can be calculated by the size of the output area and the temporary area. For details, see Embodiment 1, and details are not described here. .
  • the mobile terminal uses a maximum value in a storage space required by each layer as a size of the pre-allocated storage space, and allocates a memory resource to the network model according to the size of the pre-allocated storage space.
  • the memory allocation process of the forward calculation can be as shown in FIG. 1D: It is assumed that the input area data of the nth layer is currently stored in the A area, the temporary data required by the current layer is stored in the B area, and the output area data calculated in the C area is stored in the C area. After the nth layer calculates the output result, the output area pointer can be assigned to the input area of the n+1th layer, and the input area pointer of the A area is assigned to the output area of the n+1th layer for storage. The output of the n+1th layer, and the B zone is also used to save the n+1th temporary data. After the n+1th layer is processed, the value of n is updated to "n+1", and the above process is repeated. Repeatedly, the calculation of the entire forward network can be completed. For example, taking the initial value of n equal to 1 as an example, the details can be as follows:
  • the pointer of the output layer of the first layer (ie, the C area of the first layer) can be assigned to the input area of the second layer, and the input area pointer of the area A is assigned to the first layer.
  • 2-layer output area for storage The output result of the second layer, and the B area is also used to store the temporary data of the second layer.
  • the pointer of the output layer of the second layer (the C area of the second layer, which is also the A area of the first layer) can be assigned to the input area of the third layer, and
  • the input area pointer of the A area of the second layer ie, the C layer of the first layer
  • the B area is also used for storing the third temporary Data, and so on, and so on.
  • the calculation utilizes a feature of deep learning, that is, the calculation of the n+1th layer only needs to use the input region of the n+1th layer (ie, the output region of the nth layer) and the output region of the n+1th layer.
  • the memory occupied by the input area of the nth layer can be recycled; that is, all layers are operated in pre-allocated "A+B+C" memory.
  • the required storage space depends only on the storage space of a certain layer, so the memory resource occupation can be saved, so that the complex deep network is applied in the mobile terminal platform. may.
  • it since it is only a pointer assignment operation in memory, it can be very fast and efficient.
  • the mobile terminal determines, according to the video stream, an image that needs to be processed, to obtain a current frame.
  • the mobile terminal acquires face key coordinate and confidence of the previous frame image of the current frame, and then performs step 207.
  • the key points of the face refer to information that reflects the characteristics of the face, such as the eyes, eyebrows, nose, mouth, and contours of the face.
  • the face key coordinates refer to the coordinates of these face key points.
  • the face of the current frame can be obtained by detecting. Key point coordinates and confidence, ie step 208 is performed.
  • the mobile terminal determines whether the confidence of the coordinate of the face key point of the previous frame image is higher than a preset threshold. If yes, it indicates that the face key point tracking is successful, and step 209 is performed. Otherwise, if not higher than the preset The threshold value indicates that the face key point tracking fails, and step 208 is performed.
  • the preset threshold can be set according to the requirements of the actual application, and details are not described herein again.
  • the mobile terminal acquires a second reference face region by detecting a face in the current frame by using a face detection algorithm, and processing the second reference face region to determine a current frame by using a network model.
  • the face key point coordinates and confidence then step 210 is performed.
  • the detection manner may be multiple. For details, refer to the first embodiment.
  • the mobile terminal processes, by using the allocated memory resource, the first reference face region determined according to the coordinate of the face key point of the previous frame image, to obtain the coordinates of the face key point of the current frame and corresponding Confidence, then step 210 is performed.
  • the calculation of the coordinates of the key points of the face and the confidence can be synchronized, that is, the processing of the key point prediction branch and the confidence prediction branch can be parallel.
  • the mobile terminal determines whether the images in the video stream are all identified. If yes, the process ends. Otherwise, the process returns to step 205.
  • the face key point coordinates and the confidence of the current frame are used as a reference for the next frame image face tracking, and the loop is continued until the images in the video stream are all recognized.
  • the corresponding deep learning network model when the face tracking of the video stream is required, the corresponding deep learning network model can be obtained, and the memory resource is allocated to the network model, so that all layers of the network model share the same storage space, and then The video stream is processed based on the allocated memory resource and the network model to implement real-time tracking of the face in the mobile terminal.
  • all layers of the network model can share the same storage space in this solution, it is not necessary to allocate a separate storage space for each layer of the network model, which not only can greatly save memory usage and improve computational efficiency.
  • the number of allocation operations can be greatly reduced, and the storage fragmentation can be reduced, which is beneficial to improve application performance.
  • the scheme tracks abnormalities in the face, such as the confidence is less than or equal to the threshold. Or when the coordinates and confidence of the face key point of the previous frame are not obtained, the tracking reset can be automatically performed (that is, the coordinates and the confidence of the face key are obtained by detecting again), so that the face can be strengthened. Tracking continuity.
  • Embodiment 3 Because the solution has less memory requirements and higher computational efficiency, the device performance requirements are lower, and can be applied to devices such as mobile terminals. Therefore, the deep learning forward algorithm is placed on the server side. In terms of solutions, the face can be tracked more efficiently and flexibly, which is beneficial to improve the user experience.
  • the embodiment of the present application further provides a face tracking device.
  • the face tracking device includes an obtaining unit 301, an allocating unit 302, and a tracking unit 303, as follows: 301.
  • obtaining unit 301 For obtaining a video stream that needs face tracking, and a network for deep learning Model.
  • a video stream can be obtained from a local or other storage device, as well as a network model for deep learning, and the like.
  • the network model may be set according to the requirements of the actual application.
  • the network model may include a public network part, a key point prediction branch, and a confidence prediction branch.
  • a public network part For details, refer to the foregoing method embodiment, and details are not described herein. .
  • the allocating unit 302 is configured to allocate memory resources for the network model, so that all layers of the network model share the same storage space.
  • the allocation unit 302 can include a computing subunit and an assigning subunit, as follows:
  • the calculation subunit can be used to calculate the storage space required for each layer of the network in the network model.
  • the calculation subunit may be specifically configured to obtain a configuration file of the network model, and calculate a storage space required for each layer of the network in the network model according to the configuration file, for example, as follows:
  • the calculation subunit reads the configuration file of the network model, calculates the number of parameters of each network layer according to the configuration file, obtains the size of the input area, the output area, and the temporary area of each layer network, and then, according to the input area
  • the size of the A+B+C area as shown in Figure lc can be calculated by the size of the output area and the temporary area. For details, see Embodiment 1, and details are not described here. .
  • the allocation subunit may be used to use the maximum value of the storage space required by each layer as the size of the pre-allocated storage space, and allocate a memory resource to the network model according to the size of the pre-allocated storage space.
  • the tracking unit 303 is configured to track the face in the video stream based on the allocated memory resource and the network model.
  • the tracking unit 303 can include a determining subunit, a parameter obtaining subunit, and a predicting subunit, under:
  • Determining a subunit which may be used to determine an image that needs to be processed according to the video stream, to obtain a current frame
  • the parameter acquisition sub-unit can be used to obtain the coordinates of the face key point and the confidence of the image of the previous frame of the current frame.
  • the key points of the face refer to information that reflects the characteristics of the face, such as the eyes, eyebrows, nose, mouth, and contours of the face.
  • the face key coordinates refer to the coordinates of these face key points.
  • the prediction subunit may be configured to predict a face keypoint coordinate and a confidence of the current frame based on the allocated memory resource, the network model, the face key coordinate of the previous frame image, and the confidence, and trigger the determining subunit execution basis
  • the video stream determines the operation of the image currently being processed until the images in the video stream are processed.
  • the manner of predicting the coordinates and confidence of the face key points of the current frame based on the allocated memory resources, the network model, the face key coordinates of the previous frame image, and the confidence may be various.
  • the details may be as follows:
  • the prediction subunit may be specifically configured to determine, according to the coordinate of the face key point of the image of the previous frame, by using the allocated memory resource when the confidence of the image of the previous frame is greater than a preset threshold. Feature extraction is performed on a reference face region to obtain feature extraction results. In this way, the prediction subunit can predict the coordinates of the face key point of the current frame according to the feature extraction result, and calculate the confidence of the current frame.
  • the network model includes a public network part, a key point prediction branch, and a confidence prediction branch.
  • the implementation of the prediction subunit is the same as step 103, and details are not described herein again.
  • the foregoing units may be implemented as separate entities, and may be implemented in any combination, and may be implemented as the same entity or a plurality of entities.
  • the foregoing method embodiments and details are not described herein again. .
  • the face tracking device may be specifically integrated in a device such as a mobile terminal, and the mobile terminal may include a mobile phone, a tablet computer, or a smart wearable device.
  • the acquiring unit 301 can obtain the network model of the corresponding deep learning, and the allocating unit 302 allocates the memory resource to the network model, so that the network model is All layers share the same storage space, and then the tracking unit 303 processes the video stream based on the allocated memory resources and the network model to implement real-time tracking of the face; since in this scheme, all layers of the network model can be shared.
  • the same storage space therefore, there is no need to allocate a separate storage space for each layer of the network model, which not only can greatly save memory usage, improve computational efficiency, and, because only one allocation is required, the allocation operation can be greatly reduced. The number of times, reducing storage fragmentation, helps improve application performance.
  • FIG. 4 shows a schematic diagram of a face tracking method 400 in accordance with some embodiments of the present application.
  • the face tracking method 400 can be performed, for example, in a terminal device.
  • method 400 can include step 401.
  • step 401 an image frame from a video stream is acquired and used as the current frame.
  • the video stream is, for example, a video data stream acquired from a network in real time or a video data stream obtained locally, which is not limited in this application.
  • step 402 the coordinates of the face key point of the previous frame of the current frame in the video stream and the confidence level corresponding to the face key point coordinates of the previous frame are obtained.
  • step 403 the memory resource is allocated, based on the memory resource, the coordinates of the face key point of the previous frame, and the confidence corresponding to the coordinates of the face key point of the previous frame, and the network model based on the deep learning is used to determine the current frame.
  • the face key point coordinates and the confidence level corresponding to the face key point coordinates of the current frame are used to determine the current frame.
  • step 403 can calculate the storage space required for each layer of the network model. In addition, step 403 takes the maximum value of the storage space required for each layer as the size of the pre-allocated storage space. Thus, step 403 can allocate memory resources to the network model according to the size of the pre-allocated storage space.
  • step 403 may determine the first reference in the current frame according to the face key point coordinates of the previous frame image. Face area. Thus, step 403 can process the first reference face region using the network model to determine the face association point coordinates of the current frame and the confidence level corresponding to the face key point coordinates of the current frame.
  • the network model may include, for example, a public network portion, a keypoint prediction branch, and a confidence prediction branch.
  • Step 403 may perform feature extraction on the first reference face region through the public network portion to obtain a corresponding feature extraction result. Based on this, step 403 can process the feature extraction result by using the key point prediction branch to obtain the coordinates of the face key point of the current frame. Additionally, step 403 may process the feature extraction results using the confidence prediction branch to determine a confidence level corresponding to the coordinates of the face key points of the current frame.
  • step 403 may use the data input area of the previous layer in the allocated memory resources as the data output area of the next layer.
  • the data output area of the previous layer is used as the data input area of the next layer, and the temporary data area of the previous layer is used as the temporary data area of the latter layer.
  • step 403 may divide the memory resource into a first sub-region for the confidence prediction branch and for the key The second sub-area of the point prediction branch.
  • the data input area of the previous layer in the first sub-area is used as the data output area of the next layer, and the data output area of the previous layer is taken as the latter one.
  • the data input area of the layer, the temporary data area of the previous layer is used as the temporary data area of the next layer, and any adjacent two layers of the non-first layer in the prediction branch of the key point are in the second sub-area.
  • step 403 can simultaneously calculate the coordinates and confidence of the face key points of the current frame in the allocated memory resources.
  • step 403 may detect the current frame by using a face detection algorithm to determine a second reference face area. Based on this, step 403 may process the second reference face region by using a network model to determine a face key point coordinate of the current frame and a confidence level corresponding to a face key point coordinate of the current frame.
  • the face tracking method of the present application can simultaneously calculate the coordinate and confidence of the face key point of the current frame by using the allocated memory resource, so that the face can be accurately tracked quickly by using limited memory resources.
  • the mobile terminal may include a radio frequency (RF) circuit 501, a memory 502 including one or more computer readable storage media, and an input unit 503.
  • RF radio frequency
  • the display unit 504, the sensor 505, the audio circuit 506, the WiFi (Wireless Fidelity) module 507, the processor 508 including one or more processing cores, and the power supply 509 and the like It will be understood by those skilled in the art that the mobile terminal structure shown in FIG. 5 does not constitute a limitation to the mobile terminal, and may include more or less components than those illustrated, or some components may be combined, or different component arrangements. among them:
  • the memory 502 can be used to store software programs and modules, and the processor 508 executes various functional applications and data processing by running software programs and modules stored in the memory 502.
  • Processor 508 is the control center of the mobile terminal, connecting various portions of the entire handset using various interfaces and lines, by running or executing software programs and/or modules stored in memory 502, and recalling data stored in memory 502, Perform various functions and processing data of the mobile terminal to perform overall monitoring of the mobile phone.
  • the processor 508 can include one or more processing cores.
  • the processor 508 can integrate an application processor and a modem processor, wherein the application processor primarily processes an operating system, a user interface, an application, etc., and the modem processor primarily processes wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 508.
  • the processor 508 in the mobile terminal loads the executable file corresponding to the process of one or more applications into the memory 502 according to the following instructions, and is stored and stored by the processor 508.
  • the storage space required for each layer of the network in the network model may be calculated, for example, obtaining a configuration file of the network model, and calculating a storage space required for each layer of the network model according to the configuration file, and then
  • the maximum value of the storage space required by the layer is the size of the pre-allocated storage space, the memory resource is allocated to the network model according to the size of the pre-allocated storage space, and the like.
  • the structure of the network model may be set according to requirements of an actual application.
  • the network model may include a public network part, a key point prediction branch, and a confidence prediction branch.
  • the level of the public network part, the key point prediction branch, and the confidence prediction branch may also be determined according to the actual application requirements.
  • the manner of tracking the face in the video stream based on the allocated memory resource and the network model may be various, for example, the coordinates of the face key point and the confidence of the image of the previous frame of the current frame may be acquired, and then , predicting face key point coordinates and confidence of the current frame based on the allocated memory resource, the network model, the face key point coordinates of the previous frame image, and the confidence, that is, the storage in the memory
  • the application in 502 can also implement the following functions:
  • Determining an image currently to be processed according to the video stream obtaining a current frame; acquiring a face key point coordinate and a confidence of the previous frame image of the current frame; and based on the allocated memory resource, the network model, and the face of the previous frame image
  • the keypoint coordinates and confidence predict the face keypoint coordinates and confidence of the current frame, and return to the step of determining the image that needs to be processed according to the video stream until the images in the video stream are processed.
  • the detection method can be used to obtain the current value.
  • the coordinates of the face key points in the frame similarly, if the coordinates of the face key points of the previous frame of the current frame are not obtained.
  • the reliability for example, the current frame is the first frame of the video stream, and the detection of the face key coordinates in the current frame, that is, the application stored in the memory 402, can also be implemented as follows:
  • the face detection algorithm is adopted based on the allocated memory resource.
  • the current frame is detected to determine a second reference face region of the current frame, and the second reference face region is processed by the network model to obtain the face key point coordinates and the confidence of the current frame. .
  • the network model of the corresponding deep learning can be obtained, and the memory resource is allocated to the network model, so that the network model is All layers share the same storage space, and then the video stream is processed based on the allocated memory resources and the network model to realize real-time tracking of the face; since in this scheme, all layers of the network model can share the same storage space, Therefore, it is not necessary to allocate a separate storage space for each layer of the network model, which not only can greatly save memory usage, improve computational efficiency, but also can greatly reduce the number of allocation operations and reduce the number of allocation operations. Storage fragmentation helps improve application performance.
  • the solution has less memory requirements and higher computational efficiency, the device performance requirements are lower, and can be applied to devices such as mobile terminals. Therefore, the deep learning forward algorithm is placed on the server side.
  • the face can be tracked more efficiently and flexibly, which is beneficial to improve the user experience.
  • the program can be stored in a computer readable storage medium.
  • the storage medium can include: Read Only Memory (ROM), Random Access Memory (RAM), disk or optical disk.

Abstract

本申请实施例公开了一种人脸跟踪方法、存储介质即终端设备;本实施例在需要对视频流进行人脸跟踪时,可以获取相应的深度学习的网络模型,并为该网络模型分配内存资源,使得该网络模型的所有层共享同一存储空间,然后,基于分配的内存资源和网络模型对该视频流进行处理,以实现人脸的实时跟踪;由于在该方案中,网络模型的所有层都可以共享同一存储空间。

Description

AJ^r跟踪方法、 存储介质及终端 i殳备 本申请要求于 2017 年 02 月 27 日提交中国专利局、 申请号为 201710108748.7、 发明名称为 "一种人脸跟踪方法和装置" 的中国专利申请的优 先权, 其全部内容通过引用结合在本申请中。 技术领域
本申请涉及通信技术领域, 具体涉及一种人脸跟踪方法、 存储介质及终端 设备。 背景技术 近年来, 人脸跟踪技术得到了长足的发展, 在很多领域, 比如监控、 视频 会议和远程教学等, 都需要对特定人脸进行跟踪和分析。
在现有技术中, 有多种人脸跟踪技术, 深度学习前向预测技术就是其中一 种。 在深度学习前向预测技术中, 针对不同的应用领域, 需要建立不同的网络 模型, 而且根据需解决问题的复杂性的不同, 其网络模型的层次也会有所不同, 比如, 复杂性较高的问题一般需要建立更深层次的网络模型, 等等。 在个人计 算机(PC, Personal Computer )端, 网络模型的每一层都需要独占一段存储区域, 该存储区域具体可以通过配置文件来进行设置, 例如, 在分配存储资源时, 可 以通过读取配置文件, 对当前层进行存储空间大小计算, 并为当前层分配存储 空间, 等等, 其中, 各层的存储区域需要独立进行分配, 且各层的存储区域之 间无共享内存。 发明内容 本申请实施例提供一种人脸跟踪方案, 不仅可以节省内存的占用, 提高计 算效率, 而且, 可以减少存储碎片, 提高应用程序性能。
根据本申请一个方面, 提供一种人脸跟踪方法, 应用于终端设备, 该方法 包括: 获取需要进行人脸跟踪的视频流以及深度学习的网络模型; 为所述网络 模型分配内存资源, 使得所述网络模型的所有层共享同一存储空间; 基于分配 的内存资源和所述网络模型对所述视频流中的人脸进行跟踪。
根据本申请另一个方面, 提供一种人脸跟踪方法, 应用于终端设备, 该方 法包括: 获取来自一个视频流的一个图像帧, 并将其作为当前帧; 获取所述视 频流中所述当前帧的上一帧的人脸关键点坐标和与所述上一帧的人脸关键点坐 标对应的置信度; 以及分配内存资源, 基于所述内存资源、 所述上一帧的人脸 关键点坐标和与所述上一帧的人脸关键点坐标对应的置信度, 利用基于深度学 习的网络模型, 确定所述当前帧的人脸关键点坐标和与所述当前帧的人脸关键 点坐标对应的置信度。
根据本申请又一个方面, 提供一种终端设备, 包括: 处理器和存储器; 所 述存储器中存储有计算机可读指令, 可以使所述处理器: 获取需要进行人脸跟 踪的视频流以及深度学习的网络模型; 为所述网络模型分配内存资源, 使得所 述网络模型的所有层共享同一存储空间; 以及基于分配的内存资源和所述网络 模型对所述视频流中的人脸进行跟踪。
根据本申请又一个方面, 提供一种终端设备, 包括: 处理器和存储器; 所 述存储器中存储有计算机可读指令, 可以使所述处理器: 获取来自一个视频流 的一个图像帧, 并将其作为当前帧; 获取所述视频流中所述当前帧的上一帧的 人脸关键点坐标和与所述上一帧的人脸关键点坐标对应的置信度; 以及分配内 存资源, 基于所述内存资源、 所述上一帧的人脸关键点坐标和与所述上一帧的 人脸关键点坐标对应的置信度, 利用基于深度学习的网络模型, 确定所述当前 帧的人脸关键点坐标和与所述当前帧的人脸关键点坐标对应的置信度。
根据本申请又一个方面, 提供一种非易失性存储介质, 存储有一个或多个 程序, 所述一个或多个程序包括指令, 所述指令当由计算设备执行时, 使得所 述计算设备执行根据本申请的人脸跟踪方法。
本申请实施例在需要对视频流进行深度学习, 以进行人脸跟踪时, 可以获 取相应的深度学习的网络模型, 并为该网络模型分配内存资源, 使得该网络模 型的所有层共享同一存储空间。 本申请实施例基于分配的内存资源和网络模型 对该视频流进行处理, 以实现人脸的实时跟踪。 由于网络模型的所有层都可以 共享同一存储空间, 因此本申请实施例无需为网络模型的每一层都分配一独立 的存储空间, 可以大大节省内存的占用而提高计算效率、 另外, 由于只需分配 一次, 本申请实施例也可以大大降低分配操作的次数, 减少存储碎片, 有利于 提高应用程序性能。 附图简要说明
为了更清楚地说明本申请实施例中的技术方案, 下面将对实施例描述中所 需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本申请 的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动性的前提 下, 还可以根据这些附图获得其他的附图, 其中: 图 la是本申请实施例提供的人脸跟踪方法的场景示意图;
图 lb是本申请实施例提供的人脸跟踪方法的流程图;
图 lc是本申请实施例提供的人脸跟踪方法中内存分配的示意图;
图 Id是本申请实施例提供的人脸跟踪方法中内存空间的使用示意图; 图 2 a是本申请实施例提供的人脸跟踪方法的另一流程图;
图 2b是本申请实施例提供的人脸跟踪方法中网络模型各个层次的示意图; 图 3是本申请实施例提供的人脸跟踪装置的结构示意图;
图 4示出了本申请实施例提供的人脸跟踪方法的流程图; 以及
图 5示出了本申请实施例提供的终端设备的结构示意图。 实施本申请的方式 下面将结合本申请实施例中的附图, 对本申请实施例中的技术方案进行清 楚、 完整地描述, 显然, 所描述的实施例仅仅是本申请一部分实施例, 而不是 全部的实施例。 基于本申请中的实施例, 本领域普通技术人员在没有做出创造 性劳动前提下所获得的所有其他实施例, 都属于本申请保护的范围。
本申请实施例提供一种人脸跟踪方法和装置。
其中, 该人脸跟踪装置具体集成在移动终端等终端设备中。 例如, 参见图 la, 该移动终端在需要对视频流进行人脸跟踪时, 可以获取相应的深度学习的 网络模型, 并为该网络模型一次性分配内存资源, 使得该网络模型的所有层共 享同一存储空间。 比如, 该移动终端可以计算该网络模型中每一层网络所需的 存储空间, 选择其中的最大值作为预分配的存储空间的大小, 并据此为该网络 模型分配内存资源。 在内存资源分配完毕之后, 移动终端可以基于该分配的内 存资源和该网络模型对该视频流中的人脸进行跟踪, 从而达到省内存占用, 减 少存储碎片, 以及提高计算效率的目的。
以下分别进行详细说明。 需说明的是, 以下实施例的序号不作为对实施例 优选顺序的限定。 实施例一、
本实施例将从人脸跟踪装置的角度进行描述, 该人脸跟踪装置具体可以集 成在移动终端等终端设备中, 该移动终端可以包括手机、 平板电脑、 或智能穿 戴设备等。
一种人脸跟踪方法, 包括: 获取需要进行人脸跟踪的视频流、 以及深度学 习的网络模型, 为该网络模型分配内存资源, 使得该网络模型的所有层共享同 一存储空间, 基于分配的内存资源和该网络模型对该视频流中的人脸进行跟踪。
如图 lb所示, 该人脸跟踪方法的具体流程可以包括步骤 101、 102和 103。 在步骤 101中获取需要进行人脸跟踪的视频流、 以及深度学习的网络模型。 例如, 具体可以从本地或其他存储设备中获取视频流、 以及深度学习的网 络模型, 等等。
其中, 该网络模型可以根据实际应用的需求进行设置, 在此不再赘述。 在步骤 102中为该网络模型分配内存资源, 使得该网络模型的所有层共享同 一存储空间, 例如, 具体可以如下:
计算该网络模型中每一层网络所需的存储空间。
例如, 可以获取网络模型的配置文件, 根据该配置文件计算该网络模型中 每一层网络所需的存储空间。 比如, 具体可以如下:
首先, 读取该网络模型的配置文件, 其次, 根据该配置文件计算每一个网 络层次的参数个数。 例如, 在深度学习的网络模型为卷积神经网络模型时, 每 一个网络层次的参数个数与该网络层的神经元个数成正比, 但不限于此。 这样, 步骤 102可以根据参数个数, 而得到每一层网络的输入(即 Bottom ) Blob、 输出 (即 Top ) Blob、 以及该层需要临时开辟的 Blob (即临时 Blob ) 大小。 最后, 步 骤 102根据一层网络的 Bottom Blob, Top Blob和临时 Blob, 可以计算出该层网络 所需要的存储空间, 例如, 如图 lc中所示的 A+B+C区域大小。 其中, A区既可作 为这一层的输入区,也可作为上一层或下一层的输出区,B区为这一层的临时区, C区既可作为这一层的输出区, 也可作为上一层或下一层的输入区。
需说明的是, 为了描述方便, 在本申请实施例中, 将 Bottom Blob称为输入 区, Top Blob称为输出区, 将临时 Blob称为临时区。 其中, Blob是深度网络模型 的存储单元名称, 例如是一个四维矩阵, 包含矩阵各维度大小。
在确定每一个网络层所需要的存储空间后, 步骤 102可以将各网络层所需的 存储空间中的最大值作为预分配的存储空间的大小。
例如, 以六层的网络模型为例, 若第五层所需要的存储空间最大, 则以第 五层所需要的存储空间为准, 作为预分配的存储空间的大小, 以此类推, 等等。
步骤 102可以根据该预分配的存储空间的大小为该网络模型分配内存资源。 即, 只需为该网络模型一次性分配该预分配的存储空间大小的内存资源即可, 在前向计算时不需分配其他空间。
其中, 前向计算的内存分配过程可如图 Id所示: 假设 A区当前存放第 n层的 输入区 (即 Bottom Blob )数据, B区存放当前层所需临时数据, C区存放计算得 到的输出区 (Top Blob )数据, 则当第 n层计算得到输出结果后, 便可以将该输 出区(即 Top Blob )指针赋给第 n+1层的输入区(即 Bottom Blob ), 并将 A区的输 入区指针赋给第 n+1层的输出区 (即 Top Blob ), 用于存储第 n+1层的输出结果, 而 B区同样用于保存第 n+1的临时数据, 如此反复, 即可完成整个前向网络的计 算, 该过程无其他数据拷贝和传输, 即使指针赋值操作也可在预处理阶段完成。 在步骤 103中, 基于分配的内存资源和该网络模型对该视频流中的人脸进行跟 踪。 在一个实施例中, 步骤 103可以根据该视频流确定当前需要处理的图像, 得到当前帧。 另外, 步骤 103可以获取当前帧的上一帧图像的人脸关键点坐标和 置信度。
其中, 人脸关键点指的是能够反映人脸特征的信息, 比如眼睛、 眉毛、 鼻 子、 嘴巴、 以及脸部外轮廓等。 人脸关键点坐标指的是这些人脸关键点的坐标 集合, 每个人脸关键点的坐标集合可以用一个数组, 比如用数组(Xl , yi , x2, y2, xn, yn ) 来表征, 其中, (Xl, y. )代表其中第 i个点的坐标。
另外, 步骤 103可以基于分配的内存资源、 该网络模型、 上一帧图像的人脸 关键点坐标和置信度预测当前帧的人脸关键点坐标和置信度, 并返回执行根据 该视频流确定当前需要处理的图像的步骤, 直至该视频流中的图像均处理完毕。 其中, 基于分配的内存资源、 该网络模型、 上一帧图像的人脸关键点坐标 和置信度预测当前帧的人脸关键点坐标和置信度的方式可以有多种。 在一个实 施例中, 当确定上一帧图像的置信度大于预设阔值时, 步骤 S103可以利用分配 的内存资源和网络模型确定当前帧的人脸关键点坐标和与当前帧的人脸关键点 坐标对应的置信度。 这里, 置信度用于表示当前帧的人脸关键点坐标所描述的 区域为人脸的概率。 具体而言, 步骤 103可以在当前帧中确定与上一帧的人脸关 键点坐标对应的坐标, 确定当前帧中第一基准人脸区域。 例如, 步骤 103可以基 于人脸关键点坐标生成一个包络人脸关键点坐标的基准框。 相应的, 步骤 103可 以在当前帧提取与基准框位置对应的区域作为第一基准人脸区域。 在此基础上, 步骤 S103可以利用网络模型对第一基准人脸区域进行处理, 以获取当前帧的人 脸关键点坐标和与当前帧的人脸关键点坐标对应的置信度。
在一个实施例中, 上述网络模型包括公共网络部分、 关键点预测分支和置 信度预测分支。 步骤 103可以通过该公共网络部分对第一基准人脸区域进行特征 提取, 以获取相应的特征提取结果。 在此基础上, 步骤 103可以通过关键点预测 分支对该特征提取结果进行处理, 得到当前帧的人脸关键点坐标, 以及, 通过 该置信度预测分支对该特征提取结果进行处理, 得到当前帧的置信度。
需说明的是, 与上一帧图像的人脸关键点坐标对应的置信度如果低于 (即 不高于, 包括等于)预设阔值, 则表明上一帧的人脸关键点坐标的参考价值较 低。 因此,步骤 103可以釆用人脸检测的方式来获取当前帧中第二基准人脸区域。 同理, 若获取不到当前帧的上一帧图像的人脸关键点坐标和置信度, 比如当前 帧为该视频流的首帧, 步骤 103也可以釆用人脸检测的方式来获取当前帧中第二 基准人脸区域。 在获取不到当前帧的上一帧图像的人脸关键点坐标和置信度, 或者, 确定上一帧图像的置信度小于等于预设阈值时, 步骤 103可以基于分配的 内存资源, 通过人脸检测算法对当前帧中的人脸进行检测, 以确定当前帧的人 脸关键点坐标和置信度。
其中, 检测的方式可以有多种, 比如, 可以釆用如下方式:
获取经过训练的强分类器。 在一个实施例中, 强分类器的训练方式如下: 基于人脸图像样本, 通过图像积分图计算人脸图像样本的人脸特征, 从而根据 计算得到的人脸特征构建区分人脸和非人脸的强分类器。 在一个实施例中, 为 了提高人脸检测的准确率,本申请实施例可以采用 Adaboost算法来构建区分人脸 和非人脸的强分类器, 并通过级联方式将强分类器级联在一个系统里, 即将该 强分类器级联在同一系统中。 其中, Adaboost是一种迭代算法, 其核心思想是针 对同一个训练集训练不同的分类器 (弱分类器), 然后把这些弱分类器集合起来, 构成一个更强的最终分类器 (强分类器)。
在此基础上, 步骤 103可以利用强分类器确定第二基准人脸区域。 进一步, 步骤 103可以利用网络模型对第二基准人脸区域进行处理, 以获取当前帧的人脸 关键点坐标和与当前帧的人脸关键点对应的置信度。
由上可知, 本申请的实施例在需要对视频流进行人脸跟踪时, 可以获取相 应的深度学习的网络模型, 并为该网络模型分配内存资源, 使得该网络模型的 所有层共享同一存储空间, 然后, 基于分配的内存资源和网络模型对该视频流 进行处理, 以实现人脸的实时跟踪。 由于在该方案中, 网络模型的所有层都可 以共享同一存储空间, 因此, 无需为网络模型的每一层都分配一独立的存储空 间, 不仅可以大大节省内存的占用, 提高计算效率, 而且, 由于只需分配一次, 所以, 也可以大大降低分配操作的次数, 减少存储碎片, 有利于提高应用程序 性能。
实施例二、
根据实施例一所描述的方法, 以下将举例作进一步详细说明。
在本实施例中, 将以该人脸跟踪装置具体可以集成在移动终端为例进行说 明。
如图 2a所述, 一种人脸跟踪方法, 具体流程可以如下:
201、 移动终端获取视频流。
例如, 移动终端具体可以接收其他设备发送的视频流, 或者, 从本地存储 空间获取视频流, 等等。
202、 移动终端获取深度学习的网络模型。
其中, 该网络模型可以根据实际应用的需求进行设置, 比如, 该网络模型 可以包括三部分, 首先, 第一部分为公共网络部分, 其次, 是公共网络部分后 续生成的两个分支, 关键点预测分支和置信度预测分支。 其中, 每一部分的层 次可以根据需求而定, 例如, 参见图 2b, 各部分的层次具体可以如下: 公共网络部分可以包括 6个卷积(Convolution )层, 比如卷积层 1、 卷积层 2、 卷积层 3、 卷积层 4、 卷积层 5、 以及卷积层 6 , 每个卷积层后紧接一个修正线性 单元(Relu, Rectified linear unit )激活函数, 简称非线性激活函数, 部分非线性 激活函数后还可以紧接用于聚合的层一一池化(Pooling )层, 具体可参见图 2b。
关键点预测分支可以包括 1个卷积层和 3个内积 ( Inner Product )层, 比如, 参见图 2b, 具体可以包括卷积层 7、 内积层 1、 内积层 2和内积层 3 , 每个卷积层 和内积层后均紧接一个非线性激活函数。
置信度预测分支可以包括 1个卷积层(即卷积层 8 )、 5个内积层(即内积层 4、 内积层 5、内积层 6、内积层 7和内积层 8 )、以及 1个柔性最大值传输函数(Softmax ) 层, 其中, Softmax层输出两个值, 分别为是人脸概率和非人脸概率, 两者相加 为 1.0。 此外, 每个卷积层、 以及每两个内积层后均可接一个非线性激活函数。
203、 移动终端计算该网络模型中每一层网络所需的存储空间。
例如, 可以读取该网络模型的配置文件, 根据该配置文件计算每一个网络 层次的参数个数, 得到每一层网络的输入区、 输出区、 以及临时区的大小, 然 后, 根据该输入区、 输出区、 以及临时区的大小便可以计算出该层所需要的存 储空间, 即如图 lc中所示的 A+B+C区域大小, 具体可详见实施例一, 在此不再 赘述。
204、 移动终端将各层所需的存储空间中的最大值作为预分配的存储空间的 大小, 并根据该预分配的存储空间的大小为该网络模型分配内存资源。
其中, 前向计算的内存分配过程可如图 Id所示: 假设 A区当前存放第 n层的 输入区数据, B区存放当前层所需临时数据, C区存放计算得到的输出区数据, 则当第 n层计算得到输出结果后, 便可以将该输出区指针赋给第 n+1层的输入区, 并将 A区的输入区指针赋给第 n+1层的输出区,用于存储第 n+1层的输出结果, 而 B区同样用于保存第 n+1的临时数据, 在第 n+1层处理完之后, 将 n的值更新为 "n+1" , 重复上述过程, 如此反复, 即可完成整个前向网络的计算。 例如, 以 n 的初始值等于 1为例, 则具体可以如下:
当第 1层计算得到输出结果后, 便可以将该第 1层的输出区(即第 1层的 C区) 指针赋给第 2层的输入区, 并将 A区的输入区指针赋给第 2层的输出区, 用于存储 第 2层的输出结果, 而 B区同样用于保存第 2层的临时数据。 同理, 在第 2层计算 得到输出结果后, 便可以将该第 2层的输出区 (第 2层的 C区, 也是第 1层的 A区) 指针赋给第 3层的输入区, 并将第 2层的 A区(即第 1层的 C层)的输入区指针赋给 第 3层的输出区, 用于存储第 3层的输出结果, 而 B区同样用于保存第 3的临时数 据, 以此类推, 等等。
其中, 该过程无其他数据拷贝和传输, 即使指针赋值操作也可在预处理阶 段完成。
可见, 该计算利用了深度学习的一个特点, 即第 n+1层的计算只需要用到第 n+1层的输入区 (即第 n层的输出区)和第 n+1层的输出区, 而不需要再用到第 n 层的输入区, 从而可以循环利用第 n层的输入区所占用的内存; 也就是说, 所有 层的运算均在预先分配的 "A+B+C" 内存区域中进行, 因此, 无论该深度网络 层次有多深, 所需存储空间仅取决于某一层的存储空间, 所以, 可以节省内存 资源的占用, 使得在移动终端平台应用复杂的深层次网络成为可能。 此外, 从 计算过程来看, 由于仅仅是内存中的指针赋值操作, 因此, 可以十分快速高效。
205、 移动终端根据该视频流确定当前需要处理的图像, 得到当前帧。
206、 移动终端获取当前帧的上一帧图像的人脸关键点坐标和置信度, 然后 执行步骤 207。
其中, 人脸关键点指的是能够反映人脸特征的信息, 比如眼睛、 眉毛、 鼻 子、 嘴巴、 以及脸部外轮廓等。 人脸关键点坐标指的是这些人脸关键点的坐标。
需说明的是, 若获取不到该当前帧的上一帧图像的人脸关键点坐标和置信 度, 比如当前帧为该视频流的第一帧, 则可以通过检测来得到当前帧的人脸关 键点坐标和置信度, 即执行步骤 208。
207、 移动终端确定该上一帧图像的人脸关键点坐标的置信度是否高于预设 阔值, 若是, 则表明人脸关键点跟踪成功, 执行步骤 209, 否则, 若不高于预设 阔值, 则表明人脸关键点跟踪失败, 执行步骤 208。
其中, 该预设阔值可以根据实际应用的需求进行设置, 在此不再赘述。
208、 移动终端基于分配的内存资源, 通过人脸检测算法对当前帧中的人脸 进行检测而获取第二基准人脸区域, 并通过网络模型对第二基准人脸区域进行 处理以确定当前帧的人脸关键点坐标和置信度, 然后执行步骤 210。 其中, 检测的方式可以有多种, 具体请参见实施例一
209、 移动终端利用分配的内存资源, 通过该网络模型对根据上一帧图像的 人脸关键点坐标而确定的第一基准人脸区域进行处理, 以获取当前帧的人脸关 键点坐标和相应的置信度, 然后执行步骤 210。
其中, 为了减少计算时间, 以及节省计算资源, 人脸关键点坐标和置信度 的计算可以同步, 即关键点预测分支和置信度预测分支的处理可以是并行的。
210、 移动终端确定视频流中的图像是否均识别完毕, 若是, 则流程结束, 否则, 返回执行步骤 205。
即, 将当前帧的人脸关键点坐标和置信度作为下一帧图像人脸跟踪的一个 参考, 如此循环, 直至视频流中的图像均识别完毕。
由上可知, 本实施例在需要对视频流进行人脸跟踪时, 可以获取相应的深 度学习的网络模型, 并为该网络模型分配内存资源, 使得该网络模型的所有层 共享同一存储空间, 然后, 基于分配的内存资源和网络模型对该视频流进行处 理, 以实现在移动终端中完成人脸的实时跟踪。 一方面, 由于在该方案中, 网 络模型的所有层都可以共享同一存储空间, 因此, 无需为网络模型的每一层都 分配一独立的存储空间, 不仅可以大大节省内存的占用, 提高计算效率, 而且, 由于只需分配一次, 所以, 也可以大大降低分配操作的次数, 减少存储碎片, 有利于提高应用程序性能; 另一方面, 本方案在人脸跟踪异常, 如置信度小于 等于阔值或获取不到上一帧的人脸关键点坐标和置信度时, 还可以自动进行跟 踪重置(即重新通过检测的方式来获取人脸关键点坐标和置信度), 因此, 可以 加强人脸跟踪的连续性。
此外, 由于该方案对内存的需求较少, 且计算效率较高, 因此, 对设备性 能的要求较低, 可以适用于移动终端等设备, 所以, 相对于将深度学习前向算 法放置在服务器端的方案而言, 可以更加高效灵活地对人脸进行跟踪, 有利于 提高用户体验。 实施例三、
为了更好地实施以上方法, 本申请实施例还提供一种人脸跟踪装置, 如图 3 所示, 该人脸跟踪装置, 包括获取单元 301、 分配单元 302和跟踪单元 303 , 如下: 获取单元 301 , 用于获取需要进行人脸跟踪的视频流、 以及深度学习的网络 模型。
例如, 具体可以从本地或其他存储设备中获取视频流、 以及深度学习的网 络模型, 等等。
其中, 该网络模型可以根据实际应用的需求进行设置, 比如, 该网络模型 可以包括公共网络部分、 关键点预测分支和置信度预测分支等, 具体可参见前 面的方法实施例, 在此不再赘述。
分配单元 302, 用于为该网络模型分配内存资源, 使得该网络模型的所有层 共享同一存储空间。
例如, 该分配单元 302可以包括计算子单元和分配子单元, 如下:
计算子单元, 可以用于计算该网络模型中每一层网络所需的存储空间。 例如, 该计算子单元, 具体可以用于获取网络模型的配置文件, 根据该配 置文件计算该网络模型中每一层网络所需的存储空间, 比如, 可以如下:
计算子单元读取该网络模型的配置文件, 根据该配置文件计算每一个网络 层次的参数个数, 得到每一层网络的输入区、 输出区、 以及临时区的大小, 然 后, 根据该输入区、 输出区、 以及临时区的大小便可以计算出该层所需要的存 储空间, 即如图 lc中所示的 A+B+C区域大小, 具体可详见实施例一, 在此不再 赘述。
分配子单元, 可以用于将各层所需的存储空间中的最大值作为预分配的存 储空间的大小, 根据该预分配的存储空间的大小为该网络模型分配内存资源。
跟踪单元 303 , 用于基于分配的内存资源和该网络模型对该视频流中的人脸 进行跟踪。
例如,该跟踪单元 303可以包括确定子单元、参数获取子单元和预测子单元, 下:
确定子单元, 可以用于根据该视频流确定当前需要处理的图像, 得到当前 帧;
参数获取子单元, 可以用于获取当前帧的上一帧图像的人脸关键点坐标和 置信度。
其中, 人脸关键点指的是能够反映人脸特征的信息, 比如眼睛、 眉毛、 鼻 子、 嘴巴、 以及脸部外轮廓等。 人脸关键点坐标指的是这些人脸关键点的坐标。 预测子单元, 可以用于基于分配的内存资源、 该网络模型、 上一帧图像的 人脸关键点坐标和置信度预测当前帧的人脸关键点坐标和置信度, 并触发确定 子单元执行根据该视频流确定当前需要处理的图像的操作, 直至该视频流中的 图像均处理完毕。
其中, 基于分配的内存资源、 该网络模型、 上一帧图像的人脸关键点坐标 和置信度预测当前帧的人脸关键点坐标和置信度的方式可以有多种, 例如, 具 体可以如下:
该预测子单元, 具体可以用于确定上一帧图像的置信度大于预设阔值时, 利用分配的内存资源, 通过该网络模型对根据上一帧图像的人脸关键点坐标而 确定的第一基准人脸区域进行特征提取, 以获取特征提取结果。 这样, 预测子 单元可以根据该特征提取结果预测当前帧的人脸关键点坐标, 以及计算该当前 帧的置信度。
例如, 以该网络模型包括公共网络部分、 关键点预测分支和置信度预测分 支为,, 这里, 预测子单元的实施方式与步骤 103—致, 这里不再赘述。
具体实施时, 以上各个单元可以分别作为独立的实体来实现, 也可以进行 任意组合, 作为同一或若干个实体来实现, 以上各个单元的具体实施可参见前 面的方法实施例, 在此不再赘述。
该人脸跟踪装置具体可以集成在移动终端等设备中, 该移动终端可以包括 手机、 平板电脑或智能穿戴设备等。
由上可知, 本实施例在需要对视频流进行人脸跟踪时, 可以由获取单元 301 获取相应的深度学习的网络模型, 并由分配单元 302为该网络模型分配内存资 源, 使得该网络模型的所有层共享同一存储空间, 然后, 由跟踪单元 303基于分 配的内存资源和网络模型对该视频流进行处理, 以实现人脸的实时跟踪; 由于 在该方案中, 网络模型的所有层都可以共享同一存储空间, 因此, 无需为网络 模型的每一层都分配一独立的存储空间, 不仅可以大大节省内存的占用, 提高 计算效率, 而且, 由于只需分配一次, 所以, 也可以大大降低分配操作的次数, 减少存储碎片, 有利于提高应用程序性能。
图 4示出了根据本申请一些实施例的人脸跟踪方法 400的示意图。 人脸跟踪 方法 400例如可以在终端设备中执行。 如图 4所示, 方法 400可以包括步骤 401。 在步骤 401中, 获取来自一个视频 流的一个图像帧, 并将其作为当前帧。 这里, 视频流例如是从网络实时获取的 视频数据流或者从本地获取的视频数据流, 本申请对此不做限制。
在步骤 402中, 获取视频流中当前帧的上一帧的人脸关键点坐标和与上一帧 的人脸关键点坐标对应的置信度。
在步骤 403中, 分配内存资源, 基于内存资源、 上一帧的人脸关键点坐标和 与上一帧的人脸关键点坐标对应的置信度, 利用基于深度学习的网络模型, 确 定当前帧的人脸关键点坐标和与当前帧的人脸关键点坐标对应的置信度。
在一个实施例中, 为了分配内存资源, 步骤 403可以计算网络模型中每一层 网络所需的存储空间。 另外, 步骤 403将各层所需的存储空间中的最大值作为预 分配的存储空间的大小。 这样, 步骤 403可以根据预分配的存储空间的大小为网 络模型分配内存资源。
在一个实施例中, 当确定与上一帧的人脸关键点坐标对应的置信度超过预 设阔值时, 步骤 403可以根据上一帧图像的人脸关键点坐标确定当前帧中第一基 准人脸区域。 这样, 步骤 403可以利用网络模型对第一基准人脸区域进行处理, 以确定当前帧的人脸关联点坐标和与当前帧的人脸关键点坐标对应的置信度。
在一个实施例中, 网络模型例如可以包括公共网络部分、 关键点预测分支 和置信度预测分支。 步骤 403可以通过公共网络部分对第一基准人脸区域进行特 征提取, 以获取相应的特征提取结果。 在此基础上, 步骤 403可以利用关键点预 测分支对特征提取结果进行处理, 以获取当前帧的人脸关键点坐标。 另外, 步 骤 403可以利用置信度预测分支对特征提取结果进行处理, 以确定与当前帧的人 脸关键点坐标对应的置信度。
在一个实施例中, 对于公共网络部分任意相邻的两个层, 步骤 403可以在所 分配的内存资源中, 将这两个层中前一层的数据输入区作为后一层的数据输出 区, 将前一层的数据输出区作为后一层的数据输入区, 以及将前一层的临时数 据区作为后一层的临时数据区。
在一个实施例中, 为了在所分配的内存资源中同时执行置信度预测分支和 关联点预测分支, 步骤 403可以将内存资源中划分为用于置信度预测分支的第一 子区域和用于关键点预测分支的第二子区域。 具体而言, 对于置信度预测分支 中非首层的任意相邻两层, 在第一子区域中将这两个层中前一层的数据输入区 作为后一层的数据输出区, 将前一层的数据输出区作为后一层的数据输入区, 前一层的临时数据区作为后一层的临时数据区、 对于关键点预测分支中非首层 的任意相邻两层, 在第二子区域中将这两个层中前一层的数据输入区作为后一 层的数据输出区, 将前一层的数据输出区作为后一层的数据输入区, 前一层的 临时数据区作为后一层的临时数据区。 换言之, 第一和第二子区域各自可以包 括一个数据输入区、 一个数据输出区和一个临时数据区。 综上, 步骤 403可以使 得所分配的内存资源中同时计算当前帧的人脸关键点坐标和置信度。
在一个实施例中, 当确定与上一帧的人脸关键点坐标对应的置信度未超过 预设阔值, 或者未获取到上一帧的人脸关键点坐标和与上一帧的人脸关键点坐 标对应的置信度时, 步骤 403可以通过人脸检测算法对当前帧进行检测, 以确定 第二基准人脸区域。 在此基础上, 步骤 403可以利用网络模型对所述第二基准人 脸区域进行处理, 以确定当前帧的人脸关键点坐标和与当前帧的人脸关键点坐 标对应的置信度。
综上, 本申请的人脸跟踪方法, 可以利用所分配的一块内存资源同时计算 当前帧的人脸关键点坐标和置信度, 从而可以利用有限的内存资源快速对人脸 进行准确跟踪。
本申请实施例还提供一种移动终端, 如图 5 所示, 该移动终端可以包括射 频(RF, Radio Frequency )电路 501、 包括有一个或一个以上计算机可读存储介 质的存储器 502、 输入单元 503、 显示单元 504、 传感器 505、 音频电路 506、 无 线保真(WiFi, Wireless Fidelity)模块 507、 包括有一个或者一个以上处理核心 的处理器 508、 以及电源 509等部件。 本领域技术人员可以理解, 图 5中示出的 移动终端结构并不构成对移动终端的限定, 可以包括比图示更多或更少的部件, 或者组合某些部件, 或者不同的部件布置。 其中:
存储器 502可用于存储软件程序以及模块, 处理器 508通过运行存储在存 储器 502的软件程序以及模块, 从而执行各种功能应用以及数据处理。
处理器 508是移动终端的控制中心, 利用各种接口和线路连接整个手机的 各个部分, 通过运行或执行存储在存储器 502内的软件程序和 /或模块, 以及调 用存储在存储器 502 内的数据, 执行移动终端的各种功能和处理数据, 从而对 手机进行整体监控。 可选的, 处理器 508可包括一个或多个处理核心.优选的, 处理器 508可集成应用处理器和调制解调处理器, 其中, 应用处理器主要处理 操作系统、 用户界面和应用程序等, 调制解调处理器主要处理无线通信。 可以 理解的是, 上述调制解调处理器也可以不集成到处理器 508中。
具体在本实施例中, 移动终端中的处理器 508会按照如下的指令, 将一个 或一个以上的应用程序的进程对应的可执行文件加载到存储器 502 中, 并由处 理器 508来运行存储在存储器 502中的应用程序, 从而实现各种功能:
获取需要进行人脸跟踪的视频流、 以及深度学习的网络模型, 为该网络模 型分配内存资源, 使得该网络模型的所有层共享同一存储空间, 基于分配的内 存资源和该网络模型对该视频流中的人脸进行跟踪。
例如, 具体可以计算该网络模型中每一层网络所需的存储空间, 比如获取 网络模型的配置文件, 根据该配置文件计算该网络模型中每一层网络所需的存 储空间, 然后, 将各层所需的存储空间中的最大值作为预分配的存储空间的大 小, 根据该预分配的存储空间的大小为该网络模型分配内存资源, 等等。
其中, 该网络模型的结构可以根据实际应用的需求进行设置, 比如, 该网 络模型可以包括公共网络部分、 关键点预测分支和置信度预测分支等。 此外, 该公共网络部分、 关键点预测分支和置信度预测分支的层次也可以根据实际应 用的需求而定, 具体可参见前面的方法实施例, 在此不再赘述。
其中, 基于分配的内存资源和该网络模型对该视频流中的人脸进行跟踪的 方式可以有多种, 例如, 可以获取当前帧的上一帧图像的人脸关键点坐标和置 信度, 然后, 基于分配的内存资源、 该网络模型、 上一帧图像的人脸关键点坐 标和置信度预测当前帧的人脸关键点坐标和置信度, 等等, 即该存储在存储器
502中的应用程序, 还可以实现如下功能:
根据该视频流确定当前需要处理的图像, 得到当前帧; 获取当前帧的上一 帧图像的人脸关键点坐标和置信度; 基于分配的内存资源、 该网络模型、 上一 帧图像的人脸关键点坐标和置信度预测当前帧的人脸关键点坐标和置信度, 并 返回执行根据该视频流确定当前需要处理的图像的步骤, 直至该视频流中的图 像均处理完毕。
需说明的是, 若上一帧的置信度不高于预设阔值, 则表明上一帧的人脸关 键点坐标的参考价值较低, 因此, 此时可以釆用检测的方式来获取当前帧中人 脸关键点坐标; 同理, 若获取不到当前帧的上一帧图像的人脸关键点坐标和置 信度, 比如当前帧为该视频流的首帧, 也同样可以釆用检测的方式来获取当前 帧中人脸关键点坐标, 即该存储在存储器 402中的应用程序, 还可以实现如下功 能:
在获取不到当前帧的上一帧图像的人脸关键点坐标和置信度, 或者, 确定 上一帧图像的置信度小于等于预设阔值时, 基于分配的内存资源, 通过人脸检 测算法对当前帧进行检测, 以确定当前帧的第二基准人脸区域, 并通过网络模 型对第二基准人脸区域进行处理, 以获取当前帧的人脸关键点坐标和置信度。。
以上各个操作的具体实施可参见前面的实施例, 在此不再赘述。
由上可知, 本实施例的移动终端在需要对视频流进行深度学习, 以进行人 脸跟踪时, 可以获取相应的深度学习的网络模型, 并为该网络模型分配内存资 源, 使得该网络模型的所有层共享同一存储空间, 然后, 基于分配的内存资源 和网络模型对该视频流进行处理, 以实现人脸的实时跟踪; 由于在该方案中, 网络模型的所有层都可以共享同一存储空间, 因此, 无需为网络模型的每一层 都分配一独立的存储空间, 不仅可以大大节省内存的占用, 提高计算效率, 而 且, 由于只需分配一次, 所以, 也可以大大降低分配操作的次数, 减少存储碎 片, 有利于提高应用程序性能。
此外, 由于该方案对内存的需求较少, 且计算效率较高, 因此, 对设备性 能的要求较低, 可以适用于移动终端等设备, 所以, 相对于将深度学习前向算 法放置在服务器端的方案而言, 可以更加高效灵活地对人脸进行跟踪, 有利于 提高用户体验。 本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤 是可以通过程序来指令相关的硬件来完成, 该程序可以存储于一计算机可读存 储介质中, 存储介质可以包括: 只读存储器( ROM, Read Only Memory )、 随机 存取记忆体 ( RAM, Random Access Memory) . 磁盘或光盘等。
以上对本申请实施例所提供的一种人脸跟踪方法和装置进行了详细介绍, 本文中应用了具体个例对本申请的原理及实施方式进行了阐述, 以上实施例的 说明只是用于帮助理解本申请的方法及其核心思想; 同时, 对于本领域的技术 人员, 依据本申请的思想, 在具体实施方式及应用范围上均会有改变之处, 综 上所述, 本说明书内容不应理解为对本申请的限制。

Claims

权利要求书
1、 一种人脸跟踪方法, 应用于终端设备, 该方法包括:
获取需要进行人脸跟踪的视频流以及深度学习的网络模型;
为所述网络模型分配内存资源 , 使得所述网络模型的所有层共享同一存储 空间;
基于分配的内存资源和所述网络模型对所述视频流中的人脸进行跟踪。
2、 如权利要求 1所述的方法, 其中, 所述为所述网络模型分配内存资源, 使得所述网络模型的所有层共享同一存储空间, 包括:
计算所述网络模型中每一层网络所需的存储空间;
将各层所需的存储空间中的最大值作为预分配的存储空间的大小; 根据所述预分配的存储空间的大小为所述网络模型分配内存资源。
3、 如权利要求 2所述的方法, 其中, 所述计算所述网络模型中每一层网络 所需的存储空间, 包括:
获取所述网络模型的配置文件;
根据所述配置文件计算所述网络模型中每一层网络所需的存储空间。
4、 如权利要求 1至 3任一项所述的方法, 其中, 所述基于分配的内存资源和 所述网络模型对所述视频流中的人脸进行跟踪, 包括:
根据所述视频流确定当前需要处理的图像, 得到当前帧;
获取当前帧的上一帧图像的人脸关键点坐标和置信度;
基于分配的内存资源、 所述网络模型、 上一帧图像的人脸关键点坐标和置 信度预测当前帧的人脸关键点坐标和置信度, 并返回执行根据所述视频流确定 当前需要处理的图像的步骤, 直至所述视频流中的图像均处理完毕。
5、 如权利要求 4所述的方法, 其中, 所述基于分配的内存资源、 所述网络 模型、 上一帧图像的人脸关键点坐标和置信度预测当前帧的人脸关键点坐标和 置信度, 包括:
当确定所述上一帧图像的所述置信度大于预设阔值时, 根据所述上一帧图 像的人脸关键点坐标确定当前帧中第一基准人脸区域;
利用所述网络模型对所述当前帧中所述第一基准人脸区域对应的区域进行 计算, 以确定所述当前帧的人脸关联点坐标和表示所述当前帧的人脸关键点坐 标和与所述当前帧的人脸关键点坐标对应的置信度。
6、 如权利要求 5所述的方法, 其中, 所述网络模型包括公共网络部分、 关 键点预测分支和置信度预测分支; 所述确定所述当前帧的人脸关联点坐标和表 示所述当前帧的人脸关键点坐标和与所述当前帧的人脸关键点坐标对应的置信 度, 包括:
通过所述公共网络部分对所述第一基准人脸区域对应的区域进行特征提 取, 以获取相应的特征提取结果;;
利用所述关键点预测分支对所述特征提取结果进行处理, 以获取所述当前 帧的人脸关键点坐标;
利用所述置信度预测分支对所述特征提取结果进行处理, 以确定与所述当 前帧的人脸关键点坐标对应的置信度。
7、 如权利要求 4所述的方法, 还包括:
在获取不到当前帧的上一帧图像的人脸关键点坐标和置信度, 或者, 确定 上一帧图像的置信度小于等于预设阔值时, 基于分配的内存资源, 通过人脸检 测算法对当前帧中的人脸进行检测, 以确定第二基准人脸区域;
利用所述网络模型对所述第二基准人脸区域进行处理, 以确定当前帧的人 脸关键点坐标和与当前帧的人脸关键点坐标对应的置信度。
8、 一种人脸跟踪方法, 应用于终端设备, 该方法包括:
获取来自一个视频流的一个图像帧, 并将其作为当前帧;
获取所述视频流中所述当前帧的上一帧的人脸关键点坐标和与所述上一帧 的人脸关键点坐标对应的置信度; 以及
分配内存资源, 基于所述内存资源、 所述上一帧的人脸关键点坐标和与所 述上一帧的人脸关键点坐标对应的置信度, 利用基于深度学习的网络模型, 确 定所述当前帧的人脸关键点坐标和与所述当前帧的人脸关键点坐标对应的置信 度。
9、 如权利要求 8所述的方法, 其中, 所述分配内存资源, 包括:
计算所述网络模型中每一层网络所需的存储空间;
将各层所需的存储空间中的最大值作为预分配的存储空间的大小; 根据所述预分配的存储空间的大小为所述网络模型分配所述内存资源。
10、 如权利要求 8所述的方法, 其中, 所述基于所述内存资源、 所述上一帧 的人脸关键点坐标和与所述上一帧的人脸关键点坐标对应的置信度, 利用基于 深度学习的网络模型, 确定所述当前帧的人脸关键点坐标和与所述当前帧的人 脸关键点坐标对应的置信度, 包括:
当确定与所述上一帧的人脸关键点坐标对应的所述置信度超过预设阔值 时, 根据所述上一帧图像的人脸关键点坐标确定当前帧中第一基准人脸区域; 利用所述网络模型对所述第一基准人脸区域进行处理, 以确定所述当前帧 的人脸关联点坐标和与所述当前帧的人脸关键点坐标对应的置信度。
11、 如权利要求 8所述的方法, 所述基于所述内存资源、 所述上一帧的人脸 关键点坐标和与所述上一帧的人脸关键点坐标对应的置信度, 利用基于深度学 习的网络模型, 确定所述当前帧的人脸关键点坐标和与所述当前帧的人脸关键 点坐标对应的置信度, 包括:
当确定与所述上一帧的人脸关键点坐标对应的所述置信度未超过预设阔值 或者未获取到所述上一帧的人脸关键点坐标和与所述上一帧的人脸关键点坐标 对应的所述置信度时, 通过人脸检测算法对当前帧进行检测, 以确定第二基准 人脸区域;
利用所述网络模型对所述第二基准人脸区域进行处理, 以确定当前帧的人 脸关键点坐标和与所述当前帧的人脸关键点坐标对应的置信度。
12、 如权利要求 10所述的方法, 其中, 所述网络模型包括公共网络部分、 关键点预测分支和置信度预测分支; 所述利用所述网络模型对所述第一基准人 脸区域进行处理, 以确定所述当前帧的人脸关联点坐标和与所述当前帧的人脸 关键点坐标对应的置信度, 包括:
通过所述公共网络部分对所述第一基准人脸区域进行特征提取, 以获取相 应的特征提取结果;
利用所述关键点预测分支对所述特征提取结果进行处理, 以获取所述当前 帧的人脸关键点坐标;
利用所述置信度预测分支对所述特征提取结果进行处理, 以确定与所述当 前帧的人脸关键点坐标对应的置信度。
13、 如权利要求 12所述的方法, 其中, 所述通过所述公共网络部分对所述第一基准人脸区域进行特征提取, 以获 取相应的特征提取结果, 包括: 对于所述公共网络部分任意相邻的两个层, 在 所述内存资源中将这两个层中前一层的数据输入区作为后一层的数据输出区, 将前一层的数据输出区作为后一层的数据输入区, 以及将前一层的临时数据区 作为后一层的临时数据区;
所述利用所述关键点预测分支对所述特征提取结果进行处理, 以获取所述 当前帧的人脸关键点坐标, 以及利用所述置信度预测分支对所述特征提取结果 进行处理, 以确定与所述当前帧的人脸关键点坐标对应的置信度, 包括:
将所述内存资源中划分为用于所述置信度预测分支的第一子区域和用于 所述关键点预测分支的第二子区域;
对于所述置信度预测分支中非首层的任意相邻两层, 在所述第一子区域 中将这两个层中前一层的数据输入区作为后一层的数据输出区, 将前一层的数 据输出区作为后一层的数据输入区, 前一层的临时数据区作为后一层的临时数 据区;
对于所述关键点预测分支中非首层的任意相邻两层, 在所述第二子区域 中将这两个层中前一层的数据输入区作为后一层的数据输出区, 将前一层的数 据输出区作为后一层的数据输入区, 前一层的临时数据区作为后一层的临时数 据区。
14、 一种终端设备, 包括: 处理器和存储器; 所述存储器中存储有计算机 可读指令, 可以使所述处理器:
获取需要进行人脸跟踪的视频流以及深度学习的网络模型;
为所述网络模型分配内存资源 , 使得所述网络模型的所有层共享同一存储 空间; 以及
基于分配的内存资源和所述网络模型对所述视频流中的人脸进行跟踪。
15、 如权利要求 14所述的终端设备, 所述处理器进一步执行所述计算机可 读指令, 用于:
计算所述网络模型中每一层网络所需的存储空间;
将各层所需的存储空间中的最大值作为预分配的存储空间的大小; 根据所述预分配的存储空间的大小为所述网络模型分配内存资源。
16、 如权利要求 15所述的终端设备, 所述处理器进一步执行所述计算机可 读指令, 用于:
获取所述网络模型的配置文件;
根据所述配置文件计算所述网络模型中每一层网络所需的存储空间。
17、 如权利要求 14至 16任一项所述的终端设备, 所述处理器进一步执行所 述计算机可读指令, 用于:
根据所述视频流确定当前需要处理的图像, 得到当前帧;
获取当前帧的上一帧图像的人脸关键点坐标和置信度;
基于分配的内存资源、 所述网络模型、 上一帧图像的人脸关键点坐标和置 信度预测当前帧的人脸关键点坐标和置信度, 并返回执行根据所述视频流确定 当前需要处理的图像的步骤, 直至所述视频流中的图像均处理完毕。
18、 如权利要求 17所述的终端设备, 所述处理器进一步执行所述计算机可 读指令, 用于:
当确定所述上一帧图像的所述置信度大于预设阔值时, 根据所述上一帧图 像的人脸关键点坐标确定当前帧中第一基准人脸区域;
利用所述网络模型对所述当前帧中所述第一基准人脸区域对应的区域进行 计算, 以确定所述当前帧的人脸关联点坐标和表示所述当前帧的人脸关键点坐 标和与所述当前帧的人脸关键点坐标对应的置信度。
19、 如权利要求 18所述的终端设备, 其中, 所述网络模型包括公共网络部 分、 关键点预测分支和置信度预测分支; 所述处理器进一步执行所述计算机可 读指令, 用于:
通过所述公共网络部分对所述第一基准人脸区域对应的区域进行特征提 取, 以获取相应的特征提取结果;;
利用所述关键点预测分支对所述特征提取结果进行处理, 以获取所述当前 帧的人脸关键点坐标;
利用所述置信度预测分支对所述特征提取结果进行处理, 以确定与所述当 前帧的人脸关键点坐标对应的置信度。
20、 如权利要求 17所述的终端设备, 所述处理器进一步执行所述计算机可 读指令, 用于: 在获取不到当前帧的上一帧图像的人脸关键点坐标和置信度, 或者, 确定 上一帧图像的置信度小于等于预设阔值时, 基于分配的内存资源, 通过人脸检 测算法对当前帧进行检测, 以确定第二基准人脸区域;
利用所述网络模型对所述第二基准人脸区域进行处理, 以确定当前帧的人 脸关键点坐标和与当前帧的人脸关键点坐标对应的置信度。
21、 一种终端设备, 包括: 处理器和存储器; 所述存储器中存储有计算机 可读指令, 可以使所述处理器:
获取来自一个视频流的一个图像帧, 并将其作为当前帧;
获取所述视频流中所述当前帧的上一帧的人脸关键点坐标和与所述上一帧 的人脸关键点坐标对应的置信度; 以及
分配内存资源, 基于所述内存资源、 所述上一帧的人脸关键点坐标和与所 述上一帧的人脸关键点坐标对应的置信度, 利用基于深度学习的网络模型, 确 定所述当前帧的人脸关键点坐标和与所述当前帧的人脸关键点坐标对应的置信 度。
22、 如权利要求 21所述的终端设备, 所述处理器进一步执行所述计算机可 读指令, 用于:
计算所述网络模型中每一层网络所需的存储空间;
将各层所需的存储空间中的最大值作为预分配的存储空间的大小; 根据所述预分配的存储空间的大小为所述网络模型分配所述内存资源。
23、 如权利要求 21所述的终端设备, 所述处理器进一步执行所述计算机可 读指令, 用于:
当确定与所述上一帧的人脸关键点坐标对应的所述置信度超过预设阔值 时, 根据所述上一帧图像的人脸关键点坐标确定当前帧中第一基准人脸区域; 利用所述网络模型对所述第一基准人脸区域进行处理, 以确定所述当前帧 的人脸关联点坐标和与所述当前帧的人脸关键点坐标对应的置信度。
24、 如权利要求 21所述的终端设备, 所述处理器进一步执行所述计算机可 读指令, 用于:
当确定与所述上一帧的人脸关键点坐标对应的所述置信度未超过预设阔值 或者未获取到所述上一帧的人脸关键点坐标和与所述上一帧的人脸关键点坐标 对应的所述置信度时, 通过人脸检测通过人脸检测算法对当前帧中的人脸进行 检测, 以确定第二基准人脸区域;
利用所述网络模型对所述第二基准人脸区域进行处理, 以确定当前帧的人 脸关键点坐标和与所述当前帧的人脸关键点坐标对应的置信度。
25、 如权利要求 23所述的终端设备, 其中, 所述网络模型包括公共网络部 分、 关键点预测分支和置信度预测分支; 所述处理器进一步执行所述计算机可 读指令, 用于:
通过所述公共网络部分对所述第一基准人脸区域进行特征提取, 以获取相 应的特征提取结果;
利用所述关键点预测分支对所述特征提取结果进行处理, 以获取所述当前 帧的人脸关键点坐标;
利用所述置信度预测分支对所述特征提取结果进行处理, 以确定与所述当 前帧的人脸关键点坐标对应的置信度。
26、 如权利要求 25所述的终端设备, 所述处理器进一步执行所述计算机可 读指令, 用于:
对于所述公共网络部分任意相邻的两个层, 在所述内存资源中将这两个层 中前一层的数据输入区作为后一层的数据输出区, 将前一层的数据输出区作为 后一层的数据输入区, 以及将前一层的临时数据区作为后一层的临时数据区; 当执行所述置信度预测分支和所述关键点预测分支时, 将所述内存资源中 划分为用于所述置信度预测分支的第一子区域和用于所述关键点预测分支的第 二子区域;
对于所述置信度预测分支中非首层的任意相邻两层, 在所述第一子区域中 将这两个层中前一层的数据输入区作为后一层的数据输出区, 将前一层的数据 输出区作为后一层的数据输入区, 前一层的临时数据区作为后一层的临时数据 区;
对于所述关键点预测分支中非首层的任意相邻两层, 在所述第二子区域中 将这两个层中前一层的数据输入区作为后一层的数据输出区, 将前一层的数据 输出区作为后一层的数据输入区, 前一层的临时数据区作为后一层的临时数据 区。
27、 一种非易失性存储介质, 存储有一个或多个程序, 所述一个或多个程 序包括指令, 所述指令当由计算设备执行时, 使得所述计算设备执行权利要求 1-13中任一项所述方法的指令。
PCT/CN2018/076238 2017-02-27 2018-02-11 人脸跟踪方法、存储介质及终端设备 WO2018153294A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710108748.7 2017-02-27
CN201710108748.7A CN106919918B (zh) 2017-02-27 2017-02-27 一种人脸跟踪方法和装置

Publications (1)

Publication Number Publication Date
WO2018153294A1 true WO2018153294A1 (zh) 2018-08-30

Family

ID=59453864

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/076238 WO2018153294A1 (zh) 2017-02-27 2018-02-11 人脸跟踪方法、存储介质及终端设备

Country Status (2)

Country Link
CN (1) CN106919918B (zh)
WO (1) WO2018153294A1 (zh)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110516620A (zh) * 2019-08-29 2019-11-29 腾讯科技(深圳)有限公司 目标跟踪方法、装置、存储介质及电子设备
CN111881838A (zh) * 2020-07-29 2020-11-03 清华大学 具有隐私保护功能的运动障碍评估录像分析方法及设备
CN111914598A (zh) * 2019-05-09 2020-11-10 北京四维图新科技股份有限公司 连续帧人脸关键点检测方法、装置、设备及存储介质
CN112101106A (zh) * 2020-08-07 2020-12-18 深圳数联天下智能科技有限公司 人脸关键点确定方法、装置以及存储介质
CN112417985A (zh) * 2020-10-30 2021-02-26 杭州魔点科技有限公司 一种人脸特征点追踪方法、系统、电子设备和存储介质
CN113409354A (zh) * 2020-03-16 2021-09-17 深圳云天励飞技术有限公司 人脸跟踪方法、装置及终端设备
CN113723214A (zh) * 2021-08-06 2021-11-30 武汉光庭信息技术股份有限公司 一种人脸关键点标注方法、系统、电子设备及存储介质
CN113792633A (zh) * 2021-09-06 2021-12-14 北京工商大学 一种基于神经网络和光流法的人脸追踪系统和追踪方法

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106919918B (zh) * 2017-02-27 2022-11-29 腾讯科技(上海)有限公司 一种人脸跟踪方法和装置
CN109508575A (zh) * 2017-09-14 2019-03-22 深圳超多维科技有限公司 人脸跟踪方法及装置、电子设备和计算机可读存储介质
CN108388879B (zh) * 2018-03-15 2022-04-15 斑马网络技术有限公司 目标的检测方法、装置和存储介质
CN109285119A (zh) * 2018-10-23 2019-01-29 百度在线网络技术(北京)有限公司 超分辨图像生成方法及装置
CN109447253B (zh) * 2018-10-26 2021-04-27 杭州比智科技有限公司 显存分配的方法、装置、计算设备及计算机存储介质
CN109460077B (zh) * 2018-11-19 2022-05-17 深圳博为教育科技有限公司 一种自动跟踪方法、自动跟踪设备及自动跟踪系统
CN111666150B (zh) * 2020-05-09 2022-01-11 深圳云天励飞技术股份有限公司 存储空间的分配方法、装置、终端及计算机可读存储介质
CN112286694B (zh) * 2020-12-24 2021-04-02 瀚博半导体(上海)有限公司 基于深度学习计算网络的硬件加速器内存分配方法及系统
CN113221630A (zh) * 2021-03-22 2021-08-06 刘鸿 一种人眼注视镜头的估算方法及其在智能唤醒中的应用

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040218827A1 (en) * 2003-05-02 2004-11-04 Michael Cohen System and method for low bandwidth video streaming for face-to-face teleconferencing
CN106056529A (zh) * 2015-04-03 2016-10-26 阿里巴巴集团控股有限公司 一种对用于图片识别的卷积神经网络训练的方法与设备
CN106295707A (zh) * 2016-08-17 2017-01-04 北京小米移动软件有限公司 图像识别方法和装置
CN106919918A (zh) * 2017-02-27 2017-07-04 腾讯科技(上海)有限公司 一种人脸跟踪方法和装置

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100440246C (zh) * 2006-04-13 2008-12-03 北京中星微电子有限公司 一种人脸特征点定位方法
CN103699905B (zh) * 2013-12-27 2017-04-12 深圳市捷顺科技实业股份有限公司 一种车牌定位方法及装置
CN104036240B (zh) * 2014-05-29 2017-09-01 小米科技有限责任公司 人脸特征点的定位方法和装置
US20160180214A1 (en) * 2014-12-19 2016-06-23 Google Inc. Sharp discrepancy learning
US10331675B2 (en) * 2015-08-06 2019-06-25 Clarifai, Inc. Systems and methods for learning new trained concepts used to retrieve content relevant to the concepts learned
CN105787448A (zh) * 2016-02-28 2016-07-20 南京信息工程大学 基于时空级联形状回归的人脸形状跟踪方法
CN106203333A (zh) * 2016-07-08 2016-12-07 乐视控股(北京)有限公司 人脸识别方法及系统
CN106295567B (zh) * 2016-08-10 2019-04-12 腾讯科技(深圳)有限公司 一种关键点的定位方法及终端

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040218827A1 (en) * 2003-05-02 2004-11-04 Michael Cohen System and method for low bandwidth video streaming for face-to-face teleconferencing
CN106056529A (zh) * 2015-04-03 2016-10-26 阿里巴巴集团控股有限公司 一种对用于图片识别的卷积神经网络训练的方法与设备
CN106295707A (zh) * 2016-08-17 2017-01-04 北京小米移动软件有限公司 图像识别方法和装置
CN106919918A (zh) * 2017-02-27 2017-07-04 腾讯科技(上海)有限公司 一种人脸跟踪方法和装置

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111914598A (zh) * 2019-05-09 2020-11-10 北京四维图新科技股份有限公司 连续帧人脸关键点检测方法、装置、设备及存储介质
CN110516620B (zh) * 2019-08-29 2023-07-28 腾讯科技(深圳)有限公司 目标跟踪方法、装置、存储介质及电子设备
CN110516620A (zh) * 2019-08-29 2019-11-29 腾讯科技(深圳)有限公司 目标跟踪方法、装置、存储介质及电子设备
US11783491B2 (en) 2019-08-29 2023-10-10 Tencent Technology (Shenzhen) Company Limited Object tracking method and apparatus, storage medium, and electronic device
CN113409354A (zh) * 2020-03-16 2021-09-17 深圳云天励飞技术有限公司 人脸跟踪方法、装置及终端设备
CN111881838A (zh) * 2020-07-29 2020-11-03 清华大学 具有隐私保护功能的运动障碍评估录像分析方法及设备
CN111881838B (zh) * 2020-07-29 2023-09-26 清华大学 具有隐私保护功能的运动障碍评估录像分析方法及设备
CN112101106A (zh) * 2020-08-07 2020-12-18 深圳数联天下智能科技有限公司 人脸关键点确定方法、装置以及存储介质
CN112417985A (zh) * 2020-10-30 2021-02-26 杭州魔点科技有限公司 一种人脸特征点追踪方法、系统、电子设备和存储介质
CN113723214A (zh) * 2021-08-06 2021-11-30 武汉光庭信息技术股份有限公司 一种人脸关键点标注方法、系统、电子设备及存储介质
CN113723214B (zh) * 2021-08-06 2023-10-13 武汉光庭信息技术股份有限公司 一种人脸关键点标注方法、系统、电子设备及存储介质
CN113792633A (zh) * 2021-09-06 2021-12-14 北京工商大学 一种基于神经网络和光流法的人脸追踪系统和追踪方法
CN113792633B (zh) * 2021-09-06 2023-12-22 北京工商大学 一种基于神经网络和光流法的人脸追踪系统和追踪方法

Also Published As

Publication number Publication date
CN106919918B (zh) 2022-11-29
CN106919918A (zh) 2017-07-04

Similar Documents

Publication Publication Date Title
WO2018153294A1 (zh) 人脸跟踪方法、存储介质及终端设备
Li et al. Learning IoT in edge: Deep learning for the Internet of Things with edge computing
CN109359538B (zh) 卷积神经网络的训练方法、手势识别方法、装置及设备
US10713532B2 (en) Image recognition method and apparatus
WO2021017606A1 (zh) 视频处理方法、装置、电子设备及存储介质
US10509952B2 (en) Fast, embedded, hybrid video face recognition system
US11307865B2 (en) Data processing apparatus and method
CN110135406B (zh) 图像识别方法、装置、计算机设备和存储介质
CN109740534B (zh) 图像处理方法、装置及处理设备
WO2018188453A1 (zh) 人脸区域的确定方法、存储介质、计算机设备
CN109376596B (zh) 人脸匹配方法、装置、设备及存储介质
US20200104167A1 (en) Data processing apparatus and method
Agarwal et al. Anubhav: recognizing emotions through facial expression
CN110287836B (zh) 图像分类方法、装置、计算机设备和存储介质
CN107944381B (zh) 人脸跟踪方法、装置、终端及存储介质
CN110555334B (zh) 人脸特征确定方法、装置、存储介质及电子设备
KR20190072066A (ko) 영상 통화 서비스를 제공하는 단말과 서버
WO2022252642A1 (zh) 基于视频图像的行为姿态检测方法、装置、设备及介质
CN109598250A (zh) 特征提取方法、装置、电子设备和计算机可读介质
WO2023173646A1 (zh) 一种表情识别方法及装置
CN111985597A (zh) 模型压缩方法及装置
US10769795B2 (en) Image processing method and device
CN109711287B (zh) 人脸采集方法及相关产品
CN109963072B (zh) 对焦方法、装置、存储介质及电子设备
KR102160955B1 (ko) 딥 러닝 기반 3d 데이터 생성 방법 및 장치

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18758256

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18758256

Country of ref document: EP

Kind code of ref document: A1