代码:
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

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices的更多相关文章

  1. numpy.newaxis()

    np.newaxis 功能:为numpy.ndarray(多维数组)增加一个轴 np.newaxis 在使用和功能上等价于 None,查看源码发现:newaxis = None,其实就是 None 的 ...

  2. Python:numpy.newaxis

    x1[:,np.newaxis]:增维,转置 从字面上是插入新的维度的意思 demo1: 针对一维的情况 >>> b = np.array([1, 2, 3, 4, 5, 6]) & ...

  3. Pandas_基础_全

    Pandas基础(全) 引言 Pandas是基于Numpy的库,但功能更加强大,Numpy专注于数值型数据的操作,而Pandas对数值型,字符串型等多种格式的表格数据都有很好的支持. 关于Numpy的 ...

  4. Python问题汇总

    1.dict is not callable tree是一个字典类型. tree("left") -> tree["left"]   2.list ind ...

  5. TensorFlow2.0(1):基本数据结构—张量

    1 引言 TensorFlow2.0版本已经发布,虽然不是正式版,但预览版都发布了,正式版还会远吗?相比于1.X,2.0版的TensorFlow修改的不是一点半点,这些修改极大的弥补了1.X版本的反人 ...

  6. Codeforces Round #353 (Div. 2)Restoring Painting

    Vasya works as a watchman in the gallery. Unfortunately, one of the most expensive paintings was sto ...

  7. codeforces 675B B. Restoring Painting(暴力枚举)

    题目链接: B. Restoring Painting time limit per test 1 second memory limit per test 256 megabytes input s ...

  8. Codeforces Round #353 (Div. 2) B. Restoring Painting 水题

    B. Restoring Painting 题目连接: http://www.codeforces.com/contest/675/problem/B Description Vasya works ...

  9. OpenPyXl的使用

    OpenPyXl的使用 开始在内存中使用 创建一个workbook 在刚开始使用openpyxl的时候,不需要直接在文件系统中创建一个文件,仅仅需要导入Workbook类并开始使用它: >> ...

  10. numpy基本用法

    numpy 简介 numpy的存在使得python拥有强大的矩阵计算能力,不亚于matlab. 官方文档(https://docs.scipy.org/doc/numpy-dev/user/quick ...

随机推荐

  1. CentOS网络服务操作命令

    CentOS 重启网络服务,输入下面的命令:systemctl retart network.service 或 systemctl restart network.CentOS 启动网络服务,输入下 ...

  2. pytorch学习笔记(3)--dataset使用

    下载数据集 import torchvision from torch.utils.tensorboard import SummaryWriter dataset_transform = torch ...

  3. 模态框:JavaScript+css

    solution one: JavaScript,单个模态框展示: modal_tools.js window.onload = function () { //js默认加载页面方法 // get m ...

  4. 大数据分析——matplotlib

    参考链接:https://blog.csdn.net/xavier_muse/article/details/83859272 fig,ax = plt.subplots()等价于: fig = pl ...

  5. shell_Day01

    1.判断/etc/inittab文件是否大于100行,如果大于,则显示"/etc/inittab is a big file."否者显示"/etc/inittab is ...

  6. 简体Windows系统登录玩新枫之谷方法

    2022-2-23  游戏更新后Locale.Emulato失效,64位游戏使用新的工具Locale_Remulator,请自行到GitHub上搜索下载,使用方法与Locale.Emulato类似. ...

  7. win10下 pytorch 跑模型 gpu利用率低

    查阅资料后发现 Dataloader中的num_workers参数(线程数)设置为0,该为4后,nvidia-smi查看GPU占用率变为高(不要用任务管理器查看)

  8. 【Linux】Ubuntu随笔

    Ubuntu声明环境变量时使用 export JAVA_HOME=/xx/xx/xx,当需要引用时要写成 $JAVA_HOME 所以配置环境变量并声明方法如下: vim ~/.bashrc expor ...

  9. powerbi 模板网站

    微软网站 https://community.powerbi.com/t5/Themes-Gallery/bd-p/ThemesGallery 中国区powerbi比赛网站 http://www.ch ...

  10. python投票一致性指数(IVC)实现代码

    毕业论文中用于计算联合国会员国间在联合国大会上的投票一致性(IVC) import pandas as pd import sqlite3 import networkx as nx import t ...