iT邦幫忙

0

[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

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言