- Hands-On Deep Learning for Games
- Micheal Lanham
- 269字
- 2021-06-24 15:47:56
Examining the output
Our final step this time around will be to see what is actually happening with the images. We will finish this exercise by outputting a small sample of images in order to get our success rate. Follow along in the next exercise in order to finish the code and run the autoencoder:
- Continuing from the last exercise, locate the following last section of code:
import matplotlib.pyplot as plt
n = 10 # how many digits we will display
plt.figure(figsize=(20, 4))
for i in range(n):
# display original
ax = plt.subplot(2, n, i + 1)
plt.imshow(x_test[i].reshape(28, 28))
plt.gray()
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
# display reconstruction
ax = plt.subplot(2, n, i + 1 + n)
plt.imshow(decoded_imgs[i].reshape(28, 28))
plt.gray()
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
plt.show()
- In this section of code, we are just outputting the input and resultant auto-encoded images after all the training is done. This section of code starts with importing mathplotlib for plotting, and then we loop through a number of images to display the results. The rest of the code just outputs the images.
- Run the Python code as you normally would, and this time expect the training to take several minutes. After everything is done, you should see an image similar to the following:

Example of raw input images compared to encoded and decoded output images
That completes our look into building a simple Keras model that can encode and then decode images. This allows us to see how each small piece of a multilayer neural network is written in Keras functions. In the final section, we invite you, the reader, to undertake some additional exercises for further learning.
推薦閱讀
- 數(shù)據(jù)庫(kù)基礎(chǔ)教程(SQL Server平臺(tái))
- 卷積神經(jīng)網(wǎng)絡(luò)的Python實(shí)現(xiàn)
- 區(qū)塊鏈通俗讀本
- “互聯(lián)網(wǎng)+”時(shí)代立體化計(jì)算機(jī)組
- Construct 2 Game Development by Example
- Chef Essentials
- Unreal Engine Virtual Reality Quick Start Guide
- Web Services Testing with soapUI
- 數(shù)據(jù)庫(kù)與數(shù)據(jù)處理:Access 2010實(shí)現(xiàn)
- Doris實(shí)時(shí)數(shù)倉(cāng)實(shí)戰(zhàn)
- 數(shù)據(jù)應(yīng)用工程:方法論與實(shí)踐
- 領(lǐng)域驅(qū)動(dòng)設(shè)計(jì)精粹
- 碼上行動(dòng):利用Python與ChatGPT高效搞定Excel數(shù)據(jù)分析
- 代碼的未來(lái)
- Python金融數(shù)據(jù)挖掘與分析實(shí)戰(zhàn)