retrain.py 文件源码

python
阅读 45 收藏 0 点赞 0 评论 0

项目:Embarrassingly-Parallel-Image-Classification 作者: Azure 项目源码 文件源码
def get_preprocessing():
    def preprocessing_fn(image, output_height=224, output_width=224):
        ''' Resize the image and subtract "mean" RGB values '''
        _R_MEAN = 123.68
        _G_MEAN = 116.78
        _B_MEAN = 103.94
        #image = tf.expand_dims(image, 0)

        temp_dim = np.random.randint(175, 223)
        distorted_image = tf.random_crop(image, [output_height, output_width, 3])
        distorted_image = tf.expand_dims(distorted_image, 0)
        resized_image = tf.image.resize_bilinear(distorted_image, [output_height, output_width], align_corners=False)
        resized_image = tf.squeeze(resized_image)
        resized_image.set_shape([output_height, output_width, 3])
        resized_image = tf.image.random_flip_left_right(resized_image)

        image = tf.to_float(resized_image)
        return(mean_image_subtraction(image, [_R_MEAN, _G_MEAN, _B_MEAN]))
    return(preprocessing_fn)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号