CN117152543A - Image classification method, device, equipment and storage medium - Google Patents
Image classification method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN117152543A CN117152543A CN202311413593.XA CN202311413593A CN117152543A CN 117152543 A CN117152543 A CN 117152543A CN 202311413593 A CN202311413593 A CN 202311413593A CN 117152543 A CN117152543 A CN 117152543A
- Authority
- CN
- China
- Prior art keywords
- density
- clusters
- image
- classified
- sub
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 43
- 239000000203 mixture Substances 0.000 claims abstract description 54
- 238000004364 calculation method Methods 0.000 claims abstract description 36
- 238000009826 distribution Methods 0.000 claims abstract description 35
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 32
- 230000008859 change Effects 0.000 claims abstract description 30
- 238000012545 processing Methods 0.000 claims abstract description 18
- 238000004590 computer program Methods 0.000 claims description 14
- 230000009467 reduction Effects 0.000 claims description 8
- 238000012847 principal component analysis method Methods 0.000 claims description 4
- 230000008569 process Effects 0.000 description 6
- 238000004891 communication Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 230000009471 action Effects 0.000 description 3
- 238000002474 experimental method Methods 0.000 description 3
- 238000000513 principal component analysis Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000004927 fusion Effects 0.000 description 2
- 230000014509 gene expression Effects 0.000 description 2
- 230000005484 gravity Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000001186 cumulative effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000001815 facial effect Effects 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 239000011521 glass Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000036544 posture Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000011946 reduction process Methods 0.000 description 1
- 238000011524 similarity measure Methods 0.000 description 1
- 238000013517 stratification Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/764—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
- G06V10/765—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects using rules for classification or partitioning the feature space
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/761—Proximity, similarity or dissimilarity measures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/762—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using clustering, e.g. of similar faces in social networks
- G06V10/763—Non-hierarchical techniques, e.g. based on statistics of modelling distributions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
- G06V10/7715—Feature extraction, e.g. by transforming the feature space, e.g. multi-dimensional scaling [MDS]; Mappings, e.g. subspace methods
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- Medical Informatics (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Databases & Information Systems (AREA)
- Computing Systems (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Probability & Statistics with Applications (AREA)
- Image Analysis (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses an image classification method, an image classification device, an image classification equipment and a storage medium, which relate to the technical field of image classification and comprise the following steps: calculating pixels of the image to be classified according to a preset density calculation formula to obtain local density corresponding to the image to be classified; fitting the local density according to the Gaussian mixture model to obtain density distribution corresponding to the image to be classified, and determining a density change turning point from the density distribution by utilizing the Gaussian mixture model; dividing a plurality of images to be classified into different density areas based on density change turning points to obtain a plurality of density areas; processing the density areas by using a density peak clustering algorithm to obtain density sub-clusters corresponding to each density area; and merging according to the similarity among the density sub-clusters to obtain an image classification result aiming at the images to be classified. Therefore, the method classifies the images in the mode of dividing the density areas and combining the sub-clusters, and improves the accuracy of image classification.
Description
Technical Field
The present application relates to the field of image classification technologies, and in particular, to an image classification method, apparatus, device, and storage medium.
Background
With the continuous development of image acquisition technology and equipment, the amount of image data obtained by people is explosively increased, and the image data contains abundant visual information, but the classification of the image data is a complex task.
In the image classification process, how to accurately classify related images according to similarity and difference between images is a problem to be solved in the art.
Disclosure of Invention
Accordingly, the present application is directed to a method, apparatus, device and storage medium for classifying images, which can classify images by dividing density regions and merging sub-clusters, thereby improving the accuracy of image classification. The specific scheme is as follows:
in a first aspect, the present application provides an image classification method, including:
calculating pixels of an image to be classified according to a preset density calculation formula to obtain local density corresponding to the image to be classified;
fitting the local density according to a Gaussian mixture model to obtain density distribution corresponding to the image to be classified, and determining a density change turning point from the density distribution by utilizing the Gaussian mixture model;
dividing a plurality of images to be classified into different density areas based on the density change turning points to obtain a plurality of density areas;
processing the density areas by using a density peak clustering algorithm to obtain density sub-clusters corresponding to the density areas;
and merging according to the similarity among the density sub-clusters to obtain an image classification result aiming at the image to be classified.
Optionally, the calculating, by using a preset density calculation formula, the pixel of the image to be classified to obtain the local density corresponding to the image to be classified includes:
performing dimension reduction treatment on the images to be classified by using a principal component analysis method to obtain dimension reduced images;
and calculating pixels of the dimensionality reduced image through a preset density calculation formula to obtain the local density corresponding to the image to be classified.
Optionally, the fitting processing is performed on the local density according to a gaussian mixture model to obtain a density distribution corresponding to the image to be classified, including:
superposing a preset number of Gaussian probability densities to generate an initial Gaussian mixture model;
determining component parameters in the initial Gaussian mixture model through an expected maximization algorithm to obtain a target Gaussian mixture model;
and fitting the local density according to the target Gaussian mixture model to obtain density distribution corresponding to the image to be classified.
Optionally, the determining, by using the gaussian mixture model, a density change turning point from the density distribution includes:
and determining a density change turning point from the density distribution in a sliding window mode by utilizing the Gaussian mixture model.
Optionally, the processing the density areas by using a density peak clustering algorithm to obtain density sub-clusters corresponding to the density areas includes:
respectively determining density peak points of each density region by using a density peak clustering algorithm;
and distributing non-density peak points in each density region to the density peak points closest to the non-density peak points so as to obtain density sub-clusters corresponding to each density region.
Optionally, the merging according to the similarity between the density sub-clusters to obtain an image classification result for the image to be classified includes:
calculating the similarity among clusters of a plurality of density sub-clusters according to a preset similarity calculation formula among clusters; the preset inter-cluster similarity calculation formula is a formula constructed based on differences among local densities of cluster spacing, cluster intersection, cluster density average values and density peak points corresponding to clusters;
and merging the plurality of density sub-clusters according to the sequence of the similarity among the clusters from large to small so as to obtain an image classification result aiming at the image to be classified.
Optionally, the merging the plurality of density sub-clusters according to the order of the similarity between clusters from large to small to obtain an image classification result for the image to be classified, including:
when the number of the combined clusters obtained by combining the plurality of density sub-clusters is equal to the number of preset clusters, determining the corresponding combined clusters as target clusters, so as to obtain an image classification result aiming at the image to be classified based on the target clusters; each of the merged clusters includes one or more of the density sub-clusters.
In a second aspect, the present application provides an image classification apparatus comprising:
the local density calculation module is used for calculating pixels of the image to be classified through a preset density calculation formula to obtain local density corresponding to the image to be classified;
the turning point determining module is used for carrying out fitting processing on the local density according to a Gaussian mixture model to obtain density distribution corresponding to the image to be classified, and determining a density change turning point from the density distribution by utilizing the Gaussian mixture model;
the region dividing module is used for dividing a plurality of images to be classified into different density regions based on the density change turning points to obtain a plurality of density regions;
the density region clustering module is used for processing the density regions by using a density peak clustering algorithm to obtain density sub-clusters corresponding to the density regions;
and the sub-cluster merging module is used for merging according to the similarity among the density sub-clusters so as to obtain an image classification result aiming at the image to be classified.
In a third aspect, the present application provides an electronic device, comprising:
a memory for storing a computer program;
and a processor for executing the computer program to implement the image classification method as described above.
In a fourth aspect, the present application provides a computer readable storage medium storing a computer program which when executed by a processor implements an image classification method as described above.
Therefore, the method and the device can calculate the pixels of the image to be classified through a preset density calculation formula to obtain the local density corresponding to the image to be classified; then fitting the local density according to a Gaussian mixture model to obtain density distribution corresponding to the image to be classified, and determining a density change turning point from the density distribution by utilizing the Gaussian mixture model; dividing a plurality of images to be classified into different density areas based on the density change turning points to obtain a plurality of density areas; processing the density areas by using a density peak clustering algorithm to obtain density sub-clusters corresponding to the density areas; and combining according to the similarity among the density sub-clusters to obtain an image classification result aiming at the image to be classified. In this way, the application can obtain the density distribution of the image to be classified by utilizing the Gaussian mixture model, and combine the density areas based on the density peak clustering algorithm to obtain the image classification result; the accuracy of image classification can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an image classification method disclosed by the application;
FIG. 2 is a flow chart of a specific method for merging density sub-clusters according to the present disclosure;
FIG. 3 is a schematic diagram of an image classification apparatus according to the present disclosure;
fig. 4 is a block diagram of an electronic device according to the present disclosure.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Referring to fig. 1, an embodiment of the present application discloses an image classification method, including:
and S11, calculating pixels of the image to be classified through a preset density calculation formula to obtain the local density corresponding to the image to be classified.
In the application, when classifying the image to be classified, firstly, the pixels in the image are calculated by a preset density calculation formula to obtain the local density of the corresponding image. It will be appreciated that the present application is characterized by pixel information extracted from an image, and by the image itself as a sample. In a specific embodiment, the calculating, by using a preset density calculation formula, the pixel of the image to be classified to obtain the local density corresponding to the image to be classified may include: performing dimension reduction treatment on the images to be classified by using a principal component analysis method to obtain dimension reduced images; and calculating pixels of the dimensionality reduced image through a preset density calculation formula to obtain the local density corresponding to the image to be classified. Specifically, the image is first subjected to a dimension reduction process using principal component analysis (Principal component analysis, PCA), which filters out the cumulative contribution (R c ) And redundant data with a percentage greater than a certain percentage are used for performing dimension reduction processing on the image to obtain a dimension reduced image. And then calculating the local density of the image (pixel) by a preset density calculation formula. In a specific embodiment, the formula for calculating the local density may be:
;
d in ij Representing sample point x i And sample point x j Euclidean distance between d c Representing the cut-off distance at sample point x i Sample point to sample point x within the cut-off distance i Is large, sample points outside the cut-off distance are large to sample point x i Is small.
And S12, fitting the local density according to a Gaussian mixture model to obtain density distribution corresponding to the image to be classified, and determining a density change turning point from the density distribution by utilizing the Gaussian mixture model.
Furthermore, fitting processing can be performed on the local density corresponding to the image obtained in the step according to the Gaussian mixture model, and density distribution corresponding to the image to be classified can be obtained. In a specific embodiment, the fitting the local density according to the gaussian mixture model to obtain a density distribution corresponding to the image to be classified may include: superposing a preset number of Gaussian probability densities to generate an initial Gaussian mixture model; determining component parameters in the initial Gaussian mixture model through an expected maximization algorithm to obtain a target Gaussian mixture model; and fitting the local density according to the target Gaussian mixture model to obtain density distribution corresponding to the image to be classified. Specifically, a gaussian mixture model can be generated by superposition of K gaussian probability densities, and the formula can be:
;
pi in i Called mixing coefficients, representing the specific gravity of each model in the mixed model, N (x-mu i ,Σ i ) One component, called Gaussian mixture model, has a corresponding unknown parameter mean μ for each component i Sum covariance sigma i The method comprises the steps of carrying out a first treatment on the surface of the Accordingly, a Expectation-maximization algorithm (Expectation-Maximization algor)ithm, EM) to determine the parameter values of these components. Further, the EM algorithm is divided into two steps: the step E is called an expected step, and the calculation formula is as follows:
;
the M step is called a maximization step, in which the parameters are recalculated, and the calculation formula of the updated parameters is:
;
;
;
where N is the number of total sample points and NK is the number of samples divided by the kth gaussian distribution. E step and M step are alternately and iteratively executed, and each iteration passes through the formula:
;
calculating log-likelihood functions as newly calculated log-likelihood functionsLog likelihood function calculated from last iteration +.>Satisfy->When the iteration is stopped, the currently calculated parameters are parameters of the Gaussian mixture model.
In a specific embodiment, the determining, by using the gaussian mixture model, a density change turning point from the density distribution may include: and determining a density change turning point from the density distribution in a sliding window mode by utilizing the Gaussian mixture model. Specifically, after the gaussian mixture model is determined, the concave points of the mixture model can be found in a sliding window mode to be turning points of density change.
And step S13, dividing the plurality of images to be classified into different density areas based on the density change turning points to obtain a plurality of density areas.
According to the method, a plurality of density change turning points can be determined in each image to be classified through the steps, and further, the image to be classified can be divided into different density areas according to the density change turning points, so that a plurality of density areas can be obtained; so that the density peak clustering algorithm is used alone in each density region to find the density peak points.
And S14, processing the density areas by using a density peak clustering algorithm to obtain density sub-clusters corresponding to the density areas.
Further, a density sub-cluster corresponding to the density region is obtained through a density peak clustering algorithm; in a specific embodiment, the processing the density regions by using a density peak clustering algorithm to obtain density sub-clusters corresponding to each density region may include: respectively determining density peak points of each density region by using a density peak clustering algorithm; and distributing non-density peak points in each density region to the density peak points closest to the non-density peak points so as to obtain density sub-clusters corresponding to each density region. Specifically, the density peak value clustering algorithm is firstly utilized to determine the density peak value points of each density region, and then non-density peak value points are distributed to the nearest density peak value points, so that the density sub-clusters corresponding to the density regions can be obtained. It should be noted that, in order to avoid concentration of density peak points in a high density region, causing a cluster result deviation, the relative distance between the density regions may be calculated by a distance formula, which may be as follows:
;
by the formulaThe cluster center weight is calculated, and the density peak point is selected according to the application by using a criterion that the gamma value of the sample point is larger than +.>Is selected as the density peak point, where N (C i ) Represent C i The number of density region sample points. The remaining non-density peaks after density peak point selection are assigned to clusters where sample points with local densities greater than and closest to them are located.
And S15, merging according to the similarity among the density sub-clusters to obtain an image classification result aiming at the image to be classified.
In the application, after the density sub-clusters corresponding to the density areas of the images to be classified are obtained through the steps, the density sub-clusters can be combined according to the similarity among the density sub-clusters, and finally, the image classification result corresponding to the images to be classified can be obtained. In a specific embodiment, the merging according to the similarity between the density sub-clusters to obtain the image classification result for the image to be classified may include: calculating the similarity among clusters of a plurality of density sub-clusters according to a preset similarity calculation formula among clusters; the preset inter-cluster similarity calculation formula is a formula constructed based on differences among local densities of cluster spacing, cluster intersection, cluster density average values and density peak points corresponding to clusters; and merging the plurality of density sub-clusters according to the sequence of the similarity among the clusters from large to small so as to obtain an image classification result aiming at the image to be classified. Specifically, it should be noted that the closer the distance between the sub-clusters is, the more the number of intersections is, the larger the cluster density average value is, the smaller the local density difference of the density peak points is, the larger the similarity between the sub-clusters is, and conversely, the smaller the similarity between the sub-clusters is; therefore, the preset cluster-to-cluster similarity calculation formula in the application considers the differences among the cluster spacing, the cluster intersection, the cluster density average value and the local densities of the density peak points corresponding to the clusters, and can be based on the formulaAnd obtaining the overall evaluation of the similarity among clusters. And then merging the density sub-clusters according to the similarity, so that an image classification result aiming at the image to be classified can be obtained. In a specific embodiment, the similarity measure between sub-clusters is inspired by the gravity formula for any sub-cluster C i And C j The two sub-cluster similarity calculation formulas are:
;
sub cluster C i And sub cluster C j The closer the distance, the smaller the local density difference of density peak points, the more the number of intersections, and the larger the cluster density average value, the similarity between sub clusters SIM (C) i ,C j ) The larger, the opposite indicates the inter-sub-cluster similarity SIM (C i ,C j ) The smaller. Sub cluster C i And C j The greater the similarity, the sub-cluster C i And C j The more should the fusion be.
In which d (C) i C j ) Representing sub-cluster C i And C j The shortest Euclidean distance between any two sample points is calculated as follows:
;
and lambda is an adjusting factor, and the calculation formula is:
;
wherein ρ is i Representing sub-cluster C i Local density of density peak points ρ j Representing sub-cluster C j Local density of density peak points, and ρ i <ρ j, Sub cluster C i And sub cluster C j The greater the local density difference of the density peak points, the closer the adjustment factor lambda is to 0, the smaller the sub-cluster similarity, and the greater the inverse sub-cluster similarity.
In the middle ofRepresenting sub-cluster C i K neighbor and sub-cluster C of (C) i Is the union of sub-clusters C i K neighbor of (2) is the divisor cluster C i Distance sub-cluster C outside sample point i The calculation formula of K nearest sample points of any sample point is as follows:
;
wherein d K For distance sub-cluster C i K nearest sample points to sub-cluster C i Is assumed to be distant from ion cluster C i The nearest sample points are K, and the distances are d respectively 1 ,d 2 ,d 3 ····d K ,Is->And->Is->Is->And->The number of intersections, the greater the number of intersections is the sub-cluster C i And C j The greater the similarity. />Representing sub-cluster C i The mean of the local densities of all sample points. Lambda and->The similarity between the sub-clusters is affected by the local density difference degree of the density peak points between the sub-clusters and the intersection number, and the square form can further amplify the influence of the two, so that the sub-clusters are multiplied by the formula of universal gravitation>And->This helps to fully evaluate the similarity between two sub-clusters.
In another specific embodiment, the merging the plurality of density sub-clusters in order of the similarity between clusters from large to small to obtain the image classification result for the image to be classified may include: when the number of the combined clusters obtained by combining the plurality of density sub-clusters is equal to the number of preset clusters, determining the corresponding combined clusters as target clusters, so as to obtain an image classification result aiming at the image to be classified based on the target clusters; each of the merged clusters includes one or more of the density sub-clusters. Specifically, in the merging process of the density sub-clusters, if the number of the current obtained clusters after merging is equal to the number of preset clusters, that is, the total number of the current clusters after merging and the clusters not to be merged is equal to the preset number, cluster merging is not performed, and the current clusters after merging are determined to be target clusters, so that an image classification result aiming at an image to be classified is obtained based on the target clusters. Correspondingly, if the number of the current clusters after the combination is larger than the number of the preset clusters, the fact that the sub-clusters which are needed to be combined at present still exists is indicated, and the sub-clusters are continuously combined according to the size of the similarity among the clusters.
Further, in a specific embodiment, as shown in fig. 2, N (W) represents the number of sub-clusters to be combined (density sub-clusters that are not combined), N (H) represents the number of clusters generated after the sub-clusters are combined (clusters obtained after the density sub-clusters are combined), and N (R) represents the preset number of clusters. Specifically, after the inter-cluster similarity among all the density sub-clusters is calculated, sorting the two sub-clusters with the largest similarity in the current sorting according to the size of the inter-cluster similarity, and merging when the condition meets that the remaining sub-clusters to be merged are zero and the number of the clusters after merging is equal to the number of the real clusters, or the number of the clusters after merging plus the number of the remaining clusters to be merged is equal to the number of the real clusters, ending the merging. When the condition is satisfied that the number of the clusters after combination plus the number of the remaining clusters to be combined is equal to the number of the real clusters, the fact that the sub-cluster exists in the current sub-cluster to be combined is a cluster of the final clustering result is indicated, and the cluster does not need to be combined with any other clusters.
Therefore, the method can perform dimension reduction processing on the image to be classified, filter redundant data, fit local density change turning points of the image through a Gaussian mixture model, divide the image into a plurality of density areas according to the density change turning points, enable each density area to have density peak points through a density clustering algorithm, and combine each density sub-cluster according to the similarity among the density sub-clusters generated by each density peak point so as to obtain an image classification result aiming at the image to be classified according to the combination result; the reliability of image classification is improved.
In the embodiment of the application, in order to verify the performance of the technical scheme of the application on image classification, an image classification performance verification experiment is carried out by selecting a public image dataset Olivetti Faces, USPS, coil20 and Yale. The Olivetti Faces dataset is a classical computer vision dataset containing 400 gray-scale face images of 40 persons. Each person has 10 images with different postures and expressions, and information about whether to wear glasses, a front face, a side face and the like, and each image is cut into a size of 64×64 pixels. USPS (United States Postal Service) dataset is a commonly used handwritten number recognition dataset. Wherein each image is composed of a gray-scale image of 16×16 pixels, representing a handwritten number (between 0 and 9), a total of 9,298 images, in this embodiment 1000 images are selected for the experiment. Coil20 is a classical computer vision dataset for object recognition and image classification tasks. The Coil20 dataset contains a sequence of images of 20 different objects. Each object was rotated about a vertical axis, each time 5 degrees, 72 images were taken, each representing a different angle. The image is a color image having a resolution of 128×128 pixels and contains 400 images in total. The Yale dataset contained 15 facial images of different people, each with 11 images of different expressions and poses, for a total of 165 images. These images are taken under different lighting conditions to increase the diversity of the data. Each image is a gray scale image, of size 320 x 243 pixels.
The method is processed according to the technical scheme of the application, and comprises the following steps: firstly, performing dimension reduction processing on data, filtering redundant data by adopting principal component analysis, and setting R of 4 image data sets Olivetti Faces, USPS, yale and Coil20 in the experiment of the embodiment c The values are 80, 90 and 90, respectively. Then according to the formulaCalculating the local density of the image; fitting a gaussian mixture model generated by superposition of K gaussian probability densities to the local densities of all sample points (images) to the sample point local density distribution, and determining parameters of the mixture model by EM algorithm, and determining the gaussian mixture model ∈>Finding the turning point of the density change.
Further, dividing the sample into different density intervals according to the turning point of the density change in each density interval by the formula:
;
the relative distance between the density intervals can be calculated by the formulaCalculating cluster center weight value, and using formula +.>Sample Point +.>A value greater than->Is selected as a density peak point, eachThe density peak points represent a cluster, and when the density peak points are selected, the rest non-density peak point sample points are distributed into the clusters where the sample points closest to the non-density peak point sample points are located and have a density larger than the non-density peak point sample points, so as to generate a sub-cluster set.
For the generated cluster of sub-clusters, the formula can be used:
;
the similarity between every two sub-clusters can be calculated through the formula, the two sub-clusters with the largest similarity in the current sequence are combined according to the sequence from big to small of the similarity between the sub-clusters, and the final clustering result is stopped being output after the combination of the sub-clusters is stopped until the combination stopping condition of the sub-clusters is reached, wherein each cluster in the clustering result represents each class in the image classification. The final results output are shown in table 1 below:
TABLE 1
Wherein, DSSF-DPC (Density Peaks Clustering Algorithm Based on Density Stratification and Subcluster Fusion, density peak clustering algorithm based on density layering and sub-cluster combination) is the technical proposal of the application; correspondingly, DPC (Clustering by Fast Search and Find of Density Peaks, density peak clustering) is a commonly used image classification method at present; ACC (Accuracy).
From the table, the technical scheme of the application improves the clustering accuracy on each data set, improves the clustering accuracy on Olivetti Faces data sets by more than 10%, and improves the average clustering performance of four data sets by 9.16%.
As shown in fig. 3, an embodiment of the present application discloses an image classification apparatus, including:
the local density calculation module 11 is configured to calculate pixels of an image to be classified according to a preset density calculation formula, so as to obtain a local density corresponding to the image to be classified;
the turning point determining module 12 is configured to perform fitting processing on the local density according to a gaussian mixture model to obtain a density distribution corresponding to the image to be classified, and determine a density change turning point from the density distribution by using the gaussian mixture model;
the region dividing module 13 is configured to divide the plurality of images to be classified into different density regions based on the density change turning points, so as to obtain a plurality of density regions;
the density region clustering module 14 is configured to process the density regions by using a density peak clustering algorithm, so as to obtain density sub-clusters corresponding to each density region;
and the sub-cluster merging module 15 is used for merging according to the similarity among the density sub-clusters so as to obtain an image classification result aiming at the image to be classified.
Therefore, the application can obtain the density distribution of the image to be classified by utilizing the Gaussian mixture model, and combine the density areas based on the density peak clustering algorithm to obtain the image classification result; the accuracy of image classification can be improved.
In a specific embodiment, the local density calculating module 11 may include:
the image dimension reduction unit is used for carrying out dimension reduction treatment on the image to be classified by using a principal component analysis method to obtain a dimension reduced image;
and the density calculation unit is used for calculating the pixels of the dimensionality reduced image through a preset density calculation formula to obtain the local density corresponding to the image to be classified.
In a specific embodiment, the turning point determining module 12 may include:
the model generation unit is used for generating an initial Gaussian mixture model by superposition of a preset number of Gaussian probability densities;
the parameter determining unit is used for determining component parameters in the initial Gaussian mixture model through an expected maximization algorithm to obtain a target Gaussian mixture model;
and the density fitting unit is used for carrying out fitting treatment on the local density according to the target Gaussian mixture model to obtain density distribution corresponding to the image to be classified.
In another specific embodiment, the turning point determining module 12 may include:
and the turning point determining unit is used for determining a density change turning point from the density distribution in a sliding window mode by utilizing the Gaussian mixture model.
In a specific embodiment, the density region clustering module 14 may include:
the peak value point determining unit is used for determining the density peak value points of the density areas respectively by using a density peak value clustering algorithm;
and the density sub-cluster determining unit is used for distributing non-density peak points in each density region to the density peak points closest to the density peak points so as to obtain the density sub-clusters corresponding to each density region.
In a specific embodiment, the sub-cluster merging module 15 may include:
the similarity calculation unit is used for calculating the similarity among the clusters of the plurality of density sub-clusters according to a preset similarity calculation formula among the clusters; the preset inter-cluster similarity calculation formula is a formula constructed based on differences among local densities of cluster spacing, cluster intersection, cluster density average values and density peak points corresponding to clusters;
and the sub-cluster merging sub-module is used for merging a plurality of the density sub-clusters according to the sequence of the similarity among clusters from large to small so as to obtain an image classification result aiming at the image to be classified.
In a specific embodiment, the sub-cluster merging sub-module may include:
the sub-cluster merging unit is used for determining the corresponding merged clusters as target clusters when the number of the merged clusters obtained by merging the plurality of density sub-clusters is equal to the preset number of clusters, so as to obtain an image classification result aiming at the classified images based on the target clusters; each of the merged clusters includes one or more of the density sub-clusters.
Further, the embodiment of the present application further discloses an electronic device, and fig. 4 is a block diagram of an electronic device 20 according to an exemplary embodiment, where the content of the diagram is not to be considered as any limitation on the scope of use of the present application.
Fig. 4 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. Wherein the memory 22 is configured to store a computer program that is loaded and executed by the processor 21 to implement the relevant steps of the image classification method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and computer programs 222, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the image classification method performed by the electronic device 20 as disclosed in any of the previous embodiments.
Further, the application also discloses a computer readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the previously disclosed image classification method. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing has outlined rather broadly the more detailed description of the application in order that the detailed description of the application that follows may be better understood, and in order that the present principles and embodiments may be better understood; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.
Claims (10)
1. An image classification method, comprising:
calculating pixels of an image to be classified according to a preset density calculation formula to obtain local density corresponding to the image to be classified;
fitting the local density according to a Gaussian mixture model to obtain density distribution corresponding to the image to be classified, and determining a density change turning point from the density distribution by utilizing the Gaussian mixture model;
dividing a plurality of images to be classified into different density areas based on the density change turning points to obtain a plurality of density areas;
processing the density areas by using a density peak clustering algorithm to obtain density sub-clusters corresponding to the density areas;
and merging according to the similarity among the density sub-clusters to obtain an image classification result aiming at the image to be classified.
2. The image classification method according to claim 1, wherein the calculating pixels of the image to be classified by a preset density calculation formula to obtain a local density corresponding to the image to be classified includes:
performing dimension reduction treatment on the images to be classified by using a principal component analysis method to obtain dimension reduced images;
and calculating pixels of the dimensionality reduced image through a preset density calculation formula to obtain the local density corresponding to the image to be classified.
3. The image classification method according to claim 1, wherein the fitting the local densities according to a gaussian mixture model to obtain density distributions corresponding to the images to be classified comprises:
superposing a preset number of Gaussian probability densities to generate an initial Gaussian mixture model;
determining component parameters in the initial Gaussian mixture model through an expected maximization algorithm to obtain a target Gaussian mixture model;
and fitting the local density according to the target Gaussian mixture model to obtain density distribution corresponding to the image to be classified.
4. The image classification method according to claim 1, wherein determining a density change turning point from the density distribution using the gaussian mixture model comprises:
and determining a density change turning point from the density distribution in a sliding window mode by utilizing the Gaussian mixture model.
5. The image classification method according to claim 1, wherein the processing the density regions by using a density peak clustering algorithm to obtain density sub-clusters corresponding to each of the density regions comprises:
respectively determining density peak points of each density region by using a density peak clustering algorithm;
and distributing non-density peak points in each density region to the density peak points closest to the non-density peak points so as to obtain density sub-clusters corresponding to each density region.
6. The image classification method according to any one of claims 1 to 5, wherein the merging according to the similarity between the density sub-clusters to obtain the image classification result for the image to be classified comprises:
calculating the similarity among clusters of a plurality of density sub-clusters according to a preset similarity calculation formula among clusters; the preset inter-cluster similarity calculation formula is a formula constructed based on differences among local densities of cluster spacing, cluster intersection, cluster density average values and density peak points corresponding to clusters;
and merging the plurality of density sub-clusters according to the sequence of the similarity among the clusters from large to small so as to obtain an image classification result aiming at the image to be classified.
7. The method of image classification according to claim 6, wherein the merging the plurality of density sub-clusters in order of the inter-cluster similarity from large to small to obtain the image classification result for the image to be classified comprises:
when the number of the combined clusters obtained by combining the plurality of density sub-clusters is equal to the number of preset clusters, determining the corresponding combined clusters as target clusters, so as to obtain an image classification result aiming at the image to be classified based on the target clusters; each of the merged clusters includes one or more of the density sub-clusters.
8. An image classification apparatus, comprising:
the local density calculation module is used for calculating pixels of the image to be classified through a preset density calculation formula to obtain local density corresponding to the image to be classified;
the turning point determining module is used for carrying out fitting processing on the local density according to a Gaussian mixture model to obtain density distribution corresponding to the image to be classified, and determining a density change turning point from the density distribution by utilizing the Gaussian mixture model;
the region dividing module is used for dividing a plurality of images to be classified into different density regions based on the density change turning points to obtain a plurality of density regions;
the density region clustering module is used for processing the density regions by using a density peak clustering algorithm to obtain density sub-clusters corresponding to the density regions;
and the sub-cluster merging module is used for merging according to the similarity among the density sub-clusters so as to obtain an image classification result aiming at the image to be classified.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the image classification method according to any one of claims 1 to 7.
10. A computer-readable storage medium for storing a computer program which, when executed by a processor, implements the image classification method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311413593.XA CN117152543B (en) | 2023-10-30 | 2023-10-30 | Image classification method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311413593.XA CN117152543B (en) | 2023-10-30 | 2023-10-30 | Image classification method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117152543A true CN117152543A (en) | 2023-12-01 |
CN117152543B CN117152543B (en) | 2024-06-07 |
Family
ID=88904659
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311413593.XA Active CN117152543B (en) | 2023-10-30 | 2023-10-30 | Image classification method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117152543B (en) |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103617413A (en) * | 2013-11-07 | 2014-03-05 | 电子科技大学 | Method for identifying object in image |
CN104408734A (en) * | 2014-12-11 | 2015-03-11 | 山东师范大学 | Adaptive target area conversion method combining image segmentation and deformation registration technology |
CN110232414A (en) * | 2019-06-11 | 2019-09-13 | 西北工业大学 | Density peaks clustering algorithm based on k nearest neighbor and shared nearest neighbor |
CN111626321A (en) * | 2020-04-03 | 2020-09-04 | 河南师范大学 | Image data clustering method and device |
CN111898578A (en) * | 2020-08-10 | 2020-11-06 | 腾讯科技(深圳)有限公司 | Crowd density acquisition method and device, electronic equipment and computer program |
WO2021027193A1 (en) * | 2019-08-12 | 2021-02-18 | 佳都新太科技股份有限公司 | Face clustering method and apparatus, device and storage medium |
CN113590863A (en) * | 2021-02-23 | 2021-11-02 | 腾讯科技(北京)有限公司 | Image clustering method and device and computer readable storage medium |
WO2022088390A1 (en) * | 2020-10-30 | 2022-05-05 | 浙江商汤科技开发有限公司 | Image incremental clustering method and apparatus, electronic device, storage medium and program product |
CN115496138A (en) * | 2022-09-16 | 2022-12-20 | 桂林理工大学 | Self-adaptive density peak value clustering method based on natural neighbors |
CN116486395A (en) * | 2022-09-21 | 2023-07-25 | 北京理工大学 | Space obstacle discrimination method based on Gaussian mixture model and depth-color image |
CN116758321A (en) * | 2022-03-03 | 2023-09-15 | 丰图科技(深圳)有限公司 | Image classification method, device and storage medium |
-
2023
- 2023-10-30 CN CN202311413593.XA patent/CN117152543B/en active Active
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103617413A (en) * | 2013-11-07 | 2014-03-05 | 电子科技大学 | Method for identifying object in image |
CN104408734A (en) * | 2014-12-11 | 2015-03-11 | 山东师范大学 | Adaptive target area conversion method combining image segmentation and deformation registration technology |
CN110232414A (en) * | 2019-06-11 | 2019-09-13 | 西北工业大学 | Density peaks clustering algorithm based on k nearest neighbor and shared nearest neighbor |
WO2021027193A1 (en) * | 2019-08-12 | 2021-02-18 | 佳都新太科技股份有限公司 | Face clustering method and apparatus, device and storage medium |
CN111626321A (en) * | 2020-04-03 | 2020-09-04 | 河南师范大学 | Image data clustering method and device |
CN111898578A (en) * | 2020-08-10 | 2020-11-06 | 腾讯科技(深圳)有限公司 | Crowd density acquisition method and device, electronic equipment and computer program |
WO2022088390A1 (en) * | 2020-10-30 | 2022-05-05 | 浙江商汤科技开发有限公司 | Image incremental clustering method and apparatus, electronic device, storage medium and program product |
CN113590863A (en) * | 2021-02-23 | 2021-11-02 | 腾讯科技(北京)有限公司 | Image clustering method and device and computer readable storage medium |
CN116758321A (en) * | 2022-03-03 | 2023-09-15 | 丰图科技(深圳)有限公司 | Image classification method, device and storage medium |
CN115496138A (en) * | 2022-09-16 | 2022-12-20 | 桂林理工大学 | Self-adaptive density peak value clustering method based on natural neighbors |
CN116486395A (en) * | 2022-09-21 | 2023-07-25 | 北京理工大学 | Space obstacle discrimination method based on Gaussian mixture model and depth-color image |
Non-Patent Citations (5)
Title |
---|
JUNYI GUAN ET AL.: "Peak-Graph-Based Fast Density Peak Clustering for Image Segmentation", 《IEEE SIGNAL PROCESSING LETTERS 》, vol. 28, 16 April 2021 (2021-04-16), pages 897 - 901, XP011854675, DOI: 10.1109/LSP.2021.3072794 * |
于文博等: "整合超像元分割和峰值密度的高光谱图像聚类", 《中国图象图形学报》, vol. 21, no. 10, pages 1402 - 1410 * |
周鹿扬等: "一种基于聚类中心的快速聚类算法", 《计算机科学》, vol. 43, no. 1, pages 454 - 456 * |
王华秋等: "空间密度聚类在数字图书馆图像检索中的应用", 《现代情报》, vol. 36, no. 02, pages 129 - 134 * |
谢国伟等: "基于非参数核密度估计的密度峰值聚类算法", 《计算机应用研究》, vol. 35, no. 10, pages 2956 - 2959 * |
Also Published As
Publication number | Publication date |
---|---|
CN117152543B (en) | 2024-06-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109801256B (en) | Image aesthetic quality assessment method based on region of interest and global features | |
Chan et al. | Application of decision rules for handling class imbalance in semantic segmentation | |
Kosiorowski et al. | DepthProc an R package for robust exploration of multidimensional economic phenomena | |
CN109376205B (en) | Method, device, equipment and storage medium for mining address interest point relation | |
Alvioli et al. | Topography-driven satellite imagery analysis for landslide mapping | |
CN111241989A (en) | Image recognition method and device and electronic equipment | |
CN103473786A (en) | Gray level image segmentation method based on multi-objective fuzzy clustering | |
CN109189876B (en) | Data processing method and device | |
CN111881909A (en) | Coal and gangue identification method and device, electronic equipment and storage medium | |
CN110348516B (en) | Data processing method, data processing device, storage medium and electronic equipment | |
Yu et al. | Unsupervised pixel-level road defect detection via adversarial image-to-frequency transform | |
CN112906823A (en) | Target object recognition model training method, recognition method and recognition device | |
CN106056577B (en) | SAR image change detection based on MDS-SRM Mixed cascading | |
Akbarzadeh et al. | Design and matlab simulation of Persian license plate recognition using neural network and image filtering for intelligent transportation systems | |
DE112021005569T5 (en) | CONTRADICTORY, SEMI-SUPERVISED ONE-SHOT LEARNING | |
CN114117073B (en) | Cluster intention recognition method and device, computer equipment and readable medium | |
Matiolański et al. | CCTV object detection with fuzzy classification and image enhancement | |
Yi et al. | An airborne LiDAR building-extraction method based on the naive Bayes–RANSAC method for proportional segmentation of quantitative features | |
dos Santos et al. | The use of Otsu algorithm and multi-temporal airborne LiDAR data to detect building changes in urban space | |
Bhatt et al. | A framework for quality-based biometric classifier selection | |
WO2021139493A1 (en) | Visitor identity authentication method and apparatus based on machine learning, and computer device | |
EP3579182A1 (en) | Image processing device, image recognition device, image processing program, and image recognition program | |
CN117152543B (en) | Image classification method, device, equipment and storage medium | |
CN106980878B (en) | Method and device for determining geometric style of three-dimensional model | |
Peng et al. | Automatic SAR change detection based on visual saliency and multi-hierarchical fuzzy clustering |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant |