When training stage1 RPN, there is a prompt error of ‘numpy. Float64’ object cannot be interpreted asanindex. Almost all blogs point out that the version of numpy needs to be changed. After doing so, there is an importerror: numpy. Core. Multiarray failed to import. This problem is caused by the mismatch of numpy, which forms a vicious circle, We can consider solving ‘numpy. Float64’ object cannot be interpreted as an index from the root

`TypeError: 'numpy.float64' object cannot be interpreted as an index`

1) /home/xxx/py-faster-rcnn/lib/roi_data_layer/minibatch.py

```
Line 26: fg_rois_per_image = np.round(cfg.TRAIN.FG_FRACTION * rois_per_image)
to fg_rois_per_image = np.round(cfg.TRAIN.FG_FRACTION * rois_per_image).astype(np.int)
Line 174 & 175 to
```

for ind in inds:

cls = clss[ind]

start =int( 4 * cls)

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

2) /home/xxx/py-faster-rcnn/lib/datasets/ds_utils.py

```
Line 12: hashes = np.round(boxes * scale).dot(v)
to hashes = np.round(boxes * scale).dot(v).astype(np.int)
```

3) /home/xxx/py-faster-rcnn/lib/fast_rcnn/test.py

```
Line 129: hashes = np.round(blobs['rois'] * cfg.DEDUP_BOXES).dot(v)
to hashes = np.round(blobs['rois'] * cfg.DEDUP_BOXES).dot(v).astype(np.int)
```

4) /home/xxx/py-faster-rcnn/lib/rpn/proposal_target_layer.py

```
Line 60: fg_rois_per_image = np.round(cfg.TRAIN.FG_FRACTION * rois_per_image)
to fg_rois_per_image = np.round(cfg.TRAIN.FG_FRACTION * rois_per_image).astype(np.int)
```

After solving the previous problem, there is a typeerror: slice indexes must be integers or none or have an__ index__ If the version of numpy is not changed,

Modify/home/xxx/py fast RCNN/lib/RPN/proposal_ target_ Layer.py, go to line 123:

```
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
```

Here, ind, start and end are all numpy.int types, and data of this type cannot be used as indexes, so it is necessary to cast them. The conversion results are as follows:

```
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_weight
```