符号错误:__call __()有一个意外的关键字参数' force_apply'
我尝试制作一个带有符号符号的简单数据加载器:
train_transforms = A.Compose(
[
A.GaussNoise(always_apply=False, p=0.4, var_limit=(0, 70.0)),
A.Blur(always_apply=False, p=0.3, blur_limit=(3, 7)),
A.RandomResizedCrop(always_apply=False, p=0.2, height=128, width=128, scale=(0.7, 1.0),
ratio=(0.75, 1.3333333333333333), interpolation=0),
A.RGBShift(r_shift_limit=15, g_shift_limit=15, b_shift_limit=15, p=0.5),
A.RandomBrightnessContrast(p=0.5),
transforms.ToTensor()
]
)
class SixKDataset(Dataset):
def __init__(self, data_path, transform=None):
self.data = np.load(data_path, allow_pickle=True)
self.transform = transform
def __len__(self):
return self.data.shape[0]
def __getitem__(self, idx):
ret = np.squeeze(self.data[idx, 0, :, :, :]), np.squeeze(self.data[idx, 1, :, :, :])
if self.transform:
image1 = self.transform(image = ret[0])['image']
image2 = self.transform(image = ret[1])['image']
return image1, image2
return np.squeeze(ret[0]), np.squeeze(ret[1])
但是我会遇到此错误: TypeError:呼叫()有一个意外的关键字参数'force_apply'
我不知道如何解决这个问题
I try to make a simple dataloader with albumentations:
train_transforms = A.Compose(
[
A.GaussNoise(always_apply=False, p=0.4, var_limit=(0, 70.0)),
A.Blur(always_apply=False, p=0.3, blur_limit=(3, 7)),
A.RandomResizedCrop(always_apply=False, p=0.2, height=128, width=128, scale=(0.7, 1.0),
ratio=(0.75, 1.3333333333333333), interpolation=0),
A.RGBShift(r_shift_limit=15, g_shift_limit=15, b_shift_limit=15, p=0.5),
A.RandomBrightnessContrast(p=0.5),
transforms.ToTensor()
]
)
class SixKDataset(Dataset):
def __init__(self, data_path, transform=None):
self.data = np.load(data_path, allow_pickle=True)
self.transform = transform
def __len__(self):
return self.data.shape[0]
def __getitem__(self, idx):
ret = np.squeeze(self.data[idx, 0, :, :, :]), np.squeeze(self.data[idx, 1, :, :, :])
if self.transform:
image1 = self.transform(image = ret[0])['image']
image2 = self.transform(image = ret[1])['image']
return image1, image2
return np.squeeze(ret[0]), np.squeeze(ret[1])
However i get this error:
TypeError: call() got an unexpected keyword argument 'force_apply'
I have no idea how yo fix this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您需要定义其他目标:
然后在 getItem 中使用它们
。 nofollow noreferrer“> https://albumentations.ai/docs/examples/example_multi_target/
I believe you need to define additional targets like so:
and then use them in getitem like so:
https://albumentations.ai/docs/examples/example_multi_target/ look here