1. 程式人生 > >tensorflow-解決3個問題

tensorflow-解決3個問題

n) 準確率 markdown 調整 body flow poc div ray

問題一:對特征歸一化

Min-Max Scaling:
X′=a+(X?Xmin)(b?a)/(Xmax?Xmin)
# Problem 1 - Implement Min-Max scaling for grayscale image data
def normalize_grayscale(image_data):
    """
    Normalize the image data with Min-Max scaling to a range of [0.1, 0.9]
    :param image_data: The image data to be normalized
    :return: Normalized image data
    """
    # TODO: Implement Min-Max scaling for grayscale image data
    a = 0.1
    b = 0.9
    grayscal_min=0
    grayscal_max=255
    return a + (((image_data-grayscal_min)*(b-a))/(grayscal_max-grayscal_min))

問題二:用 TensorFlow 創建特征、目標、權重和偏置項 tensor。

問題三:調整學習率,epochs 和 batch size 來獲取最高準確率

tensorflow-解決3個問題