NVIDIA / retinanet-examples

Fast and accurate object detection with end-to-end GPU optimization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

got IndexError

jjxyai opened this issue · comments

boxes = box_head[a, :, y, x]

IndexError: tensors used as indices must be long, byte or bool tensors

https://github.com/NVIDIA/retinanet-examples/blob/main/odtk/box.py#L299

i wonder why use '/' instead of '//' to get the index?

i modified the code to

`

    # classes = indices // width // height % num_classes  # modified

    # classes = classes.type(all_cls_head.type())
    
    # # Infer kept bboxes
    # x = indices % width  # torch.int64

    # y = indices // width % height  # modified

    # a = indices // width // height // num_classes  # modified

`

I agree, I faced the same problem and it makes sense to modify the code as you have documented above. Single '/' in python can give float values, but '//' will give the integer value. After the modification, It's working fine.