Pytorch-yolov3: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.

Created on 21 Aug 2019  路  6Comments  路  Source: eriklindernoren/PyTorch-YOLOv3

when I train yolo v3 on coco, it WARNING that
"/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead."

It's so many! How to fix it?

Most helpful comment

Replace in utils:269

ByteTensor = torch.cuda.ByteTensor if pred_boxes.is_cuda else torch.ByteTensor

With:
BoolTensor = torch.cuda.BoolTensor if pred_boxes.is_cuda else torch.BoolTensor

And it usage in lines 278, 279
obj_mask = BoolTensor(nB, nA, nG, nG).fill_(0)
noobj_mask = BoolTensor(nB, nA, nG, nG).fill_(1)

All 6 comments

image

torch1.2.0--->torch1.1.0
torchvision=0.2.0

I met the same problem. Did you fixed it? @onefish51

I met the same problem. Did you fixed it? @onefish51

https://github.com/eriklindernoren/PyTorch-YOLOv3/blob/master/models.py#L191
obj_mask=obj_mask.bool() # convert int8 to bool
noobj_mask=noobj_mask.bool() #convert int8 to bool

Replace in utils:269

ByteTensor = torch.cuda.ByteTensor if pred_boxes.is_cuda else torch.ByteTensor

With:
BoolTensor = torch.cuda.BoolTensor if pred_boxes.is_cuda else torch.BoolTensor

And it usage in lines 278, 279
obj_mask = BoolTensor(nB, nA, nG, nG).fill_(0)
noobj_mask = BoolTensor(nB, nA, nG, nG).fill_(1)

@paojianghu You should replace
obj_mask=obj_mask.bool() # convert int8 to bool

noobj_mask=noobj_mask.bool() #convert int8 to bool

in utils/utils.py after line 279

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MAP
nationalflag picture nationalflag  路  5Comments

stadtgiraffe picture stadtgiraffe  路  3Comments

FanLu1994 picture FanLu1994  路  3Comments

mayaghaei picture mayaghaei  路  4Comments

0merjavaid picture 0merjavaid  路  4Comments