【发布时间】:2017-01-20 16:35:26
【问题描述】:
我需要增强多通道图像并想使用 ImageDataGenerator 不幸的是,它只支持 1,3 和 4 通道图像,我需要更多。直接编辑 site-packages/Keras/preprocessing/image.py 添加必要数量的频道可以吗?
if x.shape[self.channel_axis] not in {1, 3, 4, XXX}:
raise ValueError(
'Expected input to be images (as Numpy array) '
'following the dimension ordering convention "' + self.dim_ordering + '" '
'(channels on axis ' + str(self.channel_axis) + '), i.e. expected '
'either 1, 3 or 4 channels on axis ' + str(self.channel_axis) + '. '
'However, it was passed an array with shape ' + str(x.shape) +
' (' + str(x.shape[self.channel_axis]) + ' channels).')
其中 XXX - 是我需要的多个频道。这会破坏什么吗? 谢谢!
【问题讨论】: