Image processing method, device, electronic device and storage medium
By using a unique convolution kernel for each target feature point in the feature extraction network for feature extraction, the problem of high computational and storage resource consumption in image processing by convolutional neural networks is solved, and more efficient feature extraction is achieved.
Patent Information
- Application Number
- CN202010415459.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-15
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-05-15
AI Technical Summary
Existing convolutional neural networks consume a lot of computing resources and storage resources during the image feature extraction process, and the weight sharing of convolution kernels leads to unnecessary waste of resources.
By determining multiple target feature points in the feature extraction network, and using a unique convolution kernel from its corresponding feature extraction area for feature extraction for each feature point, weight sharing between convolution kernels is avoided.
It saves computing resources and storage resources, improves feature extraction efficiency, and reduces unnecessary weight storage.
Smart Images

Figure CN111783519B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision, and specifically to image processing methods, devices, electronic devices and storage media. Background Art
[0002] Feature extraction from images is the basis for image-related tasks. For example, feature extraction from face images is the basis for face recognition. At present, convolutional neural networks such as ResNet and MobileNet are usually used to extract features from images such as face images. In the convolutional neural networks currently used for feature extraction from images, each convolution kernel needs to be convolved with the entire image when extracting features from an image, and all convolution kernels used to extract features in each convolution layer share weights.
[0003] On the one hand, the features that each convolution kernel is responsible for extracting are only located in a certain area of the entire image, but each convolution kernel performs convolution on the entire image, resulting in more computing resources being consumed in the process of extracting features from the image. On the other hand, since all convolution kernels in each convolution layer share weights, for each convolution kernel in each convolution layer, weights that are not related to the features that the convolution kernel is responsible for extracting also need to be stored, and storing the weights of all convolution kernels consumes more storage resources. Summary of the invention
[0004] Embodiments of the present application provide an image processing method, device, electronic device, and storage medium.
[0005] The present application provides an image processing method, including:
[0006] Acquire an image to be processed containing a target object;
[0007] The image to be processed containing the target object is input into the feature extraction network to obtain features corresponding to the target feature points in the image to be processed, wherein the feature extraction network is configured as follows:
[0008] Determining a plurality of target feature points in the image to be processed;
[0009] For each target feature point, a feature extraction area corresponding to the target feature point is determined based on the position of the target feature point; a convolution kernel corresponding to the target feature point is used to extract features from the feature extraction area corresponding to the target feature point to obtain features corresponding to the target feature point. For each convolution layer in the feature extraction network that includes a convolution kernel corresponding to the target feature point, the convolution layer includes at least one convolution kernel whose weight is different from the weights of other convolution kernels in the convolution layer.
[0010] The present application provides an image processing device, including:
[0011] An acquisition unit, configured to acquire an image to be processed containing a target object;
[0012] A processing unit is configured to input an image to be processed containing a target object into a feature extraction network to obtain features corresponding to target feature points in the image to be processed, wherein the feature extraction network is configured to: determine multiple target feature points in the image to be processed; for each target feature point, determine a feature extraction area corresponding to the target feature point based on the position of the target feature point; use a convolution kernel corresponding to the target feature point to extract features from the feature extraction area corresponding to the target feature point to obtain features corresponding to the target feature point, wherein for each convolution layer in the feature extraction network that includes a convolution kernel corresponding to a target feature point, the convolution layer includes at least one convolution kernel whose weight is different from the weights of other convolution kernels in the convolution layer.
[0013] The image processing method and device provided by the embodiments of the present application, on the one hand, for each target feature point among multiple target feature points in the image to be processed, only extract features from the feature extraction area corresponding to the target feature point, saving the computing resources consumed in the process of extracting features from the image to be processed. On the other hand, for different target feature points, different convolution kernels corresponding to the target feature points are used to extract features from the feature extraction area corresponding to the feature points. In each convolution layer including the convolution kernel corresponding to the target feature point, the convolution kernel corresponding to each target feature point in the convolution layer does not share weights. For each convolution kernel corresponding to the target feature point in the convolution layer, only the weights related to the features extracted by the convolution kernel corresponding to the target feature point need to be stored, thereby saving the storage resources consumed by storing the weights of all the convolution kernels used for feature extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0015] Figure 1 A flowchart of an image processing method provided by an embodiment of the present application is shown;
[0016] Figure 2 A structural block diagram of an image processing device provided in an embodiment of the present application is shown;
[0017] Figure 3 A structural block diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0018] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It should also be noted that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.
[0019] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0020] Figure 1 A flowchart of an image processing method provided by an embodiment of the present application is shown, and the method includes:
[0021] Step 101: Acquire an image to be processed containing a target object.
[0022] For example, the image to be processed is a face image collected during face recognition, the image to be processed includes a user's face, and the target object is a human face. For example, the image to be processed is an image of a pedestrian obtained from a surveillance image during pedestrian re-identification, and the target object is the pedestrian.
[0023] Step 102: input the image to be processed containing the target object into a feature extraction network to obtain features corresponding to the target feature points in the image to be processed.
[0024] The multiple target feature points are feature points associated with the target object in the image to be processed. For example, the image to be processed is a face image, and the multiple target feature points are multiple face feature points of the face in the face image. The multiple face feature points in the face image targeted by step 102 may refer to a part of all face feature points in the face image used for related tasks such as face feature points of face recognition. For example, the image to be processed is a pedestrian image, and the multiple target feature points are multiple skeleton key points of a pedestrian in the pedestrian image. The multiple skeleton key points of a pedestrian in the pedestrian image targeted by step 102 may refer to a part of the skeleton key points of the pedestrian in the pedestrian image used for related tasks such as pedestrian re-identification.
[0025] Taking the image to be processed as a face image as an example, multiple face feature points in the face image participate in face recognition, and face feature points other than the multiple face feature points among all feature points in the face image do not participate in face recognition.
[0026] A plurality of facial feature point types may be preset, and the plurality of facial feature points in the facial image include a plurality of facial feature points belonging to the preset facial feature point types. Facial feature points belonging to the preset facial feature point types among all feature points in the facial image participate in face recognition.
[0027] For example, the multiple pre-set facial feature point types include the nose tip facial feature point type, the mouth corner facial feature point type and other facial feature point types. The multiple facial feature points in the face image include: the nose tip facial feature points, the mouth corner facial feature points and other facial feature points in the face image that belong to the pre-set facial feature point types. The nose tip facial feature points, the mouth corner facial feature points and other facial feature points that belong to the pre-set facial feature point types among all the facial feature points in the face image participate in face recognition, and the facial feature points that do not belong to the pre-set facial feature point types among all the facial feature points in the face image do not participate in face recognition.
[0028] In the present application, the feature extraction network may include a unit for determining the position of a target feature point. For example, the image to be processed is a face image, the target feature point is a face feature point, and the unit for determining the position of the target feature point is a convolutional neural network for determining the position of a face feature point. The position of each of the multiple face feature points in the face image can be determined by the unit for determining the position of the face feature point in the feature extraction network.
[0029] The feature extraction network is configured to: determine multiple target feature points in the image to be processed; for each target feature point among the multiple target feature points, determine a feature extraction area corresponding to the target feature point based on the position of the target feature point; use the convolution kernel corresponding to the target feature point to extract features from the feature extraction area corresponding to the target feature point to obtain features corresponding to the target feature point.
[0030] For example, the image to be processed is a face image, the target feature point is a face feature point, and the feature extraction network is configured as follows: for each face feature point among multiple face feature points in the face image, based on the position of the face feature point, determine the feature extraction area corresponding to the face feature point; use the convolution kernel corresponding to the face feature point to extract the face feature from the feature extraction area corresponding to the face feature point, and obtain the face feature corresponding to the face feature point.
[0031] For each facial feature point, the position of the facial feature point is located in a feature extraction region corresponding to the facial feature point, and the feature extraction region corresponding to the facial feature point includes the pixel where the facial feature point is located.
[0032] For each facial feature point, the feature extraction area attribute information corresponding to the facial feature point can be pre-set. The feature extraction area attribute information corresponding to the facial feature point includes: the shape of the feature extraction area corresponding to the facial feature point, the area of the feature extraction area corresponding to the facial feature point, and the distance between the position of the center point of the feature extraction area corresponding to the facial feature point and the position of the facial feature point.
[0033] For each facial feature point, when determining the feature extraction area corresponding to the facial feature point based on the position of the facial feature point, the feature extraction network can read the attribute information of the feature extraction area corresponding to the facial feature point, and determine the position of the center point of the feature extraction area corresponding to the facial feature point according to the position of the facial feature point and the distance between the position of the center point of the feature extraction area corresponding to the facial feature point and the position of the facial feature point. Then, according to the position of the center point of the feature extraction area corresponding to the facial feature point, the shape of the feature extraction area corresponding to the facial feature point, and the area of the feature extraction area corresponding to the facial feature point, the feature extraction area corresponding to the facial feature point can be determined.
[0034] In some embodiments, for each target feature point among a plurality of feature points in the image to be processed, the target feature point is a center point of a feature extraction region corresponding to the target feature point.
[0035] Taking the image to be processed as a face image as an example, the multiple pre-set face feature point types include nose tip face feature point type, mouth corner face feature point type and other face feature point types.
[0036] The multiple facial feature points in the facial image include the nose tip facial feature points, the mouth corner facial feature points and other facial feature points of the pre-set facial feature point types. For the nose tip facial feature points in the facial image, the nose tip facial feature points are the center points of the feature extraction areas corresponding to the nose tip facial feature points. For the mouth corner facial feature points in the facial image, the mouth corner facial feature points are the center points of the feature extraction areas corresponding to the mouth corner facial feature points.
[0037] In the present application, the feature extraction network includes a convolutional neural network for extracting features corresponding to feature points.
[0038] Each convolution layer in the feature extraction network that includes a convolution kernel corresponding to a target feature point may refer to each convolution layer in a convolutional neural network used to extract features corresponding to the feature points.
[0039] For each convolution layer in the convolution neural network used to extract features corresponding to feature points, each convolution kernel in the convolution layer corresponds to a target feature point, and each convolution kernel in the convolution layer corresponds to a different target feature point. For example, the image to be processed is a face image, and the feature extraction network includes a convolution neural network for extracting facial features corresponding to facial feature points. For each convolution layer in the convolution neural network used to extract facial features corresponding to facial feature points, each convolution kernel in the convolution layer corresponds to a facial feature point, and each convolution kernel in the convolution layer corresponds to a different facial feature point.
[0040] For each target feature point among a plurality of target feature points in the image to be processed, a convolution kernel corresponding to the target feature point is used to extract features from a feature extraction region corresponding to the target feature point.
[0041] For example, the image to be processed is a face image. For each face feature point among multiple face feature points in the face image, the convolution kernel corresponding to the face feature point is used to extract the face feature corresponding to the face feature point from the feature extraction area corresponding to the face feature point.
[0042] In the present application, for each of the multiple target feature points in the image to be processed, the convolution kernel corresponding to the target feature point does not specifically refer to the convolution kernel corresponding to the target feature point in a certain convolution layer in the convolution neural network used to extract the feature corresponding to the target feature point. The convolution kernel corresponding to the target feature point in each convolution layer in the convolution neural network used to extract the feature corresponding to the target feature point can be referred to as the convolution kernel corresponding to the target feature point.
[0043] Taking the image to be processed as a face image as an example, for each face feature point among the multiple face feature points in the face image, the convolution kernel corresponding to the face feature point does not specifically refer to the convolution kernel used to extract the face feature corresponding to the face feature point in a certain convolution layer in the convolution neural network for extracting the face feature corresponding to the face feature point. The convolution kernel used to extract the face feature corresponding to the face feature point in each convolution layer in the convolution neural network for extracting the face feature corresponding to the face feature point can be called the convolution kernel corresponding to the face feature point.
[0044] In each convolution layer in the convolutional neural network used to extract features corresponding to the target feature points, each convolution kernel in the convolutional layer does not share weights. Since each convolution kernel in the same convolutional layer does not share weights, for each convolution layer in the convolutional neural network used to extract features corresponding to the target feature points, the convolutional layer may include at least one convolution kernel whose weight is different from the weights of other convolution kernels in the convolutional layer.
[0045] In other words, for each convolution layer in the feature extraction network that includes a convolution kernel corresponding to a target feature point, the convolution layer may include at least one convolution kernel whose weight is different from the weights of other convolution kernels in the convolution layer.
[0046] In the present application, for each convolution layer in a convolutional neural network used to extract features corresponding to target feature points, facial feature points of the same type in different facial images correspond to the same convolution kernel in the convolution layer.
[0047] Taking the image to be processed as a face image as an example, for each convolution layer in the convolutional neural network used to extract facial features corresponding to facial feature points, facial feature points of the same type in different face images correspond to the same convolution kernel in the convolution layer.
[0048] For example, the type of the nose tip facial feature points in any face image is the nose tip facial feature point type. For each convolutional layer in the convolutional neural network used to extract facial features corresponding to the facial feature points, the nose tip facial feature points in any face image correspond to the same convolutional kernel in the convolutional layer, and the convolutional kernel corresponding to the nose tip facial feature points is used to extract facial features from the feature extraction area corresponding to the nose tip facial feature points. The type of the mouth corner facial feature points in any face image is the mouth corner facial feature point type. For each convolutional layer in the convolutional neural network used to extract facial features corresponding to the facial feature points, the mouth corner facial feature points in any face image correspond to the same convolutional kernel in the convolutional layer, and the convolutional kernel corresponding to the mouth corner facial feature points is used to extract facial features from the feature extraction area corresponding to the mouth corner facial feature points.
[0049] In this application, the feature extraction network is pre-trained multiple times.
[0050] Taking the image to be processed as a face image as an example, the process of training the feature extraction network is explained:
[0051] Each time the feature extraction network is trained, the feature extraction network is trained in a supervised learning manner using a face image for training the feature extraction network and annotation information of the face image for training the feature extraction network.
[0052] For each training face image, the annotation information of the face image used for training the feature extraction network includes: annotated face features corresponding to each face feature point among multiple face feature points in the face image used for training the feature extraction network.
[0053] Each time the feature extraction network is trained, the face image used to train the feature extraction network is input into the feature extraction network to obtain a prediction result, which includes: the predicted face feature corresponding to each of the multiple face feature points in the face image used to train the feature extraction network.
[0054] Each time the feature extraction network is trained, the process by which the feature extraction network extracts predicted facial features corresponding to each of the multiple facial feature points in the facial image used to train the feature extraction network can refer to the process by which the above-mentioned feature extraction network extracts facial features corresponding to each of the multiple facial feature points in the facial image.
[0055] The multiple facial feature points in the facial image used to train the feature extraction network may be a part of all facial feature points in the facial image used to train the feature extraction network.
[0056] A plurality of facial feature points in a facial image used for training a feature extraction network participate in the training, and feature points other than the plurality of facial feature points among all feature points in the facial image used for training a feature extraction network do not participate in the training.
[0057] In the present application, multiple facial feature point types can be pre-set, and the multiple facial feature points in the face image used to train the feature extraction network include multiple facial feature points belonging to the pre-set facial feature point types. Facial feature points belonging to the pre-set facial feature point types among all facial feature points in the face image used to train the feature extraction network participate in the training, and facial feature points that do not belong to the pre-set facial feature point types among all facial feature points in the face image used to train the feature extraction network do not participate in the training.
[0058] For example, the plurality of pre-set facial feature point types include a nose tip facial feature point type, a mouth corner facial feature point type, and other facial feature point types. The plurality of facial feature points in the face image used for training the feature extraction network include the nose tip facial feature point, the mouth corner facial feature point, and other facial feature points belonging to the pre-set facial feature point types in the face image used for training the feature extraction network.
[0059] In the present application, for each of the multiple facial feature points in the face image to be processed, the multiple facial feature points in the face image used to train the feature extraction network include facial feature points belonging to the facial feature point type to which the facial feature point belongs.
[0060] For example, the multiple facial feature points in the face image to be processed include facial feature points of the nose tip, mouth corners, etc. in the face image that belong to pre-set facial feature point types.
[0061] For each facial image used to train the feature extraction network, the multiple facial feature points in the facial image used to train the feature extraction network include facial feature points belonging to pre-set facial feature point types, such as the nose tip facial feature points and the mouth corner facial feature points in the facial image used to train the feature extraction network.
[0062] Each time the feature extraction network is trained, after obtaining the predicted face features corresponding to each face feature point in the face image used to train the feature extraction network, a loss function value can be calculated based on the predicted result and the annotation information of the face image used to train the feature extraction network using a preset loss function, and the loss function value indicates the degree of difference between the predicted result and the annotation information. The annotation information includes: the annotation features corresponding to each of the multiple target feature points in the image used to train the feature extraction network.
[0063] The preset loss function may be a loss function used when training an existing convolutional neural network, such as a cross entropy loss function.
[0064] For each facial feature point among multiple facial feature points in a facial image used to train a feature extraction network, the preset loss function includes an item representing the difference between a predicted facial feature corresponding to the facial feature point and a labeled facial feature corresponding to the facial feature point.
[0065] Each time the feature extraction network is trained, for each of the multiple facial feature points in the face image used to train the feature extraction network, the difference between the predicted facial feature corresponding to the facial feature point and the labeled facial feature corresponding to the facial feature point is calculated. Based on the calculated multiple differences, the loss function value is calculated.
[0066] Each time the feature extraction network is trained, after the loss function value is calculated, back propagation can be performed based on the loss function value to update the parameter values of the parameters in the feature extraction network that are related to the loss function value. The parameters related to the loss function value include: the weight of the convolution kernel corresponding to each of the multiple facial feature points in the facial image used to train the feature extraction network.
[0067] Each time the feature extraction network is trained, the parameter values of the parameters in the feature extraction network related to the loss function value are updated so that the calculated loss function value becomes smaller and smaller.
[0068] By training the feature extraction network multiple times, the weight of the convolution kernel corresponding to each facial feature point is continuously adjusted.
[0069] In some embodiments, for each of multiple target feature points in any image to be processed, the position of the target feature point can be predetermined based on the positions of sample feature points of the same type as the target feature point in multiple sample images used to train the feature extraction network.
[0070] Taking the image to be processed as a face image as an example, the sample image used to train the feature extraction network is the face image used to train the feature extraction network, and the sample feature points in the sample image used to train the feature extraction network are the face feature points in the face image used to train the feature extraction network. For each face feature point among the multiple face feature points in any face image used as the image to be processed, an average position corresponding to the face feature point can be calculated in advance based on the positions of face feature points of the same type as the face feature point in multiple face images used to train the feature extraction network, and the calculated average position corresponding to the face feature point is used as the position of the face feature point.
[0071] The positions of facial feature points can be represented by abscissa values and ordinate values in an image coordinate system established based on the facial image.
[0072] For each facial feature point among the multiple facial feature points in any face image to be processed, the horizontal coordinate value of the average position corresponding to the facial feature point is the average of the horizontal coordinate values of the positions of facial feature points of the same type as the facial feature point in multiple face images used to train the feature extraction network, and the vertical coordinate value of the average position corresponding to the facial feature point is the average of the vertical coordinate values of the positions of facial feature points of the same type as the facial feature point in multiple face images used to train the feature extraction network.
[0073] For example, the multiple facial feature points in the face image to be processed include facial feature points such as nose tip facial feature points and mouth corner facial feature points.
[0074] For the nose tip facial feature point in the facial image, the average position corresponding to the nose tip facial feature point is calculated in advance based on the positions of the nose tip facial feature point in multiple facial images used to train the feature extraction network. The horizontal coordinate value of the average position corresponding to the nose tip facial feature point is the average of the horizontal coordinate values of the positions of the nose tip facial feature point in all facial images used to train the feature extraction network. The vertical coordinate value of the average position corresponding to the nose tip facial feature point is the average of the vertical coordinate values of the positions of the nose tip facial feature point in multiple facial images used to train the feature extraction network. The calculated average position corresponding to the nose tip facial feature point is used as the position of the nose tip facial feature point.
[0075] For the facial feature points at the corners of the mouth in the facial image, the average position corresponding to the facial feature points at the corners of the mouth is calculated in advance based on the positions of the facial feature points at the corners of the mouth in multiple facial images used to train the feature extraction network, the horizontal coordinate value of the average position corresponding to the facial feature points at the corners of the mouth is the average of the horizontal coordinate values of the positions of the facial feature points at the corners of the mouth in multiple facial images used to train the feature extraction network, the vertical coordinate value of the average position corresponding to the facial feature points at the corners of the mouth is the average of the vertical coordinate values of the positions of the facial feature points at the corners of the mouth in multiple facial images used to train the feature extraction network, and the calculated average position corresponding to the facial feature points at the corners of the mouth is used as the position of the facial feature points at the corners of the mouth.
[0076] In some embodiments, for each target feature point, determining the feature extraction area corresponding to the target feature point based on the position of the target feature point includes: for each target feature point, determining the feature extraction area corresponding to the target feature point based on the position of the target feature point and the radial basis function.
[0077] In this application, the radial basis function can be expressed as e -(εr.εr) .
[0078] Among them, e is a mathematical constant, r represents the distance between the pixel where the target feature point is located and other pixels, and ε is a parameter related to the weights of other pixels. The parameter value of ε can be set in advance, and the parameter value of ε can also be obtained through pre-training.
[0079] Taking the image to be processed as a face image and the target feature point as a face feature point as an example, the process of determining the feature extraction area corresponding to the target feature point is explained:
[0080] For each of the multiple facial feature points in the facial image, the feature extraction network determines the feature extraction area corresponding to the facial feature point based on the position of the facial feature point and the radial basis function. For each of the multiple facial feature points in the facial image, the feature extraction area corresponding to the facial feature point includes the pixel where the facial feature point is located.
[0081] For example, the multiple facial feature points in the facial image include facial feature points such as the nose tip facial feature point and the mouth corner facial feature point. For the nose tip facial feature point, based on the position of the nose tip facial feature point and the radial basis function, the feature extraction area corresponding to the nose tip facial feature point is determined, and the feature extraction area corresponding to the nose tip facial feature point includes the pixel where the nose tip facial feature point is located. For the mouth corner facial feature point, based on the position of the mouth corner facial feature point and the radial basis function, the feature extraction area corresponding to the mouth corner facial feature point is determined, and the feature extraction area corresponding to the mouth corner facial feature point includes the pixel where the mouth corner facial feature point is located.
[0082] For each of the multiple facial feature points in the facial image, the pixel where the facial feature point is located can be determined by the position of the facial feature point, and the distance between each other pixel in the facial image and the pixel where the facial feature point is located can be determined. For each other pixel, the distance between the other pixel and the pixel where the facial feature point is located is the radial basis function e -(εr.εr) The value of r in can be used to calculate the radial basis function e -(εr.εr) The function value of the face feature point is calculated, and the calculated function value is used as the weight of the other pixel. The weight of each other pixel can be compared with the weight threshold, and other pixels with weights greater than the weight threshold are determined as other pixels belonging to the feature extraction area corresponding to the facial feature point. After all other pixels belonging to the feature extraction area corresponding to the facial feature point are determined, the feature extraction area corresponding to the facial feature point can be determined.
[0083] For example, the multiple facial feature points in the facial image include facial feature points such as the nose tip facial feature points and the mouth corner facial feature points.
[0084] For the nose tip facial feature point among the multiple facial feature points in the facial image, the distance between each other pixel and the pixel where the nose tip facial feature point is located is determined, and the weight of each other pixel is calculated by radial basis function. The weight of each other pixel can be compared with the weight threshold, and other pixels with weights greater than the weight threshold are determined as other pixels belonging to the feature extraction area corresponding to the nose tip facial feature point. After all other pixels belonging to the feature extraction area corresponding to the nose tip facial feature point are determined, the feature extraction area corresponding to the nose tip facial feature point can be determined.
[0085] For the mouth corner facial feature point among the multiple facial feature points in the face image, the distance between each other pixel and the pixel where the mouth corner facial feature point is located is determined, and the weight of each other pixel is calculated through the radial basis function. The weight of each other pixel can be compared with the weight threshold, and other pixels with weights greater than the weight threshold are determined as other pixels belonging to the feature extraction area corresponding to the mouth corner facial feature point. After all other pixels belonging to the feature extraction area corresponding to the mouth corner facial feature point are determined, the feature extraction area corresponding to the mouth corner facial feature point can be determined.
[0086] In some embodiments, for each target feature point, determining the feature extraction area corresponding to the target feature point based on the position of the target feature point and the radial basis function includes: determining the candidate feature extraction area corresponding to the target feature point based on the position of the target feature point; determining the feature extraction area corresponding to the target feature point based on the radial basis function and the candidate feature extraction area corresponding to the target feature point.
[0087] Taking the image to be processed as a face image and the target feature point as a face feature point as an example, the process of determining the feature extraction area corresponding to the target feature point is explained:
[0088] For each of the multiple facial feature points in the facial image, when determining the candidate feature extraction area corresponding to the facial feature point based on the position of the facial feature point, the pre-set attribute information of the candidate feature extraction area corresponding to the facial feature point can be read first. The attribute information of the candidate feature extraction area corresponding to the facial feature point includes: the shape of the candidate feature extraction area corresponding to the facial feature point, the area of the candidate feature extraction area corresponding to the facial feature point, and the distance between the position of the center point of the candidate feature extraction area corresponding to the facial feature point and the position of the facial feature point.
[0089] The position of the center point of the candidate feature extraction area corresponding to the facial feature point can be determined based on the position of the facial feature point and the distance between the position of the center point of the candidate feature extraction area corresponding to the facial feature point and the position of the facial feature point. Then, the candidate feature extraction area corresponding to the facial feature point can be determined based on the position of the center point of the candidate feature extraction area corresponding to the facial feature point, the shape of the candidate feature extraction area corresponding to the facial feature point, and the area of the candidate feature extraction area corresponding to the facial feature point.
[0090] Facial feature points of the same type in different facial images correspond to the same candidate feature extraction region attribute information.
[0091] For example, the type of the nose tip facial feature points in any face image is the nose tip facial feature point type, and the nose tip facial feature points in any face image correspond to the same candidate feature extraction region attribute information. The type of the mouth corner facial feature points in any face image is the mouth corner facial feature point type, and the mouth corner facial feature points in any face image correspond to the same candidate feature extraction region attribute information.
[0092] For each of the multiple facial feature points in the facial image, when determining the feature extraction area corresponding to the facial feature point based on the radial basis function and the candidate feature extraction area corresponding to the facial feature point, the distance between each other pixel in the candidate feature extraction area corresponding to the facial feature point and the pixel where the facial feature point is located can be first determined. For each other pixel in the candidate feature extraction area corresponding to the facial feature point, the distance between the other pixel and the pixel where the facial feature point is located is the radial basis function e -(εr.εr) The value of r in , calculates the radial basis function e -(εr.εr)The function value of the face feature point is used as the weight of the other pixel. The weight of each other pixel in the candidate feature extraction area corresponding to the facial feature point can be compared with the weight threshold, and other pixels with weights greater than the weight threshold are determined as other pixels belonging to the feature extraction area corresponding to the facial feature point. After all other pixels belonging to the feature extraction area corresponding to the facial feature point are determined, the feature extraction area corresponding to the facial feature point can be determined.
[0093] In some embodiments, each time the feature extraction network is trained, a sample image used to train the feature extraction network is input into the feature extraction network to obtain a prediction result, which includes: a predicted feature corresponding to each of a plurality of sample feature points in the sample image used to train the feature extraction network; calculating a loss function value based on the prediction result and the annotation information of the sample image used to train the feature extraction network using a preset loss function; and updating the weight of the convolution kernel corresponding to each of a plurality of target feature points in the image used to train the feature extraction network and the parameter values of the parameters in the radial basis function related to the loss function value based on the loss function value.
[0094] Each time the feature extraction network is trained, each of the multiple sample feature points in the sample image used for training the feature extraction network corresponds to a target feature point in the image to be processed, and for each of the multiple sample feature points, the type of the sample feature point is the same as the type of the target feature point corresponding to the sample feature point.
[0095] For each sample image used to train a feature extraction network, the annotation information of the sample image includes: an annotation feature corresponding to each of a plurality of sample feature points in the sample image.
[0096] Each time the feature extraction network is trained, the calculated loss function value can indicate the degree of difference between the prediction result calculated during the training of the feature extraction network and the annotation information of the sample image used for the training of the feature extraction network.
[0097] Taking the image to be processed as a face image as an example, the process of training the feature extraction network is explained:
[0098] Each time the feature extraction network is trained, the sample image used is a face image used to train the feature extraction network. The multiple sample feature points in the sample image used to train the feature extraction network are multiple face feature points in the face image used to train the feature extraction network. Each time the feature extraction network is trained, the feature extraction network is trained in a supervised learning manner using a face image used to train the feature extraction network and the annotation information of the face image used to train the feature extraction network.
[0099] For each training face image, the annotation information of the face image used for training the feature extraction network includes the annotated face features corresponding to each face feature point among the multiple face feature points in the face image used for training the feature extraction network.
[0100] Each time the feature extraction network is trained, the face image used to train the feature extraction network is input into the feature extraction network to obtain a prediction result, which includes: the predicted face feature corresponding to each of the multiple face feature points in the face image used to train the feature extraction network.
[0101] Each time the feature extraction network is trained, after the face image used for training the feature extraction network is input into the feature extraction network, for each face feature point among the multiple face feature points in the face image used for training the feature extraction network, the feature extraction network determines the feature extraction area corresponding to the face feature point based on the position of the face feature point and the radial basis function; uses the convolution kernel corresponding to the face feature point in the face image used for training the feature extraction network to extract face features from the feature extraction area corresponding to the face feature point in the face image used for training the feature extraction network, and obtains the predicted face features corresponding to the face feature point.
[0102] For example, the multiple feature points in the face image used to train the feature extraction network include face feature points such as the nose tip face feature point and the mouth corner face feature point in the face image used to train the feature extraction network.
[0103] For a nose tip facial feature point in a facial image used to train a feature extraction network, after the facial image used to train the feature extraction network is input into the feature extraction network, a feature extraction region corresponding to the nose tip facial feature point is determined based on the position of the nose tip facial feature point and a radial basis function; a convolution kernel corresponding to the nose tip facial feature point is used to extract facial features from the feature extraction region corresponding to the nose tip facial feature point in the facial image used to train the feature extraction network, and a predicted facial feature corresponding to the nose tip facial feature point is obtained.
[0104] For the facial feature points at the corners of the mouth in the facial images used for training the feature extraction network, after the facial images used for training the feature extraction network are input into the feature extraction network, a feature extraction region corresponding to the facial feature points at the corners of the mouth is determined based on the position of the facial feature points at the nose tip and the radial basis function; a convolution kernel corresponding to the facial feature points at the corners of the mouth is used to extract facial features from the feature extraction region corresponding to the facial feature points at the corners of the mouth in the facial images used for training the feature extraction network, and a predicted facial feature corresponding to the facial feature points at the corners of the mouth is obtained.
[0105] Each time the feature extraction network is trained, after obtaining the predicted facial features corresponding to each facial feature point in the facial image used to train the feature extraction network, a preset loss function can be used to calculate the loss function value based on the prediction result and the annotation information of the facial image used to train the feature extraction network. The loss function value indicates the degree of difference between the prediction result and the annotation information.
[0106] The preset loss function may be a loss function used when training an existing convolutional neural network, such as a cross entropy loss function.
[0107] For each facial feature point among multiple facial feature points in a facial image used to train a feature extraction network, the preset loss function includes an item representing the difference between a predicted facial feature corresponding to the facial feature point and a labeled facial feature corresponding to the facial feature point.
[0108] Each time the feature extraction network is trained, for each of the multiple facial feature points in the face image used to train the feature extraction network, the difference between the predicted facial feature corresponding to the facial feature point and the labeled facial feature corresponding to the facial feature point is calculated. Based on the calculated multiple differences, the loss function value is calculated.
[0109] Each time the feature extraction network is trained, after the loss function value is calculated, back propagation can be performed based on the loss function value to update the parameter values of all parameters in the feature extraction network that are related to the loss function value.
[0110] Each time the feature extraction network is trained, the parameter values of the parameters in the feature extraction network related to the loss function value are updated so that the calculated loss function value becomes smaller and smaller.
[0111] The weight of the convolution kernel corresponding to each facial feature point and the parameter ε in the radial basis function that is related to the loss function value are both related to the loss function value. Therefore, the parameter values of the parameters related to the loss function value in the feature extraction network include: the weight of the convolution kernel corresponding to each facial feature point and the parameter value of the parameter ε in the radial basis function that is related to the loss function value.
[0112] By training the feature extraction network multiple times, the weight of the convolution kernel corresponding to each facial feature point and the parameter value of the parameter ε in the radial basis function related to the loss function value are continuously adjusted.
[0113] In some embodiments, the image to be processed is a facial image, the multiple target feature points are multiple facial feature points, and the features corresponding to the target feature points are facial features corresponding to the facial feature points; it also includes: based on the facial features corresponding to each facial feature point in the multiple facial feature points and preset facial feature information of multiple reference facial images, facial recognition is performed on the user to whom the facial image belongs.
[0114] In the present application, the preset facial feature information of the reference facial image includes: facial features corresponding to each facial feature point among multiple facial feature points in the reference facial image, and the preset facial feature information of the reference facial image can be obtained through a feature extraction network.
[0115] For each reference face image, the reference face image may be input into a feature extraction network in advance to obtain a face feature corresponding to each of a plurality of face feature points in the reference face image.
[0116] The multiple facial feature points in the reference facial image may be a part of all facial feature points in the reference facial image.
[0117] A plurality of facial feature points in the reference facial image participate in facial recognition, and feature points other than the plurality of facial feature points among all feature points in the reference facial image do not participate in facial recognition.
[0118] In the present application, for each facial feature point among multiple facial feature points in a facial image serving as an image to be processed, the multiple facial feature points in the reference facial image include facial feature points belonging to the facial feature point type to which the facial feature point belongs.
[0119] For example, the multiple facial feature points in the face image to be processed include facial feature points of the nose tip, mouth corners, etc. in the face image that belong to pre-set facial feature point types.
[0120] For each reference face image, the multiple face feature points in the reference face image include face feature points of the nose tip and the mouth corners in the reference face image, which belong to the preset face feature point types.
[0121] The process of the feature extraction network extracting the facial features corresponding to each of the multiple facial feature points in the reference facial image can refer to the process of the feature extraction network extracting the facial features corresponding to each of the multiple facial feature points in the facial image.
[0122] For each reference face image, a vector of preset face feature information of the reference face image can be generated in advance. For each of the multiple face feature points in the reference face image, the vector of preset face feature information of the reference face image includes a component representing the face feature corresponding to the face feature point.
[0123] When face recognition is performed on the user to whom the face image to be processed belongs based on the face features corresponding to each face feature point and the preset face feature information of multiple reference face images, a face feature vector of the user can be generated. For each face feature point among the multiple feature points in the face image to be processed, the face feature vector of the user includes a component representing the face feature corresponding to the face feature point. Then, the similarity between the face feature vector of the user and the vector of the preset face feature information of each reference face image can be calculated to obtain multiple similarities. Finally, the maximum similarity among the multiple similarities is determined. When the maximum similarity is greater than the similarity threshold, it can be determined that the face recognition of the user is successful. The distance between the face feature vector of the user and the vector of the preset face feature information of each reference face image can also be calculated to obtain multiple vector distances. When the minimum vector distance is less than the distance threshold, it can be determined that the face recognition of the user is successful.
[0124] Please refer to Figure 2 , which shows a structural block diagram of an image processing device provided in an embodiment of the present application. The image processing device includes: an acquisition unit 201 and a processing unit 202.
[0125] The acquisition unit 201 is configured to acquire an image to be processed containing a target object;
[0126] The processing unit 202 is configured to input the image to be processed containing the target object into a feature extraction network to obtain features corresponding to the target feature points in the image to be processed, wherein the feature extraction network is configured to: determine multiple target feature points in the image to be processed; for each target feature point, determine the feature extraction area corresponding to the target feature point based on the position of the target feature point; use the convolution kernel corresponding to the target feature point to extract features from the feature extraction area corresponding to the target feature point to obtain the features corresponding to the target feature point, wherein for each convolution layer in the feature extraction network that includes a convolution kernel corresponding to the target feature point, the convolution layer includes at least one convolution kernel whose weight is different from the weights of other convolution kernels in the convolution layer.
[0127] In some embodiments, for each of the target feature points, determining the feature extraction area corresponding to the target feature point based on the position of the target feature point includes:
[0128] For each target feature point, a feature extraction region corresponding to the target feature point is determined based on the position of the target feature point and a radial basis function.
[0129] In some embodiments, determining the feature extraction area corresponding to the target feature point based on the position of the target feature point and the radial basis function includes:
[0130] Based on the position of the target feature point, determining a candidate feature extraction area corresponding to the target feature point;
[0131] Based on the radial basis function and the candidate feature extraction regions corresponding to the target feature points, the feature extraction regions corresponding to the target feature points are determined.
[0132] In some embodiments, the image processing apparatus further comprises:
[0133] The training unit is configured to train the feature extraction network. The training of the feature extraction network includes:
[0134] Inputting a sample image for training a feature extraction network into the feature extraction network to obtain a prediction result, wherein the prediction result includes: a prediction feature corresponding to each of a plurality of sample feature points in the sample image for training the feature extraction network;
[0135] Calculating a loss function value based on the prediction result and the annotation information of the sample image used to train the feature extraction network using a preset loss function;
[0136] Based on the loss function value, the weight of the convolution kernel corresponding to each target feature point and the parameter value of the parameter in the radial basis function related to the loss function value are updated.
[0137] In some embodiments, for each of the target feature points, the target feature point is a center point of a feature extraction area corresponding to the target feature point.
[0138] In some embodiments, for each of the target feature points, the position of the target feature point is determined based on the positions of sample feature points of the same type as the target feature point in a plurality of sample images used to train a feature extraction network.
[0139] Figure 33 is a block diagram of an electronic device provided by this embodiment. The electronic device 300 includes a processing component 322, which further includes one or more processors, and a memory resource represented by a memory 332, which is used to store instructions that can be executed by the processing component 322, such as an application. The application stored in the memory 332 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 322 is configured to execute instructions to perform the above method.
[0140] The electronic device 300 may also include a power supply component 326 configured to perform power management of the electronic device 300, a wired or wireless network interface 350 configured to connect the electronic device 300 to a network, and an input / output (I / O) interface 358. The electronic device 300 may operate based on an operating system stored in the memory 332, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
[0141] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory including instructions, and the instructions can be executed by an electronic device to complete the above method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0142] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0143] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. An image processing method, characterized in that: The method comprises: Acquire an image to be processed containing a target object; The image to be processed containing the target object is input into the feature extraction network to obtain features corresponding to the target feature points in the image to be processed, wherein the feature extraction network is configured as follows: Determining a plurality of target feature points in the image to be processed; For each target feature point, a feature extraction region corresponding to the target feature point is determined based on the position of the target feature point; a convolution kernel corresponding to the target feature point is used to extract features from the feature extraction region corresponding to the target feature point to obtain features corresponding to the target feature point, wherein, for each convolution layer in the feature extraction network that includes a convolution kernel corresponding to the target feature point, the convolution layer includes at least one convolution kernel whose weight is different from the weights of other convolution kernels in the convolution layer.
2. The method according to claim 1, characterized in that For each target feature point, determining the feature extraction area corresponding to the target feature point based on the position of the target feature point includes: For each target feature point, a feature extraction region corresponding to the target feature point is determined based on the position of the target feature point and a radial basis function.
3. The method according to claim 2, characterized in that The determining, based on the position of the target feature point and the radial basis function, a feature extraction area corresponding to the target feature point comprises: Based on the position of the target feature point, determining a candidate feature extraction area corresponding to the target feature point; Based on the radial basis function and the candidate feature extraction regions corresponding to the target feature points, the feature extraction regions corresponding to the target feature points are determined.
4. The method according to claim 2 or 3, characterized in that: Before inputting the image to be processed containing the target object into the feature extraction network, the method further includes: Training the feature extraction network includes: Inputting a sample image for training a feature extraction network into the feature extraction network to obtain a prediction result, wherein the prediction result includes: a prediction feature corresponding to each of a plurality of sample feature points in the sample image for training the feature extraction network; Calculating a loss function value based on the prediction result and the annotation information of the image used to train the feature extraction network using a preset loss function; Based on the loss function value, the weight of the convolution kernel corresponding to each target feature point and the parameter value of the parameter in the radial basis function related to the loss function value are updated.
5. The method according to claim 1, characterized in that For each target feature point, the target feature point is a center point of a feature extraction area corresponding to the target feature point.
6. The method according to claim 1, characterized in that For each target feature point, the position of the target feature point is determined based on the positions of sample feature points of the same type as the target feature point in a plurality of sample images used to train a feature extraction network.
7. The method according to any one of claims 1 to 6, characterized in that: The image to be processed is a face image.
8. The method according to claim 7, characterized in that The image to be processed is a face image, the multiple target feature points are multiple face feature points, and the features corresponding to the target feature points are face features corresponding to the face feature points; as well as The method further comprises: Based on the facial features corresponding to each of the multiple facial feature points and preset facial feature information of multiple reference facial images, facial recognition is performed on the user to whom the facial image belongs.
9. An image processing device, characterized in that: The device comprises: An acquisition unit, configured to acquire an image to be processed containing a target object; A processing unit is configured to input an image to be processed containing a target object into a feature extraction network to obtain features corresponding to target feature points in the image to be processed, wherein the feature extraction network is configured to: determine multiple target feature points in the image to be processed; for each target feature point, determine a feature extraction area corresponding to the target feature point based on the position of the target feature point; use a convolution kernel corresponding to the target feature point to extract features from the feature extraction area corresponding to the target feature point to obtain features corresponding to the target feature point, wherein for each convolution layer in the feature extraction network that includes a convolution kernel corresponding to a target feature point, the convolution layer includes at least one convolution kernel whose weight is different from the weights of other convolution kernels in the convolution layer.
10. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 8.
11. A storage medium, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 8.
