输入图像 dtype 为布尔值.插值不是用布尔数据类型定义的



我在使用Mask_RCNN在具有多个类的自定义数据集上进行训练时遇到了这个问题。

当我开始训练时,会发生此错误。这就是我得到的:

/home/parth/anaconda3/envs/compVision/lib/python3.7/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning. order = _validate_interpolation_order(image.dtype, order)

我一直得到这个一百次,然后内核死了。 请帮忙!!

也许你可以试试skimage版本0.16.2。当我使用0.17.2版本时,我遇到了同样的问题。祝你好运!我不知道为什么。

pip install -U scikit-image==0.16.2

我在用两个类训练 MaskRCNN 模型时也遇到了同样的问题。然后通过命令卸载现有的(我的是 0.19.2(scikit-image:

pip 卸载 scikit-image

并通过以下命令安装了同一软件包的 0.16.2 版本:

pip install scikit-image==0.16.2

注意:使用的张量流和 keras 版本是:

张量流==2.2.0 凯拉斯==2.3.1

我假设您正在尝试转换掩码(即在 Mask_RCNN 中(。如果是这种情况,一种解决方案是按照要求执行(将类型显式转换为其他类型(,然后将其转换回布尔掩码。

更改scikit映像版本实际上只是一个创可贴,最终无法正常工作,因为需要更新与旧的scikit映像版本不兼容的其他软件包。

我在下面提供了一个示例解决方案,我已经验证了该解决方案的运行良好:

# resize the mask cast as uint32 then convert back to bool
img_resized = skimage.util.img_as_bool(skimage.transform.resize(
image.astype(np.uint32), output_shape,
order=order, mode=mode, cval=cval, clip=clip,
preserve_range=preserve_range, anti_aliasing=anti_aliasing,
anti_aliasing_sigma=anti_aliasing_sigma))
return img_resized

希望有帮助。似乎这是一个常见的问题,降级scikit图像不是一个理想的解决方案。

最新更新