ValueError: Got dtype 'float64', which is a forbidden dtype

def __getitem__(self, i: int) -> Tuple[torch.Tensor, torch.Tensor]:
    _id = self.__image_ids[i]
    paths = self.__id2path(_id)
    print("step -1")
    image = self.__load_n_preprocess(paths["image_path"])
    mask = self.__load_n_preprocess(paths["mask_path"])
    print("step 0")
    if self.__transforms is not None:
        segmap = SegmentationMapsOnImage(mask, shape=mask.shape)
        print("step 1")
        image, mask = self.__transforms(image=image, segmentation_maps=segmap)
        print("step 2")
    image = torch.from_numpy(image)
    mask = torch.from_numpy(mask)
    image = image.permute(2, 0, 1)
    mask = mask.permute(2, 0, 1)
    print("step 3")
    return image, mask

ERROR

ValueError: Got dtype 'float64', which is a forbidden dtype (bool, uint16, uint32, uint64, uint128, uint256, int32, int64, int128, int256, float16, float32, float64, float96, float128, float256).

‘data.py’ file includes function above. I detected error with my extraordinary debug style :slight_smile: I cannot see “step 2” in results. What should I do ?

image, mask = self.__transforms(image=image, segmentation_maps=segmap)

Thanks in advance!

In the imgaug package, for color-related image augmentations, only np.uint8 is supported. Additionally, some other image augmentation methods apart from color-related ones may not necessarily support float64.

I can’t figure out what method you used, but maybe you can check the following URL for confirmation

https://imgaug.readthedocs.io/en/latest/source/dtype_support.html