0

I´m using Detectron2 for train Faster R-CNN model for object detection and I want to train the model given by model zoo with inputs in the range [0 1] instead [0 255] so I used a Color transform which calls my function scale_transform

def scale_transform(img):
    return img/255.

This function is receiving a numpy array and return it scaled. but, in train time this error appears

RuntimeError: Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should be the same

Someone knows how I can fix this problem? or another way to scale the images for detectron2?

Thanks

4

1 回答 1

0

我认为这里的相关词是type

也许确保输入被定义为浮点数。虽然它在正确的范围 (0-1) 内,但它可能会发现数据类型不正确,因此会在那里跳闸。

以下可能对它 -

def scale_transform(img):
    img = img/255
    img = img.astype(np.float32)
    return img
于 2021-05-10T15:55:32.283 回答