Why is there an error (numpy.float64 cannot be interpreted as in integer) in pytorch sample code
I was trying to run the sample code found here:

https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html

I get a crash in the class CocoEvaluator() constructor in coco_eval.py where the following line of code:

for iou_type in iou_types:
        self.coco_eval[iou_type] = COCOeval(coco_gt, iouType=iou_type)


will crash with the warning "object of type class 'numpy.float64' cannot be safely interpreted as an integer."

iou_type is a string 'bbox'

COCOeval is a class from pycocotools (pycocotools.cocoeval.COCOeval)

coco_gt is the return value from get_coco_api_from_dataset(data_loader.dataset)

its not clear to me where the numpy.float64 value is being used here, or what I can change to fix this



The problem most likely lies in the numpy version. Numpy version 1.18.+ usually throws this error. However when changing to numpy 1.17.4 the problem is fixed.
as shown here
-&gt; https://github.com/pytorch/vision/issues/1700
-&gt; https://www.kaggle.com/questions-and-answers/90865
#check for version number
np.version.version

#downgrade version
!pip install numpy==1.17.4

This fixed it for me, hope it helps.
