问题描述
我正在使用 Imgaug 对我的训练数据进行图像增强。代码如下:
training_augment = iaa.Sequential([iaa.Fliplr(0.5),iaa.Flipud(0.5),iaa.sometimes(0.5,iaa.Rot90((1,3))),iaa.sometimes(0.25,iaa.Affine(rotate=(-30,30),scale=(1.0,1.25),translate_percent={"x": (-0.1,0.1),"y": (-0.1,0.1)},cval=1.0)),iaa.AdditiveGaussianNoise(loc=0,scale=(0.0,0.2),per_channel=0.5)])
以下是错误:
ValueError: Got dtype 'float64',这是一个被禁止的 dtype (uint32,uint64,uint128,uint256,int32,int64,int128,int256,float64,float96,float128,float256)。
使用 AdditiveGuassianNoise 时出现此错误,使用其余部分时,它运行正常。 我不太确定错误意味着什么。如果有人可以提供帮助,将不胜感激。谢谢
def create_augmented_batch(self,index): # call in the training images
image_list,labels_batch = self._create_balanced_batch(index)
if self.augmentation is not None:
image_list = self.augmentation.augment(images=image_list)
return image_list,labels_batch
def __getitem__(self,index):
if self.augmentation is None:
images,labels = self.create_batch(index) # for test images
else:
images,labels = self.create_augmented_batch(index) # for training images
return images[...,np.newaxis],tf.keras.utils.to_categorical(np.array(labels),num_classes=self.num_classes)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)