A method and device for cataplexy face recognition based on cataplexy face recognition model
Through deep learning technology based on the cataplexy face recognition model, combined with data enhancement and infrared detection grating, the problem of low accuracy in the prevention of cataplexy attacks is solved, accurate recognition of cataplexy faces is achieved, and the prevention effect is improved.
Patent Information
- Application Number
- CN202410833693.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-26
AI Technical Summary
The accuracy of preventing cataplexy attacks in the existing technology is not high and mainly relies on subjective interviews by clinicians, resulting in poor identification accuracy.
Using a method based on the cataplexy face recognition model, by collecting and processing cataplexy face images, using ResNet-18 neural network to train a deep learning model, combined with data enhancement strategy and infrared detection grating technology, a cataplexy face recognition system is established, which can accurately identify Cataplexy face.
It achieves accurate recognition of cataplexy faces, reduces reliance on clinicians' subjective judgment, and improves the accuracy of cataplexy attack prevention.
Smart Images

Figure CN118379781B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a cataplexy face recognition method and device based on a cataplexy face recognition model. Background Art
[0002] Currently, there are no objective indicators to measure the onset and severity of cataplexy in clinical practice. The assessment of cataplexy symptoms mainly relies on structured interviews by clinicians. However, because it is a self-assessment scale, there are inevitably subjective differences, resulting in poor accuracy in cataplexy identification. Summary of the invention
[0003] In view of this, an object of the present invention is to provide a cataplexy facial recognition method and device based on a cataplexy facial recognition model, aiming to solve the problem of low accuracy in the prior art when preventing cataplexy attacks.
[0004] The embodiment of the present invention is implemented as follows:
[0005] A cataplexy face recognition method based on a cataplexy face recognition model, the method comprising:
[0006] Collecting a preset number of cataplexy facial images and normal facial images to establish a training data set, and extracting a test set from the training data set according to a preset ratio;
[0007] Expanding the remaining data sets in the training data set according to a preset data enhancement strategy, and dividing the remaining data sets into a training set and a validation set according to a preset ratio;
[0008] Obtaining an initial classification model trained by using a ResNet-18 neural network using a preset visual data set, and inputting the training set and the validation set into the initial classification model for deep learning to obtain a cataplexy face recognition model;
[0009] A facial image to be recognized is acquired, and the facial image to be recognized is input into the cataplexy facial recognition model to recognize whether the facial image is a cataplexy facial image.
[0010] Furthermore, in the above-mentioned cataplexy face recognition method based on the cataplexy face recognition model, the step of expanding the remaining data sets in the training data set according to the preset data enhancement strategy includes:
[0011] Salt and pepper noise and Gaussian blur are added to the images in the remaining data sets with random probability, or the images in the remaining data sets are randomly flipped horizontally or flipped at random angles, or the images in the remaining data sets are contrast enhanced to obtain another image data to expand the remaining data sets in the training data sets.
[0012] Furthermore, in the above-mentioned cataplexy face recognition method based on the cataplexy face recognition model, the step of dividing the remaining data set into a training set and a validation set according to a preset ratio comprises:
[0013] Divide the remaining data set into five equal parts, use four of the five equal parts as the training set, and use the other one of the five equal parts as the validation set;
[0014] The step of inputting the training set and the validation set into the initial classification model for deep learning to obtain a cataplexy face recognition model comprises:
[0015] Set a loop, cycle five times, each time select a different equal portion as the validation set, and the remaining four equal portions as the training set;
[0016] In each cycle, the currently selected training set is used to train the initial classification model, and the current validation set is used to evaluate the performance of the initial classification model until the performance of the initial classification model tends to be stable to obtain the cataplexy face recognition model.
[0017] Furthermore, in the above-mentioned cataplexy face recognition method based on the cataplexy face recognition model, before the step of collecting a preset number of cataplexy face images and normal face images to establish a training data set, and extracting a test set from the training data set according to a preset ratio, the step further includes:
[0018] Collecting a video of the cataplexy of the subject in the test area, and extracting the cataplexy video by frames to obtain an image containing the cataplexy face and an image containing the normal face;
[0019] Extracting facial information from the image containing the cataplexy face and the image containing the normal face using a preset algorithm to obtain the cataplexy face image and the normal face image;
[0020] The cataplexy facial image and the normal facial image are scaled to the same preset size, and normalized and pixel-standardized.
[0021] Furthermore, in the above-mentioned cataplexy facial recognition method based on the cataplexy facial recognition model, an image acquisition device is arranged at the front end of the test area, an infrared detection grating is arranged around the test area, and the step of acquiring a cataplexy video of the subject in the test area includes:
[0022] Collecting infrared detection information collected by the infrared detection grating, and determining body contour information of the subject according to the infrared detection information;
[0023] The image acquisition device is adjusted according to the body contour information to ensure that the subject is in the middle area of the capture screen of the image acquisition device, and then the cataplexy video of the subject is captured by the image acquisition device.
[0024] Furthermore, in the above-mentioned cataplexy facial recognition method based on the cataplexy facial recognition model, the infrared detection grating includes a first infrared detection grating array arranged on the top of the test area and a second infrared detection grating array arranged on both sides of the test area; the step of determining the body contour information of the subject according to the infrared detection includes:
[0025] Determine a top reference point according to the first infrared detection grating information detected by the first infrared detection grating array, and extend top reference lines outward from the top reference point respectively;
[0026] Determine a side reference point according to the second infrared detection grating information detected by the second infrared detection grating array, and extend side reference lines from the side reference point to both ends respectively;
[0027] The body contour information of the subject is determined according to a rectangular area enclosed by the top reference line, the side reference line and the subject area.
[0028] Furthermore, in the above-mentioned cataplexy facial recognition method based on the cataplexy facial recognition model, the step of adjusting the image acquisition device according to the body contour information to ensure that the subject is in the middle area of the image acquisition device capture screen includes:
[0029] The position information of the rectangular area is obtained, and the image acquisition device is adjusted upward, downward, leftward, and rightward according to the position information to ensure that the subject is in the middle area of the image acquisition screen captured by the image acquisition device.
[0030] Another object of the present invention is to provide a cataplexy facial recognition device based on a cataplexy facial recognition model, the device comprising:
[0031] An acquisition module, used for acquiring a preset number of cataplexy facial images and normal facial images to establish a training data set, and extracting a test set from the training data set according to a preset ratio;
[0032] A partitioning module, used to expand the remaining data set in the training data set according to a preset data enhancement strategy, and divide the remaining data set into a training set and a validation set according to a preset ratio;
[0033] A training module is used to obtain an initial classification model trained by using a ResNet-18 neural network using a preset visual data set, and input the training set and the validation set into the initial classification model for deep learning to obtain a cataplexy face recognition model;
[0034] The recognition module is used to obtain a facial image to be recognized, and input the facial image to be recognized into the cataplexy facial recognition model to recognize whether the facial image is a cataplexy facial image.
[0035] Another object of the present invention is to provide a readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the steps of any one of the methods described above.
[0036] Another object of the present invention is to provide an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.
[0037] The present invention establishes a training data set by collecting a preset number of cataplexy facial images and normal facial images, and extracts a test set from the training data set according to a preset ratio; expands the remaining data set in the training data set according to a preset data enhancement strategy, and divides the remaining data set into a training set and a verification set according to a preset ratio; obtains an initial classification model trained by using a ResNet-18 neural network using a preset visual data set, and inputs the training set and the verification set into the initial classification model for deep learning to obtain a cataplexy facial recognition model; obtains a facial image to be recognized, and inputs the facial image to be recognized into the cataplexy facial recognition model to recognize whether the facial image is a cataplexy face. The cataplexy facial recognition model obtained through model training can accurately recognize whether a patient is likely to have cataplexy according to facial information, does not rely on the problem of inaccurate recognition that is easily caused by subjective interview recognition by clinicians, and solves the problem of low accuracy in the prior art when preventing cataplexy attacks. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a flow chart of a cataplexy facial recognition method based on a cataplexy facial recognition model in a first embodiment of the present invention;
[0039] Figure 2 FIG. 4 is a structural block diagram of a cataplexy facial recognition device based on a cataplexy facial recognition model in a third embodiment of the present invention.
[0040] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0041] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.
[0042] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.
[0043] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0044] How to identify a cataplexy face based on a cataplexy face recognition model will be described in detail below in conjunction with specific embodiments and drawings.
[0045] Embodiment 1
[0046] See also Figure 1 , shown is a cataplexy facial recognition method based on a cataplexy facial recognition model in a first embodiment of the present invention, the method comprising steps S10 to S13.
[0047] Step S10, collecting a preset number of cataplexy facial images and normal facial images to establish a training data set, and extracting a test set from the training data set according to a preset ratio.
[0048] A sufficient number of cataplexy facial images and normal facial images are collected to establish a training data set for model training, wherein the training data set includes a training set, a validation set and a test set. A preset proportion is randomly selected from the entire training data set as a test set, for example, 10% is selected as a test set, and the rest are used as a training set and a validation set. The training set and the validation set are used to train parameters to establish a model, and the test set data does not participate in model training, but is only used to test the final effect of the model.
[0049] Specifically, the facial features of cataplexy are defined as: drooping eyelids, open mouth, sticking out tongue, and drooping head. The more of the above features a picture contains, the more it conforms to the cataplexy face. In specific implementation, experienced specialists can be used to extract cataplexy facial images and normal facial images from multiple collected pictures.
[0050] Step S11, expanding the remaining data sets in the training data set according to a preset data enhancement strategy, and dividing the remaining data sets into a training set and a validation set according to a preset ratio.
[0051] Among them, due to the small sample size of the study and the lack of large-scale public data sets, in order to enhance the generalization ability of the model and avoid overfitting, in the embodiment of the present invention, a data enhancement strategy is adopted to expand the remaining data sets in the training data set.
[0052] Specifically, salt and pepper noise and Gaussian blur are added to the images in the remaining data set with random probability, or the images in the remaining data set are randomly flipped horizontally or flipped at random angles, or the images in the remaining data set are contrast enhanced to obtain another image data to expand the remaining data set in the training data set. For example, salt and pepper noise and Gaussian blur are randomly added with a probability of 0.5, and the contrast of the image is adjusted by contrast enhancement method, the difference in brightness of the image is changed, the data set is expanded, and the amount of training samples is increased, thereby improving the accuracy of model classification. In practice, the total number of samples in the data set after data enhancement can be expanded to 5 times the original number.
[0053] In addition, after data enhancement is performed on the remaining training data set, the training data set is divided according to a preset ratio to obtain different numbers of training sets and validation sets. For example, 20% of the data is used as a validation set and 80% of the data is used as a training set.
[0054] Step S12, obtaining an initial classification model trained by using a ResNet-18 neural network using a preset visual data set, and inputting the training set and the validation set into the initial classification model for deep learning to obtain a cataplexy face recognition model.
[0055] Among them, ResNet-18 is a lightweight model in the ResNet series. While retaining the key features of the ResNet series (such as skip connections and residual learning), it has fewer parameters compared to deeper models (such as ResNet-50 and ResNet-152). This makes ResNet-18 very suitable for deployment and use in environments with limited computing resources. Therefore, ResNet-18 is widely used in deep learning application scenarios that require lightweight and efficient.
[0056] The preset visual data set can use the existing ImageNet data set to extract the required data set. The ImageNet data set contains up to 10,000 images of different categories, providing rich visual information for deep learning models. ResNet-18, as a powerful convolutional neural network structure, has successfully learned excellent feature representations after pre-training on this huge data set. The ResNet-18 network pre-trained on the ImageNet data set (pre-set visual data set) is used to build a cataplexy face recognition model. By fine-tuning the pre-trained parameters, it can be effectively transferred to the face recognition task. Since ResNet-18 has learned rich features of images on the ImageNet training set and has strong generalization capabilities, when building a cataplexy face recognition model, we do not need to train a new data set from scratch, nor do we need a large number of training samples to obtain an excellent classification model.
[0057] In addition, in some optional embodiments of the present invention, when dividing the training set and the validation set, the remaining data set is divided into five equal parts, four of the five parts are used as training sets, and the other one of the five parts is used as a validation set. When performing model training, a loop is set, and the loop is repeated five times, each time a different part is selected as the validation set, and the remaining four parts are used as training sets. In each loop, the currently selected training set is used to train the initial classification model, and the current validation set is used to evaluate the performance of the initial classification model until the performance of the initial classification model tends to stabilize to obtain a cataplexy face recognition model.
[0058] Step S13, obtaining a facial image to be recognized, and inputting the facial image to be recognized into the cataplexy facial recognition model to recognize whether the facial image is a cataplexy facial image.
[0059] Among them, the cataplexy facial recognition model obtained through model training has mastered the recognition logic of cataplexy facial recognition. After obtaining the facial image, it can judge whether cataplexy is likely to occur through the recognition results.
[0060] In summary, the cataplexy face recognition method based on the cataplexy face recognition model in the above-mentioned embodiment of the present invention establishes a training data set by collecting a preset number of cataplexy face images and normal face images, and extracts a test set from the training data set according to a preset ratio; expands the remaining data set in the training data set according to a preset data enhancement strategy, and divides the remaining data set into a training set and a validation set according to a preset ratio; obtains an initial classification model obtained by training the preset visual data set using the ResNet-18 neural network, and inputs the training set and the validation set into the initial classification model for deep learning to obtain a cataplexy face recognition model; obtains a facial image to be recognized, and inputs the facial image to be recognized into the cataplexy face recognition model to identify whether the facial image is a cataplexy face. The cataplexy face recognition model obtained by model training can accurately identify whether the patient is likely to have cataplexy based on facial information, and does not rely on the problem of inaccurate recognition easily caused by subjective interviews of clinicians, thereby solving the problem of low accuracy in the prevention of cataplexy attacks in the prior art.
[0061] Embodiment 2
[0062] This embodiment also proposes a cataplexy facial recognition method based on a cataplexy facial recognition model. The difference between the cataplexy facial recognition method based on a cataplexy facial recognition model in this embodiment and the cataplexy facial recognition method based on a cataplexy facial recognition model in the first embodiment is that:
[0063] Before step S10, the method further includes:
[0064] Collecting a video of the cataplexy of the subject in the test area, and extracting the cataplexy video by frames to obtain an image containing the cataplexy face and an image containing the normal face;
[0065] Extracting facial information from the image containing the cataplexy face and the image containing the normal face using a preset algorithm to obtain the cataplexy face image and the normal face image;
[0066] The cataplexy facial image and the normal facial image are scaled to the same preset size, and normalized and pixel-standardized.
[0067] Among them, the cataplexy video is collected by the subjects in the test area, and the cataplexy video is frame-by-frame extracted to obtain images containing cataplexy faces and images containing normal faces. Since the cataplexy faces are mainly manifested as changes in facial features, before model training, the key information of the face is extracted using a preset algorithm or algorithm package to obtain a face image data set, such as the Dlib algorithm. Subsequently, the image sizes in the data set are uniformly scaled to the same size (for example, 224*224 pixels), and the images are normalized, and each image is pixel-standardized.
[0068] Further, in some optional embodiments of the present invention, an image acquisition device is provided at the front end of the test area, an infrared detection grating is provided around the test area, and the step of acquiring a video of the subject's cataplexy in the test area includes:
[0069] Collecting infrared detection information collected by the infrared detection grating, and determining body contour information of the subject according to the infrared detection information;
[0070] The image acquisition device is adjusted according to the body contour information to ensure that the subject is in the middle area of the capture screen of the image acquisition device, and then the cataplexy video of the subject is captured by the image acquisition device.
[0071] In practice, the video data is collected in a closed room with sufficient lighting and no visual interference provided by the hospital. The height of the experimental camera can be initially set to 1.4 meters, with the shooting positioning area 1.5 meters away from the camera at the near end and 2 meters away from the camera at the far end. During the collection, ensure that the area is located in the center of the screen. During the experiment, the subject will stand in the test area. Specifically, an infrared detection grating is set in the test area, and the infrared detection information detected by the infrared detection grating is used to determine the subject's body contour information, so as to adjust the position of the image acquisition device according to the subject's body contour information to ensure that the subject is in the center of the screen.
[0072] Furthermore, in some optional embodiments of the present invention, the infrared detection grating includes a first infrared detection grating array disposed on the top of the test area and a second infrared detection grating array disposed on both sides of the test area; the step of determining the body contour information of the subject according to the infrared detection includes:
[0073] Determine a top reference point according to the first infrared detection grating information detected by the first infrared detection grating array, and extend top reference lines outward from the top reference point respectively;
[0074] Determine a side reference point according to the second infrared detection grating information detected by the second infrared detection grating array, and extend side reference lines from the side reference point to both ends respectively;
[0075] The body contour information of the subject is determined according to a rectangular area enclosed by the top reference line, the side reference line and the subject area.
[0076] Among them, the information of the top and sides of the subject is collected by the infrared detection gratings on the top and sides respectively. Specifically, the closest to the infrared detection grating array is used as the reference point, so that a rectangular area containing the contour information of the subject can be constructed, and the position of the image acquisition device is adjusted through the rectangular area to achieve the purpose of adjustment.
[0077] In addition, when the subject is in the center of the screen of the image acquisition device, the relative position relationship between the image acquisition device and the center point of the subject's outline rectangle can be determined. When adjusting the image acquisition device, the center point of the rectangular area of the subject's outline information can be determined, and the image acquisition device can be adjusted according to the position relationship between the center point and the image acquisition device.
[0078] Specifically, the step of adjusting the image acquisition device according to the body contour information to ensure that the subject is in the middle area of the image acquisition device capture screen includes:
[0079] The position information of the rectangular area is obtained, and the image acquisition device is adjusted upward, downward, leftward, and rightward according to the position information to ensure that the subject is in the middle area of the image acquisition screen captured by the image acquisition device.
[0080] The image acquisition device is adjusted up, down, left, and right to ensure that the subject is in the middle area of the image acquisition screen.
[0081] In summary, the cataplexy face recognition method based on the cataplexy face recognition model in the above-mentioned embodiment of the present invention establishes a training data set by collecting a preset number of cataplexy face images and normal face images, and extracts a test set from the training data set according to a preset ratio; expands the remaining data set in the training data set according to a preset data enhancement strategy, and divides the remaining data set into a training set and a validation set according to a preset ratio; obtains an initial classification model obtained by training the preset visual data set using the ResNet-18 neural network, and inputs the training set and the validation set into the initial classification model for deep learning to obtain a cataplexy face recognition model; obtains a facial image to be recognized, and inputs the facial image to be recognized into the cataplexy face recognition model to identify whether the facial image is a cataplexy face. The cataplexy face recognition model obtained by model training can accurately identify whether the patient is likely to have cataplexy based on facial information, and does not rely on the problem of inaccurate recognition easily caused by subjective interviews of clinicians, thereby solving the problem of low accuracy in the prevention of cataplexy attacks in the prior art.
[0082] Embodiment 3
[0083] See also Figure 2, shown is a cataplexy facial recognition device based on a cataplexy facial recognition model proposed in the third embodiment of the present invention, the device comprising:
[0084] The acquisition module 100 is used to acquire a preset number of cataplexy facial images and normal facial images to establish a training data set, and extract a test set from the training data set according to a preset ratio;
[0085] A division module 200, used to expand the remaining data set in the training data set according to a preset data enhancement strategy, and divide the remaining data set into a training set and a validation set according to a preset ratio;
[0086] A training module 300 is used to obtain an initial classification model trained by using a ResNet-18 neural network through a preset visual data set, and input the training set and the validation set into the initial classification model for deep learning to obtain a cataplexy face recognition model;
[0087] The recognition module 400 is used to obtain a facial image to be recognized, and input the facial image to be recognized into the cataplexy facial recognition model to recognize whether the facial image is a cataplexy facial image.
[0088] Furthermore, in the above-mentioned cataplexy facial recognition device based on the cataplexy facial recognition model, the division module includes:
[0089] A partitioning unit is used to add salt and pepper noise and Gaussian blur to the images in the remaining data set with random probability, or to randomly horizontally flip or randomly angle flip the images in the remaining data set, or to contrast enhance the images in the remaining data set to obtain another image data to expand the remaining data set in the training data set.
[0090] Furthermore, in the above-mentioned cataplexy facial recognition device based on the cataplexy facial recognition model, the division module further comprises:
[0091] an equal division unit, used for equally dividing the remaining data set into five equal parts, using four of the five equal parts as the training set, and another of the five equal parts as the validation set;
[0092] The training module includes:
[0093] A training unit is used to set a cycle, which is repeated five times, and each time a different equal portion is selected as the verification set, and the remaining four equal portions are used as the training sets;
[0094] In each cycle, the currently selected training set is used to train the initial classification model, and the current validation set is used to evaluate the performance of the initial classification model until the performance of the initial classification model tends to be stable to obtain the cataplexy face recognition model.
[0095] Furthermore, in the above-mentioned cataplexy facial recognition device based on the cataplexy facial recognition model, before the step of collecting a preset number of cataplexy facial images and normal facial images to establish a training data set, and extracting a test set from the training data set according to a preset ratio, the step further includes:
[0096] Collecting a video of the cataplexy of the subject in the test area, and extracting the cataplexy video by frames to obtain an image containing the cataplexy face and an image containing the normal face;
[0097] Extracting facial information from the image containing the cataplexy face and the image containing the normal face using a preset algorithm to obtain the cataplexy face image and the normal face image;
[0098] The cataplexy facial image and the normal facial image are scaled to the same preset size, and normalized and pixel-standardized.
[0099] Furthermore, in the above-mentioned cataplexy facial recognition device based on the cataplexy facial recognition model, an image acquisition device is arranged at the front end of the test area, an infrared detection grating is arranged around the test area, and the step of acquiring a cataplexy video of the subject in the test area includes:
[0100] Collecting infrared detection information collected by the infrared detection grating, and determining body contour information of the subject according to the infrared detection information;
[0101] The image acquisition device is adjusted according to the body contour information to ensure that the subject is in the middle area of the capture screen of the image acquisition device, and then the cataplexy video of the subject is captured by the image acquisition device.
[0102] Furthermore, in some optional embodiments of the present invention, the infrared detection grating includes a first infrared detection grating array disposed on the top of the test area and a second infrared detection grating array disposed on both sides of the test area; the step of determining the body contour information of the subject according to the infrared detection includes:
[0103] Determine a top reference point according to the first infrared detection grating information detected by the first infrared detection grating array, and extend top reference lines outward from the top reference point respectively;
[0104] Determine a side reference point according to the second infrared detection grating information detected by the second infrared detection grating array, and extend side reference lines from the side reference point to both ends respectively;
[0105] The body contour information of the subject is determined according to a rectangular area enclosed by the top reference line, the side reference line and the subject area.
[0106] Furthermore, in the above-mentioned cataplexy facial recognition device based on the cataplexy facial recognition model, the step of adjusting the image acquisition device according to the body contour information to ensure that the subject is in the middle area of the image acquisition device capture screen includes:
[0107] The position information of the rectangular area is obtained, and the image acquisition device is adjusted upward, downward, leftward, and rightward according to the position information to ensure that the subject is in the middle area of the image acquisition screen captured by the image acquisition device.
[0108] The functions or operation steps implemented when the above modules are executed are substantially the same as those in the above method embodiments, and will not be repeated here.
[0109] Embodiment 4
[0110] Another aspect of the present invention further provides a readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the steps of the method described in any one of the above embodiments 1 to 2 are implemented.
[0111] Embodiment 5
[0112] Another aspect of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in any one of the above-mentioned embodiments one to two when executing the program.
[0113] The technical features of the above embodiments can 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.
[0114] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable storage medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, a "computer-readable storage medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0115] More specific examples (a non-exhaustive list) of computer-readable storage media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable storage medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0116] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0117] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", 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. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0118] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A cataplexy face recognition method based on a cataplexy face recognition model, characterized in that: The method comprises: Collecting a preset number of cataplexy facial images and normal facial images to establish a training data set, and extracting a test set from the training data set according to a preset ratio; Expanding the remaining data sets in the training data set according to a preset data enhancement strategy, and dividing the remaining data sets into a training set and a validation set according to a preset ratio; Obtaining an initial classification model trained by using a ResNet-18 neural network using a preset visual data set, and inputting the training set and the validation set into the initial classification model for deep learning to obtain a cataplexy face recognition model; Acquire a facial image to be identified, and input the facial image to be identified into the cataplexy facial recognition model to identify whether the facial image is a cataplexy facial image; The step of expanding the remaining data sets in the training data set according to the preset data enhancement strategy includes: Adding salt and pepper noise and Gaussian blur to the images in the remaining data set with random probability, or performing random horizontal flipping and random angle flipping on the images in the remaining data set, or performing contrast enhancement on the images in the remaining data set to obtain another image data to expand the remaining data set in the training data set; The step of dividing the remaining data set into a training set and a validation set according to a preset ratio comprises: Divide the remaining data set into five equal parts, use four of the five equal parts as the training set, and use the other one of the five equal parts as the validation set; The step of inputting the training set and the validation set into the initial classification model for deep learning to obtain a cataplexy face recognition model comprises: Set a loop, cycle five times, each time select a different equal portion as the validation set, and the remaining four equal portions as the training set; In each cycle, the currently selected training set is used to train the initial classification model, and the current validation set is used to evaluate the performance of the initial classification model until the performance of the initial classification model tends to be stable to obtain the cataplexy face recognition model; Before the step of collecting a preset number of cataplexy facial images and normal facial images to establish a training data set, and extracting a test set from the training data set according to a preset ratio, the step further includes: Collecting a video of the cataplexy of the subject in the test area, and extracting the cataplexy video by frames to obtain an image containing the cataplexy face and an image containing the normal face; Extracting facial information from the image containing the cataplexy face and the image containing the normal face using a preset algorithm to obtain the cataplexy face image and the normal face image; Scaling the cataplexy facial image and the normal facial image to the same preset size, and performing normalization processing and pixel standardization; An image acquisition device is arranged at the front end of the test area, and an infrared detection grating is arranged around the test area. The step of acquiring a video of the cataplexy of the subject in the test area includes: Collecting infrared detection information collected by the infrared detection grating, and determining body contour information of the subject according to the infrared detection information; The image acquisition device is adjusted according to the body contour information to ensure that the subject is in the middle area of the image acquisition device capture screen, and then the cataplexy video of the subject is captured by the image acquisition device; The infrared detection grating includes a first infrared detection grating array arranged on the top of the test area and a second infrared detection grating array arranged on both sides of the test area; the step of determining the body contour information of the subject according to the infrared detection includes: Determine a top reference point according to the first infrared detection grating information detected by the first infrared detection grating array, and extend top reference lines outward from the top reference point respectively; Determine a side reference point according to the second infrared detection grating information detected by the second infrared detection grating array, and extend side reference lines from the side reference point to both ends respectively; The body contour information of the subject is determined according to a rectangular area enclosed by the top reference line, the side reference line and the subject area.
2. The cataplexy face recognition method based on the cataplexy face recognition model according to claim 1, characterized in that: The step of adjusting the image acquisition device according to the body contour information to ensure that the subject is located in the middle area of the image acquisition device capture screen includes: The position information of the rectangular area is obtained, and the image acquisition device is adjusted upward, downward, leftward, and rightward according to the position information to ensure that the subject is in the middle area of the image acquisition screen captured by the image acquisition device.
3. A cataplexy facial recognition device based on a cataplexy facial recognition model, characterized in that: The device is used to implement the method for cataplexy face recognition based on the cataplexy face recognition model according to any one of claims 1 to 2, the device comprising: An acquisition module, used for acquiring a preset number of cataplexy facial images and normal facial images to establish a training data set, and extracting a test set from the training data set according to a preset ratio; A partitioning module, used to expand the remaining data set in the training data set according to a preset data enhancement strategy, and divide the remaining data set into a training set and a validation set according to a preset ratio; A training module is used to obtain an initial classification model trained by using a ResNet-18 neural network using a preset visual data set, and input the training set and the validation set into the initial classification model for deep learning to obtain a cataplexy face recognition model; A recognition module, used for acquiring a facial image to be recognized, and inputting the facial image to be recognized into the cataplexy facial recognition model to recognize whether the facial image is a cataplexy facial image; The division module comprises: a partitioning unit, configured to add salt and pepper noise and Gaussian blur to the images in the remaining data set with random probability, or to randomly horizontally flip or randomly angle flip the images in the remaining data set, or to contrast enhance the images in the remaining data set to obtain another image data to expand the remaining data set in the training data set; The division module also includes: an equal division unit, used for equally dividing the remaining data set into five equal parts, using four of the five equal parts as the training set, and another of the five equal parts as the validation set; The training module includes: A training unit is used to set a loop, which is repeated five times, and each time a different equal portion is selected as the verification set, and the remaining four equal portions are used as the training sets; In each cycle, the currently selected training set is used to train the initial classification model, and the current validation set is used to evaluate the performance of the initial classification model until the performance of the initial classification model tends to be stable to obtain the cataplexy face recognition model.
4. A readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 2 are implemented.
5. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 2 when executing the program.
