首页 > 编程知识 正文

数据挖掘聚类分析,kmeans聚类分析结果怎么看

时间:2023-05-04 06:05:53 阅读:153381 作者:4484

YOLOv3使用备忘录——Kmeans聚类计算anchor boxes

使用自己的数据集聚类得到anchors。

比作者使用VOC数据集的精度更高。

# kmeans群集计算anchorboxesimportglobimportxml.etree.elementtreeasetimportnumpyasnpfromkmeansimportkmeans, avg_iou #标记文件地址ANNOTATIONS_PATH='/home/peter/桌面/项目文档/摄像机/雷达识别/724data/label _ png ' clusters=9def load _ dataters forxml _ file in glob.glob ({ }/* XML ).format ) path ) ) :tree=et.parse ) XML_file ) height=int ) ) tree.parse width=int (tree.find text ) width ) ) ) forobjintree.iter ) (object ) ) 3360xmin=int ) obj.findtext ) ) ) object ) ) width ymin=int (obj.obj ) heightxmin=NP.float64(xmin ) ymin=NP.float64(ymin ) xmax=NP.float 64 (xmax ) ymax=NP.float 64 (ymax ) ) ymax ) if xmax==xminorymax==ymin : print (XML _ file ) dataset.append([xmax-xmin, ymax-ymin (返回NP.array (dataset ) if__name_=='__main_':#print ) ___file_ '但是一次提高88 % foriinrange (10 ) : data=load _ dataset (annotations _ path ) out=kmeans ) data、 k=clusters (ifi==0: out1=outelse : out1=out1out print ) I ) out1=out1/10 # clusters=[ 10,13 ]、[ 16,16 326] ) out=NP.Array(Clusters )/608.0out=out1''data=load_ ) k=clusters(#输入图像大小为width=608,height=608out1.astype ) NP.int32 ) print ) out1) accuracy3360 ) (accuracy3360 out(*100 ) ) boxes 3360 (n { n } 1]*608 ) ) (ratios ) ) ) ) 65 decimals=2(.tolist ) )打印(ratios : (n { } ).format ) ratiod ) ration )

out * 608: [ [ 19.3748103210.93853073 ] [ 13.8391502310.93853073 ] [ 18.906329513.67316342 ] [ 24.91047047041110 [ 16.3701175612.30584708 ] [ 14.992412758.65967016 ] [ 22.6039453712.76161919 ] [ 16.8312476310.02698651 ]。 accuracy :88.91 % boxes : [ 19.3748103213.8391502318.9063329524.9104704121.2119833116.3701175614.9924127527 888-[ 10.9385307310.9385307313.6731634210.938530739.1154422812.30584708.6596701612.7616191910.02698651 ] RR

out.astype(NP.int32 ) array ([ 14,10 ]、[ 14,9 ]、[ 25,10 ]、[ 20,9 ]、[ 17,10 ]、[ 17,12 ]、[ 17,17 ]

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。