[Matplotlib] Flatten()

  • ax.flatten(): Transform n*m to 1*nm 1-D Array
    fig, ax = plt.subplots(nrows=2,ncols=2,sharex='all',sharey='all')
    ax = ax.flatten()  
 
    for i in range(4):
        img = image[i].reshape(28, 28)
        ax[i].imshow(img, cmap='Greys', interpolation='nearest')
        
    # ax[i] is available
  • Without flatten()
    fig, ax = plt.subplots(nrows=2,ncols=2,sharex='all',sharey='all')  
    for i in range(4):
        img = image[i].reshape(28, 28)
        ax[0, 0].imshow(img, cmap='Greys', interpolation='nearest') 
        ax[0, 1].imshow(img, cmap='Greys', interpolation='nearest')
        ax[1, 0].imshow(img, cmap='Greys', interpolation='nearest')
        ax[1, 1].imshow(img, cmap='Greys', interpolation='nearest')
        
    # ax[i] is unavailable
  • Convolutional Neural Networks
  1. We often use Flatten, converting matrice to vectors.
  2. After flattening, then feed the vectors to Fully Connected Layers.
  3. CNN -> Pooling -> CNN -> Pooling...-> Flatten -> Fully Connected Layers -> Softmax -> Probabilities

<<:  [Matplotlib] - Introduction to Charts and Plots

>>:  [笔记]vue-cli i18n 多语系应用练习

DAY28-如何与人协同工作与好好沟通-外国人篇

笔者本人的英文程度可以说是台湾教育典型的英文程度,可是说是好又很不好。 所谓的好又很不好听起来是一种...

网域申请看过来!3步骤带你一次搞定网域名称

网域名称申请,严格说起来就是在想办法获取最後一个点之後的最後一部分。目前大多数台湾品牌网站,都以.c...

Docker基础功能教学

#Docker Install 安装下载相关套件 sudo apt-get update sudo ...

AE-Lightning 雷电云特效1-Day23

今天来练习雷电云的特效 参考来源,六指渊:https://www.sixvfx.com/lightn...

SuiteScript - Entry Point

Schedule Script execute Map/Reduce Script getInput...