Image classification method and apparatus
By extracting features from the eyebrow and eye regions of facial images and using a pre-trained image classification model for principal component analysis and support vector machine classification, the problem of inefficient and inaccurate identification of cervical spine abnormalities in existing technologies is solved, enabling accurate detection and timely early warning of cervical spondylosis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2026-03-10
AI Technical Summary
Current technology cannot efficiently and accurately identify facial images with cervical spine abnormalities, resulting in the inability to detect and warn of cervical spondylosis in a timely manner.
By acquiring features of the eyebrow and eye regions in facial images, principal component analysis is performed using a pre-trained image classification model, and support vector machines with radial basis functions are combined for classification to establish an image classification method for normal and abnormal cervical spine.
It enables accurate detection and timely early warning of cervical spondylosis, improving the efficiency and accuracy of cervical spine abnormality identification.
Smart Images

Figure CN115713800B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine learning technology, and more specifically, to an image classification method and apparatus. Background Technology
[0002] With the influence of modern social environment and lifestyle, more and more people are suffering from chronic cervical strain due to improper work habits, posture, and excessive neck movements, which leads to cervical spondylosis. Cervical spondylosis is an important factor affecting human health and safety.
[0003] People usually rely on auxiliary examinations and experienced traditional Chinese medicine experts to diagnose cervical spondylosis, but this method often fails to accurately detect and predict cervical problems, leading to various diseases caused by cervical spondylosis.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This application provides an image classification method and apparatus to at least solve the technical problem in the related art of being unable to efficiently and accurately identify facial images of people with cervical spine abnormalities.
[0006] According to one aspect of the embodiments of this application, an image classification method is provided, comprising: acquiring a face image to be classified; extracting target region features from the face image to be classified, wherein the target region features include at least eyebrow region features and eye region features; inputting the target region features into a pre-trained image classification model to obtain an image classification result output by the image classification model, wherein the image classification model is used to perform principal component analysis on the target region features and determine the image type of the face image to be classified based on the analysis results, and the image type includes one of the following: a face image with normal cervical spine and a face image with abnormal cervical spine.
[0007] Optionally, the image classification model is a binary classification model, which includes a preset number of principal component analysis sub-models and a target classifier, wherein the target classifier is a support vector machine based on radial basis functions.
[0008] Optionally, the training process of the image classification model includes: obtaining a first sample image set, wherein the first sample image set includes a first sample image subset and a second sample image subset, wherein the images in the first sample image subset are all face images of people with normal cervical spine, and the images in the second sample image subset are all face images of people with abnormal cervical spine; preprocessing each image in the first sample image set to obtain the second sample image set, wherein the preprocessing includes: cropping the target region in each image, wherein the target region includes at least the eyebrow region and the eye region; extracting multiple first features from each image in the second sample image set, wherein the first features include at least the eyebrow region features and the eye region features; performing principal component analysis on the multiple first features based on the principal component analysis sub-model to obtain multiple second features; iteratively training the target classifier based on the multiple second features, adjusting the model parameters of the target classifier, and obtaining the image classification model.
[0009] Optionally, obtaining the first sample image set includes: obtaining multiple face images; for each face image, obtaining the manual voting result for the face image, and when the manual voting result indicates that the face image is a face image with normal cervical spine, classifying the face image into the first sample image subset, and when the manual voting result indicates that the face image is a face image with abnormal cervical spine, classifying the face image into the second sample image subset.
[0010] Optionally, extracting multiple first features from each image in the second sample image set includes: for each image in the second sample image set, converting the image into a grayscale image based on a preset three-primary-color weight; performing a local binary mode algorithm on the grayscale image based on a preset cell size to extract multiple first features from the grayscale image, wherein the multiple first features include: a first number of eyebrow region features and a second number of eye region features.
[0011] Optionally, after performing principal component analysis on multiple first features based on the principal component analysis sub-model to obtain multiple second features, the method further includes: performing a T-test on the second features of images in the first sample image subset and the second features of images in the second sample image subset to obtain the P-value of each second feature; and deleting the second feature when the P-value of any second feature is greater than a preset threshold.
[0012] Optionally, the target classifier is iteratively trained based on multiple second features, and the model parameters of the target classifier are adjusted, including: using cross-validation, inputting multiple second features into the target classifier in sequence to obtain multiple prediction results; calculating the multiple prediction results from four dimensions: sensitivity, specificity, accuracy and Matthews correlation coefficient, and adjusting the Gamma value and C value of the target classifier according to the calculation results.
[0013] According to another aspect of the embodiments of this application, an image classification apparatus is also provided, comprising: an acquisition module for acquiring a face image to be classified; an extraction module for extracting target region features from the face image to be classified, wherein the target region features include at least eyebrow region features and eye region features; and a classification module for inputting the target region features into a pre-trained image classification model to obtain an image classification result output by the image classification model, wherein the image classification model is used to perform principal component analysis on the target region features and determine the image type of the face image to be classified based on the analysis results, and the image type includes one of the following: a face image with normal cervical spine and a face image with abnormal cervical spine.
[0014] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored program, wherein the device where the non-volatile storage medium is located executes the above-described image classification method by running the program.
[0015] According to another aspect of the embodiments of this application, an electronic device is also provided, the electronic device including: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described image classification method through the computer program.
[0016] In this embodiment, a face image to be classified is acquired; target region features are extracted from the face image to be classified, wherein the target region features include at least eyebrow region features and eye region features; the target region features are input into a pre-trained image classification model to obtain the image classification result output by the image classification model, wherein the image classification model is used to perform principal component analysis on the target region features and determine the image type of the face image to be classified based on the analysis results, the image type including one of the following: a face image with normal cervical spine, or a face image with abnormal cervical spine. The image classification model for detecting cervical spondylosis is trained based on the face image, thereby enabling accurate real-time detection and timely warning of cervical spondylosis, thus solving the technical problem in related technologies that cannot efficiently and accurately identify face images with abnormal cervical spine. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0018] Figure 1 This is a flowchart illustrating an optional image classification method according to an embodiment of this application;
[0019] Figure 2 This is a schematic diagram of an optional uneven eyebrow shape according to an embodiment of this application;
[0020] Figure 3 This is a schematic diagram of an optional example of abnormal eyebrow loss according to an embodiment of this application;
[0021] Figure 4 This is a schematic diagram of an optional eyebrow pimple according to an embodiment of this application;
[0022] Figure 5 This is a schematic diagram of an optional eyebrow drooping according to an embodiment of this application;
[0023] Figure 6a This is a schematic diagram of an optional segmentation of blood vessels in the eye according to an embodiment of this application;
[0024] Figure 6b This is a schematic diagram of an optional eye redness corresponding to a disease according to an embodiment of this application;
[0025] Figure 7 This is an evaluation metric diagram of an optional classifier according to an embodiment of this application.
[0026] Figure 8 This is a schematic diagram of an optional image classification device according to an embodiment of this application. Detailed Implementation
[0027] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first," "second," etc., used in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0029] Example 1
[0030] Because traditional Chinese medicine cannot accurately detect cervical spondylosis through facial images, the condition of the cervical spine can lead to various diseases. Therefore, this application provides an image classification method, which will be described below with reference to specific embodiments.
[0031] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0032] Figure 1 This is a flowchart illustrating an optional image classification method according to an embodiment of this application, such as... Figure 1 As shown, the method includes at least steps S102-S106, wherein:
[0033] Step S102: Obtain the face image to be classified.
[0034] Since there is currently no public database of visual images and videos of patients diagnosed with cervical spondylosis, this embodiment of the application establishes a video database for detecting cervical spondylosis by recruiting volunteers to record videos, and obtains the facial images to be classified from the video database.
[0035] Step S104: Extract the target region features from the face image to be classified, wherein the target region features include at least eyebrow region features and eye region features.
[0036] According to Traditional Chinese Medicine (TCM), cervical spondylosis is mainly caused by localized arthralgia, meaning that where there is free flow, there is no pain, and where there is pain, there is obstruction. It is often caused by external injuries, qi deficiency, blood deficiency, and exposure to wind, cold, and dampness, which can easily lead to problems such as dizziness, vertigo, and tinnitus. Furthermore, in TCM theory, facial features such as eyebrows and blood vessels in the eyes are closely related to spinal health. Therefore, this embodiment of the application requires extracting target region features from the facial image to be classified.
[0037] Symptoms of cervical spine problems typically include enlarged pores between the eyebrows, uneven eyebrows, abnormal eyebrow loss, acne on the eyebrows, drooping eyebrows, and visible blood vessels in the eyebrows. Therefore, the diagnostic definition of cervical spine problems can be as follows:
[0038] Since the area between the eyebrows is a pressure point of the seventh cervical vertebra, blackheads and whiteheads in this area are particularly large, which may be due to discomfort or high pressure in the cervical spine.
[0039] Figure 2The diagram illustrates an optional uneven eyebrow shape. Since abnormal cervical curvature can lead to various facial problems, the sudden appearance of uneven eyebrows, a crooked nose, asymmetrical eyes, uneven nostrils, and uneven corners of the mouth may indicate a problem with the cervical spine.
[0040] Figure 3 The diagram illustrates an alternative method for abnormal eyebrow loss. Because a misaligned cervical vertebra can compress nerve roots, it can cause insufficient supply to the brain's nervous system and blood supply system, thus hindering the delivery of nutrients to the body's hair. Therefore, if problems such as abnormal eyebrow loss or hair loss occur, it indicates that there may be a problem with the cervical spine.
[0041] Figure 4 The illustration shows an alternative method for treating acne on the eyebrows. Due to incorrect posture or maintaining the same posture for a long time, the cervical spine is in a state of fatigue due to forward flexion for a long time, and the muscles at the back of the neck are in a state of tension. This violates the normal physiological curve of the cervical spine, which can easily cause cervical spine fatigue and illness, resulting in acne on the eyebrows.
[0042] Figure 5 The illustration shows an alternative eyebrow drooping pattern. Due to the imbalance between the internal and external cervical spine, soft tissue inflammation, congestion, edema, and insufficient blood supply are caused by blood circulation disorders of the auricular and facial nerves, resulting in eyebrow drooping.
[0043] There is a correlation between bloodshot eyes and cervical spondylosis. Bloodshot eyes and related spots are key indicators for observing cervical spondylosis. Therefore, understanding the characteristics and patterns of bloodshot eyes can help detect the onset of cervical spondylosis.
[0044] Figure 6a A schematic diagram of an optional segmentation of blood vessels in the eyeball is shown, which can be achieved through... Figure 6a To obtain the division of the eyeball and the corresponding organs and tissues; Figure 6b The diagram illustrates one possible condition corresponding to redness in the eye, which can be visualized through... Figure 6b To obtain the diseases of the organs and tissues corresponding to different areas of the eyeball.
[0045] For example, when blood vessels appear at the very top center of the eyeball and run vertically downwards, it indicates a lesion in the second and third cervical vertebrae. If there are also latent blood spots in the brain region, it suggests the cervical spine injury was caused by trauma. When blood vessels appear about one millimeter to the left or right of the top center of the eyeball, and there is hypertrophy and hyperplasia in the lower part of the cervical spine in the same direction as the blood vessels, it indicates a disease in the second and third cervical vertebrae. If the focus of the blood vessel deviates towards the corner of the eye in the same direction, it indicates that in addition to cervical spondylosis, the patient also experiences shoulder discomfort. If the blood vessels are dark in color and extend to the outer edge of the eyeball, it indicates a more severe cervical spondylosis. If the blood vessels on both sides of the cervical spine connect in the middle, the cervical spine disease is even more severe.
[0046] Step S106: Input the target region features into the pre-trained image classification model to obtain the image classification result output by the image classification model. The image classification model is used to perform principal component analysis on the target region features and determine the image type of the face image to be classified based on the analysis results. The image type includes one of the following: face image with normal cervical spine, face image with abnormal cervical spine.
[0047] The image classification model can be a binary classification model, and the image classification model includes: a preset number of principal component analysis sub-models and a target classifier, wherein the target classifier is a support vector machine based on radial basis functions.
[0048] Specifically, various binary classification algorithms are employed to solve image classification problems. The classification results are typically predicted using four metrics: sensitivity (Sn), specificity (Sp), accuracy (Acc), and Matthews classification (MCC). Figure 7 A graph of evaluation metrics for alternative classifiers is shown, where classifiers SVM-L and SVM-RBF are both support vector machines with linear and RBF kernels, respectively; k-nearest neighbors (KNN) is used to evaluate how well they perform on the cervical spondylosis detection problem based on simple distance; decision trees (DTree) have inherent properties that are easy to interpret; random forests (RForest) tend to have better classification performance; and extreme gradient boosting (XGBoost) is a recently developed open-source algorithm.
[0049] A comparison of six different classifiers reveals that, while SVM-L and SVM-RBF share the same support vector framework, SVM-L performs significantly worse than SVM-RBF. XGBoost and SVM-RBF have similar performance, with XGBoost achieving the best sensitivity (Sn) of 99.11%, but its specificity (sp) is lower than that of SVM-RBF. Therefore, in this embodiment, the target classifier is chosen to be based on radial basis functions, specifically SVM-RBF.
[0050] As an optional implementation, the training process of the image classification model can be divided into the following steps S1061-S1065, wherein:
[0051] Step S1061: Obtain a first sample image set, wherein the first sample image set includes a first sample image subset and a second sample image subset. The images in the first sample image subset are all face images of people with normal cervical spine, and the images in the second sample image subset are all face images of people with abnormal cervical spine.
[0052] Optionally, multiple face images are acquired; for each face image, the results of human voting on the face image are acquired, and when the human voting results indicate that the face image is a face image with normal cervical spine, the face image is assigned to the first sample image subset, and when the human voting results indicate that the face image is a face image with abnormal cervical spine, the face image is assigned to the second sample image subset.
[0053] Therefore, the first sample image set S can be divided into a subset of first sample images (i.e., positive samples) using the above method, represented as: P = {P1, P2, P3, ... P} n The second sample image subset (i.e., the negative samples) can be represented as: N = {N1, N2, N3, ... N} m}
[0054] For example, seven male volunteers and seven female volunteers were recruited. Detailed information for each volunteer included gender, age, and whether they wore glasses. It should be noted that the videos for the cervical spondylosis detection were recorded under the premise that none of the volunteers had sleep disturbances affecting their neurocognitive abilities, nor had they consumed any foods, drinks, or medications that could affect their neurocognitive systems.
[0055] In this embodiment, videos of volunteers were filmed in both their non-cervical spondylosis and cervical spondylosis states. All volunteers ate normally and rested completely on the first day, and a video was recorded at 8:00 AM on the second day under these conditions, yielding the video of their non-cervical spondylosis state. Volunteers then went 18 consecutive hours without rest, and a video was recorded at 3:00 AM the following morning on the third day under these conditions, yielding the video of their cervical spondylosis state.
[0056] All the videos were shot using the CMOS 5-megapixel camera in the MacBook Pro (13-inch screen), with a resolution of 1280x720 pixels, a capture rate of 30 frames per second, and a recording duration of 5 minutes per video, containing a total of 9000 (5x60x30) images.
[0057] Since each volunteer recorded two videos, one showing a non-cervical spondylosis state and the other a cervical spondylosis state, and 300 images were randomly extracted from each video, a total of 8400 images were obtained, forming the first sample image set S. Through manual annotation and voting, images were labeled as indicating whether the volunteer had cervical spondylosis, resulting in a first sample image subset (positive samples) P and a second sample image subset (negative samples) N, thus completing the division of the first sample image set.
[0058] Step S1062: Preprocess each image in the first sample image set to obtain the second sample image set. The preprocessing includes: cropping the target region in each image. The target region includes at least the eyebrow region and the eye region.
[0059] According to the definition of cervical spondylosis in Traditional Chinese Medicine, the condition can be determined by the morphological patterns of bloodshot eyes and the eyebrow area. Therefore, we preprocess each image in the first sample image set by checking whether it contains the eyeball and eyebrow areas.
[0060] Step S1063: Extract multiple first features from each image in the second sample image set, wherein the first features include at least eyebrow region features and eye region features.
[0061] Optionally, for each image in the second sample image set, the image is converted into a grayscale image based on a preset three primary color weight; the grayscale image is processed by a local binary mode algorithm based on a preset cell size to extract multiple first features from the grayscale image, wherein the multiple first features include: a first number of eyebrow region features and a second number of eye region features.
[0062] For example, each color image in the second sample image set is first converted to a grayscale image using GrayScale = 0.299*R + 0.587*G + 0.114*B, where R / G / B are the pixel values of the red / green / blue channels and can be provided by the OpenCV library function imread().
[0063] Alternatively, a gamma correction of Y=2.2 can be used to normalize the light changes. MaxV is set as the maximum grayscale pixel value of the gamma-corrected image matrix M. Therefore, the final image matrix is calculated as M'=M / (MaxV*255).
[0064] Next, the images of the blood vessels in the eyeball and the eyebrow area were scaled to 320*320, 64*32 and 64*64 respectively, and then the DXHOSEYE (Local Binary Patterns) algorithm was used to extract multiple primary features from the grayscale images.
[0065] Since the Local Binary Pattern Algorithm (LBI) has two values, Width and Height, the parameter cell size pCellSize can be used to represent Width*Height to determine a suitable parameter index to achieve optimal classification accuracy. Specifically, the SVM-RBF classifier performs best when Height is 32, with Width fixed at 16 or 32. With Width fixed at 8, the SVM-RBF classifier achieves a 1.01% improvement in classification accuracy with Height equal to 32 compared to Height equal to 64. Furthermore, with Width fixed at 16 or 32, the SVM-RBF classifier performs best with Height equal to 32. If Width is fixed at 8, the SVM-RBF classifier achieves a 1.01% improvement in classification accuracy with Height equal to 32 compared to Height equal to 64. Therefore, the SVM-RBF classifier achieves an optimal classification accuracy of 90.60% with pCellSize = 32*32.
[0066] Therefore, in this embodiment of the application, the parameter pCellSize of the local binary pattern algorithm is set to 32x32, so an eye image can have 512 first features and a mouth image can have 1024 first features, so for each image there are a total of 2048 first features.
[0067] Step S1064: Perform principal component analysis on multiple first features based on the principal component analysis sub-model to obtain multiple second features.
[0068] For example, for each image in the second sample image set, it is necessary to calculate the PCA (principal component analysis) value of each first feature, and select the top 20 with the largest PCA values as the second features.
[0069] Optionally, the features extracted by the local binary pattern algorithm do not have the ability to discriminate cervical spondylosis samples. Therefore, in this embodiment, after performing principal component analysis on multiple first features in the principal component analysis sub-model to obtain multiple second features, a T-test can be performed on the second features of the images in the first sample image subset and the second features of the images in the second sample image subset to obtain the P-value of each second feature. When the P-value of any second feature is greater than a preset threshold, it indicates that these second features do not have the ability to detect, and the second features are deleted.
[0070] Step S1065 iteratively trains the target classifier based on multiple second features, adjusts the model parameters of the target classifier, and obtains the image classification model.
[0071] Furthermore, using cross-validation, multiple second features are sequentially input into the target classifier to obtain multiple prediction results. The multiple prediction results are calculated from four dimensions: sensitivity, specificity, accuracy, and Matthews correlation coefficient. The Gamma and C values of the target classifier are adjusted based on the calculation results.
[0072] For example, by using a 10x cross-validation algorithm, multiple second features are sequentially input into the classifier SVM-RBF to obtain multiple prediction results. Then, the multiple prediction results are further calculated from four dimensions: sensitivity Sn, specificity Sp, accuracy Acc, and Matthews MCC, thereby adjusting the model parameters of the target classifier and obtaining a more accurate image classification model.
[0073] In this embodiment, a face image to be classified is acquired; target region features are extracted from the face image to be classified, wherein the target region features include at least eyebrow region features and eye region features; the target region features are input into a pre-trained image classification model to obtain the image classification result output by the image classification model, wherein the image classification model is used to perform principal component analysis on the target region features and determine the image type of the face image to be classified based on the analysis results, the image type including one of the following: a face image with normal cervical spine, or a face image with abnormal cervical spine. The image classification model for detecting cervical spondylosis is trained based on the face image, thereby enabling accurate real-time detection and timely warning of cervical spondylosis, thus solving the technical problem in related technologies that cannot efficiently and accurately identify face images with abnormal cervical spine.
[0074] Example 2
[0075] According to embodiments of this application, an image classification apparatus for implementing the image classification method in Embodiment 1 is also provided, such as... Figure 8 As shown, the image classification device includes at least an acquisition module 81, an extraction module 82, and a classification module 83, wherein:
[0076] The acquisition module 81 is used to acquire the face image to be classified.
[0077] Since there is currently no public database of visual images and videos of patients diagnosed with cervical spondylosis, in this embodiment of the application, the acquisition module 81 can establish a video database for detecting cervical spondylosis by recruiting volunteers to record videos, and then acquire the face images to be classified from the video database.
[0078] Extraction module 82 is used to extract target region features from the face image to be classified, wherein the target region features include at least eyebrow region features and eye region features.
[0079] According to Traditional Chinese Medicine (TCM), cervical spondylosis is mainly caused by localized arthralgia, meaning that where there is free flow, there is no pain; where there is pain, there is obstruction. It is often caused by external injuries, qi deficiency, blood deficiency, and exposure to wind, cold, and dampness, which can easily lead to problems such as dizziness, vertigo, and tinnitus. Furthermore, in TCM theory, facial features such as eyebrows and blood vessels in the eyes are closely related to spinal health. Therefore, in this embodiment, the feature extraction module 82 extracts the target region features from the face image to be classified.
[0080] The image classification model is a binary classification model, which includes a preset number of principal component analysis sub-models and a target classifier. The target classifier is a support vector machine based on radial basis functions.
[0081] The classification module 83 is used to input the target region features into the pre-trained image classification model and obtain the image classification result output by the image classification model. The image classification model is used to perform principal component analysis on the target region features and determine the image type of the face image to be classified based on the analysis results. The image type includes one of the following: face image with normal cervical spine, face image with abnormal cervical spine.
[0082] As an optional implementation, the image classification model can be trained through steps S1-S5:
[0083] Step S1: Obtain a first sample image set, wherein the first sample image set includes a first sample image subset and a second sample image subset. The images in the first sample image subset are all face images of people with normal cervical spine, and the images in the second sample image subset are all face images of people with abnormal cervical spine.
[0084] Specifically, the first sample image set can be obtained as follows: First, multiple face images are obtained; then, for each face image, the results of manual voting on the face image are obtained, and when the manual voting results indicate that the face image is a face image with normal cervical spine, the face image is divided into the first sample image subset; when the manual voting results indicate that the face image is a face image with abnormal cervical spine, the face image is divided into the second sample image subset.
[0085] Step S2: Preprocess each image in the first sample image set to obtain the second sample image set. The preprocessing includes: cropping the target region in each image, where the target region includes at least the eyebrow region and the eye region.
[0086] Step S3: Extract multiple first features from each image in the second sample image set, wherein the first features include at least eyebrow region features and eye region features.
[0087] Specifically, multiple first features can be extracted as follows: for each image in the second sample image set, the image is converted into a grayscale image based on a preset three primary color weight; the grayscale image is processed by a local binary mode algorithm based on a preset unit size to extract multiple first features in the grayscale image, wherein the multiple first features include: a first number of eyebrow region features and a second number of eye region features.
[0088] Step S4: Perform principal component analysis on multiple first features based on the principal component analysis sub-model to obtain multiple second features.
[0089] Optionally, after performing principal component analysis on multiple first features based on the principal component analysis sub-model to obtain multiple second features, a T-test can be performed on the second features of images in the first sample image subset and the second features of images in the second sample image subset to obtain the P-value of each second feature; if the P-value of any second feature is greater than a preset threshold, the second feature is deleted.
[0090] Step S5: Iteratively train the target classifier based on multiple second features, adjust the model parameters of the target classifier, and obtain the image classification model.
[0091] Furthermore, the target classifier is iteratively trained based on multiple second features, and the model parameters of the target classifier are adjusted, including: using cross-validation, inputting multiple second features into the target classifier in sequence to obtain multiple prediction results; calculating the multiple prediction results from four dimensions: sensitivity Sn, specificity Sp, accuracy Acc, and Matthews MCC, and adjusting the Gamma and C values of the target classifier according to the calculation results.
[0092] It should be noted that each module in the image classification device in this embodiment corresponds one-to-one with each implementation step of the image classification method in Embodiment 1. Since Embodiment 1 has been described in detail, some details not shown in this embodiment can be referred to Embodiment 1, and will not be elaborated further here.
[0093] Example 3
[0094] According to an embodiment of this application, a non-volatile storage medium is also provided, which includes a stored program, wherein the device where the non-volatile storage medium is located executes the image classification method in Embodiment 1 by running the program.
[0095] Specifically, the device containing the non-volatile storage medium executes the following steps by running the program: acquiring a face image to be classified; extracting target region features from the face image to be classified, wherein the target region features include at least eyebrow region features and eye region features; inputting the target region features into a pre-trained image classification model to obtain the image classification result output by the image classification model, wherein the image classification model is used to perform principal component analysis on the target region features and determine the image type of the face image to be classified based on the analysis results, and the image type includes one of the following: a face image with normal cervical spine, or a face image with abnormal cervical spine.
[0096] According to an embodiment of this application, a processor is also provided for running a program, wherein the program executes the image classification method in embodiment 1 during runtime.
[0097] Specifically, the program executes the following steps during runtime: acquiring a face image to be classified; extracting target region features from the face image to be classified, wherein the target region features include at least eyebrow region features and eye region features; inputting the target region features into a pre-trained image classification model to obtain the image classification result output by the image classification model, wherein the image classification model is used to perform principal component analysis on the target region features and determine the image type of the face image to be classified based on the analysis results, and the image type includes one of the following: a face image with normal cervical spine, or a face image with abnormal cervical spine.
[0098] According to an embodiment of this application, an electronic device is also provided, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the image classification method of embodiment 1 through the computer program.
[0099] Specifically, the processor is configured to execute the following steps via a computer program: acquiring a face image to be classified; extracting target region features from the face image to be classified, wherein the target region features include at least eyebrow region features and eye region features; inputting the target region features into a pre-trained image classification model to obtain the image classification result output by the image classification model, wherein the image classification model is used to perform principal component analysis on the target region features and determine the image type of the face image to be classified based on the analysis results, and the image type includes one of the following: a face image with normal cervical spine, or a face image with abnormal cervical spine.
[0100] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0101] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0102] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.
[0103] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0104] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0105] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0106] The above are merely preferred embodiments of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. An image classification method, characterized by, The method comprises: obtaining a face image to be classified; extracting target region features in the face image to be classified, wherein the target region features at least include eyebrow region features and eye region features; inputting the target region features into a pre-trained image classification model to obtain an image classification result output by the image classification model, wherein the image classification model is used to perform principal component analysis on the target region features, and determine an image type of the face image to be classified based on an analysis result, the image type including one of the following: a normal cervical spine face image and an abnormal cervical spine face image; wherein the training process of the image classification model comprises: obtaining a first sample image set, wherein the first sample image set includes a first sample image subset and a second sample image subset, images in the first sample image subset are all normal cervical spine face images, and images in the second sample image subset are all abnormal cervical spine face images; performing preprocessing on each image in the first sample image set to obtain a second sample image set, wherein the preprocessing includes: intercepting a target region in each image, the target region at least including an eyebrow region and an eye region; extracting a plurality of first features in each image in the second sample image set, wherein the first features at least include eyebrow region features and eye region features; performing principal component analysis on the plurality of first features based on a principal component analysis submodel to obtain a plurality of second features; and iteratively training a target classifier based on the plurality of second features to adjust model parameters of the target classifier to obtain the image classification model.
2. The method of claim 1, wherein, The image classification model is a binary classification model, and the image classification model includes: a preset number of principal component analysis submodels and a target classifier, and the target classifier is a support vector machine based on a radial basis function.
3. The method of claim 1, wherein, Obtaining the first sample image set comprises: obtaining a plurality of face images; for each face image, obtaining an artificial voting result for the face image, and when the artificial voting result indicates that the face image is a normal cervical spine face image, dividing the face image into the first sample image subset, and when the artificial voting result indicates that the face image is an abnormal cervical spine face image, dividing the face image into the second sample image subset.
4. The method of claim 1, wherein, Extracting a plurality of first features in each image in the second sample image set comprises: for each image in the second sample image set, converting the image into a grayscale image based on a preset three-primary-color weight; performing local binary pattern algorithm processing on the grayscale image based on a preset unit size to extract a plurality of first features in the grayscale image, wherein the plurality of first features include: a first number of eyebrow region features and a second number of eye region features.
5. The method of claim 1, wherein, After performing principal component analysis on the plurality of first features based on the principal component analysis submodel to obtain a plurality of second features, the method further comprises: performing T test on the second features of the images in the first sample image subset and the second features of the images in the second sample image subset to obtain a P value of each second feature; when the P value of any second feature is greater than a preset threshold, deleting the second feature.
6. The method of claim 1, wherein, Iteratively training the target classifier based on the plurality of second features to adjust model parameters of the target classifier comprises: The second features are input into the target classifier one by one by using a cross-validation method, and a plurality of prediction results are obtained. The plurality of prediction results are calculated from four dimensions of sensitivity, specificity, accuracy and Matthew correlation coefficient, and the Gamma value and C value of the target classifier are adjusted according to the calculation results.
7. An image classification apparatus characterized by comprising: The method comprises the steps of: An acquisition module is configured to acquire a face image to be classified. An extraction module is configured to extract target region features in the face image to be classified, wherein the target region features at least include eyebrow region features and eye region features. A classification module is configured to input the target region features into a pre-trained image classification model to obtain an image classification result output by the image classification model, wherein the image classification model is configured to perform principal component analysis on the target region features and determine an image type of the face image to be classified based on an analysis result, and the image type includes one of a normal cervical spine face image and an abnormal cervical spine face image.
8. A non-volatile storage medium, characterized by, The training process of the image classification model includes: acquiring a first sample image set, wherein the first sample image set includes a first sample image subset and a second sample image subset, images in the first sample image subset are all normal cervical spine face images, and images in the second sample image subset are all abnormal cervical spine face images; performing preprocessing on each image in the first sample image set to obtain a second sample image set, wherein the preprocessing includes: intercepting a target region in each image, and the target region at least includes an eyebrow region and an eye region; extracting a plurality of first features in each image in the second sample image set, wherein the first features at least include eyebrow region features and eye region features; performing principal component analysis on the plurality of first features based on a principal component analysis submodel to obtain a plurality of second features; and iteratively training a target classifier based on the plurality of second features, adjusting model parameters of the target classifier, and obtaining the image classification model.
9. An electronic device, comprising: The non-volatile storage medium includes a stored program, wherein a device in which the non-volatile storage medium is located executes the image classification method of any one of claims 1 to 6 by running the program. The method comprises the steps of: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the image classification method of any one of claims 1 to 6 by the computer program.
Citation Information
Patent Citations
Face recognition method based on improved LBP operator and support vector machine classification
CN110287823A
Facial color classification method and device, computer readable program medium and electronic equipment
CN115100723A