将重新缩放层添加到keras模型中



假设我有一个形状为(100,100,3(的输入图像,我想重新缩放图像,即使其更小,并具有一个维度,例如(50,50,3(,即将其重新缩放到一半。如果在重新缩放后将高斯平滑应用于层内的图像,效果会更好。

啊,这很好,我想明白了,

y = layers.Lambda( 
lambda image: tf.image.resize( 
inputs, 
(int(80 * 1/2), int(80 * 1/2)), 
method = tf.image.ResizeMethod.BICUBIC,
#align_corners = True, # possibly important
preserve_aspect_ratio = True
)
)(inputs)

最新更新