開始使用免費開始

像自動編碼器一樣去雜訊

好的,你剛剛建立了一個 autoencoder 模型。來看看它如何應對更具挑戰性的任務。

首先,你會建立一個能將影像編碼的模型,並用 show_encodings() 檢視不同數字是如何被表示。為了建立編碼器,你會重用已經訓練好的 autoencoder,只取用網路的前半部,也就是輸入層到瓶頸輸出。如此一來,你會得到 32 維的輸出,代表輸入影像的編碼版本。

接著,你會將 autoencoder 應用到 MNIST 的含雜訊影像上,模型應該能清除雜訊。

X_test_noise 已載入到你的工作環境。這個含雜訊資料集裡的數字長這樣:

發揮自動編碼器的威力吧!

本練習屬於課程

Keras 深度學習入門

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Build your encoder by using the first layer of your autoencoder
encoder = Sequential()
encoder.add(____.layers[____])

# Encode the noisy images and show the encodings for your favorite number [0-9]
encodings = ____.predict(____)
show_encodings(____, number = 1)
編輯並執行程式碼