Mental property identification method and device based on deep learning, medium and product
Through the Resnet18 network and pre-processing technology based on deep learning, the accuracy of mental trait recognition is improved, the problem of low accuracy of mental trait recognition is solved, and effective applications in fields such as personal growth and business management are achieved.
Patent Information
- Application Number
- CN202410752757.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-09-10
AI Technical Summary
The accuracy of mental trait recognition in the existing technology is not high, mainly due to the complexity of mental traits, data quality issues and limitations of recognition technology.
Using a method based on deep learning, the Resnet18 network is used as the mental trait recognition model. By obtaining and preprocessing facial image data, data enhancement and model training are performed, the model weight is adjusted until the set accuracy threshold is reached, and the average absolute error is used and cumulative index as prediction evaluation indicators.
It improves the accuracy of mental trait identification and can more accurately predict personal mental traits. It can be used in fields such as personal growth, public security and corporate management, and provides a deeper explanation of personal thinking patterns.
Smart Images

Figure CN118629076A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of neural network technology, and in particular to a method, device, medium and product for identifying mental traits based on deep learning. Background Art
[0002] As a deep learning model, deep convolutional neural network has powerful image feature extraction capabilities and has achieved advanced performance in many computer vision tasks such as image classification, object detection and object segmentation.
[0003] Mental traits have certain similarities with traditional personality, but mental traits can express the characteristics of human behavior patterns at a deeper level and have a wider and deeper application scenario. However, the accuracy of mental trait recognition is not high at present. The factors are as follows: 1) The complexity and diversity of mental traits themselves are important reasons for the low recognition accuracy. Human mental traits include emotions, cognition, motivation and other aspects, and these traits present unique combinations and manifestations in each person. 2) Data quality issues also affect the accuracy of mental trait recognition. 3) The limitations of recognition technology are also one of the reasons for the low accuracy. Summary of the invention
[0004] The purpose of the present invention is to provide a method, device, medium and product for mental trait recognition based on deep learning, which can improve the accuracy of mental trait recognition.
[0005] To achieve the above object, the present invention provides the following solutions:
[0006] In a first aspect, the present invention provides a method for identifying mental traits based on deep learning, comprising:
[0007] A facial image data set is obtained; the facial image data set includes facial images of persons to be tested.
[0008] The facial image of the person to be tested is input into a trained mental trait recognition model to obtain the mental traits of the person to be tested; the trained mental trait recognition model is a model trained with sample facial images as input and the mental traits corresponding to the sample facial images as labels; the sample facial images are facial images labeled with mental traits; the mental trait recognition model is a deep learning neural network with the Resnet18 network as the main backbone and the last fully connected layer modified to output a 4-dimensional vector.
[0009] Optionally, before obtaining the facial image dataset, the following steps are also included:
[0010] Perform image background removal on the face image of the test person.
[0011] Optionally, before inputting the facial image of the person to be tested into the trained mental trait recognition model, the method further includes:
[0012] Performing image preprocessing on the facial image dataset specifically includes:
[0013] Face alignment, cropping and resizing.
[0014] Optionally, the process of determining the trained mental trait recognition model is as follows:
[0015] Get a sample face image dataset.
[0016] The sample facial images in the sample facial image data set are subjected to image preprocessing to obtain a processed sample facial image data set.
[0017] The processed sample facial image data set is divided into a training set and a test set according to a set ratio, and data enhancement is performed on the training set to obtain a data-enhanced training set.
[0018] The data-enhanced training set is input into a deep learning neural network for training to obtain a mental trait recognition model.
[0019] The test set is input into the trained mental trait recognition model to obtain test data.
[0020] Based on the test data, the accuracy is evaluated using a prediction evaluation index.
[0021] When the accuracy is greater than or equal to the set threshold, a trained mental trait recognition model is obtained.
[0022] When the accuracy rate is less than the set threshold, the weight of the mental trait recognition model is adjusted, and the step of inputting the data-enhanced training set into the deep learning neural network for training is performed again until the accuracy rate is greater than or equal to the set threshold.
[0023] Optionally, the calculation formula of the loss function of the deep learning neural network is as follows:
[0024]
[0025] Among them, y represents the true label value of a certain dimension of the training data, It represents the predicted value after passing through the network. a is a real number. The size of a determines the changing trend of the loss function.
[0026] Optionally, the prediction evaluation indicators include mean absolute error and cumulative index.
[0027] Optionally, the calculation formula of the prediction evaluation index is as follows:
[0028]
[0029] Among them, y k represents the true label value of the test data, Represents the predicted value output by the model, N represents the number of all test images, N θ≤j It represents the number of test images in which the absolute error between the predicted value and the true label value in the test image does not exceed j; MAE represents the mean absolute error; CS represents the cumulative index.
[0030] In a second aspect, the present invention provides a computer device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of a deep learning-based mental trait identification method described in the first aspect.
[0031] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a method for identifying mental traits based on deep learning as described in the first aspect.
[0032] In a fourth aspect, the present invention provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of a mental trait identification method based on deep learning as described in the first aspect.
[0033] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0034] The present invention provides a method, device, medium and product for identifying mental traits based on deep learning, the method comprising: obtaining a facial image data set; the facial image data set comprises facial images of persons to be tested; the facial images of persons to be tested are input into a trained mental trait recognition model to obtain the mental traits of the persons to be tested; the trained mental trait recognition model is a model trained by taking sample facial images as input and mental traits corresponding to the sample facial images as labels; the sample facial images are facial images labeled with mental traits; the mental trait recognition model is a deep learning neural network whose main trunk is a Resnet18 network and whose last fully connected layer is modified so that the output is a 4-dimensional vector. The present invention realizes the prediction of mental traits based on the Resnet18 convolutional network and achieves a high accuracy rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0036] Figure 1 A schematic diagram of a process of identifying mental traits based on deep learning provided in the first embodiment of the present invention;
[0037] Figure 2 A schematic diagram of a deep learning network used in the first embodiment of the present invention;
[0038] Figure 3 A schematic diagram of the loss function used in the first embodiment of the present invention;
[0039] Figure 4 This is a diagram of the internal structure of a computer device provided in Embodiment 2 of the present invention. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] The purpose of the present invention is to provide a method, device, medium and product for mental trait recognition based on deep learning, which can improve the accuracy of mental trait recognition.
[0042] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0043] Embodiment 1
[0044] like Figure 1 As shown, this embodiment provides a method for identifying mental traits based on deep learning, including:
[0045] Step 101: Obtain a facial image dataset; the facial image dataset includes facial images of the person to be tested.
[0046] Step 102: Input the facial image of the person to be tested into a trained mental trait recognition model to obtain the mental traits of the person to be tested; the trained mental trait recognition model is a model trained with sample facial images as input and the mental traits corresponding to the sample facial images as labels; the sample facial images are facial images labeled with mental traits; the mental trait recognition model is a deep learning neural network with the Resnet18 network as the main backbone and the last fully connected layer modified so that the output is a 4-dimensional vector.
[0047] Mental traits are essentially a reflection of the activity pattern of human brain nerves, which are specifically manifested in four dimensions: introversion-extroversion, abstraction-concreteness, sensibility-rationality, and rigidity-flexibility. The mental trait identification method proposed in this embodiment is often used in the following scenarios:
[0048] 1) Personal growth: By predicting one's own mental traits, one can gain a certain understanding of one's mental model, discover the essential laws of one's own thinking, find the paths and methods that are suitable for one's career development and personal growth, and then find a work and lifestyle that suits one, thereby achieving harmonious personal growth.
[0049] 2) Public security: Investigative interrogation is an important part of public security case handling. During the interrogation process, mental factors are an important factor affecting the communication between interrogators and criminal suspects. By predicting the mental characteristics of interrogators and criminal suspects, the mental patterns of the interrogator and the object of interrogation can be analyzed, and then the physical and mental state during the interrogation can be inferred. This helps to predict the language and behavioral tendencies of criminal suspects, so that interrogators can scientifically and rationally construct the initial interrogation link.
[0050] 3) Enterprise management: Predicting the mental traits of employees or team members, combined with their own abilities, can help enterprise managers analyze the positions or duties that are suitable for each member. For example, the United States uses Personality Insight API in the recruitment of police officers to help it recruit people with suitable personalities, thereby improving team collaboration and police productivity.
[0051] Before executing step 101, the following steps may also be included:
[0052] Perform image background removal on the face image of the test person.
[0053] Before executing step 102, the following steps may also be included:
[0054] Performing image preprocessing on the facial image dataset specifically includes:
[0055] Face alignment, cropping and resizing.
[0056] In some implementations of this embodiment, the process of determining the trained mental trait recognition model is as follows:
[0057] Step 201: Obtain a sample facial image dataset.
[0058] Step 202: performing image preprocessing on the sample facial images in the sample facial image dataset to obtain a processed sample facial image dataset.
[0059] Step 203: dividing the processed sample facial image data set into a training set and a test set according to a set ratio, and performing data enhancement on the training set to obtain a data enhanced training set.
[0060] Step 204: Input the data-enhanced training set into a deep learning neural network for training to obtain a mental trait recognition model.
[0061] Step 205: Input the test set into the trained mental trait recognition model to obtain test data.
[0062] Step 206: Based on the test data, use the prediction evaluation index to perform accuracy evaluation.
[0063] When the accuracy is greater than or equal to the set threshold, a trained mental trait recognition model is obtained.
[0064] When the accuracy rate is less than the set threshold, the weight of the mental trait recognition model is adjusted, and the step of inputting the data-enhanced training set into the deep learning neural network for training is performed again until the accuracy rate is greater than or equal to the set threshold.
[0065] Specifically, when executing step 201, the specific steps may be as follows:
[0066] 2200 Asian face photos were selected from the open source SCUT-FBP5500 dataset to construct an image dataset, the labels of the original dataset were removed, and the background of the image dataset was removed using the deeplabv3p_xception65_humanseg model; mental recognition experts annotated the facial image dataset multiple times, and the average of the multiple annotations was taken as the final label value. The specific method is: based on the four mental trait dimensions, a score of 0-100 is given, and the scores of each dimension represent the degree of mental trait tendency of each dimension. Specifically, extroversion, abstraction, rationality, and rigidity are taken as the main tendencies. For the convenience of description, the mental trait indexes of the four dimensions are called extroversion index, abstraction index, rationality index, and rigidity index respectively.
[0067] Since the mental trait index is obtained by expert scoring, it is impossible to completely avoid the influence of subjective factors. However, the following method is used to reduce the influence of subjective factors when labeling mental traits: the mental trait prediction expert scores the same photo at least 3 times. To avoid interference between multiple scores, each score is separated by at least one week. After 3 scores, the standard deviation of each mental trait dimension is calculated. The face image with a standard deviation of more than 10 in a certain dimension is considered to have a relatively unstable mental trait index and needs to be scored again until the standard deviation of multiple scores is less than 10. The result is considered to be relatively stable. Finally, the average of multiple scores is taken as the mental trait labeling value.
[0068] Specifically, when executing step 202, the specific steps may be as follows:
[0069] Use the face_recognition API to detect 68 key points of the face, rotate the entire image according to the position of the eyes, and achieve the purpose of face alignment; then crop the facial image to a uniform size of 224×224, and ensure that in the vertical direction, the average point of the eye key point to the top of the image accounts for 30% of the vertical direction, the average point of the eye and lip key points connected to the vertical direction accounts for 35%, and the average point of the lip key point to the bottom of the image accounts for 35% of the vertical direction; in the horizontal direction, the midpoint of the leftmost and rightmost key points is the center point of the horizontal direction.
[0070] Specifically, when executing step 203, the specific steps may be as follows:
[0071] The processed and annotated data set is randomly divided into training set and test set in a ratio of 9:1, and data enhancement is performed by horizontal inversion and random rotation. The method used is horizontal inversion and random rotation within 5°.
[0072] Specifically, when executing steps 204-206, the specific steps may be as follows:
[0073] Design a deep learning neural network with a network structure such as Figure 2 As shown, the data-enhanced training set is input into the network for training to obtain a mental trait recognition model.
[0074] In this embodiment, the backbone of the designed deep learning network model is the Resnet18 network, and the last fully connected layer is modified so that the output is a 4-dimensional vector, and the output vector value is the four-dimensional mental trait prediction value.
[0075] The loss function used by the deep learning network is as follows:
[0076]
[0077] Among them, y represents the true label value of a certain dimension of the training data, Represents the predicted value after passing through the network.
[0078] When the difference between the predicted value and the label value is less than 10, the value of the loss function approaches 0. When the difference between the predicted value and the label value is greater than 10, the value of the loss function is larger. Figure 3 is the function ln(1+e x-12 ) images.
[0079] In this embodiment, the network model is built based on Python 3.9.0 and Pytorch 1.13.0. The allocated training set is imported into the model for training. The training sets the batch-size to 32, the optimizer uses Adam, and the number of training iterations epochs is 200.
[0080] Based on the trained mental trait recognition model, the test set data is input, the mental traits of the test data are predicted and their accuracy is evaluated.
[0081] The test data prediction evaluation indicators are the mean absolute error MAE and the cumulative index CS, and their expressions are:
[0082]
[0083] Among them, y k represents the true label value of the test data, Represents the predicted value output by the model, N represents the number of all test images, N θ≤j It indicates the number of test images in which the absolute error between the predicted value and the true label value in the test image does not exceed j; the smaller the MAE, the smaller the error range, and the more accurate the algorithm prediction; the larger the CS, the more images with accurate predicted values within the error range, and the more accurate the algorithm prediction; more specifically, the cumulative index with j equal to 15 is taken as the main evaluation indicator.
[0084] Embodiment 2
[0085] In this embodiment, a computer device is provided. The computer device may be a database, and its internal structure diagram may be as follows: Figure 4As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store pending transactions. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data processing method is implemented.
[0086] In one embodiment, a computer device is also provided, including a memory and a processor to store a computer program in the memory and run on the processor, and the processor implements the steps in the above method embodiments when executing the computer program.
[0087] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0088] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0089] It should be noted that the object information (including but not limited to object device information, object personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the object or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0090] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited thereto.
[0091] In summary, the present invention has the following beneficial effects:
[0092] 1. The present invention realizes the prediction of mental traits based on the Resnet18 convolutional network, and achieves a high accuracy rate, and has good application space in personal growth, corporate career judgment and other aspects.
[0093] 2. Compared with the ordinary personality system, the mental trait theory system used in the present invention can interpret individual thinking patterns at a deeper level and explain human behavior more fundamentally. It adopts the form of scoring rather than classification for specific mental traits, which more accurately reflects the tendency of individual mental traits.
[0094] 3. By submitting facial images to mental experts for multiple evaluations, a scientific and effective mental trait dataset is established, which is conducive to further research on the relationship between facial images and mental traits.
[0095] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0096] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for identifying mental traits based on deep learning, characterized in that: include: Acquire a facial image data set; the facial image data set includes facial images of persons to be tested; The facial image of the person to be tested is input into a trained mental trait recognition model to obtain the mental traits of the person to be tested; the trained mental trait recognition model is a model trained with sample facial images as input and the mental traits corresponding to the sample facial images as labels; the sample facial images are facial images labeled with mental traits; the mental trait recognition model is a deep learning neural network with the Resnet18 network as the main backbone and the last fully connected layer modified to output a 4-dimensional vector.
2. According to the method of mental trait identification based on deep learning in claim 1, it is characterized in that: Before obtaining the face image dataset, it also includes: Perform image background removal on the face image of the test person.
3. The method for identifying mental traits based on deep learning according to claim 1, characterized in that: Before inputting the facial image of the person to be tested into the trained mental trait recognition model, the method further includes: Performing image preprocessing on the facial image dataset specifically includes: Face alignment, cropping and resizing.
4. The method for identifying mental traits based on deep learning according to claim 1, characterized in that: The determination process of the trained mental trait recognition model is as follows: Get a sample face image dataset; Performing image preprocessing on the sample facial images in the sample facial image data set to obtain a processed sample facial image data set; Dividing the processed sample facial image data set into a training set and a test set according to a set ratio, and performing data enhancement on the training set to obtain a data enhanced training set; Inputting the data-enhanced training set into a deep learning neural network for training to obtain a mental trait recognition model; Inputting the test set into the trained mental trait recognition model to obtain test data; Based on the test data, using prediction evaluation indicators to evaluate accuracy; When the accuracy rate is greater than or equal to the set threshold, a trained mental trait recognition model is obtained; When the accuracy rate is less than the set threshold, the weight of the mental trait recognition model is adjusted, and the step of inputting the data-enhanced training set into the deep learning neural network for training is performed again until the accuracy rate is greater than or equal to the set threshold.
5. A method for identifying mental traits based on deep learning according to claim 1 or 4, characterized in that: The calculation formula of the loss function of the deep learning neural network is as follows: Among them, y represents the true label value of a certain dimension of the training data, It represents the predicted value after passing through the network. a is a real number. The size of a determines the changing trend of the loss function.
6. The method for identifying mental traits based on deep learning according to claim 4, characterized in that: The prediction evaluation indicators include mean absolute error and cumulative index.
7. The method for identifying mental traits based on deep learning according to claim 6, characterized in that: The calculation formula of the prediction evaluation index is as follows: Among them, y k represents the true label value of the test data, Represents the predicted value output by the model, N represents the number of all test images, N θ≤j It represents the number of test images in which the absolute error between the predicted value and the true label value in the test image does not exceed j; MAE represents the mean absolute error; CS represents the cumulative index.
8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of a method for identifying mental traits based on deep learning as described in any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a method for identifying mental traits based on deep learning as described in any one of claims 1 to 7 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program / instructions are executed by a processor, the steps of a method for identifying mental traits based on deep learning as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Group emotion recognition method, device, intelligent device and storage medium
CN109522945A
Characteristic prediction method and device for interviewer, computer equipment and computer storage medium
CN109657542A
Human face age identification method and system based on uncertainty suppression network model
CN114267060A
Forensics method for synthesized face image based on local binary pattern and deep learning
WO2021134871A1
