Pain feeling grading method and system based on machine learning and facial expression
Through a pain grading method based on machine learning, three-dimensional image data of facial expressions are used to extract features and classify pain, solving the accuracy and timeliness problems of existing pain assessment methods and achieving more accurate and efficient pain management.
Patent Information
- Application Number
- CN202410746685.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-08-30
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing pain assessment methods have problems with accuracy and timeliness. In particular, facial expression assessment relies on the subjective judgment of medical staff and lacks accurate measurement tools, which affects the effectiveness of pain management.
Using a method based on machine learning, we obtain three-dimensional image data of facial expressions, extract features and build a pain grading model, use multi-layer perceptron and maximum pooling layers to extract global features, and combine with k-nearest neighbor algorithm for pain classification to achieve pain level classification. Automated assessment.
It improves the accuracy and timeliness of pain assessment, reduces the impact on illumination changes, can effectively extract features in complex scenes, and enhances the reliability of pain classification.
Smart Images

Figure CN118570863A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a pain grading method and system based on machine learning and facial expressions. Background Art
[0002] There is a close relationship between facial expressions and pain. When the human body senses pain stimulation, the brain transmits corresponding information through neural pathways, thereby activating facial muscles and showing different changes in facial expressions. These changes in expression are not just superficial reactions, but are closely related to the degree, type and nature of pain. Medical staff usually use a variety of methods to judge the patient's pain level, generally including language scoring method, numerical scoring method, visual scoring method and facial expression method. Language scoring method, numerical scoring method and visual scoring method usually require patients to feedback their pain to medical staff. Facial expression method is to evaluate pain by observing the patient's facial expression by medical staff. These evaluation methods help medical staff to objectively and quantitatively evaluate the patient's pain, so as to better formulate treatment plans and medication plans.
[0003] However, the above-mentioned method of judging pain levels has some drawbacks: pain is a subjective feeling, and different patients may have different feelings and descriptions of pain, so the assessment of medical staff may not be accurate enough; due to the heavy workload and tight time of medical staff, pain assessment may not be timely, thus affecting the treatment effect of patients; due to the lack of sufficient tools to accurately measure pain, pain assessment may be inaccurate and untimely; some patients may be afraid of the side effects caused by anesthetics, such as delayed wound healing and slowed postoperative recovery, and thus refuse to take medication, affecting pain control. The above-mentioned drawbacks cause certain errors in the pain assessment process of medical staff, affecting the actual pain management effect. . Summary of the invention
[0004] The purpose of the present invention is to provide a pain grading method and system based on machine learning and facial expressions to solve at least one technical problem existing in the above-mentioned background technology.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] In a first aspect, the present invention provides a pain grading method based on machine learning and facial expressions, comprising:
[0007] Acquiring three-dimensional image data of facial expression of a target to be analyzed for pain;
[0008] The acquired three-dimensional facial expression image is processed using a pre-trained pain grading model to obtain a target pain grading result; wherein training the pain grading model includes:
[0009] Using multiple three-dimensional facial expression images and labels of pain levels corresponding to relevant facial expressions in the annotated images, image processing technology is used to extract features related to facial expressions from the three-dimensional facial expression images; using the extracted features as input and the corresponding pain levels as output, a machine learning model is constructed and trained to obtain the pain grading model.
[0010] Furthermore, image processing technology is used to extract features related to facial expressions from the three-dimensional facial expression image, including:
[0011] Convert the acquired facial expression three-dimensional image into three-dimensional point cloud data; pre-process the three-dimensional point cloud data obtained through coordinate transformation, including denoising and smoothing the three-dimensional point cloud data;
[0012] The idea of symmetric function is used to construct a feature extraction network based on point cloud to solve the disorder problem of point cloud data. A method combining multi-layer perceptron and maximum pooling layer is used to extract global features of point cloud data. At the same time, the farthest point sampling method is used to sample the point cloud to obtain a fixed number of feature points.
[0013] Construct a local feature four-dimensional descriptor. According to the relative position and normal angle of the point pair in the local area, a four-dimensional descriptor is constructed to express the geometric features of the local area. Using this four-dimensional descriptor, the relationship between the point pairs in the local area is manually marked to form a local feature descriptor.
[0014] A local area is defined around each feature point, and the geometric features of the local area are encoded using a four-dimensional descriptor. The feature encoding of each local area is sent to the point cloud feature extraction network, and all local features are integrated through the maximum pooling layer to extract the global features.
[0015] Furthermore, a local feature four-dimensional descriptor is constructed. A four-dimensional descriptor is constructed according to the relative position of the regional point pairs and the normal angle. The four-dimensional descriptor manually marks the relationship between the point pairs in the local region and forms a local feature descriptor to express the geometric features of the local region in a fine-grained manner. The four-dimensional descriptor meets the requirements of translation invariance. Assume that (p i , p j ) is a pair of feature points in the local area, and their spatial geometric relationship is:
[0016] ψ ij =(||d||,∠(n i ,d),∠(n j ,d),∠(n i ,n j ))
[0017] Among them, d is a vector representing the difference between two points; ||.|| is the Euclidean distance; n i and n j is the point p in the local area i and p j The normal vector of ; ∠(·,·) represents the angle between vectors:
[0018] ∠(n i ,n j )=(atan2||n i ×n j ||,n i ·n j ).
[0019] Furthermore, the four-dimensional descriptor describes the spatial geometric features between point pairs. i In a sphere with center as center and radius k as radius, all points {p1,p2,p3,…,p N} and the center point p i Constitute j point pairs, the encoding method of the local area is:
[0020] F i =[p1,n1,p2,n2,...,p j ,n j ,ψ i1 ,ψ i2 ,...,ψ ij ]
[0021] Among them, n j For point p j The normal vector in this local area, ψ ij For p j With the center point p i The four-dimensional feature descriptor between i By p i All points in the local area with the center of the sphere and k as the radius and the midpoint p i The spatial geometric relationship describes the spatial geometric characteristics of the local area.
[0022] Furthermore, each group of point cloud objects uniformly samples N1 feature points {p1, p2, p3, …, p N}, taking each feature point as the midpoint and k as the radius to obtain a local region, encoding each local region according to the local feature descriptor of formula (4) to obtain a set of local spatial geometric features Then for each Use the point cloud feature extraction network in step c to extract local features and obtain a set of features in a high-dimensional feature space Send this group of features into the maximum pooling layer to obtain the local to global features of the point cloud object f LtoG .
[0023] Furthermore, after obtaining the above facial expression features f LtoG Finally, the k-nearest neighbor (kNN) algorithm is used for expression classification, including:
[0024] Calculate feature distance: Input expression feature f LtoG , calculate the Euclidean distance between it and each expression feature in the training set;
[0025] Find the nearest distance: find the k nearest training data features as the nearest neighbors of the input expression;
[0026] Perform expression classification: Classify the input expression according to the categories of the k nearest neighbors, that is, their corresponding pain level labels.
[0027] In a second aspect, the present invention provides a pain grading system based on machine learning and facial expressions, comprising:
[0028] An acquisition module, used to acquire three-dimensional image data of facial expressions of a target to be analyzed for pain;
[0029] A processing module is used to process the acquired three-dimensional facial expression image using a pre-trained pain grading model to obtain a target pain grading result; wherein training the pain grading model includes:
[0030] Using multiple three-dimensional facial expression images and labels of pain levels corresponding to relevant facial expressions in the annotated images, image processing technology is used to extract features related to facial expressions from the three-dimensional facial expression images; using the extracted features as input and the corresponding pain levels as output, a machine learning model is constructed and trained to obtain the pain grading model.
[0031] In a third aspect, the present invention provides a non-transitory computer-readable storage medium, which is used to store computer instructions. When the computer instructions are executed by a processor, the pain grading method based on machine learning and facial expressions as described in the first aspect is implemented.
[0032] In a fourth aspect, the present invention provides a computer device comprising a memory and a processor, wherein the processor and the memory communicate with each other, the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the pain grading method based on machine learning and facial expressions as described in the first aspect.
[0033] In a fifth aspect, the present invention provides an electronic device, comprising: a processor, a memory, and a computer program; wherein the processor is connected to the memory, and the computer program is stored in the memory. When the electronic device is running, the processor executes the computer program stored in the memory so that the electronic device executes instructions for implementing the pain grading method based on machine learning and facial expressions as described in the first aspect.
[0034] The beneficial effects of the present invention are as follows: the collected data itself remains stable to changes in illumination, so that it can be effectively applied to scenes with a lack of illumination or large changes in illumination; background separation can be achieved simply based on distance information, reducing background interference with the target, allowing the task to better focus on the object itself; features can still be effectively extracted in complex situations such as facial expression and posture interference and partial occlusion, and the overall accuracy of pain grading is better.
[0035] Additional advantages of the present invention will be more clearly presented in the following description or learned through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0037] Figure 1 This is a flow chart of a pain grading method based on machine learning and facial expressions according to an embodiment of the present invention.
[0038] Figure 2 This is a functional principle block diagram of the pain grading system based on machine learning and facial expressions described in an embodiment of the present invention.
[0039] Figure 3 A schematic diagram of the structure of the terminal device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements with the same or similar functions. The embodiments described below by the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.
[0041] It should be understood by those skilled in the art that unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those skilled in the art to which this invention belongs.
[0042] It should also be understood that terms, such as those defined in commonly used dictionaries, should be understood to have a meaning consistent with that in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless as defined herein.
[0043] Those skilled in the art will appreciate that, unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or groups thereof.
[0044] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. Different embodiments or examples described in this specification and features of different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
[0045] To facilitate understanding of the present invention, the present invention is further explained below with reference to specific embodiments in conjunction with the accompanying drawings, and the specific embodiments do not constitute a limitation on the embodiments of the present invention.
[0046] Those skilled in the art should understand that the drawings are merely schematic diagrams of embodiments, and the components in the drawings are not necessarily necessary for implementing the present invention.
[0047] The present invention provides a pain grading method and system based on machine learning and facial expressions. A three-dimensional camera is used to collect three-dimensional image files of facial expressions, and the files are transmitted to a storage server for storage; image processing technology is used to extract features related to facial expressions from the collected three-dimensional image files of facial expressions; the extracted features are used as input to build and train a machine learning model, and the corresponding pain degree is used as output. The data collected by the present invention itself remains stable to changes in illumination, so that it can be effectively applied to scenes with a lack of illumination or large changes in illumination, and background separation can be simply achieved based on distance information, reducing the interference of the background on the target, so that the task can better focus on the object itself, and features can still be effectively extracted under complex conditions such as interference from facial expressions and postures and partial occlusion, and the overall accuracy of pain grading is better.
[0048] Example 1
[0049] In this embodiment 1, a pain grading system based on machine learning and facial expressions is first provided, including: an acquisition module for acquiring three-dimensional image data of facial expressions of a target to be subjected to pain analysis; a processing module for processing the acquired three-dimensional facial expression image using a pre-trained pain grading model to obtain a pain grading result of the target.
[0050] In this embodiment 1, the above-mentioned system is used to implement a pain grading method based on machine learning and facial expressions, including: using an acquisition module to acquire facial expression three-dimensional image data of a target to be subjected to pain analysis; using a processing module to process the acquired facial expression three-dimensional image using a pre-trained pain grading model to obtain the target's pain grading result. Among them, training the pain grading model includes: using multiple facial expression three-dimensional images and labels of pain levels corresponding to relevant facial expressions in the annotated images, using image processing technology, extracting features related to facial expressions from the facial expression three-dimensional images; using the extracted features as input and the corresponding pain level as output, constructing and training a machine learning model to obtain the pain grading model.
[0051] Using image processing technology, features related to facial expressions are extracted from the 3D facial expression images, including:
[0052] Convert the acquired facial expression three-dimensional image into three-dimensional point cloud data; pre-process the three-dimensional point cloud data obtained through coordinate transformation, including denoising and smoothing the three-dimensional point cloud data;
[0053] The idea of symmetric function is used to construct a feature extraction network based on point cloud to solve the disorder problem of point cloud data. A method combining multi-layer perceptron and maximum pooling layer is used to extract global features of point cloud data. At the same time, the farthest point sampling method is used to sample the point cloud to obtain a fixed number of feature points.
[0054] Construct a local feature four-dimensional descriptor. According to the relative position and normal angle of the point pair in the local area, a four-dimensional descriptor is constructed to express the geometric features of the local area. Using this four-dimensional descriptor, the relationship between the point pairs in the local area is manually marked to form a local feature descriptor.
[0055] A local area is defined around each feature point, and the geometric features of the local area are encoded using a four-dimensional descriptor. The feature encoding of each local area is sent to the point cloud feature extraction network, and all local features are integrated through the maximum pooling layer to extract the global features.
[0056] Construct a local feature four-dimensional descriptor. According to the relative position of the regional point pair and the normal angle, a four-dimensional descriptor is constructed. The four-dimensional descriptor manually marks the relationship between the point pairs in the local area, and forms a local feature descriptor to express the geometric features of the local area in a fine-grained manner. The four-dimensional descriptor meets the requirements of translation invariance. Assume that (p i , p j ) is a pair of feature points in the local area, and their spatial geometric relationship is:
[0057] ψ ij =(||d||,∠(n i ,d),∠(n j ,d),∠(n i ,n j ))
[0058] Among them, d is a vector representing the difference between two points; ||.|| is the Euclidean distance; n i and n j is the point p in the local area i and p j The normal vector of ; ∠(·,·) represents the angle between vectors:
[0059] ∠(n i ,n j )=(atan2||n i ×n j ||,n i ·n j ).
[0060] The four-dimensional descriptor describes the spatial geometric features between point pairs. i In a sphere with center as center and radius k as radius, all points {p1,p2,p3,…,p N} and the center point p i Constitute j point pairs, the encoding method of the local area is:
[0061] F i =[p1,n1,p2,n2,…,p j ,n j ,ψ i1 ,ψ i2 ,...,ψ ij ]
[0062] Among them, n j For point p j The normal vector in this local area, ψ ij For p j With the center point p i The four-dimensional feature descriptor between i By p iAll points in the local area with the center of the sphere and k as the radius and the midpoint p i The spatial geometric relationship describes the spatial geometric characteristics of the local area.
[0063] Each group of point cloud objects uses the farthest point sampling method to uniformly sample N1 feature points {p1, p2, p3, …, p N}, taking each feature point as the midpoint and k as the radius to obtain a local region, encoding each local region according to the local feature descriptor of formula (4) to obtain a set of local spatial geometric features Then for each Use the point cloud feature extraction network in step c to extract local features and obtain a set of features in a high-dimensional feature space Send this group of features into the maximum pooling layer to obtain the local to global features of the point cloud object f LtoG .
[0064] After obtaining the above facial expression features f LtoG Finally, the k-nearest neighbor (kNN) algorithm is used for expression classification, including:
[0065] Calculate feature distance: Input expression feature f LtoG , calculate the Euclidean distance between it and each expression feature in the training set;
[0066] Find the nearest distance: find the k nearest training data features as the nearest neighbors of the input expression;
[0067] Perform expression classification: Classify the input expression according to the categories of the k nearest neighbors, that is, their corresponding pain level labels.
[0068] Example 2
[0069] In this embodiment 2, first, a pain grading system based on machine learning and facial expressions is provided, including: a data acquisition module, which is responsible for capturing the facial expressions of the target object, generating a three-dimensional image file, and transmitting the acquired three-dimensional image file to a storage server; a feature extraction module, which reads the facial expression three-dimensional image file from the storage server and extracts features related to the facial expression from the image; a machine learning module, which is used to receive feature data output by the feature extraction module, use these feature data to build a machine learning model, and train the model to learn the mapping relationship between facial expression features and pain levels; a pain grading module, which, when new facial expression data is input, will call the trained machine learning model, use the model to process the new facial expression data, and output the corresponding pain level.
[0070] In this embodiment 2, the above-mentioned system is used to implement a pain grading method based on machine learning and facial expressions, which aims to obtain the patient's facial expressions and establish a machine learning model, use the patient's facial expressions as features input into the machine learning model, and use the corresponding pain level as output, so as to obtain the pain grading results, so as to manage the patient's pain in a timely manner.
[0071] The pain grading method based on machine learning and facial expressions described in this embodiment 2 specifically includes the following steps: step 1, using a 3D camera to collect a 3D image file of facial expressions, and transferring the file to a storage server for storage; step 2, using image processing technology to extract features related to facial expressions from the collected 3D image file of facial expressions; step 3, using the extracted features as input, building and training a machine learning model, and using the corresponding pain level as output.
[0072] The specific steps of extracting features related to facial expressions from the collected facial expression three-dimensional image files include:
[0073] a. Convert the acquired facial expression 3D image file into 3D point cloud data;
[0074] b. Preprocessing the three-dimensional point cloud data obtained through coordinate transformation, including denoising and smoothing the three-dimensional point cloud data;
[0075] c. Use the idea of symmetric function to build a feature extraction network based on point cloud to solve the disorder problem of point cloud data. Then use the method of combining multi-layer perceptron and maximum pooling layer to extract global features of point cloud data. At the same time, use the farthest point sampling method to sample the point cloud to obtain a fixed number of feature points.
[0076] d. Construct a local feature four-dimensional descriptor. According to the relative position and normal angle of the point pair in the local area, a four-dimensional descriptor is constructed to express the geometric features of the local area. Using this four-dimensional descriptor, the relationship between the point pairs in the local area is manually marked to form a local feature descriptor.
[0077] e. Local to global feature extraction: define a local area around each feature point, and use a four-dimensional descriptor to encode the geometric features of the local area. Send the feature code of each local area to the point cloud feature extraction network, and integrate all local features through the maximum pooling layer to extract features from local to global.
[0078] The idea of symmetric function is used to construct a feature extraction network based on point cloud to solve the disorder problem of point cloud data. Specifically, a feature extraction network Pointnet based on point cloud is constructed, and a set of points χ∈R in l-dimensional space is defined. n, function g:R k →R N is a mapping between different feature spaces, then there is the following theorem, assuming f:χ→R M , g:R k →R N are all symmetric functions,
[0079] but:
[0080] In the formula, h:χ→R K , γ:R N →R M ;
[0081] According to this theorem, for an unordered point cloud {p1,p2,p3,…,p N}, to achieve f:p→R M Global feature extraction, Pointnet uses multi-layer perceptron and maximum pooling layer to construct the right part of formula (1), where n is the number of feature points, l is the feature dimension of the point, and the multi-layer perceptron, such as the h function in formula (1), extracts features from each point through three layers of convolutional layers with a convolution kernel of 1x1, and the number of output channels is 64, 64, and 128 respectively. The maximum pooling layer, such as the symmetric function g in formula (1), takes the maximum value of each feature dimension to obtain the global features of the point cloud. Finally, the global features are mapped to a specific feature space R through a multi-layer perceptron according to the required feature dimension. M In the example, the farthest point sampling method is used to sample a fixed number of feature points for each object, that is, for the input point set {p1, p2, p3, …, p N}Randomly select p i As the starting point, traverse the point set and find the farthest point p ij Put it into the new point set, and use p again in the remaining point set i As the starting point, iterate the above process and obtain a fixed number of feature points {p i1 ,p i2 ,p i3 ,…,p iN}.
[0082] Construct a local feature four-dimensional descriptor. According to the relative position of the regional point pairs and the normal angle, a four-dimensional descriptor is constructed. The descriptor manually marks the relationship between the point pairs in the local area, and forms a local feature descriptor to express the geometric features of the local area in a fine-grained manner. The descriptor meets the requirements of translation invariance. Assume that (p i , p j ) is a pair of feature points in the local area, and their spatial geometric relationship is:
[0083] ψ ij =(||d||,∠(n i,d),∠(n j ,d),∠(n i ,n j )) (2)
[0084] In the formula, d is a vector representing the difference between two points; ||.|| is the Euclidean distance; n i and n j is the point p in the local area i and p j The normal vector of ; ∠(·,·) represents the angle between vectors:
[0085] ∠(n i ,n j )=(atan2||n i ×n j ||,n i ·n j ) (3)
[0086] This four-dimensional descriptor describes the spatial geometric features between point pairs. i In a sphere with center as center and radius k as radius, all points {p1,p2,p3,…,p N} and the center point p i Constitute j point pairs, the encoding method of the local area is:
[0087] F i =[p1,n1,p2,n2,…,p j ,n j ,ψ i1 ,ψ i2 ,...,ψ ij ] (4)
[0088] Where n j For point p j The normal vector in this local area, ψ ij For p j With the center point p i The four-dimensional feature descriptor between i By p i All points in the local area with the center of the sphere and k as the radius and the midpoint p i The spatial geometric relationship describes the spatial geometric characteristics of the local area.
[0089] Each group of point cloud objects uses the farthest point sampling method to uniformly sample N1 feature points {p1, p2, p3, …, p N}, taking each feature point as the midpoint and k as the radius to obtain a local region, encoding each local region according to the local feature descriptor of formula (4) to obtain a set of local spatial geometric features Then for each Use the point cloud feature extraction network in step c to extract local features and obtain a set of features in a high-dimensional feature space Send this group of features into the maximum pooling layer to obtain the local to global features of the point cloud object f LtoG .
[0090] After obtaining the above facial expression features f LtoG Then the k-nearest neighbor (kNN) algorithm is used to classify expressions. The steps include:
[0091] i. Calculate feature distance: Input expression feature f LtoG , calculate the Euclidean distance between it and each expression feature in the training set;
[0092] ii. Find the nearest distance: find the k training data features with the closest distance as the nearest neighbors of the input expression;
[0093] iii. Perform expression classification: Classify the input expression according to the categories of the k nearest neighbors, that is, their corresponding pain level labels.
[0094] Example 3
[0095] In this embodiment 3, Figure 2 As shown, firstly a pain grading system is provided, comprising:
[0096] Data acquisition module: This module is responsible for capturing the facial expressions of the target object, generating a 3D image file, and transmitting the acquired 3D image file to the storage server;
[0097] A feature extraction module reads a facial expression three-dimensional image file from a storage server and extracts features related to facial expressions from the image;
[0098] A machine learning module, the module is used to receive the feature data output by the feature extraction module, use the feature data to build a machine learning model, and train the model to learn the mapping relationship between facial expression features and pain levels;
[0099] The pain grading module, when new facial expression data is input, the module will call the trained machine learning model, use the model to process the new facial expression data, and output the corresponding pain level.
[0100] like Figure 1 As shown, in this embodiment 3, the pain grading method is implemented using the above system, which specifically includes the following steps:
[0101] First, collect a series of images, audio or video data containing facial expressions of different pain levels, including various expressions and audio from no pain to extreme pain. When collecting the above data, the scene should be a real scene related to pain;
[0102] In the above real scene, select the corresponding installation position to install the 3D camera to ensure the captured facial expressions. The camera should have sufficient resolution and frame rate to capture subtle changes in facial expressions. After collecting the 3D image file of facial expression, transfer the above file to the storage server based on the local area network for storage.
[0103] Using image processing technology, features related to facial expressions are extracted from the collected 3D facial expression image files. These features can include the shape, position, and movement trajectory of eyebrows, eyes, mouth, and other parts.
[0104] The specific steps include:
[0105] a. Convert the acquired facial expression 3D image file into 3D point cloud data. Since the imaging quality of ordinary RGB images depends on lighting conditions, it is difficult to obtain effective information through ordinary cameras in some scenes with insufficient lighting. With the development of 3D cameras, such as Kinect, it has become more convenient to obtain high-quality 3D images. Based on the infrared imaging principle, it remains stable to changes in lighting, and each pixel represents the distance from the sensor to the target, which can effectively depict the spatial information of the target. Through simple coordinate transformation, the conversion of facial expression 3D image files into 3D point cloud data can be realized;
[0106] b. Preprocessing the three-dimensional point cloud data obtained through coordinate transformation, including denoising and smoothing the three-dimensional point cloud data to ensure the accuracy and quality of the data;
[0107] c. Point cloud feature extraction: extract features from point cloud data. At the same time, to solve the disorder of point cloud, a point cloud-based feature extraction network Pointnet is constructed based on the idea of symmetric function. Define a set of points χ∈R in l-dimensional space n , function g:R k →R N is a mapping between different feature spaces, then there is the following theorem, assuming f:χ→R M , g:R k →R N They are all symmetric functions.
[0108] but:
[0109] In the formula, h:χ→R K , γ:R N →RM ;
[0110] According to this theorem, for an unordered point cloud {p1,p2,p3,…,p N}, to achieve f:p→R M Global feature extraction, Pointnet uses multi-layer perceptron and maximum pooling layer to construct the right part of formula (1), where n is the number of feature points, l is the feature dimension of the point, and the multi-layer perceptron, such as the h function in formula (1), extracts features from each point through three layers of convolutional layers with a 1x1 convolution kernel (due to the disorder of the point cloud, the convolution kernel cannot index the surrounding feature points in an orderly manner, and can only use a 1x1 convolution kernel to extract features from a single feature point point by point). The number of output channels is 64, 64, and 128 respectively. The maximum pooling layer, such as the symmetric function g in formula (1), takes the maximum value of each feature dimension to obtain the global features of the point cloud. Finally, according to the required feature dimension, the global features are mapped to a specific feature space R through a multi-layer perceptron. M middle.
[0111] As mentioned above, for different face point cloud objects, the number of points they constitute is different due to different facial contours and head sizes. In order to ensure that the network has the same feature input dimension, the farthest point sampling method is used to sample a fixed number of feature points for each object, that is, for the input point set {p1, p2, p3, …, p N}Randomly select p i As the starting point, traverse the point set and find the farthest point p ij Put it into the new point set, and use p again in the remaining point set i As the starting point, iterate the above process and obtain a fixed number of feature points {p i1 ,p i2 ,p i3 ,…,p iN Compared with the random sampling method, the farthest point sampling method can sample samples more evenly, that is, the sampling points can better cover the entire point set.
[0112] d. Construct a local feature four-dimensional descriptor. According to the relative position of the regional point pairs and the normal angle, a four-dimensional descriptor is constructed. The descriptor manually marks the relationship between the point pairs in the local area, and forms a local feature descriptor to express the geometric features of the local area in a fine-grained manner. The descriptor meets the requirements of translation invariance. (p i , p j ) is a pair of feature points in the local area, and their spatial geometric relationship is:
[0113] ψ ij =(||d||,∠(n i ,d),∠(n j ,d),∠(n i,n j )) (2)
[0114] In the formula, d is a vector representing the difference between two points; ||.|| is the Euclidean distance; n i and n j is the point p in the local area i and p j The normal vector of ; ∠(·,·) represents the angle between vectors:
[0115] ∠(n i ,n j )=(atan2||n i ×n j ||,n i ·n j ) (3)
[0116] This four-dimensional descriptor describes the spatial geometric features between point pairs. i In a sphere with center as center and radius k as radius, all points {p1,p2,p3,…,p N} and the center point p i Constitute j point pairs, the encoding method of the local area is:
[0117] F i =[p1,n1,p2,n2,…,p j ,n j ,ψ i1 ,ψ i2 ,...,ψ ij ] (4)
[0118] Where n j For point p j The normal vector in this local area, ψ ij For p j With the center point p i The four-dimensional feature descriptor between i By p i All points in the local area with the center of the sphere and k as the radius and the midpoint p i The spatial geometric relationship describes the spatial geometric characteristics of the local area;
[0119] e. Extraction of local features to global features. In step c, each group of point cloud objects uniformly samples N1 feature points {p1, p2, p3, …, p N}, taking each feature point as the midpoint and k as the radius to obtain a local region, encoding each local region according to the local feature descriptor of formula (4) to obtain a set of local spatial geometric features Then for each Use the point cloud feature extraction network in step c to extract local features and obtain a set of features in a high-dimensional feature space Send this group of features into the maximum pooling layer to obtain the local to global features of the point cloud object f LtoG , due to f LtoG It is extracted by integrating local features and therefore contains rich local geometric information.
[0120] Using the above extracted features f LtoG as input, taking the corresponding pain level as output, and constructing and training a machine learning model, wherein the machine learning model adopts a classifier model;
[0121] Specifically, after obtaining the above facial expression features f LtoG After that, expression classification can be performed. In this implementation, the k-nearest neighbor (kNN) algorithm is used. The main steps include:
[0122] i. Calculate feature distance: Input expression feature f LtoG (i.e., the features in the test set), calculate the Euclidean distance between it and each expression feature in the training set. The Euclidean distance is a commonly used distance metric used to measure the straight-line distance between two points (here, feature vectors) in a multidimensional space.
[0123] ii. Find the nearest distance: find the k training data features with the closest distance as the nearest neighbors of the input expression;
[0124] iii. Perform expression classification: Classify the input expression according to the categories of the k nearest neighbors (i.e., their corresponding pain level labels).
[0125] Example 4
[0126] This embodiment 4 provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by a processor, the pain grading method based on machine learning and facial expression as described above is implemented. The method includes:
[0127] Acquiring three-dimensional image data of facial expression of a target to be analyzed for pain;
[0128] The acquired three-dimensional facial expression image is processed using a pre-trained pain grading model to obtain a target pain grading result; wherein training the pain grading model includes:
[0129] Using multiple three-dimensional facial expression images and labels of pain levels corresponding to relevant facial expressions in the annotated images, image processing technology is used to extract features related to facial expressions from the three-dimensional facial expression images; using the extracted features as input and the corresponding pain levels as output, a machine learning model is constructed and trained to obtain the pain grading model.
[0130] Example 5
[0131] This embodiment 5 provides a computer device, including a memory and a processor, the processor and the memory communicate with each other, the memory stores program instructions executable by the processor, the processor calls the program instructions to execute the above-mentioned pain grading method based on machine learning and facial expression, the method comprising:
[0132] Acquiring three-dimensional image data of facial expression of a target to be analyzed for pain;
[0133] The acquired three-dimensional facial expression image is processed using a pre-trained pain grading model to obtain a target pain grading result; wherein training the pain grading model includes:
[0134] Using multiple three-dimensional facial expression images and labels of pain levels corresponding to relevant facial expressions in the annotated images, image processing technology is used to extract features related to facial expressions from the three-dimensional facial expression images; using the extracted features as input and the corresponding pain levels as output, a machine learning model is constructed and trained to obtain the pain grading model.
[0135] Example 6
[0136] like Figure 3 As shown, this embodiment 6 provides an electronic terminal device, including: a processor, a memory, and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory to enable the electronic device to execute instructions for implementing the pain grading method based on machine learning and facial expressions as described above, the method comprising:
[0137] Acquiring three-dimensional image data of facial expression of a target to be analyzed for pain;
[0138] The acquired three-dimensional facial expression image is processed using a pre-trained pain grading model to obtain a target pain grading result; wherein training the pain grading model includes:
[0139] Using multiple three-dimensional facial expression images and labels of pain levels corresponding to relevant facial expressions in the annotated images, image processing technology is used to extract features related to facial expressions from the three-dimensional facial expression images; using the extracted features as input and the corresponding pain levels as output, a machine learning model is constructed and trained to obtain the pain grading model.
[0140] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0141] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0142] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0143] These computer program instructions can also be loaded onto a computer or other programmable data processing device, and a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0144] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative work on the basis of the technical solution disclosed in the present invention should be included in the scope of protection of the present invention.
Claims
1. A pain grading method based on machine learning and facial expressions, It is characterized in that include: Acquiring three-dimensional image data of facial expression of a target to be analyzed for pain; The acquired three-dimensional facial expression image is processed using a pre-trained pain grading model to obtain a target pain grading result; wherein training the pain grading model includes: Using multiple three-dimensional facial expression images and labels of pain levels corresponding to relevant facial expressions in the annotated images, image processing technology is used to extract features related to facial expressions from the three-dimensional facial expression images; using the extracted features as input and the corresponding pain levels as output, a machine learning model is constructed and trained to obtain the pain grading model.
2. The pain grading method based on machine learning and facial expression according to claim 1, It is characterized in that Using image processing technology, features related to facial expressions are extracted from the 3D facial expression images, including: Convert the acquired facial expression three-dimensional image into three-dimensional point cloud data; pre-process the three-dimensional point cloud data obtained through coordinate transformation, including denoising and smoothing the three-dimensional point cloud data; The idea of symmetric function is used to construct a feature extraction network based on point cloud to solve the disorder problem of point cloud data. A method combining multi-layer perceptron and maximum pooling layer is used to extract global features of point cloud data. At the same time, the farthest point sampling method is used to sample the point cloud to obtain a fixed number of feature points. Construct a local feature four-dimensional descriptor. According to the relative position and normal angle of the point pair in the local area, a four-dimensional descriptor is constructed to express the geometric features of the local area. Using this four-dimensional descriptor, the relationship between the point pairs in the local area is manually marked to form a local feature descriptor. A local area is defined around each feature point, and the geometric features of the local area are encoded using a four-dimensional descriptor. The feature encoding of each local area is sent to the point cloud feature extraction network, and all local features are integrated through the maximum pooling layer to extract the global features.
3. The pain grading method based on machine learning and facial expression according to claim 1, It is characterized in that Construct a local feature four-dimensional descriptor. According to the relative position of the regional point pair and the normal angle, a four-dimensional descriptor is constructed. The four-dimensional descriptor manually marks the relationship between the point pairs in the local area, and forms a local feature descriptor to express the geometric features of the local area in a fine-grained manner. The four-dimensional descriptor meets the requirements of translation invariance. Assume that (p i , p j ) is a pair of feature points in the local area, and their spatial geometric relationship is: ψ ij =(||d||,∠(n i ,d),∠(n j ,d),∠(n i ,n j )) Among them, d is a vector representing the difference between two points; ||.|| is the Euclidean distance; n i and n j is the point p in the local area i and p j The normal vector of ; ∠(·,·) represents the angle between vectors: <h2 style=";text-align:left;direction:ltr">∠(n<h2 style=";text-align:left;direction:ltr"> i <h2 style=";text-align:left;direction:ltr"> ,n<h2 style=";text-align:left;direction:ltr"> j <h2 style=";text-align:left;direction:ltr"> )=(atan2||n<h2 style=";text-align:left;direction:ltr"> i <h2 style=";text-align:left;direction:ltr"> ×n<h2 style=";text-align:left;direction:ltr"> j <h2 style=";text-align:left;direction:ltr"> ||,n<h2 style=";text-align:left;direction:ltr"> i <h2 style=";text-align:left;direction:ltr"> ·n<h2 style=";text-align:left;direction:ltr"> j <h2 style=";text-align:left;direction:ltr"> )。 4. The method for pain grading based on machine learning and facial expression according to claim 3, It is characterized in that The four-dimensional descriptor describes the spatial geometric features between point pairs. i In a sphere with center as center and radius k as radius, all points {p 1 ,p 2 ,p 3 ,...,p N } and the center point p i Constitute j point pairs, the encoding method of the local area is: F i =[p 1 ,n 1 ,p 2 ,n 2 ,...,p j ,n j ,ψ i1 ,ψ i2 ,...,ψ ij ] Among them, n j For point p j The normal vector in this local area, ψ ij For p j With the center point p i The four-dimensional feature descriptor between i By p i All points in the local area with the center of the sphere and k as the radius and the midpoint p i The spatial geometric relationship describes the spatial geometric characteristics of the local area.
5. The method for pain grading based on machine learning and facial expression according to claim 4, It is characterized in that Each group of point cloud objects is sampled uniformly using the farthest point sampling method. 1 Feature points {p 1 ,p 2 ,p 3 ,...,p N }, taking each feature point as the midpoint and k as the radius to obtain a local region, encoding each local region according to the local feature descriptor of formula (4) to obtain a set of local spatial geometric features Then for each Use the point cloud feature extraction network in step c to extract local features and obtain a set of features in a high-dimensional feature space Send this group of features into the maximum pooling layer to obtain the local to global features of the point cloud object f LtoG .
6. The method for pain grading based on machine learning and facial expression according to claim 5, It is characterized in that After obtaining the above facial expression features f LtoG Finally, the k-nearest neighbor (kNN) algorithm is used for expression classification, including: Calculate feature distance: Input expression feature f LtoG , calculate the Euclidean distance between it and each expression feature in the training set; Find the nearest distance: find the k nearest training data features as the nearest neighbors of the input expression; Perform expression classification: Classify the input expression according to the categories of the k nearest neighbors, that is, their corresponding pain level labels.
7. A pain grading system based on machine learning and facial expressions, It is characterized in that include: An acquisition module, used to acquire three-dimensional image data of facial expressions of a target to be analyzed for pain; A processing module is used to process the acquired three-dimensional facial expression image using a pre-trained pain grading model to obtain a target pain grading result; wherein training the pain grading model includes: Using multiple three-dimensional facial expression images and labels of pain levels corresponding to relevant facial expressions in the annotated images, image processing technology is used to extract features related to facial expressions from the three-dimensional facial expression images; using the extracted features as input and the corresponding pain levels as output, a machine learning model is constructed and trained to obtain the pain grading model.
8. A non-transitory computer-readable storage medium, It is characterized in that The non-transitory computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by the processor, the pain grading method based on machine learning and facial expressions as described in any one of claims 1-6 is implemented.
9. A computer device, It is characterized in that It includes a memory and a processor, the processor and the memory communicate with each other, the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the pain grading method based on machine learning and facial expressions as described in any one of claims 1-6.
10. An electronic device, It is characterized in that include: A processor, a memory and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory so that the electronic device executes instructions for implementing the pain grading method based on machine learning and facial expressions as described in any one of claims 1-6.
Citation Information
Patent Citations
Facial expression recognition method based on fusion of traditional features of facial key point regions and face global depth features
CN107729835A
Pain level identification method and device, server and storage medium
CN115035585A
Target detection method and device and terminal equipment
CN116740697A
Target object pose estimation method and computer readable storage medium
CN117611663A
