IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices


代码:
cate_ids=np.unique(gt_box_array[:,-1])
for tmp_cateid in cate_ids:
      conf_matrix[tmp_cateid,0]+=1
原因:numpy里面不指定类型的话,默认是float64位,无法作为索引
修改:强转为int  ,即conf_matrix[int(tmp_cateid),0]+=1


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM