CN114494756A - Improved clustering algorithm based on Shape-GIoU - Google Patents

Improved clustering algorithm based on Shape-GIoU Download PDF

Info

Publication number
CN114494756A
CN114494756A CN202210007090.1A CN202210007090A CN114494756A CN 114494756 A CN114494756 A CN 114494756A CN 202210007090 A CN202210007090 A CN 202210007090A CN 114494756 A CN114494756 A CN 114494756A
Authority
CN
China
Prior art keywords
giou
yolov4
clustering
data
mask
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
Application number
CN202210007090.1A
Other languages
Chinese (zh)
Inventor
王兰美
周琨
王桂宝
廖桂生
孙长征
张志伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xidian University
Shaanxi University of Technology
Original Assignee
Xidian University
Shaanxi University of Technology
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Xidian University, Shaanxi University of Technology filed Critical Xidian University
Priority to CN202210007090.1A priority Critical patent/CN114494756A/en
Publication of CN114494756A publication Critical patent/CN114494756A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a clustering algorithm based on Shape-GIoU improvement, which solves the problem that the original GIoU is degraded into IoU, introduces a proportionality coefficient lambda/beta, introduces the influence of the aspect ratio of two frames into a formula, can solve the problem that the GIoU is degraded, considers the influence of the non-coverage area and the aspect ratio of the two frames, and partially improves the detection performance of the YOLOv4 algorithm; firstly, constructing a data set and preprocessing sample data; secondly, introducing the proposed Shape-GIoU method into a K-means + + clustering method, and then replacing an anchor value in the cfg file of the original edition YOLOv4 algorithm by the obtained anchor value; finally, comparing a YOLOv4 algorithm model using a K-means + + clustering method, and analyzing a test result; compared with a K-means + + clustering algorithm, the improved clustering algorithm based on Shape-GIoU can solve the problem that the GIoU is degraded, considers the influences of non-coverage area and aspect ratio, and improves the detection precision and recall rate of the YOLOv4 algorithm model; in addition, the method can still be used in combination with other classical algorithm models, and the detection performance of the algorithm models is improved.

Description

Improved clustering algorithm based on Shape-GIoU
Technical Field
The invention belongs to the field of image recognition, and particularly relates to a Shape-GIoU-based improved clustering algorithm, wherein a K-means + + clustering method is combined with a Shape-GIoU to cluster an initial Anchor box by improving a computing mode Shape-GIoU of IoU, so that the detection precision and recall rate of a YOLOv4 algorithm in a data set are improved.
Background
In recent years, deep learning models are becoming the main algorithms in the field of target detection, wherein convolutional neural networks have achieved significant results in the field of target detection. The target detection model based on deep learning can be divided into two types: a two-stage detection algorithm based on Region Proposal, such as R-CNN, Fast R-CNN, etc., the algorithm needs to generate candidate regions first, and then classify and regress the target candidate regions. The other is a single-stage detection algorithm such as a YOLO series, and compared with a double-stage target detection algorithm, the YOLO series algorithm abandons the stage of generating a candidate region, and uses an Anchor box (Anchor box) to replace the candidate region for final regression. Before YOLOv4 was proposed, the parameter for evaluating the similarity between the Anchor box and the real box was IoU, but IoU has many drawbacks: firstly, IoU is always 0 when two frames do not intersect, and then IoU cannot express the information of the distance between the center points of the two frames; secondly, since IoU only contains information about the overlapping area of two frames, when IoU of the two frames are equal, it is impossible to determine the specific shape information, such as aspect ratio.
Therefore, the invention provides a clustering algorithm based on Shape-GIoU improvement, the problem that the original GIoU is degraded to IoU is solved through embedding the improved IoU calculation mode Shape-GIoU, the problem that the GIoU is degraded can be solved by introducing a proportional coefficient lambda/beta and introducing the influence of the aspect ratio into a formula, the influence of the non-coverage area and the aspect ratio is considered, and the detection accuracy and the recall rate of the YOLOv4 network are improved.
Disclosure of Invention
In view of the above problems, it is an object of the present invention to provide an improved clustering algorithm for IoU calculation.
In order to achieve the purpose, the invention adopts the following technical solutions:
a clustering algorithm based on Shape-GIoU improvement is characterized in that a proportional coefficient lambda/beta is introduced, the influence of non-coverage area and aspect ratio is considered, the problem that the original GIoU is degraded to IoU is solved, and the detection performance of the YOLOv4 algorithm is improved.
The improved clustering algorithm comprises the following steps:
downloading public data sets AIZOO and RMFD for detecting the face mask, wherein because the quality of the data sets is also uneven, the face mask-wearing photo or the face mask-not-wearing photo with the resolution ratio larger than 608X 608 is selected from the public AIZOO and RMFD face recognition data sets, and a face mask data set used by the invention is constructed; creating a corresponding xml file for each sample picture in the data set, and storing the path of each sample picture and the category information p of the interested target in the sample pictureiCoordinate information of the upper left corner and the lower right corner of the target and the resolution of the sample picture are stored in corresponding xml files; preprocessing xml file data, firstly obtaining coordinate values of an interested target in a sample picture, and then converting the coordinate data into the width and height of a real frame, wherein the calculation formula is as follows: the width is equal to the horizontal coordinate of the lower right corner-the horizontal coordinate of the upper left corner, the height is equal to the vertical coordinate of the lower right corner-the vertical coordinate of the upper left corner, finally, the width and height values are normalized, and the normalized width and heightValue-width-height value/resolution of input picture; wherein the download address of the AIZOO data set: https:// github. com/AIZOOTech/faceMaskDetection; download address of RMFD data set: https// gitubb. com/X-zhangyang/Real-World-Masked-Face-Dataset;
because the prior open data sets aiming at the face and mask detection are less and the picture quality is also uneven, the invention selects the face picture with the mask or the picture without the mask with the resolution ratio more than 608X 608 from the open AIZOO and RMFD face recognition data sets to construct the face and mask data set used by the invention; the data sets of the invention are divided into two categories: the method comprises the steps that a mask wearing face target and a mask not wearing face target comprise 11208 pictures, a data set comprises 7933 mask wearing face targets and 13651 mask not wearing face targets in different scenes, and a test set, a verification set and a training set are divided according to the ratio of 6:2: 2;
step two, arbitrarily selecting normalized width and height data (w) of a real frame of an interested target in 1 sample picture from the data set to be processedj,hj) As initial clustering center yj(wj,hj);
Step three, for each sample x in the data seti(wi,hi) Calculating it from the selected cluster center yj(wj,hj) The distance of (d); distance d usedijThe calculation method is as follows:
dij=1-Shape-GIoUij
the invention is Shape-GIoUijThe calculation is shown as follows:
Figure RE-GDA0003558945930000031
xi∩yj=min(wi,wj)×min(hi,hj)
xi∪yj=wi×hi+wj×hj-min(wi,wj)×min(hi,hj)
Aij=max(wi,wj)×max(hi,hj)
Figure RE-GDA0003558945930000032
Figure RE-GDA0003558945930000033
wherein xi∩yjArea, x, representing the union between the ith real box and the jth cluster centeri∪yjDenotes the area of intersection between the ith real box and the jth cluster center, AijAn area of a minimum bounding rectangle representing an ith real box and a jth cluster center, where i ═ 0, 1., 21583, j ═ 1, 2., 9;
as can be seen from the above formula, when Aij=(xi∪yj) When the two frames completely intersect, the GIoU will degenerate to IoU, and a scaling factor is introduced
Figure RE-GDA0003558945930000041
The coefficient introduces the influence of the aspect ratio of the two frames into a formula, and can solve the problem that the GIoU is degenerated to IoU;
step four, calculating each sample xi(wi,hi) Probability of being selected as next cluster center
Figure RE-GDA0003558945930000042
Randomly generating a new clustering center yj+1(wj+1,hj+1);
Step five, repeating the step three and the step four until K clustering centers are selected, and operating a standard K-means algorithm by using the K initial clustering centers to recalculate the clustering centers of each category;
because the YOLOv4 algorithm has three detection scales, each scale has 3 anchors, so that 9 clustering centers are obtained by selecting K to be 9, and the values of the clustering centers are multiplied by the resolution of output pictures to finally obtain 9 anchors required by the YOLOv4 algorithm;
step six, obtaining an anchor value by using a K-means + + clustering algorithm, carrying out network training through standard YOLOv4 and storing a test result test1, obtaining a new anchor value by using the method of the invention, and carrying out network training through standard YOLOv4 and storing a test result test 2; comparing the test results of the 2 experiments, wherein the indexes of comparison are mAP and Recall respectively; downloading standard YOLOv4 network and compiling, the downloading address of YOLOv 4: https// githu.com/alexeyAB/darknet, changing a training set, a verification set and a test set directory in a voc.data file in a data folder into addresses of downloaded data sets, and specifying the number and name of categories; modifying anchor, classes and filters parameters in a YOLOv4.cfg file in a cfg folder, wherein the anchor parameters are 9 anchor values obtained by using a K-means + + clustering algorithm; classes are the category numbers of the data set constructed by the invention and are respectively a mask wearing face target and a mask not wearing face target, namely, the classes are 2; filters (category number +5) × 3 ═ 21; starting to train the YOLOv4 network, and selecting a YOLOv4_ best in a backup folder as a test weight Q after the network training is finished1Testing is carried out and a test result test1 is obtained; the method of the invention is used for obtaining a new anchor value, modifying the anchor parameter in the Yolov4.cfg file in the cfg folder, training the Yolov4 network and obtaining the test weight Q2The test is performed and the test result test2 is obtained.
The method provides an improved clustering algorithm based on Shape-GIoU, and combines a K-means + + clustering method and the Shape-GIoU to cluster an initial Anchor box by improving a calculation mode of IoU; compared with a K-means + + clustering method, the method disclosed by the invention improves the mAP value and the Recall value of the YOLOv4 algorithm in the data set.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flow chart of the method of the present invention;
FIG. 2 is a sample graph of a training set;
FIG. 3 is a comparison graph of IoU values;
FIG. 4 is a graph of Shape-GIoU value calculations;
FIG. 5 is a graph of the partial detection results of the YOLOv4 model using the method of the invention;
FIG. 6 is the overall performance of the YOLOv4 model using the K-means + + clustering algorithm and the YOLOv4 model using the method of the present invention on validation data sets;
Detailed Description
In order to make the aforementioned and other objects, features and advantages of the present invention more apparent, the following detailed description of the embodiments of the present invention, taken in conjunction with the accompanying drawings, is set forth below:
referring to fig. 1, the implementation steps of the invention are as follows:
downloading public data sets AIZOO and RMFD for detecting the face mask, wherein because the quality of the data sets is also uneven, the face mask-wearing photo or the face mask-not-wearing photo with the resolution ratio larger than 608X 608 is selected from the public AIZOO and RMFD face recognition data sets, and a face mask data set used by the invention is constructed; creating a corresponding xml file for each sample picture in the data set, and storing the path of each sample picture and the category information p of the interested target in the sample pictureiCoordinate information of the upper left corner and the lower right corner of the target and the resolution of the sample picture are stored in corresponding xml files; preprocessing xml file data, firstly obtaining coordinate values of an interested target in a sample picture, and then converting the coordinate data into the width and height of a real frame, wherein the calculation formula is as follows: and finally, normalizing the width and height values, wherein the calculation formula is as follows: the normalized width and height value is equal to the width and height value/the resolution of the input picture; wherein the download address of the AIZOO data set: https:// githubZOOTech/faceMaskDetection; download address of RMFD data set: https// gitubb. com/X-zhangyang/Real-World-Masked-Face-Dataset;
the data sets of the invention are divided into two categories: the method comprises the steps that a mask wearing face target and a mask not wearing face target comprise 11208 pictures, a data set comprises 7933 mask wearing face targets and 13651 mask not wearing face targets in different scenes, and a test set, a verification set and a training set are divided according to the ratio of 6:2: 2;
FIG. 2 is a partial sample diagram of a training set in a data set used in the present invention, so as to show the universality of a target detection object, and different images are trained under different angles in different scenes;
step two, arbitrarily selecting normalized width and height data (w) of a real frame of an interested target in 1 sample picture from the data set to be processedj,hj) As initial clustering center yj(wj,hj);
Step three, for each sample x in the data seti(wi,hi) Calculating it from the selected cluster center yj(wj,hj) The distance of (d); distance d usedijThe calculation method is as follows:
dij=1-Shape-GIoUij
referring to FIG. 4, the Shape-GIoU calculation of the present invention is shown as follows:
Figure RE-GDA0003558945930000061
xi∩yj=min(wi,wj)×min(hi,hj)
xi∪yj=wi×hi+wj×hj-min(wi,wj)×min(hi,hj)
Aij=max(wi,wj)×max(hi,hj)
Figure RE-GDA0003558945930000071
Figure RE-GDA0003558945930000072
Figure RE-GDA0003558945930000073
Figure RE-GDA0003558945930000074
Figure RE-GDA0003558945930000075
wherein xi∩yjArea, x, representing the union between real box and cluster centeri∪yjRepresenting the area of intersection between the real box and the cluster center, AijThe area of the smallest bounding rectangle representing the real box and the cluster center,
as can be seen from the above formula, when Aij=(xi∪yj) When the two frames completely intersect, the GIoU will degenerate to IoU, and a scaling factor is introduced
Figure RE-GDA0003558945930000076
The coefficient introduces the influence of the aspect ratio of the two frames into a formula, and can solve the problem that the GIoU is degenerated to IoU;
step four, calculating each sample xi(wi,hi) Probability of being selected as next cluster center
Figure RE-GDA0003558945930000077
Randomly generating a new clustering center yj+1(wj+1,hj+1);
Step five, repeating the step three and the step four until K clustering centers are selected, and operating a standard K-means algorithm by using the K initial clustering centers to recalculate the clustering centers of each category;
because the YOLOv4 algorithm has three detection scales, each scale has 3 anchors, so that 9 clustering centers are obtained by selecting K to be 9, and the values of the clustering centers are multiplied by the resolution of output pictures to finally obtain 9 anchors required by the YOLOv4 algorithm;
step six, obtaining an anchor value by using a K-means + + clustering algorithm, carrying out network training through standard YOLOv4 and storing a test result test1, obtaining a new anchor value by using the method of the invention, and carrying out network training through standard YOLOv4 and storing a test result test 2; comparing the test results of the 2 experiments, wherein the indexes of comparison are mAP and Recall respectively; downloading and compiling a standard YOLOv4 network, wherein the download address of the standard YOLOv4 network is as follows: https// githu.com/alexeyAB/darknet), changing the addresses of the training set, the verification set and the test set directory in the voc.data file in the data folder into download data sets, and specifying the number and the name of categories; modifying anchor, classes and filters parameters in a YOLOv4.cfg file in a cfg folder, wherein the anchor parameters are 9 anchor values obtained by using a K-means + + clustering algorithm; classes are the category numbers of the data set constructed by the invention and are respectively a mask wearing face target and a mask not wearing face target, namely, the classes are 2; filters (category number +5) × 3 ═ 21; starting to train the YOLOv4 network, and selecting a YOLOv4_ best in a backup folder as a test weight Q after the network training is finished1Testing is carried out and a test result test1 is obtained; the method of the invention is used for obtaining a new anchor value, modifying the anchor parameter in the Yolov4.cfg file in the cfg folder, training the Yolov4 network and obtaining the test weight Q2The test is performed and the test result test2 is obtained.
The invention is further described below in connection with a simulation example.
Simulation example:
the invention adopts a face mask data set as a training set, a verification set and a test set, and provides part of detection effect graphs using the method of the invention.
Fig. 2 is an illustration diagram of a part of samples in a training set, a part of test data in a face mask data set is randomly selected and displayed as a result, and pictures with different backgrounds, different types of masks, different target sizes, different angles and different target densities are selected to display the universality of the test result.
FIG. 3 shows a graphical representation of the Shape-GIoU-based calculation of the method of the present invention, wherein the dashed box represents the prediction box, the solid box represents the real box, and the parameter of FIG. 4(a) is wi=4,hi=8,wj=2,h j4; 4(b) has a parameter wi=4,hi=8,
Figure RE-GDA0003558945930000081
Fig. 4(a) results using different calculation methods:
xi∩yj=min(wi,wj)×min(hi,hj)=2×4=8
xi∪yj=wi×hi+wj×hj-min(wi,wj)×min(hi,hj)
=4×8+2×4-2×4=32
Aij=max(wi,wj)×max(hi,hj)=4×8=32
Figure RE-GDA0003558945930000091
Figure RE-GDA0003558945930000092
Figure RE-GDA0003558945930000093
Figure RE-GDA0003558945930000094
Figure RE-GDA0003558945930000095
fig. 4(b) results using different calculation methods:
Figure RE-GDA0003558945930000096
Figure RE-GDA0003558945930000097
Figure RE-GDA0003558945930000098
therefore, under the condition that the prediction frame is completely wrapped by the real frame, for the condition that the prediction frame accounts for the same proportion of the real frame but has different length-width ratios, the Shape-GIoU provided by the method can be well distinguished, but the existing calculation method cannot be distinguished.
FIG. 3 is a diagram comparing the Shape-GIoU calculation of the present invention with the current calculation method, wherein the dashed box represents the prediction box, and the solid box represents the real box, so that when the prediction box is completely wrapped by the real box, the current calculation method cannot be distinguished, and the Shape-GIoU proposed by the present invention can be distinguished from the current calculation method when the prediction box occupies the real box with the same ratio but with different aspect ratios.
Fig. 5 is a partial detection result diagram of the original YOLOv4 model, and a detection diagram of pictures with different backgrounds, different types of masks, different target sizes, different angles and different target densities is selected to show the universality of the original detection model, so that it can be seen that the basic class detection effect of the object in the picture is good.
FIG. 6 shows the overall performance of the YOLOv4 model using the K-means + + clustering algorithm and the YOLOv4 model using the method of the present invention on the test data set, and it can be seen that both mAP and Recall on the test set are improved by the method of the present invention.
In conclusion, simulation experiments show that the YOLOv4 model of the method can be well distinguished when the prediction frame is completely wrapped by the real frame and the prediction frame accounts for the same proportion of the real frame but has different length-width ratios, and the detection performance of the YOLOv4 algorithm model is improved. The method can also be used in combination with a classical algorithm model, and the detection performance of the algorithm model is improved.

Claims (7)

1. A clustering algorithm based on Shape-GIoU improvement is characterized in that:
downloading public data sets AIZOO and RMFD of face mask detection, selecting a face photo with a mask or a photo without the mask with a resolution ratio of more than 608X 608 to construct a face mask data set used by the invention, and preprocessing data in the data set to obtain normalized wide and high value data;
step two, arbitrarily selecting normalized width and height data (w) of a real frame of an interested target in 1 sample picture from the data set to be processedj,hj) As initial clustering center yj(wj,hj);
Step three, for each sample x in the data seti(wi,hi) Calculating it from the selected cluster center yj(wj,hj) The distance of (d);
step four, calculating each sample xi(wi,hi) Probability of being selected as next cluster center
Figure RE-FDA0003558945920000011
Randomly generating a new clustering center yj+1(wj+1,hj+1);
Step five, repeating the step three and the step four until k clustering centers are selected, and operating a standard k-means algorithm by using the k initial clustering centers to recalculate the clustering centers of each category;
step six, obtaining an anchor value by using a K-means + + clustering algorithm, performing network training through standard YOLOv4 and storing a test result test1, obtaining a new anchor value by using the method of the invention, performing network training through standard YOLOv4 and storing a test result test2, and comparing the test results of 2 experiments, wherein the compared indexes are mAP and Recall respectively;
in the foregoing steps, i ═ 0, 1., 21583 denotes a reference numeral of sample data, and j ═ 1, 2., 9 denotes a reference numeral of a cluster center.
2. The improved clustering algorithm based on Shape-GIoU as claimed in claim 1, step one, downloading the public data sets aizo and RMFD of face mask detection, because the quality of the data sets is also uneven, the invention selects the face photo with a mask or the non-mask photo with resolution greater than 608 x 608 from the public data sets of face recognition of aizo and RMFD, and constructs the data set of the face mask used in the invention; creating a corresponding xml file for each sample picture in the data set, and storing the path of each sample picture and the category information p of the interested target in the sample pictureiCoordinate information of the upper left corner and the lower right corner of the target and the resolution of the sample picture are stored in corresponding xml files; preprocessing xml file data, firstly obtaining coordinate values of an interested target in a sample picture, and then converting the coordinate data into the width and height of a real frame, wherein the calculation formula is as follows: and finally, normalizing the width and height values, wherein the calculation formula is as follows: the normalized width and height value is equal to the width and height value/the resolution of the input picture; wherein the download address of the AIZOO data set: https:// github. com/AIZOOTech/faceMaskDetection; download address of RMFD data set: https// gitubb. com/X-zhangyang/Real-World-Masked-Face-Dataset;
the data sets of the invention are divided into two categories: the mask wearing face target and the mask not wearing face target comprise 11208 photos, the data set comprises 7933 mask wearing face targets and 13651 mask not wearing face targets in different scenes, and the test set, the verification set and the training set are divided according to the ratio of 6:2: 2.
3. The improved clustering algorithm based on Shape-GIoU as claimed in claim 1, wherein in step two, the normalized width and height data (w) of the real frame of the target of interest in 1 sample picture is arbitrarily selected from the data set to be processedj,hj) As initial clustering center yj(wj,hj)。
4. The improved clustering algorithm based on Shape-GIoU as claimed in claim 1, step three, for each sample x in the data seti(wi,hi) Calculating it from the selected cluster center yj(wj,hj) The distance of (d); distance d usedijThe calculation method is as follows:
dij=1-Shape-GIoUij
the invention is Shape-GIoUijThe calculation is shown as follows:
Figure RE-FDA0003558945920000021
xi∩yj=min(wi,wj)×min(hi,hj)
xi∪yj=wi×hi+wj×hj-min(wi,wj)×min(hi,hj)
Aij=max(wi,wj)×max(hi,hj)
Figure RE-FDA0003558945920000031
Figure RE-FDA0003558945920000032
wherein xi∩yjArea, x, representing the union between real box and cluster centeri∪yjRepresenting the area of intersection between the real box and the cluster center, AijThe area of the smallest bounding rectangle representing the real box and the cluster center,
as can be seen from the above formula, when Aij=(xi∪yj) When the two frames completely intersect, the GIoU is degenerated to IoU, and a proportionality coefficient lambda is introducedijijThis factor introduces the effect of the aspect ratio of the two boxes into the equation, which can solve the problem of GIoU falling to IoU.
5. The improved clustering algorithm based on Shape-GIoU as claimed in claim 1, wherein x is calculated for each samplei(wi,hi) Probability of being selected as next cluster center
Figure RE-FDA0003558945920000033
Randomly generating a new clustering center yj+1(wj+1,hj+1)。
6. The improved clustering algorithm based on Shape-GIoU as claimed in claim 1, wherein step five, step three and step four are repeated until K clustering centers are selected, and the K initial clustering centers are used to run a standard K-means algorithm to recalculate the clustering centers of each category; because the YOLOv4 algorithm has three detection scales, each scale has 3 anchors, we take K to 9 to obtain 9 cluster centers, multiply the values of the cluster centers by the resolution of the output picture, and finally we obtain 9 anchors required by the YOLOv4 algorithm.
7. The improved clustering algorithm based on Shape-GIoU as claimed in claim 1, step six, using K-means + + clustering algorithm to obtain anchor value, training and storing test result test1 through standard YOLOv4 network, obtaining new anchor value using the method of the present invention, training and storing test result test2 through standard YOLOv4 network; the test results of 2 experiments were compared,the indexes of comparison are mAP and Recall respectively, and the standard YOLOv4 network download address is as follows: https:// github.com/alexeyAB/dacknet downloads and compiles a standard YOLOv4 network, changes a training set, a verification set and a test set directory in a voc.data file in a data folder as addresses of downloaded data sets, and specifies the number and name of categories; modifying the anchor, classes and filters parameters in a YOLOv4.cfg file in a cfg folder, wherein the anchor parameter is 9 anchor values obtained by using a K-means + + clustering algorithm; classes are the category numbers of the data set constructed by the invention and are respectively a mask wearing face target and a mask not wearing face target, namely, the classes are 2; filters (category number +5) × 3 ═ 21; starting to train the YOLOv4 network, and selecting a YOLOv4_ best in a backup folder as a test weight Q after the network training is finished1Testing is carried out and a test result test1 is obtained; the method of the invention is used for obtaining a new anchor value, modifying the anchor parameter in the Yolov4.cfg file in the cfg folder, training the Yolov4 network and obtaining the test weight Q2The test is performed and the test result test2 is obtained.
CN202210007090.1A 2022-01-05 2022-01-05 Improved clustering algorithm based on Shape-GIoU Pending CN114494756A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210007090.1A CN114494756A (en) 2022-01-05 2022-01-05 Improved clustering algorithm based on Shape-GIoU

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210007090.1A CN114494756A (en) 2022-01-05 2022-01-05 Improved clustering algorithm based on Shape-GIoU

Publications (1)

Publication Number Publication Date
CN114494756A true CN114494756A (en) 2022-05-13

Family

ID=81509282

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210007090.1A Pending CN114494756A (en) 2022-01-05 2022-01-05 Improved clustering algorithm based on Shape-GIoU

Country Status (1)

Country Link
CN (1) CN114494756A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115641637A (en) * 2022-11-11 2023-01-24 杭州海量信息技术有限公司 Face recognition method and system for mask
CN116503344A (en) * 2023-04-21 2023-07-28 南京邮电大学 Crack instance segmentation method based on deep learning

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115641637A (en) * 2022-11-11 2023-01-24 杭州海量信息技术有限公司 Face recognition method and system for mask
CN116503344A (en) * 2023-04-21 2023-07-28 南京邮电大学 Crack instance segmentation method based on deep learning

Similar Documents

Publication Publication Date Title
CN112232476B (en) Method and device for updating test sample set
CN111428818B (en) Deep learning model test method and device based on neural pathway activation state
CN110826638B (en) Zero sample image classification model based on repeated attention network and method thereof
CN104680542B (en) Remote sensing image variation detection method based on on-line study
CN109784293B (en) Multi-class target object detection method and device, electronic equipment and storage medium
CN111783840A (en) Visualization method and device for random forest model and storage medium
CN112418212B (en) YOLOv3 algorithm based on EIoU improvement
CN114494756A (en) Improved clustering algorithm based on Shape-GIoU
CN111951097A (en) Enterprise credit risk assessment method, device, equipment and storage medium
CN109815988B (en) Model generation method, classification method, device and computer-readable storage medium
CN113033516A (en) Object identification statistical method and device, electronic equipment and storage medium
CN112420125A (en) Molecular attribute prediction method and device, intelligent equipment and terminal
CN112817563B (en) Target attribute configuration information determining method, computer device, and storage medium
CN115114421A (en) Question-answer model training method
CN111242176B (en) Method and device for processing computer vision task and electronic system
CN115311502A (en) Remote sensing image small sample scene classification method based on multi-scale double-flow architecture
CN114419406A (en) Image change detection method, training method, device and computer equipment
CN110363830A (en) Element image generation method, apparatus and system
CN108596044A (en) Pedestrian detection method based on depth convolutional neural networks
CN115017679A (en) Simulation method and device for atmospheric pollution diffusion, storage medium and electronic equipment
CN114723037A (en) Heterogeneous graph neural network computing method for aggregating high-order neighbor nodes
CN117036834B (en) Data classification method and device based on artificial intelligence and electronic equipment
Costa et al. Genetic adaptation of segmentation parameters
CN114332473A (en) Object detection method, object detection device, computer equipment, storage medium and program product
CN111860601A (en) Method and device for predicting large fungus species

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