CN113821664A - Image classification method, system, terminal and readable storage medium based on histogram statistical frequency - Google Patents
Image classification method, system, terminal and readable storage medium based on histogram statistical frequency Download PDFInfo
- Publication number
- CN113821664A CN113821664A CN202111004455.7A CN202111004455A CN113821664A CN 113821664 A CN113821664 A CN 113821664A CN 202111004455 A CN202111004455 A CN 202111004455A CN 113821664 A CN113821664 A CN 113821664A
- Authority
- CN
- China
- Prior art keywords
- group
- classification
- sample
- gray
- energy
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 80
- 239000011159 matrix material Substances 0.000 claims abstract description 56
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 33
- 238000012549 training Methods 0.000 claims description 78
- 238000013145 classification model Methods 0.000 claims description 58
- 230000004927 fusion Effects 0.000 claims description 36
- 238000012216 screening Methods 0.000 claims description 11
- 238000010276 construction Methods 0.000 claims description 9
- 238000004590 computer program Methods 0.000 claims description 5
- 238000012360 testing method Methods 0.000 claims description 5
- 238000012417 linear regression Methods 0.000 claims description 4
- 230000009977 dual effect Effects 0.000 claims description 3
- 238000012795 verification Methods 0.000 claims description 3
- 230000000694 effects Effects 0.000 abstract description 8
- 238000001514 detection method Methods 0.000 abstract description 5
- 230000005540 biological transmission Effects 0.000 abstract description 2
- 238000004891 communication Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 239000000463 material Substances 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 239000013598 vector Substances 0.000 description 3
- 238000012512 characterization method Methods 0.000 description 2
- 238000002790 cross-validation Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000007689 inspection Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000005065 mining Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000007619 statistical method Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/50—Information retrieval; Database structures therefor; File system structures therefor of still image data
- G06F16/55—Clustering; Classification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/213—Feature extraction, e.g. by transforming the feature space; Summarisation; Mappings, e.g. subspace methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/25—Fusion techniques
- G06F18/253—Fusion techniques of extracted features
Abstract
The invention discloses an image classification method, a system, a terminal and a readable storage medium based on the square root statistical frequency, the method can be used in the field of dual-energy XRT (X-Ray Transmission) detection, and the method is based on sample classification and identification of image gray frequency, maximally excavates effective characteristics of the gray frequency, simultaneously compresses the size of a characteristic space as much as possible, specifically, an ElasticNet algorithm is adopted to obtain a characteristic weight matrix W, the contribution degree of the characteristic corresponding to each gray level group is represented by the weight, the characteristics with low contribution degree are fused, the characteristics with high contribution degree are reserved, therefore, the gray grouping numbers V1 and Vh of high and low energy in the gray histogram statistics are updated, the problems of overlarge feature space and poor classification effect in the classification and identification problem based on the gray frequency features in the dual-energy XRT detection field are effectively solved, and the accuracy and the real-time performance of the algorithm are improved.
Description
Technical Field
The invention belongs to the technical field of image classification and identification in the field of dual-energy XRT, and particularly relates to an image classification method, system, terminal and readable storage medium based on square statistic frequency.
Background
The dual-energy XRT detection technology is widely applied to a plurality of fields such as security inspection, medical treatment, industrial detection and the like. This technique can gather the data of high energy and low energy image binary channels through dual energy X ray detector, through these binary channels data of analysis, can effectively avoid the material thickness that single channel data can't be avoided to give the restriction that categorised discernment brought, and the performance obtains the promotion of quality. The gray frequency is one of the basic features of image classification identification. However, in the field of dual-energy XRT image classification and identification, the image gray scale variation range is large (generally: 0-2)16) If the fine-grained equidistant grouping is carried out, although more detailed characteristics can be mastered, the problem of dimension disaster caused by high-dimension sample characteristics can be solved; and if coarse-grained division is carried out, although the dimension of the sample data is well controlled, the model effect is poor due to loss of details. Therefore, in the dual-energy XRT image classification and identification technology, the features extracted based on the image gray level are still required to be further optimized, and the effect and the reliability of the dual-energy XRT image classification and identification result are improved.
Similarly, in other application fields, image classification is always widely applied, so how to improve image classification accuracy, explore feasible classification techniques, and enrich research hotspots in the field of image classification techniques.
Disclosure of Invention
The invention aims to provide an image classification method based on the square-square statistic frequency aiming at the feasibility technical research in the field of image classification; meanwhile, the problem of dimension disaster caused by high-dimension sample characteristics due to equidistant grouping with fine granularity in the existing dual-energy XRT image classification and identification field is solved; and coarse-grained division, details are lost, and the model effect is poor. Therefore, the dual-energy XRT image classification and identification result has poor effect and low reliability, and the method for classifying the dual-energy image based on the histogram statistical frequency is provided.
On one hand, the invention provides an image classification method based on the basis of the histogram statistical frequency, which comprises the following steps:
s1: acquiring an image for target classification and a classification label corresponding to the image for target classification to construct a sample database D;
s2: the gray values are divided into a plurality of groups at equal intervals according to the gray value range;
s3: according to the gray frequency histogram data of the samples in the sample database D which are counted in groups, the gray frequency histogram data serve as sample characteristics, and a training sample database S is constructed;
s4: training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
s5: fusing grouping features according to the weight corresponding to each group in the feature weight matrix W;
reserving a group with higher contribution rate according to the weight, fusing and updating the group with lower contribution rate and an adjacent group, returning to the step S3 to continue fusing if the updated group meets the preset fusing condition, and otherwise executing the step S6;
s6: and counting the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the updated groups, and training a target classification model, wherein the target classification model is used for image classification, the input data of the target classification model is the sample characteristics of the images under the grouping, and the output data is a classification label corresponding to the images.
In a second aspect, the present invention provides an image classification method based on dual-energy image features according to histogram statistical frequency, which includes:
step 1: acquiring a dual-energy image for target classification and acquiring a corresponding classification label to construct a sample database D;
step 2: the gray values are divided into a plurality of groups V1 and Vh at equal intervals according to the ranges of the high gray values and the low gray values;
and step 3: according to the grouping statistics determined by the group numbers V1 and Vh, the gray frequency histogram data of the samples in the sample database D is used as sample characteristics to construct a training sample database S;
and 4, step 4: training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
and 5: fusing grouping features according to the weight corresponding to each group in the feature weight matrix W;
retaining the groups with higher contribution rate according to the weight, fusing the groups with lower contribution rate with the adjacent groups to obtain updated group numbers V1 and Vh, and returning to the step 3 to continue fusing if the updated group numbers V1 and Vh reach the preset fusion condition; otherwise, executing step 6;
step 6: counting the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the groups determined by the updated group numbers V1 and Vh;
and 7: training a target classification model based on the sample features of the samples in the step 6 and the classification labels of the samples, wherein the target classification model is used for classifying the dual-energy images, the input data of the target classification model is the sample features of the dual-energy images in the groups determined by the group numbers V1 and Vh, and the output data is the classification labels corresponding to the dual-energy images.
Optionally, the process of fusing the grouping features according to the weight sizes corresponding to the respective groups in the feature weight matrix W in step 5 is as follows:
firstly, calculating the contribution value corresponding to each group in group numbers V1 and Vh in a characteristic weight matrix W, wherein the contribution value is determined according to the weight size corresponding to each group in the characteristic weight matrix W;
then, respectively judging whether the contribution value corresponding to each group is less than or equal to high and low energy channel screening threshold values Tl and Th, if so, the corresponding group is a group with low contribution rate;
and the high and low energy channel screening threshold values Tl and Th are calculated by adopting an OTSU algorithm based on the characteristic weight matrix W.
Alternatively, the contribution value is represented by an average value of the weight magnitudes corresponding to the respective groups in the feature weight matrix W.
Optionally, the preset conditions corresponding to the group numbers V1 and Vh in step 5 are:
determining gray frequency histogram data of the grouped statistical samples based on the group numbers V1 and Vh as sample characteristics, verifying whether the gray frequency histogram data meet the conditions or not by adopting K-fold cross verification (K-fold cross validation) of a linear regression model, and if the test accuracy P is larger than an accuracy threshold (the characterization capability of the new sample characteristics is within an allowable range), determining that fusion preset conditions are met, otherwise, determining that the fusion preset conditions are not met;
or based on the group numbers V1 and Vh: and whether the Vh group number is larger than or equal to the group number threshold value or not is judged, if so, the fusion preset condition is met, and otherwise, the fusion preset condition is not met.
In a third aspect, the present invention provides a system based on an image classification method, which includes:
the sample database construction module is used for acquiring images for target classification and corresponding classification labels thereof and constructing a sample database D;
the grouping module is used for being divided into a plurality of groups at equal intervals according to the gray value range;
the characteristic counting module is used for counting the gray frequency histogram data of the samples in the sample database D as sample characteristics according to groups to construct a training sample database S;
the model training module is used for training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
the fusion module is used for fusing the grouping characteristics according to the weight corresponding to each group in the characteristic weight matrix W;
the method comprises the steps that a group with higher contribution rate is reserved according to the weight, the group with lower contribution rate and an adjacent group are fused and updated to be a group, if the updated group meets a fusion preset condition, the grouping characteristics are continuously fused, and the next iteration cycle is started; otherwise, the characteristic counting module counts the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the updated groups, and the model training module trains a target classification model based on the sample characteristics of the samples and the classification labels of the samples.
In a fourth aspect, the present invention provides a system for an image classification method based on dual-energy image features, which includes:
the sample database construction module is used for acquiring the dual-energy images for target classification and acquiring corresponding classification labels to construct a sample database D;
the grouping module is used for being equidistantly divided into a plurality of groups V1 and Vh according to the high-energy gray value range and the low-energy gray value range respectively;
the characteristic counting module is used for counting the gray frequency histogram data of the samples in the sample database D as sample characteristics according to the grouping determined by the group numbers V1 and Vh to construct a training sample database S;
the model training module is used for training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
the fusion module is used for fusing the grouping characteristics according to the weight corresponding to each group in the characteristic weight matrix W;
reserving a group with higher contribution rate according to the weight, and fusing the group with lower contribution rate with an adjacent group to obtain updated group numbers V1 and Vh;
if the updated group numbers V1 and Vh reach the fusion preset condition, continuing to fuse the grouping features, and entering the next iteration cycle;
if the updated group numbers V1 and Vh do not reach the fusion preset condition, the feature statistics module performs statistics on gray frequency histogram data of the samples in the sample database D as sample features based on the groups determined by the updated group numbers V1 and Vh, the model training module trains a target classification model based on the sample features of the samples and the classification labels of the samples, and the target classification model is used for dual-energy image classification;
the input data of the target classification model is sample characteristics of the dual-energy images under the grouping determined by the group numbers V1 and Vh, and the output data is classification labels corresponding to the dual-energy images.
In a fifth aspect, the present invention provides a terminal, comprising:
one or more processors;
a memory storing one or more programs;
the processor calls the program to perform:
a step of an image classification method based on the square direction statistical frequency or a step of an image classification method based on the dual-energy image characteristic of the square direction statistical frequency.
In a sixth aspect, the present invention provides a readable storage medium storing a computer program for invocation by a processor to implement:
a step of an image classification method based on the square direction statistical frequency or a step of an image classification method based on the dual-energy image characteristic of the square direction statistical frequency.
Advantageous effects
The invention provides an image classification method based on a dual-energy image characteristic of a square-column statistical frequency, which comprises the steps of on one hand, utilizing a maximum program of the square-column statistical frequency to mine effective characteristics of gray-scale frequency, and on the other hand, using weight to measure contribution programs of all grouping characteristics in order to obtain accurate and proper grouping, thereby introducing weights into grouping fusion, calculating the contribution degree of each grouping, fusing the characteristics with low contribution degree, reducing data dimensionality, simultaneously reserving the characteristics with high contribution degree and ensuring the accuracy of an algorithm. Therefore, the method of the invention not only can keep the details of the gray frequency characteristics of the sample and ensure the accuracy of the model, but also can reduce the dimension of the characteristics in a characteristic fusion mode, thereby reducing the complexity of the algorithm.
Similarly, the technical idea of mining the effective characteristics of the gray frequency by utilizing the maximum program of the histogram statistical frequency can be applied to image classification in other fields, so that the image classification method based on the histogram statistical frequency enriches the image classification technical means. The feature fusion of the invention is to fuse and aggregate adjacent elements in the matrix, namely to fuse adjacent features with low contribution degree to a classification task, namely to fuse features far away from a classification boundary, and to keep sufficient refinement on features near.
Drawings
Fig. 1 is a schematic flow chart provided by the image classification method according to the present invention.
Detailed Description
The invention provides an image classification method based on the square direction statistical frequency and an image classification method based on the dual-energy image characteristics of the square direction statistical frequency, and particularly aims to solve the problem of dimension disaster caused by high-dimension sample characteristics due to the fact that the image classification method is divided into groups with equal intervals of fine granularity in the field of existing dual-energy XRT image classification and identification; and coarse-grained division, details are lost, and the model effect is poor. Therefore, the problems of poor effect and low reliability of the dual-energy XRT image classification and identification result are solved, the technical means which can reduce the feature dimension and simultaneously reserve the features with high contribution degree is provided, and the reliability of the dual-energy XRT image classification and identification result is finally improved. The present invention will be further described with reference to the following examples.
Example 1:
the embodiment provides an image classification method based on dual-energy image features according to the histogram statistical frequency, which comprises the following steps of:
step 1: detecting a target by using a dual-energy X-ray detector to obtain a dual-energy image for target classification and obtain a corresponding classification label so as to construct a sample database D;
the method is generally applied to material classification, and therefore, the acquired dual-energy XRT image data (projection images formed after X-rays penetrate through the material) of the material generally correspond to a high-energy image and a low-energy image, the high-energy image and the low-energy image refer to energy range intervals detected by a detector, the high-energy image mainly detects the X-rays with relatively higher energy range, and the low-energy image mainly detects the X-rays with relatively lower energy range. For example, in the field of security inspection, dual-energy XRT detection is applied, and high-energy and low-energy image information of materials is utilized to establish a classification identification model of dangerous goods and non-dangerous goods, so that the aim of detecting the dangerous goods is fulfilled. It should be understood that the present invention is not limited to specific classification objects and classification types, which set the classification objects and classification categories thereof according to actual needs and application targets.
And the image is preferably preprocessed in this embodiment, including but not limited to: and the conventional processing means such as correction processing, denoising processing and the like selectively perform preprocessing according to the quality condition of the image.
Step 2: and the gray values are equally divided into a plurality of groups V1 and Vh according to the high-energy gray value range and the low-energy gray value range respectively.
The number of sets V1 and Vh can be set empirically, such as 0-216The value range is taken as an example, and 16 or 32 can be taken as the option of the spacing in general. If the classification has high requirements on the gray level details, the resolution requirement is high, the space is small (the division is fine), otherwise, the space is large, and the range of the gray level values is generally 0-2NTherefore, generally take 2nAs a spacing option, if demand cannot be determined, then processing is higher on demand.
And step 3: according to the grouping statistics determined by the group numbers V1 and Vh, the gray frequency histogram data of the samples in the sample database D is used as sample characteristics to construct a training sample database S;
in this embodiment, the grayscale frequency histogram data of the grouped statistical samples determined according to the group numbers V1 and Vh is dual-channel data, so that each sample obtains a two-dimensional histogram statistical matrix as a sample feature (binary array) of the sample, and in this embodiment, it is preferable to straighten the two-dimensional histogram statistical matrix in columns or rows to form a long vector as a feature vector of the sample.
And 4, step 4: and training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W, wherein the characteristic weight matrix W corresponds to the data format of the sample characteristics one by one, and corresponds to the two-dimensional histogram statistical matrix of the sample in the embodiment.
The ElasticNet (elastic network) algorithm is a linear regression model using L1 norm and L2 norm as regularization, and L1 norm and L2 norm regularization of feature weight can improve the generalization capability of the algorithm, and is a mature algorithm which is widely applied, and the objective function and constraint condition of the algorithm are expressed as:
an objective function: l (a, w) ═ y-wX not messaging2+(1-a)|w|2+(a)|w|1
Constraint conditions are as follows:
wherein a is more than or equal to 0 and more than or equal to 1
w=(w1,w2...,wp)
X=(x1,x2...,xn)
Wherein w is the feature weight, y is the sample label, a is the L1 norm specific gravity, 1-a is the L2 norm, L (a, w) is the objective function, X is the sample feature matrix formed by arranging the features (column vectors) of all training samples, n is the number of training samples, p is the total feature number, wjFor the weight of the jth feature, w tends to be sparse as a is larger, and w tends to be smaller as a is smaller.
The method obtains the solution W of the optimal objective function under the constraint condition through the LARS-EN algorithm training, and restores the W into a characteristic weight matrix W according to columns or rows. W corresponds to the two-dimensional histogram statistical matrix of the sample.
Wherein, because the elastic network algorithm is a mature algorithm, the training process is not described too much, wherein, the training process described in "Zou H, noise T.Regulation and variable selection view the elastic net [ J ]. Journal of the radial statistical facility B (statistical methods), 2005,67(2): 301-; the LARS-EN algorithm can be referred to The training procedure described in "Efren B, Hastie T, Johnstone I, et al.
And 5: and fusing the grouping characteristics according to the weight corresponding to each group in the characteristic weight matrix W.
In this embodiment, the OTSU algorithm is used to calculate the high and low energy channel screening thresholds Tl and Th. The OTSU calculation method, also known as the maximum inter-class variance method, automatically divides the data into 2 parts, such that the difference between the two parts is maximum and the difference between each part is minimum, without the need for additional input parameters. Therefore, the invention processes the characteristic weight matrix W based on the OTSU algorithm to obtain the high and low energy channel screening thresholds Tl and Th.
In addition, in this embodiment, an average value of the weight sizes corresponding to the groups in the feature weight matrix W is calculated, and then it is determined whether the average value corresponding to the high-energy channel is less than or equal to the high-energy channel screening threshold Tl, if so, the groups are marked; and judging whether the average value corresponding to the low-energy channel is less than or equal to a low-energy channel screening threshold Th, and if so, marking the low-energy channel screening threshold Th.
In order to reduce the complexity of the algorithm, the present invention preferably combines two adjacent marked packets or combines a marked packet with its adjacent packet, so as to update the group numbers V1 and Vh.
It should be understood that the weight size corresponding to each group under each sample may represent the contribution degree thereof, and therefore, in other possible embodiments, the weight size of the sample under each group may also be selected, and the contribution degree thereof may be represented by using other mathematical parameters, which is not specifically limited by the present invention.
It should be noted that the group numbers V1 and Vh are updated after the feature is fused. If the updated group numbers V1 and Vh reach the fusion preset condition, returning to the step 3; otherwise, executing step 6;
in this embodiment, the preset conditions are set as follows:
determining gray frequency histogram data of the grouped statistical samples based on the group numbers V1 and Vh as sample characteristics, verifying whether the gray frequency histogram data meets the conditions or not by adopting K-fold cross verification (K-fold cross validation) test accuracy p of a linear regression model, if the test accuracy p is greater than an accuracy threshold, determining that the preset conditions are met, otherwise, determining that the preset conditions are not met;
or based on the group numbers V1 and Vh: and whether the Vh group number is larger than or equal to the group number threshold or not, if so, determining that the fusion preset condition is met, and continuing the fusion, otherwise, determining that the fusion preset condition is not met.
And if the characterization capability is in an allowable range, returning to the step 3 and continuing to fuse the features.
Step 6: and counting the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the grouping determined by the updated group numbers V1 and Vh.
And 7: training a target classification model based on the sample features of the samples in the step 6 and the classification labels of the samples, wherein the target classification model is used for classifying the dual-energy images, the input data of the target classification model is the sample features of the dual-energy images in the groups determined by the group numbers V1 and Vh, and the output data is the classification labels corresponding to the dual-energy images.
The invention can effectively reduce the feature dimension through the technical means of feature fusion, thereby achieving the purpose of reducing the complexity.
Example 2:
on the basis of the concept of the embodiment 1, the technical concept of the invention can also be applied to image classification in other fields, namely, effective features of the gray frequency are mined by fully utilizing the maximum histogram statistical frequency program, and adjacent features with low contribution degree to classification tasks are fused. Therefore, the present embodiment provides an image classification method based on histogram statistic frequency, which includes the following steps:
s1: acquiring an image for target classification and a classification label corresponding to the image for target classification to construct a sample database D;
s2: the gray values are divided into a plurality of groups at equal intervals according to the gray value range;
s3: according to the gray frequency histogram data of the samples in the sample database D which are counted in groups, the gray frequency histogram data serve as sample characteristics, and a training sample database S is constructed;
s4: training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
s5: fusing grouping features according to the weight corresponding to each group in the feature weight matrix W;
reserving a group with higher contribution rate according to the weight, fusing and updating the group with lower contribution rate and an adjacent group, returning to the step S3 to continue fusing if the updated group meets the preset fusing condition, and otherwise executing the step S6;
s6: and counting the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the updated groups, and training a target classification model, wherein the target classification model is used for image classification, the input data of the target classification model is the sample characteristics of the images under the grouping, and the output data is a classification label corresponding to the images.
It should be understood that, the specific implementation process of each step may refer to embodiment 1, which is different in that there is no high-energy and low-energy image difference in this embodiment, so the group number is represented as V, and the size of the feature weight matrix W corresponds to the sample histogram statistical matrix under the group number V, so as to obtain the screening threshold T based on the feature weight matrix W, and update the grouping based on the screening threshold.
Example 3:
this embodiment provides a system based on the image classification method compared with embodiment 1, which includes: the system comprises a sample database construction module, a grouping module, a characteristic statistics module, a model training module and a fusion module.
The system comprises a sample database construction module, a database classification module and a database classification module, wherein the sample database construction module is used for acquiring a dual-energy image for target classification and acquiring a corresponding classification label to construct a sample database D;
the grouping module is used for being equidistantly divided into a plurality of groups V1 and Vh according to the high-energy gray value range and the low-energy gray value range respectively;
the characteristic counting module is used for counting the gray frequency histogram data of the samples in the sample database D as sample characteristics according to the grouping determined by the group numbers V1 and Vh to construct a training sample database S;
the model training module is used for training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
the fusion module is used for fusing the grouping characteristics according to the weight corresponding to each group in the characteristic weight matrix W;
reserving a group with higher contribution rate according to the weight, and fusing the group with lower contribution rate with an adjacent group to obtain updated group numbers V1 and Vh;
if the updated group numbers V1 and Vh reach the fusion preset condition, continuing to fuse the grouping features, and entering the next iteration cycle;
if the updated group numbers V1 and Vh do not reach the fusion preset condition, the feature statistics module performs statistics on gray frequency histogram data of the samples in the sample database D as sample features based on the groups determined by the updated group numbers V1 and Vh, the model training module trains a target classification model based on the sample features of the samples and the classification labels of the samples, and the target classification model is used for dual-energy image classification;
the input data of the target classification model is sample characteristics of the dual-energy images under the grouping determined by the group numbers V1 and Vh, and the output data is classification labels corresponding to the dual-energy images.
For the specific implementation process of each unit module, refer to the corresponding process of the foregoing method. It should be understood that, the specific implementation process of the above unit module refers to the method content, and the present invention is not described herein in detail, and the division of the above functional module unit is only a division of a logic function, and there may be another division manner in the actual implementation, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or may not be executed. Meanwhile, the integrated unit can be realized in a hardware form, and can also be realized in a software functional unit form.
Example 4:
this embodiment, compared with embodiment 2, provides a system based on the image classification method, which includes: the system comprises a sample database construction module, a grouping module, a characteristic statistics module, a model training module and a fusion module.
The sample database construction module is used for acquiring images for target classification and corresponding classification labels thereof and constructing a sample database D;
the grouping module is used for being divided into a plurality of groups at equal intervals according to the gray value range;
the characteristic counting module is used for counting the gray frequency histogram data of the samples in the sample database D as sample characteristics according to groups to construct a training sample database S;
the model training module is used for training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
the fusion module is used for fusing the grouping characteristics according to the weight corresponding to each group in the characteristic weight matrix W;
the method comprises the steps that a group with higher contribution rate is reserved according to the weight, the group with lower contribution rate and an adjacent group are fused and updated to be a group, if the updated group meets a fusion preset condition, the grouping characteristics are continuously fused, and the next iteration cycle is started; otherwise, the characteristic counting module counts the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the updated groups, and the model training module trains a target classification model based on the sample characteristics of the samples and the classification labels of the samples.
For the specific implementation process of each unit module, refer to the corresponding process of the foregoing method. It should be understood that, the specific implementation process of the above unit module refers to the method content, and the present invention is not described herein in detail, and the division of the above functional module unit is only a division of a logic function, and there may be another division manner in the actual implementation, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or may not be executed. Meanwhile, the integrated unit can be realized in a hardware form, and can also be realized in a software functional unit form.
Example 5:
the present embodiment provides a terminal, which includes:
one or more processors;
a memory storing one or more programs;
the processor calls the program to perform:
the image classification method based on the dual-energy image features of the histogram statistical frequency comprises the following steps. The method specifically comprises the following steps:
step 1: detecting a target by using a dual-energy X-ray detector to obtain a dual-energy image for target classification and obtain a corresponding classification label so as to construct a sample database D;
step 2: and the gray values are equally divided into a plurality of groups V1 and Vh according to the high-energy gray value range and the low-energy gray value range respectively.
And step 3: according to the grouping statistics determined by the group numbers V1 and Vh, the gray frequency histogram data of the samples in the sample database D is used as sample characteristics to construct a training sample database S;
and 4, step 4: and training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W.
And 5: and fusing the grouping characteristics according to the weight corresponding to each group in the characteristic weight matrix W.
Step 6: and counting the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the grouping determined by the updated group numbers V1 and Vh.
And 7: training a target classification model based on the sample features of the samples in the step 6 and the classification labels of the samples, wherein the target classification model is used for classifying the dual-energy images, the input data of the target classification model is the sample features of the dual-energy images in the groups determined by the group numbers V1 and Vh, and the output data is the classification labels corresponding to the dual-energy images.
Or the processor calls the program to perform: an image classification method based on the square-based statistical frequency specifically executes the following steps:
s1: acquiring an image for target classification and a classification label corresponding to the image for target classification to construct a sample database D;
s2: the gray values are divided into a plurality of groups at equal intervals according to the gray value range;
s3: according to the gray frequency histogram data of the samples in the sample database D which are counted in groups, the gray frequency histogram data serve as sample characteristics, and a training sample database S is constructed;
s4: training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
s5: fusing grouping features according to the weight corresponding to each group in the feature weight matrix W;
reserving a group with higher contribution rate according to the weight, fusing and updating the group with lower contribution rate and an adjacent group, returning to the step S3 to continue fusing if the updated group meets the preset fusing condition, and otherwise executing the step S6;
s6: and counting the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the updated groups, and training a target classification model, wherein the target classification model is used for image classification, the input data of the target classification model is the sample characteristics of the images under the grouping, and the output data is a classification label corresponding to the images.
The terminal further includes: and the communication interface is used for communicating with external equipment and carrying out data interactive transmission.
The memory may include high speed RAM memory, and may also include a non-volatile defibrillator, such as at least one disk memory.
If the memory, the processor and the communication interface are implemented independently, the memory, the processor and the communication interface may be connected to each other through a bus and perform communication with each other. The bus may be an industry standard architecture bus, a peripheral device interconnect bus, an extended industry standard architecture bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc.
Optionally, in a specific implementation, if the memory, the processor, and the communication interface are integrated on a chip, the memory, the processor, that is, the communication interface may complete communication with each other through the internal interface.
The specific implementation process of each step refers to the explanation of the foregoing method.
It should be understood that in the embodiments of the present invention, the Processor may be a Central Processing Unit (CPU), and the Processor may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The memory may include both read-only memory and random access memory, and provides instructions and data to the processor. The portion of memory may also include non-volatile random access memory. For example, the memory may also store device type information.
Example 6:
the present invention provides a readable storage medium storing a computer program for invocation by a processor to implement:
the image classification method based on the dual-energy image features of the histogram statistical frequency comprises the following steps. The method specifically comprises the following steps:
step 1: detecting a target by using a dual-energy X-ray detector to obtain a dual-energy image for target classification and obtain a corresponding classification label so as to construct a sample database D;
step 2: and the gray values are equally divided into a plurality of groups V1 and Vh according to the high-energy gray value range and the low-energy gray value range respectively.
And step 3: according to the grouping statistics determined by the group numbers V1 and Vh, the gray frequency histogram data of the samples in the sample database D is used as sample characteristics to construct a training sample database S;
and 4, step 4: and training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W.
And 5: and fusing the grouping characteristics according to the weight corresponding to each group in the characteristic weight matrix W.
Step 6: and counting the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the grouping determined by the updated group numbers V1 and Vh.
And 7: training a target classification model based on the sample features of the samples in the step 6 and the classification labels of the samples, wherein the target classification model is used for classifying the dual-energy images, the input data of the target classification model is the sample features of the dual-energy images in the groups determined by the group numbers V1 and Vh, and the output data is the classification labels corresponding to the dual-energy images.
Or the computer program is invoked by a processor to implement: an image classification method based on the square-based statistical frequency specifically executes the following steps:
s1: acquiring an image for target classification and a classification label corresponding to the image for target classification to construct a sample database D;
s2: the gray values are divided into a plurality of groups at equal intervals according to the gray value range;
s3: according to the gray frequency histogram data of the samples in the sample database D which are counted in groups, the gray frequency histogram data serve as sample characteristics, and a training sample database S is constructed;
s4: training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
s5: fusing grouping features according to the weight corresponding to each group in the feature weight matrix W;
reserving a group with higher contribution rate according to the weight, fusing and updating the group with lower contribution rate and an adjacent group, returning to the step S3 to continue fusing if the updated group meets the preset fusing condition, and otherwise executing the step S6;
s6: and counting the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the updated groups, and training a target classification model, wherein the target classification model is used for image classification, the input data of the target classification model is the sample characteristics of the images under the grouping, and the output data is a classification label corresponding to the images.
The specific implementation process of each step refers to the explanation of the foregoing method.
The readable storage medium is a computer readable storage medium, which may be an internal storage unit of the controller according to any of the foregoing embodiments, for example, a hard disk or a memory of the controller. The readable storage medium may also be an external storage device of the controller, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the controller. Further, the readable storage medium may also include both an internal storage unit of the controller and an external storage device. The readable storage medium is used for storing the computer program and other programs and data required by the controller. The readable storage medium may also be used to temporarily store data that has been output or is to be output.
Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned readable storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It should be emphasized that the examples described herein are illustrative and not restrictive, and thus the invention is not to be limited to the examples described herein, but rather to other embodiments that may be devised by those skilled in the art based on the teachings herein, and that various modifications, alterations, and substitutions are possible without departing from the spirit and scope of the present invention.
Claims (9)
1. An image classification method based on the square-based statistical frequency is characterized in that: the method comprises the following steps:
s1: acquiring an image for target classification and a classification label corresponding to the image for target classification to construct a sample database D;
s2: the gray values are divided into a plurality of groups at equal intervals according to the gray value range;
s3: according to the gray frequency histogram data of the samples in the sample database D which are counted in groups, the gray frequency histogram data serve as sample characteristics, and a training sample database S is constructed;
s4: training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
s5: fusing grouping features according to the weight corresponding to each group in the feature weight matrix W;
reserving a group with higher contribution rate according to the weight, fusing and updating the group with lower contribution rate and an adjacent group, returning to the step S3 to continue fusing if the updated group meets the preset fusing condition, and otherwise executing the step S6;
s6: and counting the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the updated groups, and training a target classification model, wherein the target classification model is used for image classification, the input data of the target classification model is the sample characteristics of the images under the grouping, and the output data is a classification label corresponding to the images.
2. An image classification method based on the dual-energy image features of the histogram statistical frequency is characterized in that: the method comprises the following steps:
step 1: acquiring a dual-energy image for target classification and acquiring a corresponding classification label to construct a sample database D;
step 2: the gray values are divided into a plurality of groups V1 and Vh at equal intervals according to the ranges of the high gray values and the low gray values;
and step 3: according to the grouping statistics determined by the group numbers V1 and Vh, the gray frequency histogram data of the samples in the sample database D is used as sample characteristics to construct a training sample database S;
and 4, step 4: training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
and 5: fusing grouping features according to the weight corresponding to each group in the feature weight matrix W;
retaining the groups with higher contribution rate according to the weight, fusing the groups with lower contribution rate with the adjacent groups to obtain updated group numbers V1 and Vh, and returning to the step 3 to continue fusing if the updated group numbers V1 and Vh reach the preset fusion condition; otherwise, executing step 6;
step 6: counting the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the groups determined by the updated group numbers V1 and Vh;
and 7: training a target classification model based on the sample features of the samples in the step 6 and the classification labels of the samples, wherein the target classification model is used for classifying the dual-energy images, the input data of the target classification model is the sample features of the dual-energy images in the groups determined by the group numbers V1 and Vh, and the output data is the classification labels corresponding to the dual-energy images.
3. The method of claim 2, wherein: in step 5, the process of fusing the grouping features according to the weight corresponding to each group in the feature weight matrix W is as follows:
firstly, calculating the contribution value corresponding to each group in group numbers V1 and Vh in a characteristic weight matrix W, wherein the contribution value is determined according to the weight size corresponding to each group in the characteristic weight matrix W;
then, respectively judging whether the contribution value corresponding to each group is less than or equal to high and low energy channel screening threshold values Tl and Th, if so, the corresponding group is a group with low contribution rate;
and the high and low energy channel screening threshold values Tl and Th are calculated by adopting an OTSU algorithm based on the characteristic weight matrix W.
4. The method of claim 3, wherein: the contribution value is represented by an average value of the weight magnitudes corresponding to the respective groups in the feature weight matrix W.
5. The method of claim 2, wherein: in the step 5, the preset fusion condition corresponding to the group numbers V1 and Vh is as follows:
determining gray frequency histogram data of the grouped statistical samples based on the group numbers V1 and Vh as sample characteristics, verifying whether the gray frequency histogram data meet the conditions by adopting the test accuracy P of K-fold cross verification of a linear regression model, if the test accuracy P is greater than an accuracy threshold, determining that the fusion preset conditions are met, otherwise, determining that the fusion preset conditions are not met;
or based on the group numbers V1 and Vh: and whether the Vh group number is larger than or equal to the group number threshold value or not is judged, if so, the fusion preset condition is met, and otherwise, the fusion preset condition is not met.
6. A system based on the method of claim 1, characterized in that: the method comprises the following steps:
the sample database construction module is used for acquiring images for target classification and corresponding classification labels thereof and constructing a sample database D;
the grouping module is used for being divided into a plurality of groups at equal intervals according to the gray value range;
the characteristic counting module is used for counting the gray frequency histogram data of the samples in the sample database D as sample characteristics according to groups to construct a training sample database S;
the model training module is used for training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
the fusion module is used for fusing the grouping characteristics according to the weight corresponding to each group in the characteristic weight matrix W;
the method comprises the steps that a group with higher contribution rate is reserved according to the weight, the group with lower contribution rate and an adjacent group are fused and updated to be a group, if the updated group meets a fusion preset condition, the grouping characteristics are continuously fused, and the next iteration cycle is started; otherwise, the characteristic counting module counts the gray frequency histogram data of the samples in the sample database D as sample characteristics based on the updated groups, and the model training module trains a target classification model based on the sample characteristics of the samples and the classification labels of the samples.
7. A system based on the method of any one of claims 2-5, characterized by: the method comprises the following steps:
the sample database construction module is used for acquiring the dual-energy images for target classification and acquiring corresponding classification labels to construct a sample database D;
the grouping module is used for being equidistantly divided into a plurality of groups V1 and Vh according to the high-energy gray value range and the low-energy gray value range respectively;
the characteristic counting module is used for counting the gray frequency histogram data of the samples in the sample database D as sample characteristics according to the grouping determined by the group numbers V1 and Vh to construct a training sample database S;
the model training module is used for training a classification model based on an ElasticNet algorithm and the training sample library S to obtain a characteristic weight matrix W;
the fusion module is used for fusing the grouping characteristics according to the weight corresponding to each group in the characteristic weight matrix W;
reserving a group with higher contribution rate according to the weight, and fusing the group with lower contribution rate with an adjacent group to obtain updated group numbers V1 and Vh;
if the updated group numbers V1 and Vh reach the fusion preset condition, continuing to fuse the grouping features, and entering the next iteration cycle;
if the updated group numbers V1 and Vh do not reach the fusion preset condition, the feature statistics module performs statistics on gray frequency histogram data of the samples in the sample database D as sample features based on the groups determined by the updated group numbers V1 and Vh, the model training module trains a target classification model based on the sample features of the samples and the classification labels of the samples, and the target classification model is used for dual-energy image classification;
the input data of the target classification model is sample characteristics of the dual-energy images under the grouping determined by the group numbers V1 and Vh, and the output data is classification labels corresponding to the dual-energy images.
8. A terminal, characterized by: the method comprises the following steps:
one or more processors;
a memory storing one or more programs;
the processor calls the program to perform:
the steps of the image classification method of claim 1 or the image classification method of dual energy image features of any of claims 2-5.
9. A readable storage medium, characterized by: a computer program is stored, which is invoked by a processor to implement:
the steps of the image classification method of claim 1 or the image classification method of dual energy image features of any of claims 2-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111004455.7A CN113821664A (en) | 2021-08-30 | 2021-08-30 | Image classification method, system, terminal and readable storage medium based on histogram statistical frequency |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111004455.7A CN113821664A (en) | 2021-08-30 | 2021-08-30 | Image classification method, system, terminal and readable storage medium based on histogram statistical frequency |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113821664A true CN113821664A (en) | 2021-12-21 |
Family
ID=78923386
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111004455.7A Pending CN113821664A (en) | 2021-08-30 | 2021-08-30 | Image classification method, system, terminal and readable storage medium based on histogram statistical frequency |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113821664A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101615286A (en) * | 2008-06-25 | 2009-12-30 | 中国科学院自动化研究所 | A kind of blind hidden information detection method based on analysis of image gray run-length histogram |
WO2019100724A1 (en) * | 2017-11-24 | 2019-05-31 | 华为技术有限公司 | Method and device for training multi-label classification model |
CN110298280A (en) * | 2019-06-20 | 2019-10-01 | 上海海洋大学 | A kind of ocean eddy recognition methods based on MKL multiple features fusion |
CN110399909A (en) * | 2019-07-08 | 2019-11-01 | 南京信息工程大学 | A kind of hyperspectral image classification method based on label constraint elastic network(s) graph model |
-
2021
- 2021-08-30 CN CN202111004455.7A patent/CN113821664A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101615286A (en) * | 2008-06-25 | 2009-12-30 | 中国科学院自动化研究所 | A kind of blind hidden information detection method based on analysis of image gray run-length histogram |
WO2019100724A1 (en) * | 2017-11-24 | 2019-05-31 | 华为技术有限公司 | Method and device for training multi-label classification model |
CN110298280A (en) * | 2019-06-20 | 2019-10-01 | 上海海洋大学 | A kind of ocean eddy recognition methods based on MKL multiple features fusion |
CN110399909A (en) * | 2019-07-08 | 2019-11-01 | 南京信息工程大学 | A kind of hyperspectral image classification method based on label constraint elastic network(s) graph model |
Non-Patent Citations (1)
Title |
---|
(法)AURÉLIENGÉRON著: "《机器学习实战》", vol. 978, 北京:机械工业出版社, pages: 126 - 134 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109978893B (en) | Training method, device, equipment and storage medium of image semantic segmentation network | |
US20190087737A1 (en) | Anomaly detection and automated analysis in systems based on fully masked weighted directed | |
CN110033026B (en) | Target detection method, device and equipment for continuous small sample images | |
WO2019179403A1 (en) | Fraud transaction detection method based on sequence width depth learning | |
US20090055344A1 (en) | System and method for arbitrating outputs from a plurality of threat analysis systems | |
CN111860398B (en) | Remote sensing image target detection method and system and terminal equipment | |
CN106327468B (en) | Curve detection method and curve detection device | |
CN109858476B (en) | Tag expansion method and electronic equipment | |
Khandelwal et al. | Segmentation-grounded scene graph generation | |
CN111814910B (en) | Abnormality detection method, abnormality detection device, electronic device, and storage medium | |
CN111723815B (en) | Model training method, image processing device, computer system and medium | |
CN109840413B (en) | Phishing website detection method and device | |
US20190087248A1 (en) | Anomaly detection and automated analysis using weighted directed graphs | |
CN110705531B (en) | Missing character detection and missing character detection model establishing method and device | |
CN116894985B (en) | Semi-supervised image classification method and semi-supervised image classification system | |
CN111199186A (en) | Image quality scoring model training method, device, equipment and storage medium | |
CN112287993B (en) | Model generation method, image classification method, device, electronic device, and medium | |
CN114022926A (en) | Face recognition method, device, equipment and storage medium | |
CN113821664A (en) | Image classification method, system, terminal and readable storage medium based on histogram statistical frequency | |
CN111369489B (en) | Image identification method and device and terminal equipment | |
CN111582647A (en) | User data processing method and device and electronic equipment | |
Cohen et al. | Set features for fine-grained anomaly detection | |
CN116304910A (en) | Anomaly detection method, device, equipment and storage medium for operation and maintenance data | |
CN107403199B (en) | Data processing method and device | |
CN113239738B (en) | Image blurring detection method and blurring detection device |
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 |