我有 16 位图像(如果相关,则为灰度),我正在尝试使用 Keras' 进行扩充ImageDataGenerator。现在,我正在使用flow()单个测试图像并保存增强图像的样本(最终我将使用flow_from_directory())。
问题是保存的图像总是饱和的,即图像中的大多数像素的值为 (255, 255, 255)。尽管原始图像的最大值为 65535 中的 ~6000。我的期望是增强图像的最大值为 ~23。
我绝对不想为我的模型提供饱和图像,因为这意味着失去了很多动态范围。任何想法这里发生了什么?
这是我正在使用的代码:
from keras.preprocessing.image import ImageDataGenerator, img_to_array, load_img
test_img = img_to_array(load_img('image10.tif'))
test_img = test_img.reshape((1,) + test_img.shape)
train_datagen = ImageDataGenerator(
rotation_range = 90,
horizontal_flip = True,
vertical_flip = True,
fill_mode = 'constant',
rescale = 1./65535)
i = 0
for batch in train_datagen.flow(test_img_array, batch_size=1, save_to_dir=preview_output, save_prefix='test_img', save_format='tif'):
i += 1
if i > 10:
break
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
547 次 |
| 最近记录: |