faster rcnn报错:TypeError: slice indices must be integers or None or have an __index__ method
2017-12-20 09:48
881 查看
博主之前在跑faster rcnn训练的时候别的问题都能按照网上教程解决唯独这个问题一直不行,去网上搜说是numpy有问题,我安装过conda所以我有两个numpy一个是pip安装的还有一个是conda安装的,我的python2.7使用的是conda环境下的,这个numpy坑确实不小,我对numpy一通乱改把conda装的降到了1.11.3,将pip安装的升到了1.13.3但还是不行,于是我就开始看代码改错了,我主要改的是/home/xiaohua/py-faster-rcnn/lib/roi_data_layer下的minibatch.py文件转到172行,将
for ind in inds:
cls = clss[ind]
start = 4 * cls
end = start + 4
bbox_targets[ind, start:end] = bbox_target_data[ind, 1:]
bbox_inside_weights[ind, start:end] = cfg.TRAIN.BBOX_INSIDE_WEIGHTS
return bbox_targets, bbox_inside_weights
改为:
for ind in inds:
ind = int(ind)
cls = clss[ind]
start = int(4 * cos)
end = int(start + 4)
bbox_targets[ind, start:end] = bbox_target_data[ind, 1:]
bbox_inside_weights[ind, start:end] = cfg.TRAIN.BBOX_INSIDE_WEIGHTS
return bbox_targets, bbox_inside_weights
即可,自己注意python语法格式哦。
for ind in inds:
cls = clss[ind]
start = 4 * cls
end = start + 4
bbox_targets[ind, start:end] = bbox_target_data[ind, 1:]
bbox_inside_weights[ind, start:end] = cfg.TRAIN.BBOX_INSIDE_WEIGHTS
return bbox_targets, bbox_inside_weights
改为:
for ind in inds:
ind = int(ind)
cls = clss[ind]
start = int(4 * cos)
end = int(start + 4)
bbox_targets[ind, start:end] = bbox_target_data[ind, 1:]
bbox_inside_weights[ind, start:end] = cfg.TRAIN.BBOX_INSIDE_WEIGHTS
return bbox_targets, bbox_inside_weights
即可,自己注意python语法格式哦。
相关文章推荐
- TypeError: slice indices must be integers or None or have an index method
- TypeError: slice indices must be integers or None or have an __index__ method
- TypeError: slice indices must be integers or None or have an __index__ method
- TypeError: slice indices must be integers or None or have an index method
- 错误异常slice indices must be integers or None or have
- 快速解决Python问题:TypeError: list indices must be integers or slices, not str
- TypeError: list indices must be integers or slices, not tuple
- TypeError: string indices must be integers, not str
- Pymongo: TypeError: if no direction is specified, key_or_list must be an instance of list
- 读取页面返回字典值提示错误:TypeError: string indices must be integers, not str
- python错误:TypeError: string indices must be integers
- 处理错误TypeError: initial_value must be unicode or None, not str
- python错误:TypeError: string indices must be integers
- Python TypeError: must be string or buffer, not dict
- TypeError: name must be an instance of basestring
- TypeError: view must be a callable or a list/tuple in the case of include()
- TypeError: view must be a callable or a list/tuple in the case of include()
- TypeError: view must be a callable or a list/tuple in the case of include()
- 无法启动soapUI3.0.1 Error: the jvm could not be started. the main method may have thrown an exception
- TypeError: unbound method x must be called with x instance as first argument (got nothing instead)