Image Classification

In this project, you'll classify images from the CIFAR-10 dataset. The dataset consists of airplanes, dogs, cats, and other objects. You'll preprocess the images, then train a convolutional neural network on all the samples. The images need to be normalized and the labels need to be one-hot encoded. You'll get to apply what you learned and build a convolutional, max pooling, dropout, and fully connected layers. At the end, you'll get to see your neural network's predictions on the sample images.

Get the Data

Run the following cell to download the CIFAR-10 dataset for python.


In [1]:
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile

cifar10_dataset_folder_path = 'cifar-10-batches-py'

class DLProgress(tqdm):
    last_block = 0

    def hook(self, block_num=1, block_size=1, total_size=None):
        self.total = total_size
        self.update((block_num - self.last_block) * block_size)
        self.last_block = block_num

if not isfile('cifar-10-python.tar.gz'):
    with DLProgress(unit='B', unit_scale=True, miniters=1, desc='CIFAR-10 Dataset') as pbar:
        urlretrieve(
            'https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz',
            'cifar-10-python.tar.gz',
            pbar.hook)

if not isdir(cifar10_dataset_folder_path):
    with tarfile.open('cifar-10-python.tar.gz') as tar:
        tar.extractall()
        tar.close()


tests.test_folder_path(cifar10_dataset_folder_path)


All files found!

Explore the Data

The dataset is broken into batches to prevent your machine from running out of memory. The CIFAR-10 dataset consists of 5 batches, named data_batch_1, data_batch_2, etc.. Each batch contains the labels and images that are one of the following:

  • airplane
  • automobile
  • bird
  • cat
  • deer
  • dog
  • frog
  • horse
  • ship
  • truck

Understanding a dataset is part of making predictions on the data. Play around with the code cell below by changing the batch_id and sample_id. The batch_id is the id for a batch (1-5). The sample_id is the id for a image and label pair in the batch.

Ask yourself "What are all possible labels?", "What is the range of values for the image data?", "Are the labels in order or random?". Answers to questions like these will help you preprocess the data and end up with better predictions.


In [2]:
%matplotlib inline
%config InlineBackend.figure_format = 'retina'

import helper
import numpy as np
import matplotlib.pyplot as plt

# Explore the dataset
batch_id = 1
sample_id = 5
helper.display_stats(cifar10_dataset_folder_path, batch_id, sample_id)


Stats of batch 1:
Samples: 10000
Label Counts: {0: 1005, 1: 974, 2: 1032, 3: 1016, 4: 999, 5: 937, 6: 1030, 7: 1001, 8: 1025, 9: 981}
First 20 Labels: [6, 9, 9, 4, 1, 1, 2, 7, 8, 3, 4, 7, 7, 2, 9, 9, 9, 3, 2, 6]

Example of Image 5:
Image - Min Value: 0 Max Value: 252
Image - Shape: (32, 32, 3)
Label - Label Id: 1 Name: automobile

In [3]:
#histogram of labels in batch
features, labels = helper.load_cfar10_batch(cifar10_dataset_folder_path, batch_id)
plt.hist(labels)
plt.show()
#labels seem to be evenly distributed and not in order. The shape of the images is 32x32x3


Implement Preprocess Functions

Normalize

In the cell below, implement the normalize function to take in image data, x, and return it as a normalized Numpy array. The values should be in the range of 0 to 1, inclusive. The return object should be the same shape as x.


In [4]:
def normalize(x):
    """
    Normalize a list of sample image data in the range of 0 to 1
    : x: List of image data.  The image shape is (32, 32, 3)
    : return: Numpy array of normalize data
    """
    # TODO: Implement Function
    print((x-x.min())/(x.max()-x.min()))
    return (x-x.min())/(x.max()-x.min())


"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_normalize(normalize)


[[[[ 0.10980392  0.45490196  0.5372549 ]
   [ 0.44313725  0.06666667  0.38823529]
   [ 0.11764706  0.51764706  0.21960784]
   ..., 
   [ 0.42745098  0.02745098  0.6       ]
   [ 0.49803922  0.39215686  0.36470588]
   [ 0.2745098   0.04313725  0.43529412]]

  [[ 0.76470588  0.31372549  0.5372549 ]
   [ 0.90196078  0.29803922  0.72156863]
   [ 0.94509804  0.92156863  0.00784314]
   ..., 
   [ 0.69019608  0.95686275  0.63137255]
   [ 0.36078431  0.17647059  0.45882353]
   [ 0.15294118  0.45098039  0.54901961]]

  [[ 0.78039216  0.58039216  0.62745098]
   [ 0.23137255  0.39607843  0.71764706]
   [ 0.2         0.2         0.16470588]
   ..., 
   [ 0.00392157  0.29019608  0.58039216]
   [ 0.53333333  0.98823529  0.45490196]
   [ 0.04705882  0.14901961  0.1372549 ]]

  ..., 
  [[ 0.11764706  0.03529412  0.54901961]
   [ 0.28627451  0.65098039  0.18823529]
   [ 0.36470588  0.36470588  0.19607843]
   ..., 
   [ 0.51372549  0.84705882  0.32156863]
   [ 0.38039216  0.61176471  0.80784314]
   [ 0.74117647  0.40392157  0.8745098 ]]

  [[ 0.85490196  0.04705882  0.40784314]
   [ 0.5372549   0.75294118  0.19215686]
   [ 0.70196078  0.65490196  0.83529412]
   ..., 
   [ 0.58039216  0.43921569  0.8       ]
   [ 0.70980392  0.45490196  0.64705882]
   [ 0.78823529  0.56470588  0.34117647]]

  [[ 0.43529412  0.15686275  0.54509804]
   [ 0.01568627  0.49411765  0.42352941]
   [ 0.27843137  0.85098039  0.05882353]
   ..., 
   [ 0.19607843  0.55686275  1.        ]
   [ 0.78039216  0.94901961  0.99215686]
   [ 0.61176471  0.92941176  0.18823529]]]


 [[[ 0.78039216  0.61176471  0.53333333]
   [ 0.01176471  0.39215686  0.83921569]
   [ 0.78431373  0.46666667  0.50588235]
   ..., 
   [ 0.11764706  0.60392157  0.43137255]
   [ 0.35686275  0.38431373  0.17647059]
   [ 0.19607843  0.34509804  0.58039216]]

  [[ 0.39607843  0.79215686  0.98823529]
   [ 0.32156863  0.93333333  0.42745098]
   [ 0.18823529  0.7372549   0.27058824]
   ..., 
   [ 0.4627451   0.54117647  0.72156863]
   [ 0.41960784  0.30980392  0.87843137]
   [ 0.38039216  0.2627451   0.96078431]]

  [[ 0.31764706  0.91372549  0.43921569]
   [ 0.87843137  0.38039216  0.45098039]
   [ 0.83137255  0.00392157  0.22745098]
   ..., 
   [ 0.24705882  0.19215686  0.80392157]
   [ 0.87058824  0.9372549   0.2       ]
   [ 0.65490196  0.91372549  0.85490196]]

  ..., 
  [[ 0.45882353  0.03137255  0.48627451]
   [ 0.0627451   0.82352941  0.25882353]
   [ 0.50980392  0.91764706  0.28235294]
   ..., 
   [ 0.4627451   0.39215686  0.57254902]
   [ 0.56078431  0.36078431  0.97647059]
   [ 0.10196078  0.47843137  0.37647059]]

  [[ 0.41960784  0.97254902  0.85490196]
   [ 0.25098039  0.5372549   0.41176471]
   [ 0.02352941  0.66666667  0.94901961]
   ..., 
   [ 0.03137255  0.08235294  0.49019608]
   [ 0.85882353  0.24705882  0.18823529]
   [ 0.01568627  0.56470588  0.67058824]]

  [[ 0.58039216  0.37647059  0.74901961]
   [ 0.52941176  0.64313725  0.20784314]
   [ 0.94901961  0.85098039  0.35294118]
   ..., 
   [ 0.9254902   0.74509804  0.59607843]
   [ 0.10196078  0.85882353  0.50588235]
   [ 0.00392157  0.7254902   0.47843137]]]


 [[[ 0.19215686  0.0745098   0.11764706]
   [ 0.74509804  0.09019608  0.73333333]
   [ 0.96862745  0.87058824  0.86666667]
   ..., 
   [ 0.51372549  0.04313725  0.41960784]
   [ 0.08627451  0.01568627  0.96078431]
   [ 0.06666667  0.32941176  0.27843137]]

  [[ 0.36078431  0.60392157  0.29411765]
   [ 0.74117647  1.          0.34509804]
   [ 0.89803922  0.0745098   0.69411765]
   ..., 
   [ 0.87843137  0.44313725  0.80392157]
   [ 0.41568627  0.48627451  0.33333333]
   [ 0.17647059  0.20392157  0.31372549]]

  [[ 0.29019608  0.75686275  0.03921569]
   [ 0.83921569  0.57254902  0.14509804]
   [ 0.50588235  0.04705882  0.66666667]
   ..., 
   [ 0.85490196  0.52156863  0.30196078]
   [ 0.42745098  0.74117647  0.20392157]
   [ 0.1254902   0.8         0.43529412]]

  ..., 
  [[ 0.56470588  0.50588235  0.77647059]
   [ 0.94117647  0.65098039  0.94901961]
   [ 0.2627451   0.01176471  0.90980392]
   ..., 
   [ 0.43137255  0.88627451  0.25882353]
   [ 0.05490196  0.29803922  0.6745098 ]
   [ 0.18823529  0.22745098  0.96862745]]

  [[ 0.11764706  0.61568627  0.50588235]
   [ 0.92941176  0.9254902   0.23137255]
   [ 0.14117647  0.85882353  0.94901961]
   ..., 
   [ 0.97254902  0.65882353  0.95686275]
   [ 0.40784314  0.36470588  0.58823529]
   [ 0.79607843  0.31764706  0.85490196]]

  [[ 0.06666667  0.92156863  0.54901961]
   [ 0.5254902   0.66666667  0.77254902]
   [ 0.65490196  0.49019608  0.72156863]
   ..., 
   [ 0.43921569  0.73333333  0.10588235]
   [ 0.21568627  0.56078431  0.90588235]
   [ 0.4         0.3254902   0.79607843]]]


 ..., 
 [[[ 0.35686275  0.10980392  0.94117647]
   [ 0.21568627  0.29803922  0.74901961]
   [ 0.02745098  0.58431373  0.94117647]
   ..., 
   [ 0.94117647  0.95686275  0.61176471]
   [ 0.10588235  0.58039216  0.25098039]
   [ 0.58431373  0.41176471  0.35294118]]

  [[ 0.58823529  0.98039216  0.26666667]
   [ 0.67058824  0.72156863  0.74509804]
   [ 0.30196078  0.43529412  0.80784314]
   ..., 
   [ 0.77254902  0.62352941  0.53333333]
   [ 0.27058824  0.03921569  0.6627451 ]
   [ 0.80392157  0.86666667  0.30588235]]

  [[ 0.69803922  0.19215686  0.4627451 ]
   [ 0.91764706  0.18431373  0.61960784]
   [ 0.0745098   0.03137255  0.4627451 ]
   ..., 
   [ 0.16078431  0.4745098   0.69411765]
   [ 0.23921569  0.43921569  0.52941176]
   [ 0.98431373  0.96078431  0.90588235]]

  ..., 
  [[ 0.01568627  0.90588235  0.16470588]
   [ 0.14509804  0.78823529  0.63137255]
   [ 0.98823529  0.89411765  0.05098039]
   ..., 
   [ 0.64313725  0.96470588  0.29019608]
   [ 0.1254902   0.9254902   0.21568627]
   [ 0.83529412  0.57254902  0.01176471]]

  [[ 0.95294118  0.17647059  1.        ]
   [ 0.68627451  0.91372549  0.2745098 ]
   [ 0.4745098   0.82352941  0.94509804]
   ..., 
   [ 1.          0.58823529  0.8627451 ]
   [ 0.68627451  0.08235294  0.21568627]
   [ 0.74509804  0.66666667  0.04705882]]

  [[ 0.01176471  0.40784314  0.42352941]
   [ 0.14901961  0.81568627  0.48627451]
   [ 0.99607843  0.25882353  0.76078431]
   ..., 
   [ 0.17254902  0.68235294  0.2745098 ]
   [ 0.09411765  0.37647059  0.57647059]
   [ 0.34509804  0.50588235  0.34117647]]]


 [[[ 0.50588235  0.6         0.44313725]
   [ 0.52156863  0.25490196  0.85098039]
   [ 0.54901961  0.7254902   0.23137255]
   ..., 
   [ 0.28235294  0.5254902   0.47058824]
   [ 0.29019608  0.36078431  0.29411765]
   [ 0.21960784  0.51764706  0.9254902 ]]

  [[ 0.26666667  0.08627451  0.63529412]
   [ 0.82352941  0.62352941  0.42745098]
   [ 0.60392157  0.79215686  0.75294118]
   ..., 
   [ 0.13333333  0.20392157  0.36862745]
   [ 0.16862745  0.90196078  1.        ]
   [ 0.76078431  0.71372549  0.44313725]]

  [[ 0.74117647  0.87058824  0.24705882]
   [ 0.03921569  0.87058824  0.92941176]
   [ 0.44705882  0.05098039  0.4       ]
   ..., 
   [ 0.96078431  0.66666667  0.41176471]
   [ 0.11764706  0.58823529  0.69411765]
   [ 0.89411765  0.34901961  0.12941176]]

  ..., 
  [[ 0.02352941  0.5254902   0.39215686]
   [ 0.71764706  0.24313725  0.54901961]
   [ 0.9254902   0.78431373  0.63921569]
   ..., 
   [ 0.01960784  1.          0.56470588]
   [ 0.91764706  0.57647059  0.83137255]
   [ 0.70588235  0.88235294  0.37647059]]

  [[ 0.26666667  0.63921569  0.76078431]
   [ 0.45098039  0.65882353  0.99215686]
   [ 0.01176471  0.47058824  0.19215686]
   ..., 
   [ 0.18039216  0.11764706  0.30588235]
   [ 0.34509804  0.18039216  0.34509804]
   [ 0.64705882  0.7372549   0.88235294]]

  [[ 0.00392157  0.5254902   0.14509804]
   [ 0.95686275  0.16470588  0.5254902 ]
   [ 0.0627451   0.55294118  0.6       ]
   ..., 
   [ 0.20392157  0.06666667  0.21960784]
   [ 0.81960784  0.03921569  0.84705882]
   [ 0.23137255  0.29803922  0.03921569]]]


 [[[ 0.38431373  0.71372549  0.77647059]
   [ 0.0627451   0.22352941  0.43921569]
   [ 0.30196078  0.34901961  0.9372549 ]
   ..., 
   [ 0.23921569  0.39215686  0.61176471]
   [ 0.23529412  0.34509804  0.83921569]
   [ 0.92941176  0.19215686  0.66666667]]

  [[ 0.23137255  0.20392157  0.80784314]
   [ 0.47058824  0.81176471  0.76862745]
   [ 0.7372549   0.41568627  0.3372549 ]
   ..., 
   [ 0.64705882  0.89803922  0.65098039]
   [ 0.90588235  0.45098039  0.54901961]
   [ 0.65490196  0.56862745  0.91764706]]

  [[ 0.05490196  0.46666667  0.9254902 ]
   [ 0.66666667  0.26666667  0.38823529]
   [ 0.00392157  0.70196078  0.58431373]
   ..., 
   [ 0.16078431  0.69019608  0.96862745]
   [ 0.92156863  0.58039216  0.57647059]
   [ 0.3372549   0.25882353  0.04313725]]

  ..., 
  [[ 0.00392157  0.8627451   0.13333333]
   [ 0.02745098  0.13333333  0.76470588]
   [ 0.62745098  0.07058824  0.8745098 ]
   ..., 
   [ 0.78823529  0.99215686  0.20784314]
   [ 0.86666667  0.52156863  0.34901961]
   [ 0.00784314  0.65882353  0.70588235]]

  [[ 0.14117647  0.01176471  0.00784314]
   [ 0.41176471  0.60784314  0.48235294]
   [ 0.23137255  0.5254902   0.25098039]
   ..., 
   [ 0.12941176  0.82352941  0.39607843]
   [ 0.35294118  0.39215686  0.50588235]
   [ 0.75294118  0.54901961  0.43137255]]

  [[ 0.25882353  0.38431373  0.47843137]
   [ 0.61176471  0.60784314  0.11764706]
   [ 0.52941176  0.16470588  0.07843137]
   ..., 
   [ 0.40392157  0.42745098  0.17254902]
   [ 0.69803922  0.18823529  0.0627451 ]
   [ 0.62352941  0.37254902  0.49411765]]]]
Tests Passed

One-hot encode

Just like the previous code cell, you'll be implementing a function for preprocessing. This time, you'll implement the one_hot_encode function. The input, x, are a list of labels. Implement the function to return the list of labels as One-Hot encoded Numpy array. The possible values for labels are 0 to 9. The one-hot encoding function should return the same encoding for each value between each call to one_hot_encode. Make sure to save the map of encodings outside the function.

Hint: Don't reinvent the wheel.


In [5]:
n_labels = 10
encoding_map = np.eye(n_labels)
def one_hot_encode(x):
    """
    One hot encode a list of sample labels. Return a one-hot encoded vector for each label.
    : x: List of sample Labels
    : return: Numpy array of one-hot encoded labels
    """
    # TODO: Implement Function
    return np.array([encoding_map[label] for label in x])


"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_one_hot_encode(one_hot_encode)


Tests Passed

Randomize Data

As you saw from exploring the data above, the order of the samples are randomized. It doesn't hurt to randomize it again, but you don't need to for this dataset.

Preprocess all the data and save it

Running the code cell below will preprocess all the CIFAR-10 data and save it to file. The code below also uses 10% of the training data for validation.


In [6]:
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
# Preprocess Training, Validation, and Testing Data
helper.preprocess_and_save_data(cifar10_dataset_folder_path, normalize, one_hot_encode)


[[[[ 0.23137255  0.24313725  0.24705882]
   [ 0.16862745  0.18039216  0.17647059]
   [ 0.19607843  0.18823529  0.16862745]
   ..., 
   [ 0.61960784  0.51764706  0.42352941]
   [ 0.59607843  0.49019608  0.4       ]
   [ 0.58039216  0.48627451  0.40392157]]

  [[ 0.0627451   0.07843137  0.07843137]
   [ 0.          0.          0.        ]
   [ 0.07058824  0.03137255  0.        ]
   ..., 
   [ 0.48235294  0.34509804  0.21568627]
   [ 0.46666667  0.3254902   0.19607843]
   [ 0.47843137  0.34117647  0.22352941]]

  [[ 0.09803922  0.09411765  0.08235294]
   [ 0.0627451   0.02745098  0.        ]
   [ 0.19215686  0.10588235  0.03137255]
   ..., 
   [ 0.4627451   0.32941176  0.19607843]
   [ 0.47058824  0.32941176  0.19607843]
   [ 0.42745098  0.28627451  0.16470588]]

  ..., 
  [[ 0.81568627  0.66666667  0.37647059]
   [ 0.78823529  0.6         0.13333333]
   [ 0.77647059  0.63137255  0.10196078]
   ..., 
   [ 0.62745098  0.52156863  0.2745098 ]
   [ 0.21960784  0.12156863  0.02745098]
   [ 0.20784314  0.13333333  0.07843137]]

  [[ 0.70588235  0.54509804  0.37647059]
   [ 0.67843137  0.48235294  0.16470588]
   [ 0.72941176  0.56470588  0.11764706]
   ..., 
   [ 0.72156863  0.58039216  0.36862745]
   [ 0.38039216  0.24313725  0.13333333]
   [ 0.3254902   0.20784314  0.13333333]]

  [[ 0.69411765  0.56470588  0.45490196]
   [ 0.65882353  0.50588235  0.36862745]
   [ 0.70196078  0.55686275  0.34117647]
   ..., 
   [ 0.84705882  0.72156863  0.54901961]
   [ 0.59215686  0.4627451   0.32941176]
   [ 0.48235294  0.36078431  0.28235294]]]


 [[[ 0.60392157  0.69411765  0.73333333]
   [ 0.49411765  0.5372549   0.53333333]
   [ 0.41176471  0.40784314  0.37254902]
   ..., 
   [ 0.35686275  0.37254902  0.27843137]
   [ 0.34117647  0.35294118  0.27843137]
   [ 0.30980392  0.31764706  0.2745098 ]]

  [[ 0.54901961  0.62745098  0.6627451 ]
   [ 0.56862745  0.6         0.60392157]
   [ 0.49019608  0.49019608  0.4627451 ]
   ..., 
   [ 0.37647059  0.38823529  0.30588235]
   [ 0.30196078  0.31372549  0.24313725]
   [ 0.27843137  0.28627451  0.23921569]]

  [[ 0.54901961  0.60784314  0.64313725]
   [ 0.54509804  0.57254902  0.58431373]
   [ 0.45098039  0.45098039  0.43921569]
   ..., 
   [ 0.30980392  0.32156863  0.25098039]
   [ 0.26666667  0.2745098   0.21568627]
   [ 0.2627451   0.27058824  0.21568627]]

  ..., 
  [[ 0.68627451  0.65490196  0.65098039]
   [ 0.61176471  0.60392157  0.62745098]
   [ 0.60392157  0.62745098  0.66666667]
   ..., 
   [ 0.16470588  0.13333333  0.14117647]
   [ 0.23921569  0.20784314  0.22352941]
   [ 0.36470588  0.3254902   0.35686275]]

  [[ 0.64705882  0.60392157  0.50196078]
   [ 0.61176471  0.59607843  0.50980392]
   [ 0.62352941  0.63137255  0.55686275]
   ..., 
   [ 0.40392157  0.36470588  0.37647059]
   [ 0.48235294  0.44705882  0.47058824]
   [ 0.51372549  0.4745098   0.51372549]]

  [[ 0.63921569  0.58039216  0.47058824]
   [ 0.61960784  0.58039216  0.47843137]
   [ 0.63921569  0.61176471  0.52156863]
   ..., 
   [ 0.56078431  0.52156863  0.54509804]
   [ 0.56078431  0.5254902   0.55686275]
   [ 0.56078431  0.52156863  0.56470588]]]


 [[[ 1.          1.          1.        ]
   [ 0.99215686  0.99215686  0.99215686]
   [ 0.99215686  0.99215686  0.99215686]
   ..., 
   [ 0.99215686  0.99215686  0.99215686]
   [ 0.99215686  0.99215686  0.99215686]
   [ 0.99215686  0.99215686  0.99215686]]

  [[ 1.          1.          1.        ]
   [ 1.          1.          1.        ]
   [ 1.          1.          1.        ]
   ..., 
   [ 1.          1.          1.        ]
   [ 1.          1.          1.        ]
   [ 1.          1.          1.        ]]

  [[ 1.          1.          1.        ]
   [ 0.99607843  0.99607843  0.99607843]
   [ 0.99607843  0.99607843  0.99607843]
   ..., 
   [ 0.99607843  0.99607843  0.99607843]
   [ 0.99607843  0.99607843  0.99607843]
   [ 0.99607843  0.99607843  0.99607843]]

  ..., 
  [[ 0.44313725  0.47058824  0.43921569]
   [ 0.43529412  0.4627451   0.43529412]
   [ 0.41176471  0.43921569  0.41568627]
   ..., 
   [ 0.28235294  0.31764706  0.31372549]
   [ 0.28235294  0.31372549  0.30980392]
   [ 0.28235294  0.31372549  0.30980392]]

  [[ 0.43529412  0.4627451   0.43137255]
   [ 0.40784314  0.43529412  0.40784314]
   [ 0.38823529  0.41568627  0.38431373]
   ..., 
   [ 0.26666667  0.29411765  0.28627451]
   [ 0.2745098   0.29803922  0.29411765]
   [ 0.30588235  0.32941176  0.32156863]]

  [[ 0.41568627  0.44313725  0.41176471]
   [ 0.38823529  0.41568627  0.38431373]
   [ 0.37254902  0.4         0.36862745]
   ..., 
   [ 0.30588235  0.33333333  0.3254902 ]
   [ 0.30980392  0.33333333  0.3254902 ]
   [ 0.31372549  0.3372549   0.32941176]]]


 ..., 
 [[[ 0.27058824  0.27843137  0.20392157]
   [ 0.24313725  0.24313725  0.19215686]
   [ 0.22745098  0.22352941  0.18823529]
   ..., 
   [ 0.4627451   0.49019608  0.31372549]
   [ 0.4745098   0.49019608  0.28627451]
   [ 0.48235294  0.50588235  0.29019608]]

  [[ 0.2745098   0.27843137  0.19215686]
   [ 0.23137255  0.22745098  0.18431373]
   [ 0.2         0.19215686  0.16862745]
   ..., 
   [ 0.48235294  0.48235294  0.3254902 ]
   [ 0.45882353  0.47843137  0.29803922]
   [ 0.41568627  0.43921569  0.25490196]]

  [[ 0.28627451  0.28235294  0.18431373]
   [ 0.25490196  0.24705882  0.17647059]
   [ 0.20392157  0.19607843  0.17254902]
   ..., 
   [ 0.47058824  0.46666667  0.30980392]
   [ 0.45098039  0.45098039  0.27058824]
   [ 0.42745098  0.43529412  0.26666667]]

  ..., 
  [[ 0.76862745  0.82352941  0.37254902]
   [ 0.79215686  0.82745098  0.42745098]
   [ 0.76078431  0.78823529  0.41176471]
   ..., 
   [ 0.77647059  0.84313725  0.35294118]
   [ 0.81568627  0.85882353  0.42352941]
   [ 0.83137255  0.88235294  0.43529412]]

  [[ 0.74509804  0.80784314  0.36862745]
   [ 0.74901961  0.80784314  0.37254902]
   [ 0.74509804  0.80392157  0.36470588]
   ..., 
   [ 0.77647059  0.83921569  0.36862745]
   [ 0.76470588  0.81568627  0.37254902]
   [ 0.80784314  0.8627451   0.41960784]]

  [[ 0.71764706  0.76470588  0.36470588]
   [ 0.72156863  0.77254902  0.37647059]
   [ 0.71372549  0.75686275  0.36078431]
   ..., 
   [ 0.75686275  0.81176471  0.35686275]
   [ 0.74117647  0.8         0.34117647]
   [ 0.77647059  0.82745098  0.39215686]]]


 [[[ 0.61960784  0.61960784  0.61960784]
   [ 0.61960784  0.61960784  0.61568627]
   [ 0.61960784  0.62352941  0.60392157]
   ..., 
   [ 0.61176471  0.61568627  0.59607843]
   [ 0.61176471  0.61568627  0.59607843]
   [ 0.61176471  0.61176471  0.59215686]]

  [[ 0.61568627  0.61568627  0.61568627]
   [ 0.61960784  0.61960784  0.61568627]
   [ 0.61568627  0.61568627  0.60784314]
   ..., 
   [ 0.61176471  0.61568627  0.6       ]
   [ 0.61176471  0.61568627  0.59607843]
   [ 0.61176471  0.61176471  0.59607843]]

  [[ 0.61176471  0.61176471  0.61176471]
   [ 0.61568627  0.61568627  0.61176471]
   [ 0.61568627  0.61568627  0.60784314]
   ..., 
   [ 0.60784314  0.60784314  0.6       ]
   [ 0.60784314  0.60784314  0.6       ]
   [ 0.60784314  0.60784314  0.6       ]]

  ..., 
  [[ 0.22745098  0.26666667  0.26666667]
   [ 0.24313725  0.28235294  0.29019608]
   [ 0.21960784  0.25882353  0.2627451 ]
   ..., 
   [ 0.24313725  0.2745098   0.30196078]
   [ 0.18823529  0.22352941  0.23137255]
   [ 0.22352941  0.25882353  0.26666667]]

  [[ 0.20392157  0.24313725  0.23921569]
   [ 0.23529412  0.27058824  0.27843137]
   [ 0.16862745  0.20392157  0.20392157]
   ..., 
   [ 0.25882353  0.29803922  0.30980392]
   [ 0.21568627  0.25882353  0.2627451 ]
   [ 0.23529412  0.2745098   0.29019608]]

  [[ 0.19607843  0.22745098  0.23137255]
   [ 0.2         0.21960784  0.21960784]
   [ 0.20784314  0.23529412  0.23921569]
   ..., 
   [ 0.18039216  0.21176471  0.21176471]
   [ 0.22745098  0.25882353  0.26666667]
   [ 0.23921569  0.28235294  0.29019608]]]


 [[[ 0.76862745  0.67058824  0.51372549]
   [ 0.76862745  0.6745098   0.51372549]
   [ 0.75686275  0.65882353  0.50196078]
   ..., 
   [ 0.69411765  0.6         0.50980392]
   [ 0.67058824  0.57647059  0.48627451]
   [ 0.64705882  0.55294118  0.45882353]]

  [[ 0.77647059  0.67843137  0.52156863]
   [ 0.77647059  0.67843137  0.52156863]
   [ 0.76470588  0.6627451   0.50588235]
   ..., 
   [ 0.69803922  0.60784314  0.51764706]
   [ 0.6745098   0.58431373  0.49411765]
   [ 0.65490196  0.56470588  0.47058824]]

  [[ 0.76862745  0.67058824  0.51764706]
   [ 0.76862745  0.67058824  0.51764706]
   [ 0.75294118  0.65490196  0.50196078]
   ..., 
   [ 0.69019608  0.60392157  0.51764706]
   [ 0.66666667  0.58431373  0.49411765]
   [ 0.64705882  0.56078431  0.4745098 ]]

  ..., 
  [[ 0.7372549   0.61960784  0.40392157]
   [ 0.7372549   0.62745098  0.40392157]
   [ 0.74117647  0.62745098  0.4       ]
   ..., 
   [ 0.8         0.74509804  0.69803922]
   [ 0.78431373  0.74117647  0.70196078]
   [ 0.76862745  0.71764706  0.68235294]]

  [[ 0.74117647  0.62352941  0.40392157]
   [ 0.74117647  0.62745098  0.40784314]
   [ 0.74509804  0.63137255  0.4       ]
   ..., 
   [ 0.80392157  0.74509804  0.68627451]
   [ 0.78431373  0.73333333  0.69019608]
   [ 0.77254902  0.71764706  0.67843137]]

  [[ 0.72156863  0.60392157  0.39215686]
   [ 0.72156863  0.61176471  0.39215686]
   [ 0.72156863  0.60784314  0.38039216]
   ..., 
   [ 0.78039216  0.71372549  0.64705882]
   [ 0.76862745  0.70588235  0.65490196]
   [ 0.75686275  0.69411765  0.65098039]]]]
[[[[ 0.1372549   0.09803922  0.10196078]
   [ 0.10588235  0.08235294  0.08235294]
   [ 0.09803922  0.07843137  0.0745098 ]
   ..., 
   [ 0.51764706  0.50588235  0.50588235]
   [ 0.52156863  0.4745098   0.45490196]
   [ 0.49411765  0.45098039  0.44313725]]

  [[ 0.24705882  0.21568627  0.19607843]
   [ 0.1254902   0.10588235  0.08235294]
   [ 0.06666667  0.05098039  0.03137255]
   ..., 
   [ 0.4         0.37254902  0.34509804]
   [ 0.41176471  0.34901961  0.29803922]
   [ 0.39215686  0.3372549   0.30196078]]

  [[ 0.38823529  0.35686275  0.32941176]
   [ 0.19215686  0.17647059  0.14509804]
   [ 0.05882353  0.04705882  0.01960784]
   ..., 
   [ 0.18039216  0.16862745  0.15294118]
   [ 0.20392157  0.16078431  0.13333333]
   [ 0.20392157  0.17254902  0.16078431]]

  ..., 
  [[ 0.65098039  0.64705882  0.67058824]
   [ 0.64313725  0.63921569  0.65098039]
   [ 0.64313725  0.64313725  0.64705882]
   ..., 
   [ 0.67843137  0.6745098   0.66666667]
   [ 0.66666667  0.66666667  0.65882353]
   [ 0.65490196  0.65490196  0.65490196]]

  [[ 0.6627451   0.65882353  0.69019608]
   [ 0.6627451   0.65882353  0.67843137]
   [ 0.65882353  0.65882353  0.67058824]
   ..., 
   [ 0.6745098   0.67058824  0.66666667]
   [ 0.65882353  0.65490196  0.65490196]
   [ 0.64705882  0.64705882  0.65098039]]

  [[ 0.67843137  0.6745098   0.70196078]
   [ 0.68627451  0.68235294  0.69803922]
   [ 0.67843137  0.67843137  0.68627451]
   ..., 
   [ 0.66666667  0.65882353  0.6627451 ]
   [ 0.65882353  0.65490196  0.65882353]
   [ 0.65098039  0.65098039  0.65882353]]]


 [[[ 0.07843137  0.05882353  0.04705882]
   [ 0.07843137  0.05882353  0.04705882]
   [ 0.07058824  0.05098039  0.03921569]
   ..., 
   [ 0.07843137  0.0627451   0.0627451 ]
   [ 0.08235294  0.0627451   0.05490196]
   [ 0.08235294  0.0627451   0.05098039]]

  [[ 0.07843137  0.05882353  0.04705882]
   [ 0.07843137  0.05882353  0.04705882]
   [ 0.07058824  0.05098039  0.03921569]
   ..., 
   [ 0.07843137  0.0627451   0.05882353]
   [ 0.08235294  0.0627451   0.05098039]
   [ 0.08235294  0.0627451   0.05098039]]

  [[ 0.07843137  0.05882353  0.04705882]
   [ 0.07843137  0.05882353  0.04705882]
   [ 0.07058824  0.05098039  0.03921569]
   ..., 
   [ 0.07843137  0.0627451   0.05490196]
   [ 0.08235294  0.0627451   0.05098039]
   [ 0.08235294  0.0627451   0.05098039]]

  ..., 
  [[ 0.25882353  0.21176471  0.16078431]
   [ 0.31372549  0.2627451   0.20784314]
   [ 0.18431373  0.1372549   0.0745098 ]
   ..., 
   [ 0.5254902   0.5254902   0.39215686]
   [ 0.43137255  0.44313725  0.30196078]
   [ 0.38431373  0.4         0.25882353]]

  [[ 0.23529412  0.18823529  0.12941176]
   [ 0.21568627  0.16862745  0.10588235]
   [ 0.19607843  0.14901961  0.08627451]
   ..., 
   [ 0.48235294  0.49019608  0.3254902 ]
   [ 0.30980392  0.31764706  0.16470588]
   [ 0.28235294  0.29019608  0.14901961]]

  [[ 0.25098039  0.21176471  0.14901961]
   [ 0.21568627  0.17647059  0.11372549]
   [ 0.18823529  0.14901961  0.08235294]
   ..., 
   [ 0.60784314  0.61568627  0.43529412]
   [ 0.53333333  0.5372549   0.38039216]
   [ 0.34509804  0.34901961  0.2       ]]]


 [[[ 0.45490196  0.40392157  0.21960784]
   [ 0.45098039  0.41176471  0.23137255]
   [ 0.60784314  0.50196078  0.32156863]
   ..., 
   [ 0.68627451  0.51764706  0.30196078]
   [ 0.6627451   0.52156863  0.28235294]
   [ 0.55686275  0.46666667  0.20784314]]

  [[ 0.45490196  0.4         0.22745098]
   [ 0.47843137  0.42352941  0.25490196]
   [ 0.6         0.4745098   0.30980392]
   ..., 
   [ 0.58823529  0.43529412  0.22352941]
   [ 0.56862745  0.4745098   0.23529412]
   [ 0.52156863  0.48235294  0.21176471]]

  [[ 0.37254902  0.3372549   0.16078431]
   [ 0.38431373  0.32941176  0.17254902]
   [ 0.55294118  0.41568627  0.2627451 ]
   ..., 
   [ 0.56862745  0.43921569  0.22745098]
   [ 0.49411765  0.43529412  0.2       ]
   [ 0.49803922  0.49019608  0.24313725]]

  ..., 
  [[ 0.30196078  0.24705882  0.11372549]
   [ 0.34509804  0.28235294  0.14509804]
   [ 0.2745098   0.23137255  0.10588235]
   ..., 
   [ 0.18823529  0.15294118  0.07843137]
   [ 0.45490196  0.42352941  0.32941176]
   [ 0.62352941  0.55686275  0.47843137]]

  [[ 0.21568627  0.14509804  0.0627451 ]
   [ 0.25490196  0.18039216  0.09411765]
   [ 0.26666667  0.20784314  0.11764706]
   ..., 
   [ 0.16470588  0.11764706  0.05098039]
   [ 0.49411765  0.44705882  0.35294118]
   [ 0.62745098  0.57647059  0.49019608]]

  [[ 0.30588235  0.22352941  0.14509804]
   [ 0.28235294  0.19607843  0.11764706]
   [ 0.2627451   0.19607843  0.1254902 ]
   ..., 
   [ 0.20392157  0.14509804  0.07058824]
   [ 0.48627451  0.43137255  0.32941176]
   [ 0.60784314  0.56470588  0.48627451]]]


 ..., 
 [[[ 0.41568627  0.3372549   0.61176471]
   [ 0.48235294  0.4         0.50588235]
   [ 0.43529412  0.33333333  0.49019608]
   ..., 
   [ 0.51372549  0.4627451   0.61568627]
   [ 0.42745098  0.39215686  0.55686275]
   [ 0.55294118  0.52941176  0.61960784]]

  [[ 0.60784314  0.5254902   0.63529412]
   [ 0.6745098   0.57254902  0.44313725]
   [ 0.51372549  0.43529412  0.48627451]
   ..., 
   [ 0.51764706  0.46666667  0.60784314]
   [ 0.39215686  0.34901961  0.50980392]
   [ 0.56862745  0.5372549   0.63529412]]

  [[ 0.63529412  0.5254902   0.68235294]
   [ 0.62745098  0.49803922  0.43137255]
   [ 0.44313725  0.34509804  0.5254902 ]
   ..., 
   [ 0.73333333  0.71372549  0.65490196]
   [ 0.69411765  0.6745098   0.65882353]
   [ 0.78823529  0.77254902  0.71764706]]

  ..., 
  [[ 0.35686275  0.03921569  0.5254902 ]
   [ 0.34509804  0.03529412  0.49803922]
   [ 0.34509804  0.05098039  0.49803922]
   ..., 
   [ 0.40784314  0.24705882  0.49411765]
   [ 0.43529412  0.28235294  0.52156863]
   [ 0.43921569  0.25490196  0.53333333]]

  [[ 0.29803922  0.02352941  0.50196078]
   [ 0.30588235  0.01568627  0.47058824]
   [ 0.35686275  0.08235294  0.51764706]
   ..., 
   [ 0.42745098  0.27058824  0.49803922]
   [ 0.41960784  0.26666667  0.50980392]
   [ 0.44705882  0.24705882  0.54509804]]

  [[ 0.2627451   0.03137255  0.50196078]
   [ 0.26666667  0.02352941  0.47058824]
   [ 0.30980392  0.07058824  0.49803922]
   ..., 
   [ 0.45882353  0.28627451  0.5254902 ]
   [ 0.43137255  0.25098039  0.52156863]
   [ 0.38823529  0.16470588  0.49019608]]]


 [[[ 0.96862745  0.96470588  0.97254902]
   [ 0.96078431  0.97647059  0.98823529]
   [ 0.95686275  0.97254902  0.97647059]
   ..., 
   [ 0.45882353  0.38039216  0.32941176]
   [ 0.49803922  0.41960784  0.37647059]
   [ 0.61960784  0.56470588  0.54117647]]

  [[ 0.95294118  0.95686275  0.96862745]
   [ 0.95294118  0.96862745  0.97647059]
   [ 0.95294118  0.96078431  0.95686275]
   ..., 
   [ 0.44313725  0.35686275  0.29803922]
   [ 0.47843137  0.4         0.34509804]
   [ 0.63137255  0.56862745  0.52941176]]

  [[ 0.95686275  0.96078431  0.97647059]
   [ 0.96078431  0.97647059  0.98039216]
   [ 0.96862745  0.96862745  0.95686275]
   ..., 
   [ 0.52941176  0.42745098  0.36470588]
   [ 0.4745098   0.37647059  0.31764706]
   [ 0.50588235  0.43137255  0.38823529]]

  ..., 
  [[ 0.71372549  0.6627451   0.63529412]
   [ 0.77647059  0.7254902   0.69803922]
   [ 0.85490196  0.80392157  0.77647059]
   ..., 
   [ 0.61568627  0.54901961  0.44313725]
   [ 0.36862745  0.30588235  0.21960784]
   [ 0.50980392  0.45882353  0.41176471]]

  [[ 0.54509804  0.4627451   0.41960784]
   [ 0.49411765  0.40392157  0.35686275]
   [ 0.5254902   0.43529412  0.38431373]
   ..., 
   [ 0.61960784  0.55686275  0.43921569]
   [ 0.46666667  0.40784314  0.31372549]
   [ 0.45490196  0.40784314  0.35294118]]

  [[ 0.76862745  0.70196078  0.62745098]
   [ 0.7254902   0.63921569  0.54509804]
   [ 0.69019608  0.58823529  0.48235294]
   ..., 
   [ 0.59607843  0.54901961  0.42352941]
   [ 0.69411765  0.64313725  0.5372549 ]
   [ 0.63529412  0.59607843  0.52156863]]]


 [[[ 0.74117647  0.89803922  0.94117647]
   [ 0.76470588  0.90980392  0.94901961]
   [ 0.79607843  0.93333333  0.96470588]
   ..., 
   [ 0.65882353  0.75686275  0.81176471]
   [ 0.65882353  0.74901961  0.79215686]
   [ 0.65882353  0.7372549   0.78039216]]

  [[ 0.79607843  0.9372549   0.96470588]
   [ 0.83137255  0.96470588  0.98431373]
   [ 0.82352941  0.94901961  0.96862745]
   ..., 
   [ 0.58431373  0.67843137  0.76470588]
   [ 0.59215686  0.6745098   0.76470588]
   [ 0.60784314  0.67843137  0.77254902]]

  [[ 0.83529412  0.96862745  0.98431373]
   [ 0.81568627  0.94509804  0.96078431]
   [ 0.82745098  0.94509804  0.95686275]
   ..., 
   [ 0.58431373  0.6745098   0.76862745]
   [ 0.57647059  0.65490196  0.76470588]
   [ 0.56470588  0.63137255  0.75686275]]

  ..., 
  [[ 0.29019608  0.31764706  0.35294118]
   [ 0.21176471  0.32156863  0.47843137]
   [ 0.15294118  0.40784314  0.62352941]
   ..., 
   [ 0.18039216  0.15294118  0.18039216]
   [ 0.19607843  0.16862745  0.2       ]
   [ 0.27058824  0.24705882  0.25098039]]

  [[ 0.25490196  0.2627451   0.28627451]
   [ 0.16470588  0.22745098  0.35686275]
   [ 0.17647059  0.36078431  0.50980392]
   ..., 
   [ 0.14509804  0.08627451  0.17647059]
   [ 0.17254902  0.10588235  0.18431373]
   [ 0.22352941  0.17254902  0.2       ]]

  [[ 0.20784314  0.22745098  0.24705882]
   [ 0.15294118  0.2         0.25490196]
   [ 0.24705882  0.30588235  0.36862745]
   ..., 
   [ 0.18039216  0.10196078  0.19215686]
   [ 0.23137255  0.14901961  0.18431373]
   [ 0.29411765  0.23921569  0.2       ]]]]
[[[[ 0.10196078  0.09019608  0.1254902 ]
   [ 0.06666667  0.05490196  0.09803922]
   [ 0.05098039  0.03529412  0.09411765]
   ..., 
   [ 0.05882353  0.05490196  0.10980392]
   [ 0.09411765  0.09411765  0.14509804]
   [ 0.08627451  0.08235294  0.13333333]]

  [[ 0.07843137  0.06666667  0.10196078]
   [ 0.05098039  0.03921569  0.08627451]
   [ 0.05098039  0.03529412  0.09411765]
   ..., 
   [ 0.0745098   0.06666667  0.1372549 ]
   [ 0.08235294  0.07843137  0.1372549 ]
   [ 0.11372549  0.11372549  0.15294118]]

  [[ 0.05490196  0.04313725  0.07843137]
   [ 0.05098039  0.03921569  0.08235294]
   [ 0.05098039  0.03529412  0.09019608]
   ..., 
   [ 0.06666667  0.0627451   0.1254902 ]
   [ 0.09803922  0.09411765  0.14901961]
   [ 0.12156863  0.12156863  0.16470588]]

  ..., 
  [[ 0.35294118  0.42745098  0.5372549 ]
   [ 0.13333333  0.25098039  0.37254902]
   [ 0.10980392  0.21176471  0.35294118]
   ..., 
   [ 0.09019608  0.07843137  0.14509804]
   [ 0.0627451   0.05098039  0.11764706]
   [ 0.03529412  0.02352941  0.09019608]]

  [[ 0.30980392  0.41176471  0.55294118]
   [ 0.22745098  0.37647059  0.54509804]
   [ 0.1254902   0.26666667  0.43137255]
   ..., 
   [ 0.05490196  0.04313725  0.10980392]
   [ 0.0627451   0.05098039  0.11764706]
   [ 0.03921569  0.02745098  0.09411765]]

  [[ 0.50196078  0.61568627  0.76862745]
   [ 0.22745098  0.36470588  0.58431373]
   [ 0.09803922  0.23529412  0.41568627]
   ..., 
   [ 0.05098039  0.03921569  0.10588235]
   [ 0.04705882  0.03529412  0.10196078]
   [ 0.05098039  0.03921569  0.10588235]]]


 [[[ 0.36862745  0.3372549   0.22745098]
   [ 0.39607843  0.35686275  0.23921569]
   [ 0.37254902  0.33333333  0.21176471]
   ..., 
   [ 0.56862745  0.54117647  0.41568627]
   [ 0.56862745  0.54901961  0.42352941]
   [ 0.4745098   0.45882353  0.35294118]]

  [[ 0.34901961  0.32941176  0.21568627]
   [ 0.38039216  0.34901961  0.23137255]
   [ 0.39607843  0.35686275  0.23529412]
   ..., 
   [ 0.57254902  0.5372549   0.41568627]
   [ 0.57254902  0.54509804  0.41960784]
   [ 0.47843137  0.45882353  0.35294118]]

  [[ 0.3372549   0.32941176  0.21176471]
   [ 0.36862745  0.34509804  0.22352941]
   [ 0.41960784  0.38431373  0.2627451 ]
   ..., 
   [ 0.57254902  0.53333333  0.41568627]
   [ 0.57647059  0.54117647  0.41960784]
   [ 0.48235294  0.45490196  0.35294118]]

  ..., 
  [[ 0.80392157  0.80392157  0.8       ]
   [ 0.81568627  0.81568627  0.81176471]
   [ 0.78823529  0.78823529  0.78431373]
   ..., 
   [ 0.56862745  0.58431373  0.58431373]
   [ 0.58431373  0.59607843  0.61568627]
   [ 0.49019608  0.50196078  0.52941176]]

  [[ 0.78823529  0.78823529  0.78823529]
   [ 0.80392157  0.80392157  0.80392157]
   [ 0.77647059  0.77647059  0.77647059]
   ..., 
   [ 0.60392157  0.61960784  0.6627451 ]
   [ 0.61960784  0.63529412  0.69411765]
   [ 0.5254902   0.54117647  0.6       ]]

  [[ 0.74509804  0.74509804  0.74117647]
   [ 0.7372549   0.7372549   0.73333333]
   [ 0.68627451  0.68627451  0.67843137]
   ..., 
   [ 0.63529412  0.64313725  0.71372549]
   [ 0.63921569  0.65098039  0.72156863]
   [ 0.52941176  0.5372549   0.60784314]]]


 [[[ 0.71764706  0.72941176  0.69803922]
   [ 0.61960784  0.65490196  0.59607843]
   [ 0.65098039  0.6745098   0.62745098]
   ..., 
   [ 0.55686275  0.57647059  0.56470588]
   [ 0.5372549   0.57254902  0.55294118]
   [ 0.56470588  0.58823529  0.57254902]]

  [[ 0.49019608  0.5254902   0.47058824]
   [ 0.38039216  0.43529412  0.35294118]
   [ 0.39215686  0.43921569  0.37254902]
   ..., 
   [ 0.24705882  0.29019608  0.26666667]
   [ 0.23137255  0.29019608  0.2627451 ]
   [ 0.2627451   0.30980392  0.28235294]]

  [[ 0.41960784  0.4745098   0.40392157]
   [ 0.33333333  0.40784314  0.30980392]
   [ 0.34509804  0.40784314  0.3254902 ]
   ..., 
   [ 0.24705882  0.30980392  0.27843137]
   [ 0.20784314  0.28627451  0.25098039]
   [ 0.23529412  0.30196078  0.27058824]]

  ..., 
  [[ 0.42352941  0.45490196  0.40392157]
   [ 0.38431373  0.41960784  0.34117647]
   [ 0.46666667  0.50980392  0.41176471]
   ..., 
   [ 0.44705882  0.49019608  0.44313725]
   [ 0.40784314  0.45098039  0.40392157]
   [ 0.35686275  0.39607843  0.35294118]]

  [[ 0.78039216  0.80392157  0.77254902]
   [ 0.77254902  0.79607843  0.74509804]
   [ 0.81176471  0.83921569  0.76862745]
   ..., 
   [ 0.79607843  0.81960784  0.79215686]
   [ 0.78431373  0.80392157  0.78039216]
   [ 0.74117647  0.76078431  0.7372549 ]]

  [[ 0.98431373  1.          0.98823529]
   [ 0.97254902  0.98823529  0.96470588]
   [ 0.97647059  0.99215686  0.95686275]
   ..., 
   [ 0.98039216  0.98431373  0.98039216]
   [ 0.98039216  0.98039216  0.98039216]
   [ 0.98039216  0.98431373  0.98039216]]]


 ..., 
 [[[ 0.6745098   0.67843137  0.59607843]
   [ 0.67058824  0.6745098   0.59607843]
   [ 0.69803922  0.69803922  0.61960784]
   ..., 
   [ 0.41960784  0.41176471  0.30196078]
   [ 0.41568627  0.40392157  0.30980392]
   [ 0.4         0.38823529  0.30588235]]

  [[ 0.64705882  0.63921569  0.56078431]
   [ 0.62352941  0.61568627  0.54117647]
   [ 0.70588235  0.69803922  0.62352941]
   ..., 
   [ 0.45882353  0.43921569  0.3254902 ]
   [ 0.45882353  0.43921569  0.3372549 ]
   [ 0.43529412  0.41568627  0.3254902 ]]

  [[ 0.68235294  0.6627451   0.58823529]
   [ 0.61176471  0.59215686  0.51764706]
   [ 0.68235294  0.6627451   0.58823529]
   ..., 
   [ 0.47058824  0.44705882  0.3254902 ]
   [ 0.4745098   0.44705882  0.3372549 ]
   [ 0.46666667  0.43921569  0.34509804]]

  ..., 
  [[ 0.47843137  0.45882353  0.36862745]
   [ 0.47058824  0.45098039  0.36470588]
   [ 0.45490196  0.43921569  0.34901961]
   ..., 
   [ 0.48627451  0.49803922  0.39215686]
   [ 0.4745098   0.49411765  0.39215686]
   [ 0.45882353  0.47843137  0.38039216]]

  [[ 0.43529412  0.41176471  0.30588235]
   [ 0.43921569  0.41960784  0.3254902 ]
   [ 0.48235294  0.48627451  0.39607843]
   ..., 
   [ 0.47843137  0.45490196  0.32941176]
   [ 0.45882353  0.4627451   0.35294118]
   [ 0.44313725  0.45882353  0.35294118]]

  [[ 0.43921569  0.41176471  0.30196078]
   [ 0.45098039  0.42352941  0.32941176]
   [ 0.4627451   0.47058824  0.37647059]
   ..., 
   [ 0.48627451  0.45098039  0.31372549]
   [ 0.43137255  0.43137255  0.31764706]
   [ 0.4         0.41568627  0.30980392]]]


 [[[ 0.37254902  0.34509804  0.2       ]
   [ 0.36078431  0.34509804  0.19215686]
   [ 0.35686275  0.34117647  0.19607843]
   ..., 
   [ 0.20784314  0.20392157  0.11764706]
   [ 0.20392157  0.2         0.11764706]
   [ 0.21176471  0.21176471  0.1254902 ]]

  [[ 0.4         0.36862745  0.20784314]
   [ 0.41568627  0.38039216  0.2       ]
   [ 0.41960784  0.38431373  0.21176471]
   ..., 
   [ 0.20392157  0.20392157  0.1254902 ]
   [ 0.19215686  0.18823529  0.10588235]
   [ 0.23137255  0.22745098  0.1254902 ]]

  [[ 0.41960784  0.38431373  0.20392157]
   [ 0.42745098  0.38823529  0.20392157]
   [ 0.41176471  0.38039216  0.20392157]
   ..., 
   [ 0.20784314  0.20784314  0.1254902 ]
   [ 0.21568627  0.20784314  0.11764706]
   [ 0.24313725  0.23529412  0.1254902 ]]

  ..., 
  [[ 0.37647059  0.36078431  0.23529412]
   [ 0.24313725  0.23921569  0.15686275]
   [ 0.20784314  0.21176471  0.14117647]
   ..., 
   [ 0.19607843  0.19607843  0.12941176]
   [ 0.21568627  0.21568627  0.14117647]
   [ 0.23529412  0.22745098  0.15294118]]

  [[ 0.31372549  0.29803922  0.2       ]
   [ 0.23137255  0.22745098  0.15294118]
   [ 0.19607843  0.2         0.12941176]
   ..., 
   [ 0.21960784  0.20392157  0.13333333]
   [ 0.25098039  0.23529412  0.15294118]
   [ 0.25098039  0.23529412  0.14901961]]

  [[ 0.18431373  0.18039216  0.1254902 ]
   [ 0.15294118  0.15686275  0.10980392]
   [ 0.15294118  0.15686275  0.09803922]
   ..., 
   [ 0.30980392  0.29019608  0.17647059]
   [ 0.25098039  0.23137255  0.14901961]
   [ 0.23921569  0.22352941  0.14901961]]]


 [[[ 0.60784314  0.40392157  0.43137255]
   [ 0.59607843  0.39215686  0.41960784]
   [ 0.60784314  0.40392157  0.43137255]
   ..., 
   [ 0.23137255  0.14901961  0.17254902]
   [ 0.22352941  0.15686275  0.18039216]
   [ 0.22352941  0.16078431  0.19607843]]

  [[ 0.60784314  0.40784314  0.43529412]
   [ 0.58039216  0.38039216  0.40784314]
   [ 0.6         0.4         0.42745098]
   ..., 
   [ 0.28627451  0.18823529  0.20784314]
   [ 0.21960784  0.15294118  0.17647059]
   [ 0.21960784  0.16078431  0.19215686]]

  [[ 0.61176471  0.41176471  0.43921569]
   [ 0.58823529  0.38823529  0.41568627]
   [ 0.58039216  0.38039216  0.40784314]
   ..., 
   [ 0.41176471  0.30980392  0.3254902 ]
   [ 0.23137255  0.16470588  0.18823529]
   [ 0.2         0.14117647  0.17254902]]

  ..., 
  [[ 0.45490196  0.43921569  0.5254902 ]
   [ 0.44313725  0.43529412  0.50980392]
   [ 0.44313725  0.44313725  0.50196078]
   ..., 
   [ 0.42745098  0.38039216  0.44705882]
   [ 0.28235294  0.23921569  0.29803922]
   [ 0.42352941  0.37647059  0.43529412]]

  [[ 0.45490196  0.44313725  0.52156863]
   [ 0.44705882  0.43529412  0.50980392]
   [ 0.45098039  0.43921569  0.51372549]
   ..., 
   [ 0.43137255  0.41176471  0.48627451]
   [ 0.23137255  0.19607843  0.26666667]
   [ 0.29411765  0.23921569  0.30980392]]

  [[ 0.46666667  0.45490196  0.52941176]
   [ 0.45490196  0.44313725  0.51764706]
   [ 0.45490196  0.44313725  0.51764706]
   ..., 
   [ 0.47058824  0.45882353  0.5372549 ]
   [ 0.39607843  0.37254902  0.44705882]
   [ 0.24705882  0.19607843  0.26666667]]]]
[[[[ 0.69803922  0.69019608  0.74117647]
   [ 0.69803922  0.69019608  0.74117647]
   [ 0.69803922  0.69019608  0.74117647]
   ..., 
   [ 0.66666667  0.65882353  0.70588235]
   [ 0.65882353  0.65098039  0.69411765]
   [ 0.64705882  0.63921569  0.68235294]]

  [[ 0.70588235  0.69803922  0.74901961]
   [ 0.70196078  0.69411765  0.74509804]
   [ 0.70588235  0.69803922  0.74901961]
   ..., 
   [ 0.67843137  0.67058824  0.71372549]
   [ 0.67058824  0.6627451   0.70588235]
   [ 0.65882353  0.65098039  0.69411765]]

  [[ 0.69411765  0.68627451  0.7372549 ]
   [ 0.69411765  0.68627451  0.7372549 ]
   [ 0.69803922  0.69019608  0.74117647]
   ..., 
   [ 0.67058824  0.6627451   0.70588235]
   [ 0.6627451   0.65490196  0.69803922]
   [ 0.65490196  0.64705882  0.69019608]]

  ..., 
  [[ 0.43921569  0.41960784  0.41960784]
   [ 0.44313725  0.42745098  0.42352941]
   [ 0.44705882  0.43137255  0.43137255]
   ..., 
   [ 0.39215686  0.38039216  0.36862745]
   [ 0.38431373  0.36862745  0.36470588]
   [ 0.39607843  0.37254902  0.37254902]]

  [[ 0.43921569  0.4         0.39607843]
   [ 0.43921569  0.40392157  0.4       ]
   [ 0.44313725  0.40392157  0.40392157]
   ..., 
   [ 0.4         0.37254902  0.36470588]
   [ 0.4         0.36470588  0.35686275]
   [ 0.4         0.36078431  0.35686275]]

  [[ 0.40392157  0.37647059  0.36078431]
   [ 0.39215686  0.36470588  0.35294118]
   [ 0.40392157  0.37254902  0.36862745]
   ..., 
   [ 0.36078431  0.32941176  0.31372549]
   [ 0.36470588  0.3372549   0.31372549]
   [ 0.35686275  0.32941176  0.30196078]]]


 [[[ 0.11372549  0.16862745  0.03921569]
   [ 0.08627451  0.14117647  0.01568627]
   [ 0.09803922  0.14509804  0.0627451 ]
   ..., 
   [ 0.77254902  0.85882353  0.5372549 ]
   [ 0.77647059  0.85882353  0.5372549 ]
   [ 0.78039216  0.87058824  0.54901961]]

  [[ 0.12156863  0.18039216  0.03529412]
   [ 0.10588235  0.16078431  0.02352941]
   [ 0.06666667  0.11372549  0.02352941]
   ..., 
   [ 0.82352941  0.90980392  0.58039216]
   [ 0.81960784  0.90588235  0.58039216]
   [ 0.81960784  0.90588235  0.58039216]]

  [[ 0.15686275  0.21568627  0.0627451 ]
   [ 0.12156863  0.17647059  0.03137255]
   [ 0.07843137  0.12941176  0.02745098]
   ..., 
   [ 0.82352941  0.90980392  0.58823529]
   [ 0.82352941  0.90980392  0.58431373]
   [ 0.82352941  0.90980392  0.58431373]]

  ..., 
  [[ 0.17647059  0.14901961  0.09019608]
   [ 0.09411765  0.08235294  0.04313725]
   [ 0.0627451   0.05490196  0.02745098]
   ..., 
   [ 0.09803922  0.11372549  0.1254902 ]
   [ 0.09411765  0.10980392  0.12156863]
   [ 0.09411765  0.10980392  0.12156863]]

  [[ 0.08235294  0.07058824  0.02745098]
   [ 0.07058824  0.05098039  0.01176471]
   [ 0.10588235  0.0627451   0.01960784]
   ..., 
   [ 0.10196078  0.11764706  0.12941176]
   [ 0.11372549  0.12941176  0.14117647]
   [ 0.10980392  0.1254902   0.1372549 ]]

  [[ 0.20784314  0.15686275  0.09019608]
   [ 0.31764706  0.24313725  0.14901961]
   [ 0.38039216  0.2745098   0.16862745]
   ..., 
   [ 0.08627451  0.10196078  0.11372549]
   [ 0.09411765  0.10980392  0.12156863]
   [ 0.09019608  0.10588235  0.11764706]]]


 [[[ 0.14117647  0.25490196  0.4       ]
   [ 0.12941176  0.21568627  0.42352941]
   [ 0.08235294  0.18431373  0.4627451 ]
   ..., 
   [ 0.10196078  0.1254902   0.15686275]
   [ 0.10196078  0.12156863  0.12156863]
   [ 0.11372549  0.11372549  0.12156863]]

  [[ 0.21568627  0.41960784  0.47058824]
   [ 0.18431373  0.36862745  0.42352941]
   [ 0.05882353  0.24705882  0.44313725]
   ..., 
   [ 0.08627451  0.2         0.41176471]
   [ 0.09019608  0.19215686  0.39215686]
   [ 0.08235294  0.18039216  0.38039216]]

  [[ 0.32156863  0.45490196  0.44705882]
   [ 0.36862745  0.49803922  0.4       ]
   [ 0.30980392  0.45882353  0.42352941]
   ..., 
   [ 0.18431373  0.3254902   0.6       ]
   [ 0.18431373  0.3372549   0.61176471]
   [ 0.17647059  0.33333333  0.6       ]]

  ..., 
  [[ 0.62352941  0.62745098  0.58039216]
   [ 0.63529412  0.62352941  0.58431373]
   [ 0.65098039  0.62745098  0.59215686]
   ..., 
   [ 0.73333333  0.70588235  0.69411765]
   [ 0.7254902   0.69019608  0.68235294]
   [ 0.71764706  0.68235294  0.6745098 ]]

  [[ 0.65098039  0.6627451   0.62745098]
   [ 0.66666667  0.6627451   0.63137255]
   [ 0.67843137  0.6627451   0.63529412]
   ..., 
   [ 0.71764706  0.69019608  0.68235294]
   [ 0.70980392  0.67843137  0.67058824]
   [ 0.70588235  0.6745098   0.67058824]]

  [[ 0.65882353  0.68235294  0.65098039]
   [ 0.67058824  0.67843137  0.65490196]
   [ 0.68627451  0.67843137  0.65882353]
   ..., 
   [ 0.71372549  0.69019608  0.67843137]
   [ 0.70980392  0.6745098   0.66666667]
   [ 0.70588235  0.6745098   0.66666667]]]


 ..., 
 [[[ 0.27058824  0.34509804  0.44705882]
   [ 0.35294118  0.4745098   0.58823529]
   [ 0.35294118  0.49803922  0.61960784]
   ..., 
   [ 0.00784314  0.01176471  0.07058824]
   [ 0.00784314  0.00784314  0.0627451 ]
   [ 0.00784314  0.00784314  0.05882353]]

  [[ 0.11372549  0.15294118  0.25098039]
   [ 0.05882353  0.10588235  0.20784314]
   [ 0.05098039  0.09803922  0.2       ]
   ..., 
   [ 0.00392157  0.          0.00784314]
   [ 0.          0.          0.00392157]
   [ 0.          0.00392157  0.00784314]]

  [[ 0.01568627  0.01176471  0.01960784]
   [ 0.01568627  0.00392157  0.00784314]
   [ 0.01176471  0.00392157  0.00784314]
   ..., 
   [ 0.          0.          0.00392157]
   [ 0.          0.          0.00784314]
   [ 0.          0.          0.01176471]]

  ..., 
  [[ 0.00392157  0.00392157  0.01960784]
   [ 0.          0.          0.00392157]
   [ 0.          0.          0.        ]
   ..., 
   [ 0.03921569  0.03137255  0.04313725]
   [ 0.00784314  0.00784314  0.01568627]
   [ 0.00392157  0.00392157  0.01568627]]

  [[ 0.03137255  0.0627451   0.12941176]
   [ 0.00392157  0.01568627  0.05098039]
   [ 0.          0.00392157  0.01176471]
   ..., 
   [ 0.02745098  0.03921569  0.09019608]
   [ 0.01176471  0.01568627  0.03921569]
   [ 0.00392157  0.00392157  0.01176471]]

  [[ 0.14509804  0.25098039  0.42352941]
   [ 0.09411765  0.16862745  0.30196078]
   [ 0.03921569  0.0745098   0.15294118]
   ..., 
   [ 0.07843137  0.11764706  0.23921569]
   [ 0.05098039  0.07843137  0.16862745]
   [ 0.02352941  0.03921569  0.09019608]]]


 [[[ 0.7254902   0.79215686  0.81176471]
   [ 0.67843137  0.77647059  0.80392157]
   [ 0.69019608  0.81176471  0.85098039]
   ..., 
   [ 0.14509804  0.17647059  0.24313725]
   [ 0.10196078  0.1372549   0.2       ]
   [ 0.12941176  0.19607843  0.27058824]]

  [[ 0.42745098  0.47058824  0.46666667]
   [ 0.4627451   0.52941176  0.52941176]
   [ 0.4745098   0.56078431  0.56470588]
   ..., 
   [ 0.16862745  0.19607843  0.23529412]
   [ 0.12941176  0.13333333  0.16862745]
   [ 0.15686275  0.18823529  0.22745098]]

  [[ 0.20392157  0.22745098  0.21568627]
   [ 0.22745098  0.26666667  0.25098039]
   [ 0.22745098  0.28235294  0.2627451 ]
   ..., 
   [ 0.18039216  0.22745098  0.26666667]
   [ 0.15686275  0.18431373  0.22745098]
   [ 0.18431373  0.22745098  0.26666667]]

  ..., 
  [[ 0.63529412  0.62745098  0.6745098 ]
   [ 0.61960784  0.61176471  0.65490196]
   [ 0.62352941  0.61568627  0.65882353]
   ..., 
   [ 0.05882353  0.05098039  0.09019608]
   [ 0.05490196  0.04705882  0.09019608]
   [ 0.07058824  0.0627451   0.10588235]]

  [[ 0.61176471  0.60392157  0.65882353]
   [ 0.59607843  0.58823529  0.63921569]
   [ 0.59607843  0.58823529  0.63921569]
   ..., 
   [ 0.05098039  0.04313725  0.08235294]
   [ 0.05882353  0.05098039  0.09411765]
   [ 0.1254902   0.11764706  0.16078431]]

  [[ 0.58431373  0.57647059  0.63137255]
   [ 0.56470588  0.55686275  0.61176471]
   [ 0.57254902  0.56470588  0.61960784]
   ..., 
   [ 0.0627451   0.05490196  0.09411765]
   [ 0.20392157  0.19607843  0.23921569]
   [ 0.38431373  0.37647059  0.41960784]]]


 [[[ 0.76470588  0.71764706  0.67058824]
   [ 0.75686275  0.70980392  0.6627451 ]
   [ 0.76078431  0.71372549  0.66666667]
   ..., 
   [ 0.22352941  0.22352941  0.22352941]
   [ 0.20392157  0.20392157  0.20392157]
   [ 0.03137255  0.03137255  0.03137255]]

  [[ 0.77254902  0.72156863  0.67843137]
   [ 0.76470588  0.71764706  0.6745098 ]
   [ 0.77254902  0.7254902   0.68235294]
   ..., 
   [ 0.34117647  0.34117647  0.34117647]
   [ 0.31372549  0.31372549  0.31372549]
   [ 0.03921569  0.03921569  0.03921569]]

  [[ 0.77254902  0.72156863  0.68627451]
   [ 0.76862745  0.71764706  0.68235294]
   [ 0.77647059  0.7254902   0.69411765]
   ..., 
   [ 0.43137255  0.43137255  0.43137255]
   [ 0.41568627  0.41568627  0.41568627]
   [ 0.04705882  0.04705882  0.04705882]]

  ..., 
  [[ 0.78039216  0.7254902   0.69411765]
   [ 0.76862745  0.72156863  0.68627451]
   [ 0.78039216  0.74117647  0.69803922]
   ..., 
   [ 0.13333333  0.10980392  0.08235294]
   [ 0.10980392  0.09019608  0.07058824]
   [ 0.08627451  0.0745098   0.0627451 ]]

  [[ 0.77254902  0.7254902   0.69019608]
   [ 0.76470588  0.71764706  0.68235294]
   [ 0.77254902  0.72941176  0.69411765]
   ..., 
   [ 0.15294118  0.12156863  0.08235294]
   [ 0.14509804  0.12156863  0.08627451]
   [ 0.1372549   0.11372549  0.08627451]]

  [[ 0.75686275  0.71764706  0.68235294]
   [ 0.75686275  0.70588235  0.6745098 ]
   [ 0.76470588  0.70980392  0.67843137]
   ..., 
   [ 0.16470588  0.12941176  0.08235294]
   [ 0.16862745  0.12941176  0.09019608]
   [ 0.16078431  0.1254902   0.09411765]]]]
[[[[ 1.          1.          0.99607843]
   [ 0.98823529  0.98823529  0.98823529]
   [ 0.99215686  0.98823529  0.99607843]
   ..., 
   [ 0.64705882  0.69411765  0.72156863]
   [ 0.95294118  0.96470588  0.96862745]
   [ 0.99607843  0.99215686  0.98823529]]

  [[ 1.          1.          0.99607843]
   [ 0.98823529  0.98823529  0.98823529]
   [ 0.99607843  0.99607843  1.        ]
   ..., 
   [ 0.50980392  0.56470588  0.63137255]
   [ 0.88235294  0.90980392  0.9372549 ]
   [ 0.99215686  1.          1.        ]]

  [[ 1.          1.          1.        ]
   [ 0.99607843  0.99607843  0.99607843]
   [ 0.97254902  0.96862745  0.97647059]
   ..., 
   [ 0.55294118  0.60784314  0.68627451]
   [ 0.8627451   0.89019608  0.92156863]
   [ 0.99215686  1.          1.        ]]

  ..., 
  [[ 0.91372549  0.91764706  0.91764706]
   [ 0.84705882  0.84705882  0.84705882]
   [ 0.94509804  0.94509804  0.94509804]
   ..., 
   [ 0.03529412  0.04313725  0.04313725]
   [ 0.07058824  0.0745098   0.0745098 ]
   [ 0.6627451   0.67058824  0.66666667]]

  [[ 1.          1.          1.        ]
   [ 1.          1.          1.        ]
   [ 0.99215686  0.99215686  0.99215686]
   ..., 
   [ 0.08235294  0.09019608  0.08627451]
   [ 0.44313725  0.45098039  0.44705882]
   [ 0.92156863  0.92941176  0.9254902 ]]

  [[ 1.          1.          1.        ]
   [ 0.98431373  0.98431373  0.98431373]
   [ 0.99215686  0.99215686  0.99215686]
   ..., 
   [ 0.6745098   0.68235294  0.67843137]
   [ 0.90196078  0.90980392  0.90588235]
   [ 0.96862745  0.97254902  0.97254902]]]


 [[[ 0.49803922  0.56862745  0.65490196]
   [ 0.49411765  0.56470588  0.65098039]
   [ 0.49803922  0.56862745  0.65490196]
   ..., 
   [ 0.49019608  0.55686275  0.62352941]
   [ 0.49019608  0.55686275  0.62352941]
   [ 0.48627451  0.55294118  0.61960784]]

  [[ 0.49019608  0.56078431  0.64313725]
   [ 0.49019608  0.56078431  0.63921569]
   [ 0.49411765  0.56470588  0.64313725]
   ..., 
   [ 0.49019608  0.55686275  0.61568627]
   [ 0.48627451  0.55686275  0.61176471]
   [ 0.48627451  0.55294118  0.61176471]]

  [[ 0.49411765  0.56862745  0.63529412]
   [ 0.48627451  0.56078431  0.62745098]
   [ 0.49411765  0.56862745  0.63529412]
   ..., 
   [ 0.48627451  0.56078431  0.61176471]
   [ 0.48235294  0.55294118  0.60784314]
   [ 0.48235294  0.55294118  0.60784314]]

  ..., 
  [[ 0.32941176  0.40784314  0.4627451 ]
   [ 0.33333333  0.40784314  0.4627451 ]
   [ 0.34117647  0.41568627  0.47058824]
   ..., 
   [ 0.25490196  0.3254902   0.37254902]
   [ 0.30980392  0.38039216  0.42745098]
   [ 0.34509804  0.41568627  0.4627451 ]]

  [[ 0.3372549   0.41176471  0.47058824]
   [ 0.3254902   0.4         0.45490196]
   [ 0.3254902   0.4         0.45490196]
   ..., 
   [ 0.28627451  0.35686275  0.40392157]
   [ 0.3254902   0.39607843  0.44313725]
   [ 0.34117647  0.41176471  0.45882353]]

  [[ 0.33333333  0.40784314  0.4627451 ]
   [ 0.33333333  0.40392157  0.45882353]
   [ 0.3254902   0.4         0.45490196]
   ..., 
   [ 0.28235294  0.35294118  0.4       ]
   [ 0.30588235  0.37647059  0.42352941]
   [ 0.32156863  0.39215686  0.43921569]]]


 [[[ 0.45490196  0.27843137  0.10196078]
   [ 0.25098039  0.13333333  0.03921569]
   [ 0.0745098   0.02352941  0.00784314]
   ..., 
   [ 0.58039216  0.32941176  0.14901961]
   [ 0.6627451   0.37647059  0.18039216]
   [ 0.7372549   0.44705882  0.23137255]]

  [[ 0.44705882  0.26666667  0.08627451]
   [ 0.25098039  0.1372549   0.04313725]
   [ 0.07058824  0.02352941  0.00784314]
   ..., 
   [ 0.58431373  0.32941176  0.16862745]
   [ 0.63921569  0.36862745  0.17647059]
   [ 0.7254902   0.44705882  0.23137255]]

  [[ 0.44705882  0.25882353  0.09019608]
   [ 0.24313725  0.13333333  0.04313725]
   [ 0.06666667  0.02352941  0.00784314]
   ..., 
   [ 0.61568627  0.35294118  0.18431373]
   [ 0.68627451  0.4         0.2       ]
   [ 0.7254902   0.44705882  0.22745098]]

  ..., 
  [[ 0.94509804  0.94117647  0.91764706]
   [ 0.95294118  0.94901961  0.9254902 ]
   [ 0.94509804  0.94509804  0.9254902 ]
   ..., 
   [ 0.12156863  0.07058824  0.01568627]
   [ 0.1372549   0.07843137  0.01960784]
   [ 0.15294118  0.07843137  0.01960784]]

  [[ 0.84313725  0.82745098  0.78823529]
   [ 0.90196078  0.89019608  0.8627451 ]
   [ 0.92941176  0.92156863  0.90196078]
   ..., 
   [ 0.09019608  0.05098039  0.01176471]
   [ 0.09803922  0.05098039  0.00784314]
   [ 0.10196078  0.05098039  0.01176471]]

  [[ 0.47058824  0.42352941  0.37254902]
   [ 0.54117647  0.49803922  0.45098039]
   [ 0.60784314  0.57254902  0.5254902 ]
   ..., 
   [ 0.17254902  0.09803922  0.02745098]
   [ 0.16078431  0.08627451  0.02352941]
   [ 0.14901961  0.0745098   0.01960784]]]


 ..., 
 [[[ 0.23921569  0.28627451  0.29803922]
   [ 0.18039216  0.22745098  0.26666667]
   [ 0.15294118  0.19215686  0.25882353]
   ..., 
   [ 0.27843137  0.35294118  0.31372549]
   [ 0.24313725  0.30588235  0.29411765]
   [ 0.17647059  0.22745098  0.23921569]]

  [[ 0.24705882  0.29411765  0.30196078]
   [ 0.17647059  0.22745098  0.2627451 ]
   [ 0.1254902   0.16862745  0.22745098]
   ..., 
   [ 0.28627451  0.34901961  0.32156863]
   [ 0.27843137  0.32941176  0.31372549]
   [ 0.19607843  0.23529412  0.24313725]]

  [[ 0.24705882  0.31372549  0.30196078]
   [ 0.22352941  0.29411765  0.29411765]
   [ 0.24705882  0.30980392  0.31764706]
   ..., 
   [ 0.32156863  0.37647059  0.35686275]
   [ 0.29803922  0.34509804  0.32156863]
   [ 0.20784314  0.24705882  0.24313725]]

  ..., 
  [[ 0.51372549  0.52156863  0.4       ]
   [ 0.61176471  0.60392157  0.4627451 ]
   [ 0.63137255  0.61568627  0.4745098 ]
   ..., 
   [ 0.91764706  0.8745098   0.67843137]
   [ 0.8627451   0.8         0.61176471]
   [ 0.70980392  0.65098039  0.49411765]]

  [[ 0.41176471  0.42352941  0.3254902 ]
   [ 0.41960784  0.42352941  0.30980392]
   [ 0.45098039  0.45098039  0.32941176]
   ..., 
   [ 0.92156863  0.86666667  0.6745098 ]
   [ 0.89803922  0.81568627  0.63137255]
   [ 0.74901961  0.66666667  0.51372549]]

  [[ 0.2627451   0.29019608  0.23921569]
   [ 0.30588235  0.3254902   0.26666667]
   [ 0.43921569  0.45098039  0.35294118]
   ..., 
   [ 0.89019608  0.80784314  0.58823529]
   [ 0.85098039  0.75294118  0.54509804]
   [ 0.72156863  0.62745098  0.45882353]]]


 [[[ 0.03921569  0.01568627  0.05490196]
   [ 0.04313725  0.02352941  0.05882353]
   [ 0.07843137  0.08627451  0.09019608]
   ..., 
   [ 0.23137255  0.27843137  0.21568627]
   [ 0.22352941  0.2745098   0.21568627]
   [ 0.20784314  0.26666667  0.23137255]]

  [[ 0.03921569  0.01568627  0.05490196]
   [ 0.04313725  0.03529412  0.05882353]
   [ 0.09803922  0.1254902   0.10980392]
   ..., 
   [ 0.21568627  0.23921569  0.18823529]
   [ 0.25882353  0.29803922  0.22745098]
   [ 0.18823529  0.24705882  0.21176471]]

  [[ 0.04705882  0.02352941  0.0627451 ]
   [ 0.04313725  0.03921569  0.05882353]
   [ 0.14901961  0.18431373  0.14901961]
   ..., 
   [ 0.18431373  0.20392157  0.16470588]
   [ 0.22352941  0.25882353  0.19215686]
   [ 0.20392157  0.25098039  0.2       ]]

  ..., 
  [[ 0.69411765  0.6627451   0.71764706]
   [ 0.70588235  0.6627451   0.72156863]
   [ 0.72156863  0.6745098   0.74509804]
   ..., 
   [ 0.6745098   0.62352941  0.68235294]
   [ 0.66666667  0.61568627  0.67058824]
   [ 0.64313725  0.58823529  0.64705882]]

  [[ 0.62352941  0.61568627  0.69019608]
   [ 0.63529412  0.61568627  0.69411765]
   [ 0.65490196  0.63529412  0.71764706]
   ..., 
   [ 0.72156863  0.69803922  0.78431373]
   [ 0.70980392  0.68627451  0.77254902]
   [ 0.69803922  0.67843137  0.76470588]]

  [[ 0.61960784  0.61960784  0.72941176]
   [ 0.62352941  0.62352941  0.73333333]
   [ 0.63921569  0.63921569  0.74509804]
   ..., 
   [ 0.70980392  0.70588235  0.82745098]
   [ 0.70196078  0.69411765  0.81568627]
   [ 0.68627451  0.68235294  0.80392157]]]


 [[[ 0.68627451  0.75686275  0.89803922]
   [ 0.6745098   0.75294118  0.9254902 ]
   [ 0.67058824  0.75686275  0.94117647]
   ..., 
   [ 0.75686275  0.80784314  0.93333333]
   [ 0.76862745  0.80784314  0.90588235]
   [ 0.76078431  0.79607843  0.89019608]]

  [[ 0.65490196  0.73333333  0.88627451]
   [ 0.64313725  0.73333333  0.90196078]
   [ 0.64313725  0.7372549   0.90980392]
   ..., 
   [ 0.70196078  0.75686275  0.88235294]
   [ 0.69803922  0.74901961  0.85098039]
   [ 0.69019608  0.73333333  0.83137255]]

  [[ 0.65490196  0.72156863  0.86666667]
   [ 0.65490196  0.72941176  0.87058824]
   [ 0.67058824  0.72941176  0.85098039]
   ..., 
   [ 0.69019608  0.74901961  0.87843137]
   [ 0.68235294  0.74117647  0.85098039]
   [ 0.67058824  0.72156863  0.82745098]]

  ..., 
  [[ 0.33333333  0.32941176  0.39607843]
   [ 0.33333333  0.32156863  0.36470588]
   [ 0.36078431  0.32941176  0.32156863]
   ..., 
   [ 0.4745098   0.44313725  0.47058824]
   [ 0.41960784  0.40392157  0.46666667]
   [ 0.45882353  0.43921569  0.50588235]]

  [[ 0.33333333  0.34117647  0.4       ]
   [ 0.32941176  0.31764706  0.34901961]
   [ 0.34117647  0.30980392  0.30588235]
   ..., 
   [ 0.30196078  0.28235294  0.32941176]
   [ 0.43137255  0.40392157  0.47058824]
   [ 0.44705882  0.41960784  0.48627451]]

  [[ 0.32156863  0.32941176  0.37647059]
   [ 0.29411765  0.29019608  0.32156863]
   [ 0.22352941  0.19607843  0.21568627]
   ..., 
   [ 0.30196078  0.26666667  0.30588235]
   [ 0.35686275  0.30588235  0.35294118]
   [ 0.35686275  0.30588235  0.35294118]]]]
[[[[ 0.54901961  0.49019608  0.45098039]
   [ 0.57254902  0.50980392  0.47843137]
   [ 0.56078431  0.49803922  0.47843137]
   ..., 
   [ 0.66666667  0.56862745  0.51372549]
   [ 0.69019608  0.58823529  0.5254902 ]
   [ 0.66666667  0.57647059  0.52156863]]

  [[ 0.4745098   0.42352941  0.50588235]
   [ 0.50980392  0.4627451   0.54509804]
   [ 0.5254902   0.4745098   0.56078431]
   ..., 
   [ 0.63921569  0.55294118  0.61568627]
   [ 0.66666667  0.57254902  0.63137255]
   [ 0.66666667  0.58039216  0.63137255]]

  [[ 0.59607843  0.54509804  0.68235294]
   [ 0.61568627  0.56862745  0.70196078]
   [ 0.60784314  0.56078431  0.68627451]
   ..., 
   [ 0.69411765  0.60392157  0.75686275]
   [ 0.70980392  0.61176471  0.76078431]
   [ 0.71764706  0.62745098  0.76078431]]

  ..., 
  [[ 0.49019608  0.43137255  0.4       ]
   [ 0.50588235  0.43921569  0.40392157]
   [ 0.29803922  0.2627451   0.18431373]
   ..., 
   [ 0.65882353  0.5372549   0.47058824]
   [ 0.61960784  0.49411765  0.40392157]
   [ 0.57254902  0.45490196  0.34117647]]

  [[ 0.33333333  0.30196078  0.2745098 ]
   [ 0.36862745  0.31764706  0.27843137]
   [ 0.29019608  0.25490196  0.17647059]
   ..., 
   [ 0.63529412  0.51764706  0.41568627]
   [ 0.65098039  0.5254902   0.39215686]
   [ 0.61960784  0.50196078  0.36078431]]

  [[ 0.49019608  0.43921569  0.43529412]
   [ 0.50980392  0.44313725  0.43529412]
   [ 0.41176471  0.35686275  0.29411765]
   ..., 
   [ 0.51764706  0.41568627  0.30588235]
   [ 0.50980392  0.39607843  0.25098039]
   [ 0.55686275  0.45098039  0.30588235]]]


 [[[ 0.39215686  0.42745098  0.32941176]
   [ 0.47843137  0.49411765  0.42745098]
   [ 0.34117647  0.34117647  0.29803922]
   ..., 
   [ 0.29411765  0.30588235  0.27058824]
   [ 0.2745098   0.28627451  0.25098039]
   [ 0.2745098   0.28627451  0.25098039]]

  [[ 0.3372549   0.38823529  0.27843137]
   [ 0.29803922  0.32941176  0.25882353]
   [ 0.23529412  0.25098039  0.21176471]
   ..., 
   [ 0.30588235  0.31764706  0.28235294]
   [ 0.29803922  0.30980392  0.2745098 ]
   [ 0.32156863  0.33333333  0.29803922]]

  [[ 0.32941176  0.39215686  0.28627451]
   [ 0.3254902   0.37254902  0.29411765]
   [ 0.30196078  0.3372549   0.28235294]
   ..., 
   [ 0.29019608  0.30196078  0.26666667]
   [ 0.28627451  0.29803922  0.2627451 ]
   [ 0.3254902   0.3372549   0.30196078]]

  ..., 
  [[ 0.25098039  0.30196078  0.30980392]
   [ 0.47843137  0.52156863  0.56470588]
   [ 0.5254902   0.56862745  0.61176471]
   ..., 
   [ 0.41176471  0.48235294  0.47058824]
   [ 0.32941176  0.40392157  0.35686275]
   [ 0.23529412  0.34509804  0.24705882]]

  [[ 0.17254902  0.2         0.21960784]
   [ 0.30588235  0.32941176  0.36862745]
   [ 0.37647059  0.39607843  0.43137255]
   ..., 
   [ 0.57647059  0.64705882  0.69803922]
   [ 0.49411765  0.56078431  0.58431373]
   [ 0.36862745  0.45882353  0.44313725]]

  [[ 0.14117647  0.1372549   0.15294118]
   [ 0.23137255  0.22745098  0.25882353]
   [ 0.32156863  0.31764706  0.33333333]
   ..., 
   [ 0.5254902   0.6         0.62745098]
   [ 0.54117647  0.59607843  0.61960784]
   [ 0.50980392  0.58039216  0.58823529]]]


 [[[ 0.0745098   0.1254902   0.05882353]
   [ 0.08235294  0.14901961  0.08235294]
   [ 0.10588235  0.19215686  0.1254902 ]
   ..., 
   [ 0.29411765  0.48627451  0.51372549]
   [ 0.29803922  0.48627451  0.50980392]
   [ 0.27843137  0.4627451   0.48627451]]

  [[ 0.09019608  0.12156863  0.05490196]
   [ 0.08235294  0.11764706  0.04705882]
   [ 0.09019608  0.1372549   0.05490196]
   ..., 
   [ 0.28235294  0.4627451   0.49411765]
   [ 0.29411765  0.46666667  0.48627451]
   [ 0.26666667  0.43529412  0.44705882]]

  [[ 0.09411765  0.14509804  0.06666667]
   [ 0.08627451  0.1372549   0.0627451 ]
   [ 0.09411765  0.14117647  0.07058824]
   ..., 
   [ 0.25098039  0.42745098  0.43921569]
   [ 0.2627451   0.42745098  0.43529412]
   [ 0.25098039  0.41176471  0.41176471]]

  ..., 
  [[ 0.24313725  0.18039216  0.09019608]
   [ 0.23529412  0.18039216  0.10588235]
   [ 0.21568627  0.18823529  0.10980392]
   ..., 
   [ 0.05098039  0.02352941  0.01568627]
   [ 0.04705882  0.05490196  0.03137255]
   [ 0.09803922  0.15686275  0.11764706]]

  [[ 0.24705882  0.20784314  0.11764706]
   [ 0.19215686  0.17647059  0.08627451]
   [ 0.17647059  0.18039216  0.09019608]
   ..., 
   [ 0.11372549  0.1372549   0.12156863]
   [ 0.11764706  0.16470588  0.14509804]
   [ 0.10588235  0.19607843  0.16862745]]

  [[ 0.27058824  0.20392157  0.11372549]
   [ 0.19215686  0.14901961  0.07843137]
   [ 0.21176471  0.18039216  0.10588235]
   ..., 
   [ 0.25882353  0.34509804  0.33333333]
   [ 0.15686275  0.26666667  0.25098039]
   [ 0.11372549  0.24313725  0.22745098]]]


 ..., 
 [[[ 0.1372549   0.69803922  0.92156863]
   [ 0.15686275  0.69019608  0.9372549 ]
   [ 0.16470588  0.69019608  0.94509804]
   ..., 
   [ 0.38823529  0.69411765  0.85882353]
   [ 0.30980392  0.57647059  0.77254902]
   [ 0.34901961  0.58039216  0.74117647]]

  [[ 0.22352941  0.71372549  0.91764706]
   [ 0.17254902  0.72156863  0.98039216]
   [ 0.19607843  0.71764706  0.94117647]
   ..., 
   [ 0.61176471  0.71372549  0.78431373]
   [ 0.55294118  0.69411765  0.80784314]
   [ 0.45490196  0.58431373  0.68627451]]

  [[ 0.38431373  0.77254902  0.92941176]
   [ 0.25098039  0.74117647  0.98823529]
   [ 0.27058824  0.75294118  0.96078431]
   ..., 
   [ 0.7372549   0.76470588  0.80784314]
   [ 0.46666667  0.52941176  0.57647059]
   [ 0.23921569  0.30980392  0.35294118]]

  ..., 
  [[ 0.28627451  0.30980392  0.30196078]
   [ 0.20784314  0.24705882  0.26666667]
   [ 0.21176471  0.26666667  0.31372549]
   ..., 
   [ 0.06666667  0.15686275  0.25098039]
   [ 0.08235294  0.14117647  0.2       ]
   [ 0.12941176  0.18823529  0.19215686]]

  [[ 0.23921569  0.26666667  0.29411765]
   [ 0.21568627  0.2745098   0.3372549 ]
   [ 0.22352941  0.30980392  0.40392157]
   ..., 
   [ 0.09411765  0.18823529  0.28235294]
   [ 0.06666667  0.1372549   0.20784314]
   [ 0.02745098  0.09019608  0.1254902 ]]

  [[ 0.17254902  0.21960784  0.28627451]
   [ 0.18039216  0.25882353  0.34509804]
   [ 0.19215686  0.30196078  0.41176471]
   ..., 
   [ 0.10588235  0.20392157  0.30196078]
   [ 0.08235294  0.16862745  0.25882353]
   [ 0.04705882  0.12156863  0.19607843]]]


 [[[ 0.74117647  0.82745098  0.94117647]
   [ 0.72941176  0.81568627  0.9254902 ]
   [ 0.7254902   0.81176471  0.92156863]
   ..., 
   [ 0.68627451  0.76470588  0.87843137]
   [ 0.6745098   0.76078431  0.87058824]
   [ 0.6627451   0.76078431  0.8627451 ]]

  [[ 0.76078431  0.82352941  0.9372549 ]
   [ 0.74901961  0.81176471  0.9254902 ]
   [ 0.74509804  0.80784314  0.92156863]
   ..., 
   [ 0.67843137  0.75294118  0.8627451 ]
   [ 0.67058824  0.74901961  0.85490196]
   [ 0.65490196  0.74509804  0.84705882]]

  [[ 0.81568627  0.85882353  0.95686275]
   [ 0.80392157  0.84705882  0.94117647]
   [ 0.8         0.84313725  0.9372549 ]
   ..., 
   [ 0.68627451  0.74901961  0.85098039]
   [ 0.6745098   0.74509804  0.84705882]
   [ 0.6627451   0.74901961  0.84313725]]

  ..., 
  [[ 0.81176471  0.78039216  0.70980392]
   [ 0.79607843  0.76470588  0.68627451]
   [ 0.79607843  0.76862745  0.67843137]
   ..., 
   [ 0.52941176  0.51764706  0.49803922]
   [ 0.63529412  0.61960784  0.58823529]
   [ 0.65882353  0.63921569  0.59215686]]

  [[ 0.77647059  0.74509804  0.66666667]
   [ 0.74117647  0.70980392  0.62352941]
   [ 0.70588235  0.6745098   0.57647059]
   ..., 
   [ 0.69803922  0.67058824  0.62745098]
   [ 0.68627451  0.6627451   0.61176471]
   [ 0.68627451  0.6627451   0.60392157]]

  [[ 0.77647059  0.74117647  0.67843137]
   [ 0.74117647  0.70980392  0.63529412]
   [ 0.69803922  0.66666667  0.58431373]
   ..., 
   [ 0.76470588  0.72156863  0.6627451 ]
   [ 0.76862745  0.74117647  0.67058824]
   [ 0.76470588  0.74509804  0.67058824]]]


 [[[ 0.89803922  0.89803922  0.9372549 ]
   [ 0.9254902   0.92941176  0.96862745]
   [ 0.91764706  0.9254902   0.96862745]
   ..., 
   [ 0.85098039  0.85882353  0.91372549]
   [ 0.86666667  0.8745098   0.91764706]
   [ 0.87058824  0.8745098   0.91372549]]

  [[ 0.87058824  0.86666667  0.89803922]
   [ 0.9372549   0.9372549   0.97647059]
   [ 0.91372549  0.91764706  0.96470588]
   ..., 
   [ 0.8745098   0.8745098   0.9254902 ]
   [ 0.89019608  0.89411765  0.93333333]
   [ 0.82352941  0.82745098  0.8627451 ]]

  [[ 0.83529412  0.80784314  0.82745098]
   [ 0.91764706  0.90980392  0.9372549 ]
   [ 0.90588235  0.91372549  0.95686275]
   ..., 
   [ 0.8627451   0.8627451   0.90980392]
   [ 0.8627451   0.85882353  0.90980392]
   [ 0.79215686  0.79607843  0.84313725]]

  ..., 
  [[ 0.58823529  0.56078431  0.52941176]
   [ 0.54901961  0.52941176  0.49803922]
   [ 0.51764706  0.49803922  0.47058824]
   ..., 
   [ 0.87843137  0.87058824  0.85490196]
   [ 0.90196078  0.89411765  0.88235294]
   [ 0.94509804  0.94509804  0.93333333]]

  [[ 0.5372549   0.51764706  0.49411765]
   [ 0.50980392  0.49803922  0.47058824]
   [ 0.49019608  0.4745098   0.45098039]
   ..., 
   [ 0.70980392  0.70588235  0.69803922]
   [ 0.79215686  0.78823529  0.77647059]
   [ 0.83137255  0.82745098  0.81176471]]

  [[ 0.47843137  0.46666667  0.44705882]
   [ 0.4627451   0.45490196  0.43137255]
   [ 0.47058824  0.45490196  0.43529412]
   ..., 
   [ 0.70196078  0.69411765  0.67843137]
   [ 0.64313725  0.64313725  0.63529412]
   [ 0.63921569  0.63921569  0.63137255]]]]
[[[[ 0.61960784  0.43921569  0.19215686]
   [ 0.62352941  0.43529412  0.18431373]
   [ 0.64705882  0.45490196  0.2       ]
   ..., 
   [ 0.5372549   0.37254902  0.14117647]
   [ 0.49411765  0.35686275  0.14117647]
   [ 0.45490196  0.33333333  0.12941176]]

  [[ 0.59607843  0.43921569  0.2       ]
   [ 0.59215686  0.43137255  0.15686275]
   [ 0.62352941  0.44705882  0.17647059]
   ..., 
   [ 0.53333333  0.37254902  0.12156863]
   [ 0.49019608  0.35686275  0.1254902 ]
   [ 0.46666667  0.34509804  0.13333333]]

  [[ 0.59215686  0.43137255  0.18431373]
   [ 0.59215686  0.42745098  0.12941176]
   [ 0.61960784  0.43529412  0.14117647]
   ..., 
   [ 0.54509804  0.38431373  0.13333333]
   [ 0.50980392  0.37254902  0.13333333]
   [ 0.47058824  0.34901961  0.12941176]]

  ..., 
  [[ 0.26666667  0.48627451  0.69411765]
   [ 0.16470588  0.39215686  0.58039216]
   [ 0.12156863  0.34509804  0.5372549 ]
   ..., 
   [ 0.14901961  0.38039216  0.57254902]
   [ 0.05098039  0.25098039  0.42352941]
   [ 0.15686275  0.33333333  0.49803922]]

  [[ 0.23921569  0.45490196  0.65882353]
   [ 0.19215686  0.4         0.58039216]
   [ 0.1372549   0.33333333  0.51764706]
   ..., 
   [ 0.10196078  0.32156863  0.50980392]
   [ 0.11372549  0.32156863  0.49411765]
   [ 0.07843137  0.25098039  0.41960784]]

  [[ 0.21176471  0.41960784  0.62745098]
   [ 0.21960784  0.41176471  0.58431373]
   [ 0.17647059  0.34901961  0.51764706]
   ..., 
   [ 0.09411765  0.30196078  0.48627451]
   [ 0.13333333  0.32941176  0.50588235]
   [ 0.08235294  0.2627451   0.43137255]]]


 [[[ 0.92156863  0.92156863  0.92156863]
   [ 0.90588235  0.90588235  0.90588235]
   [ 0.90980392  0.90980392  0.90980392]
   ..., 
   [ 0.91372549  0.91372549  0.91372549]
   [ 0.91372549  0.91372549  0.91372549]
   [ 0.90980392  0.90980392  0.90980392]]

  [[ 0.93333333  0.93333333  0.93333333]
   [ 0.92156863  0.92156863  0.92156863]
   [ 0.92156863  0.92156863  0.92156863]
   ..., 
   [ 0.9254902   0.9254902   0.9254902 ]
   [ 0.9254902   0.9254902   0.9254902 ]
   [ 0.92156863  0.92156863  0.92156863]]

  [[ 0.92941176  0.92941176  0.92941176]
   [ 0.91764706  0.91764706  0.91764706]
   [ 0.91764706  0.91764706  0.91764706]
   ..., 
   [ 0.92156863  0.92156863  0.92156863]
   [ 0.92156863  0.92156863  0.92156863]
   [ 0.91764706  0.91764706  0.91764706]]

  ..., 
  [[ 0.34117647  0.38823529  0.34901961]
   [ 0.16862745  0.2         0.14509804]
   [ 0.0745098   0.09019608  0.04313725]
   ..., 
   [ 0.6627451   0.72156863  0.70196078]
   [ 0.71372549  0.77254902  0.75686275]
   [ 0.7372549   0.79215686  0.78823529]]

  [[ 0.32156863  0.37647059  0.32156863]
   [ 0.18039216  0.22352941  0.14117647]
   [ 0.14117647  0.17254902  0.08627451]
   ..., 
   [ 0.68235294  0.74117647  0.71764706]
   [ 0.7254902   0.78431373  0.76862745]
   [ 0.73333333  0.79215686  0.78431373]]

  [[ 0.33333333  0.39607843  0.3254902 ]
   [ 0.24313725  0.29411765  0.18823529]
   [ 0.22745098  0.2627451   0.14901961]
   ..., 
   [ 0.65882353  0.71764706  0.69803922]
   [ 0.70588235  0.76470588  0.74901961]
   [ 0.72941176  0.78431373  0.78039216]]]


 [[[ 0.61960784  0.74509804  0.87058824]
   [ 0.61960784  0.73333333  0.85490196]
   [ 0.54509804  0.65098039  0.76078431]
   ..., 
   [ 0.89411765  0.90588235  0.91764706]
   [ 0.92941176  0.9372549   0.95294118]
   [ 0.93333333  0.94509804  0.96470588]]

  [[ 0.66666667  0.78431373  0.89803922]
   [ 0.6745098   0.78039216  0.88627451]
   [ 0.59215686  0.69019608  0.78823529]
   ..., 
   [ 0.90980392  0.90980392  0.9254902 ]
   [ 0.96470588  0.96470588  0.98039216]
   [ 0.96470588  0.96862745  0.98431373]]

  [[ 0.68235294  0.78823529  0.88235294]
   [ 0.69019608  0.78431373  0.87058824]
   [ 0.61568627  0.70196078  0.78039216]
   ..., 
   [ 0.90196078  0.89803922  0.90980392]
   [ 0.98039216  0.97647059  0.98431373]
   [ 0.96078431  0.95686275  0.96862745]]

  ..., 
  [[ 0.12156863  0.15686275  0.17647059]
   [ 0.11764706  0.15294118  0.17254902]
   [ 0.10196078  0.1372549   0.15686275]
   ..., 
   [ 0.14509804  0.15686275  0.18039216]
   [ 0.03529412  0.05098039  0.05490196]
   [ 0.01568627  0.02745098  0.01960784]]

  [[ 0.09019608  0.13333333  0.15294118]
   [ 0.10588235  0.14901961  0.16862745]
   [ 0.09803922  0.14117647  0.16078431]
   ..., 
   [ 0.0745098   0.07843137  0.09411765]
   [ 0.01568627  0.02352941  0.01176471]
   [ 0.01960784  0.02745098  0.01176471]]

  [[ 0.10980392  0.16078431  0.18431373]
   [ 0.11764706  0.16862745  0.19607843]
   [ 0.1254902   0.17647059  0.20392157]
   ..., 
   [ 0.01960784  0.02352941  0.03137255]
   [ 0.01568627  0.01960784  0.01176471]
   [ 0.02745098  0.03137255  0.02745098]]]


 ..., 
 [[[ 0.07843137  0.05882353  0.04705882]
   [ 0.0745098   0.05490196  0.04313725]
   [ 0.05882353  0.05490196  0.04313725]
   ..., 
   [ 0.03921569  0.03529412  0.02745098]
   [ 0.04705882  0.04313725  0.03529412]
   [ 0.05098039  0.04705882  0.03921569]]

  [[ 0.08235294  0.0627451   0.05098039]
   [ 0.07843137  0.0627451   0.05098039]
   [ 0.07058824  0.06666667  0.04705882]
   ..., 
   [ 0.03921569  0.03529412  0.02745098]
   [ 0.03921569  0.03529412  0.02745098]
   [ 0.04705882  0.04313725  0.03529412]]

  [[ 0.08235294  0.0627451   0.05098039]
   [ 0.08235294  0.06666667  0.04705882]
   [ 0.07843137  0.07058824  0.04313725]
   ..., 
   [ 0.04705882  0.04313725  0.03529412]
   [ 0.04705882  0.04313725  0.03529412]
   [ 0.05098039  0.04705882  0.03921569]]

  ..., 
  [[ 0.12941176  0.09803922  0.05098039]
   [ 0.13333333  0.10196078  0.05882353]
   [ 0.13333333  0.10196078  0.05882353]
   ..., 
   [ 0.10980392  0.09803922  0.20392157]
   [ 0.11372549  0.09803922  0.22745098]
   [ 0.09019608  0.07843137  0.16470588]]

  [[ 0.12941176  0.09803922  0.05490196]
   [ 0.13333333  0.10196078  0.05882353]
   [ 0.13333333  0.10196078  0.05882353]
   ..., 
   [ 0.10588235  0.09411765  0.20392157]
   [ 0.10588235  0.09411765  0.21960784]
   [ 0.09803922  0.08627451  0.18431373]]

  [[ 0.12156863  0.09019608  0.04705882]
   [ 0.1254902   0.09411765  0.05098039]
   [ 0.12941176  0.09803922  0.05490196]
   ..., 
   [ 0.09411765  0.09019608  0.19607843]
   [ 0.10196078  0.09019608  0.20784314]
   [ 0.09803922  0.07843137  0.18431373]]]


 [[[ 0.09803922  0.15686275  0.04705882]
   [ 0.05882353  0.14117647  0.01176471]
   [ 0.09019608  0.16078431  0.07058824]
   ..., 
   [ 0.23921569  0.32156863  0.30588235]
   [ 0.36078431  0.44313725  0.43921569]
   [ 0.29411765  0.34901961  0.36078431]]

  [[ 0.04705882  0.09803922  0.02352941]
   [ 0.07843137  0.14509804  0.02745098]
   [ 0.09411765  0.14117647  0.05882353]
   ..., 
   [ 0.45098039  0.5254902   0.54117647]
   [ 0.58431373  0.65882353  0.69411765]
   [ 0.40784314  0.45882353  0.51372549]]

  [[ 0.04705882  0.09803922  0.04313725]
   [ 0.05882353  0.11372549  0.02352941]
   [ 0.13333333  0.15686275  0.09411765]
   ..., 
   [ 0.60392157  0.6745098   0.71372549]
   [ 0.61568627  0.68627451  0.75294118]
   [ 0.45490196  0.50588235  0.59215686]]

  ..., 
  [[ 0.39215686  0.50588235  0.31764706]
   [ 0.40392157  0.51764706  0.32941176]
   [ 0.40784314  0.5254902   0.3372549 ]
   ..., 
   [ 0.38039216  0.50196078  0.32941176]
   [ 0.38431373  0.49411765  0.32941176]
   [ 0.35686275  0.4745098   0.30980392]]

  [[ 0.40392157  0.51764706  0.3254902 ]
   [ 0.40784314  0.51372549  0.3254902 ]
   [ 0.41960784  0.52941176  0.34117647]
   ..., 
   [ 0.39607843  0.51764706  0.34117647]
   [ 0.38823529  0.49803922  0.32941176]
   [ 0.36078431  0.4745098   0.30980392]]

  [[ 0.37254902  0.49411765  0.30588235]
   [ 0.37254902  0.48235294  0.29803922]
   [ 0.39607843  0.50196078  0.31764706]
   ..., 
   [ 0.36470588  0.48627451  0.31372549]
   [ 0.37254902  0.48235294  0.31764706]
   [ 0.36078431  0.47058824  0.31372549]]]


 [[[ 0.28627451  0.30588235  0.29411765]
   [ 0.38431373  0.40392157  0.44313725]
   [ 0.38823529  0.41568627  0.44705882]
   ..., 
   [ 0.52941176  0.58823529  0.59607843]
   [ 0.52941176  0.58431373  0.60392157]
   [ 0.79607843  0.84313725  0.8745098 ]]

  [[ 0.27058824  0.28627451  0.2745098 ]
   [ 0.32941176  0.34901961  0.38039216]
   [ 0.26666667  0.29411765  0.31764706]
   ..., 
   [ 0.33333333  0.37254902  0.34901961]
   [ 0.27843137  0.32156863  0.31372549]
   [ 0.47058824  0.52156863  0.52941176]]

  [[ 0.27058824  0.28627451  0.2745098 ]
   [ 0.35294118  0.37254902  0.39215686]
   [ 0.24313725  0.27843137  0.29019608]
   ..., 
   [ 0.29019608  0.31764706  0.2745098 ]
   [ 0.20784314  0.24313725  0.21176471]
   [ 0.24313725  0.29019608  0.27058824]]

  ..., 
  [[ 0.48235294  0.50196078  0.37647059]
   [ 0.51764706  0.51764706  0.4       ]
   [ 0.50588235  0.50196078  0.39215686]
   ..., 
   [ 0.42352941  0.41960784  0.34509804]
   [ 0.24313725  0.23529412  0.21568627]
   [ 0.10588235  0.10588235  0.10980392]]

  [[ 0.45098039  0.4745098   0.35686275]
   [ 0.48235294  0.48627451  0.37254902]
   [ 0.50588235  0.49411765  0.38823529]
   ..., 
   [ 0.45098039  0.45490196  0.36862745]
   [ 0.25882353  0.25490196  0.23137255]
   [ 0.10588235  0.10588235  0.10588235]]

  [[ 0.45490196  0.47058824  0.35294118]
   [ 0.4745098   0.47843137  0.36862745]
   [ 0.50588235  0.50196078  0.39607843]
   ..., 
   [ 0.45490196  0.45098039  0.36862745]
   [ 0.26666667  0.25490196  0.22745098]
   [ 0.10588235  0.10196078  0.10196078]]]]

Check Point

This is your first checkpoint. If you ever decide to come back to this notebook or have to restart the notebook, you can start from here. The preprocessed data has been saved to disk.


In [7]:
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
import pickle
import problem_unittests as tests
import helper

# Load the Preprocessed Validation data
valid_features, valid_labels = pickle.load(open('preprocess_validation.p', mode='rb'))

Build the network

For the neural network, you'll build each layer into a function. Most of the code you've seen has been outside of functions. To test your code more thoroughly, we require that you put each layer in a function. This allows us to give you better feedback and test for simple mistakes using our unittests before you submit your project.

Note: If you're finding it hard to dedicate enough time for this course each week, we've provided a small shortcut to this part of the project. In the next couple of problems, you'll have the option to use classes from the TensorFlow Layers or TensorFlow Layers (contrib) packages to build each layer, except the layers you build in the "Convolutional and Max Pooling Layer" section. TF Layers is similar to Keras's and TFLearn's abstraction to layers, so it's easy to pickup.

However, if you would like to get the most out of this course, try to solve all the problems without using anything from the TF Layers packages. You can still use classes from other packages that happen to have the same name as ones you find in TF Layers! For example, instead of using the TF Layers version of the conv2d class, tf.layers.conv2d, you would want to use the TF Neural Network version of conv2d, tf.nn.conv2d.

Let's begin!

Input

The neural network needs to read the image data, one-hot encoded labels, and dropout keep probability. Implement the following functions

  • Implement neural_net_image_input
    • Return a TF Placeholder
    • Set the shape using image_shape with batch size set to None.
    • Name the TensorFlow placeholder "x" using the TensorFlow name parameter in the TF Placeholder.
  • Implement neural_net_label_input
    • Return a TF Placeholder
    • Set the shape using n_classes with batch size set to None.
    • Name the TensorFlow placeholder "y" using the TensorFlow name parameter in the TF Placeholder.
  • Implement neural_net_keep_prob_input
    • Return a TF Placeholder for dropout keep probability.
    • Name the TensorFlow placeholder "keep_prob" using the TensorFlow name parameter in the TF Placeholder.

These names will be used at the end of the project to load your saved model.

Note: None for shapes in TensorFlow allow for a dynamic size.


In [8]:
import tensorflow as tf

def neural_net_image_input(image_shape):
    """
    Return a Tensor for a batch of image input
    : image_shape: Shape of the images
    : return: Tensor for image input.
    """
    # TODO: Implement Function
    return tf.placeholder(tf.float32, [None, image_shape[0], image_shape[1], image_shape[2]], name='x')


def neural_net_label_input(n_classes):
    """
    Return a Tensor for a batch of label input
    : n_classes: Number of classes
    : return: Tensor for label input.
    """
    # TODO: Implement Function
    return tf.placeholder(tf.float32, [None, n_classes], name='y')


def neural_net_keep_prob_input():
    """
    Return a Tensor for keep probability
    : return: Tensor for keep probability.
    """
    # TODO: Implement Function
    return tf.placeholder(tf.float32, name='keep_prob')


"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tf.reset_default_graph()
tests.test_nn_image_inputs(neural_net_image_input)
tests.test_nn_label_inputs(neural_net_label_input)
tests.test_nn_keep_prob_inputs(neural_net_keep_prob_input)


Image Input Tests Passed.
Label Input Tests Passed.
Keep Prob Tests Passed.

Convolution and Max Pooling Layer

Convolution layers have a lot of success with images. For this code cell, you should implement the function conv2d_maxpool to apply convolution then max pooling:

  • Create the weight and bias using conv_ksize, conv_num_outputs and the shape of x_tensor.
  • Apply a convolution to x_tensor using weight and conv_strides.
    • We recommend you use same padding, but you're welcome to use any padding.
  • Add bias
  • Add a nonlinear activation to the convolution.
  • Apply Max Pooling using pool_ksize and pool_strides.
    • We recommend you use same padding, but you're welcome to use any padding.

Note: You can't use TensorFlow Layers or TensorFlow Layers (contrib) for this layer, but you can still use TensorFlow's Neural Network package. You may still use the shortcut option for all the other layers.


In [9]:
def conv2d_maxpool(x_tensor, conv_num_outputs, conv_ksize, conv_strides, pool_ksize, pool_strides):
    """
    Apply convolution then max pooling to x_tensor
    :param x_tensor: TensorFlow Tensor
    :param conv_num_outputs: Number of outputs for the convolutional layer
    :param conv_ksize: kernel size 2-D Tuple for the convolutional layer
    :param conv_strides: Stride 2-D Tuple for convolution
    :param pool_ksize: kernel size 2-D Tuple for pool
    :param pool_strides: Stride 2-D Tuple for pool
    : return: A tensor that represents convolution and max pooling of x_tensor
    """
    # TODO: Implement Function
    kernel = tf.Variable(tf.truncated_normal([conv_ksize[0], conv_ksize[1], int(x_tensor.shape[3]), conv_num_outputs], mean=0.0, stddev=0.1))
    bias = tf.Variable(tf.truncated_normal([conv_num_outputs], mean=0.0, stddev=0.1))
    conv = tf.nn.conv2d(x_tensor, kernel, [1, conv_strides[0], conv_strides[1], 1], 'SAME')
    conv = tf.nn.bias_add(conv, bias)
    conv = tf.nn.relu(conv)
    pool = tf.nn.max_pool(conv, [1, pool_ksize[0], pool_ksize[1], 1], [1, pool_strides[0], pool_strides[1], 1], 'SAME')
    return pool


"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_con_pool(conv2d_maxpool)


Tests Passed

Flatten Layer

Implement the flatten function to change the dimension of x_tensor from a 4-D tensor to a 2-D tensor. The output should be the shape (Batch Size, Flattened Image Size). Shortcut option: you can use classes from the TensorFlow Layers or TensorFlow Layers (contrib) packages for this layer. For more of a challenge, only use other TensorFlow packages.


In [10]:
def flatten(x_tensor):
    """
    Flatten x_tensor to (Batch Size, Flattened Image Size)
    : x_tensor: A tensor of size (Batch Size, ...), where ... are the image dimensions.
    : return: A tensor of size (Batch Size, Flattened Image Size).
    """
    # TODO: Implement Function
    dimensions = x_tensor.get_shape().as_list()
    return tf.reshape(x_tensor, [-1, dimensions[1]*dimensions[2]*dimensions[3]])


"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_flatten(flatten)


Tests Passed

Fully-Connected Layer

Implement the fully_conn function to apply a fully connected layer to x_tensor with the shape (Batch Size, num_outputs). Shortcut option: you can use classes from the TensorFlow Layers or TensorFlow Layers (contrib) packages for this layer. For more of a challenge, only use other TensorFlow packages.


In [11]:
def fully_conn(x_tensor, num_outputs):
    """
    Apply a fully connected layer to x_tensor using weight and bias
    : x_tensor: A 2-D tensor where the first dimension is batch size.
    : num_outputs: The number of output that the new tensor should be.
    : return: A 2-D tensor where the second dimension is num_outputs.
    """
    # TODO: Implement Function
    dims = x_tensor.get_shape().as_list()
    weights = tf.Variable(tf.truncated_normal([dims[1], num_outputs], mean=0.0, stddev=0.1))
    bias = tf.Variable(tf.truncated_normal([num_outputs], mean=0.0, stddev=0.1))
    layer = tf.add(tf.matmul(x_tensor, weights), bias)
    layer = tf.nn.relu(layer)
    return layer


"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_fully_conn(fully_conn)


Tests Passed

Output Layer

Implement the output function to apply a fully connected layer to x_tensor with the shape (Batch Size, num_outputs). Shortcut option: you can use classes from the TensorFlow Layers or TensorFlow Layers (contrib) packages for this layer. For more of a challenge, only use other TensorFlow packages.

Note: Activation, softmax, or cross entropy should not be applied to this.


In [12]:
def output(x_tensor, num_outputs):
    """
    Apply a output layer to x_tensor using weight and bias
    : x_tensor: A 2-D tensor where the first dimension is batch size.
    : num_outputs: The number of output that the new tensor should be.
    : return: A 2-D tensor where the second dimension is num_outputs.
    """
    # TODO: Implement Function
    dims = x_tensor.get_shape().as_list()
    weights = tf.Variable(tf.truncated_normal([dims[1], num_outputs], mean=0.0, stddev=0.1))
    bias = tf.Variable(tf.truncated_normal([num_outputs], mean=0.0, stddev=0.1))
    layer = tf.add(tf.matmul(x_tensor, weights), bias)
    return layer


"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_output(output)


Tests Passed

Create Convolutional Model

Implement the function conv_net to create a convolutional neural network model. The function takes in a batch of images, x, and outputs logits. Use the layers you created above to create this model:

  • Apply 1, 2, or 3 Convolution and Max Pool layers
  • Apply a Flatten Layer
  • Apply 1, 2, or 3 Fully Connected Layers
  • Apply an Output Layer
  • Return the output
  • Apply TensorFlow's Dropout to one or more layers in the model using keep_prob.

In [13]:
def conv_net(x, keep_prob):
    """
    Create a convolutional neural network model
    : x: Placeholder tensor that holds image data.
    : keep_prob: Placeholder tensor that hold dropout keep probability.
    : return: Tensor that represents logits
    """
    # TODO: Apply 1, 2, or 3 Convolution and Max Pool layers
    #    Play around with different number of outputs, kernel size and stride
    # Function Definition from Above:
    #    conv2d_maxpool(x_tensor, conv_num_outputs, conv_ksize, conv_strides, pool_ksize, pool_strides)
    
    conv = conv2d_maxpool(x, 64, [4,4], [2,2], [4,4], [2,2])
    conv = conv2d_maxpool(conv, 128, [4,4], [2,2], [4,4], [2,2])
    conv = conv2d_maxpool(conv, 254, [4,4], [2,2], [4,4], [2,2])
    

    # TODO: Apply a Flatten Layer
    # Function Definition from Above:
    #   flatten(x_tensor)
    flattened_x = flatten(conv)
    

    # TODO: Apply 1, 2, or 3 Fully Connected Layers
    #    Play around with different number of outputs
    # Function Definition from Above:
    #   fully_conn(x_tensor, num_outputs)
    full_layer = fully_conn(flattened_x, 2048)
    full_layer = tf.nn.dropout(full_layer, keep_prob)
    full_layer = fully_conn(full_layer, 2048)
    full_layer = tf.nn.dropout(full_layer, keep_prob)
    
    
    # TODO: Apply an Output Layer
    #    Set this to the number of classes
    # Function Definition from Above:
    #   output(x_tensor, num_outputs)
    output_layer = output(full_layer, 10)
    
    
    # TODO: return output
    return output_layer


"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""

##############################
## Build the Neural Network ##
##############################

# Remove previous weights, bias, inputs, etc..
tf.reset_default_graph()

# Inputs
x = neural_net_image_input((32, 32, 3))
y = neural_net_label_input(10)
keep_prob = neural_net_keep_prob_input()

# Model
logits = conv_net(x, keep_prob)

# Name logits Tensor, so that is can be loaded from disk after training
logits = tf.identity(logits, name='logits')

# Loss and Optimizer
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=logits, labels=y))
optimizer = tf.train.AdamOptimizer().minimize(cost)

# Accuracy
correct_pred = tf.equal(tf.argmax(logits, 1), tf.argmax(y, 1))
accuracy = tf.reduce_mean(tf.cast(correct_pred, tf.float32), name='accuracy')

tests.test_conv_net(conv_net)


Neural Network Built!

Train the Neural Network

Single Optimization

Implement the function train_neural_network to do a single optimization. The optimization should use optimizer to optimize in session with a feed_dict of the following:

  • x for image input
  • y for labels
  • keep_prob for keep probability for dropout

This function will be called for each batch, so tf.global_variables_initializer() has already been called.

Note: Nothing needs to be returned. This function is only optimizing the neural network.


In [14]:
def train_neural_network(session, optimizer, keep_probability, feature_batch, label_batch):
    """
    Optimize the session on a batch of images and labels
    : session: Current TensorFlow session
    : optimizer: TensorFlow optimizer function
    : keep_probability: keep probability
    : feature_batch: Batch of Numpy image data
    : label_batch: Batch of Numpy label data
    """
    # TODO: Implement Function
    session.run(optimizer, feed_dict = {x: feature_batch, y: label_batch, keep_prob: keep_probability})
        


"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_train_nn(train_neural_network)


Tests Passed

Show Stats

Implement the function print_stats to print loss and validation accuracy. Use the global variables valid_features and valid_labels to calculate validation accuracy. Use a keep probability of 1.0 to calculate the loss and validation accuracy.


In [15]:
def print_stats(session, feature_batch, label_batch, cost, accuracy):
    """
    Print information about loss and validation accuracy
    : session: Current TensorFlow session
    : feature_batch: Batch of Numpy image data
    : label_batch: Batch of Numpy label data
    : cost: TensorFlow cost function
    : accuracy: TensorFlow accuracy function
    """
    # TODO: Implement Function
    print(session.run(cost, feed_dict = {x: feature_batch, y: label_batch, keep_prob: 1.0}))
    print(session.run(accuracy, feed_dict = {x: valid_features, y: valid_labels, keep_prob: 1.0}))

Hyperparameters

Tune the following parameters:

  • Set epochs to the number of iterations until the network stops learning or start overfitting
  • Set batch_size to the highest number that your machine has memory for. Most people set them to common sizes of memory:
    • 64
    • 128
    • 256
    • ...
  • Set keep_probability to the probability of keeping a node using dropout

In [16]:
# TODO: Tune Parameters
epochs = 50
batch_size = 512
keep_probability = 0.5

Train on a Single CIFAR-10 Batch

Instead of training the neural network on all the CIFAR-10 batches of data, let's use a single batch. This should save time while you iterate on the model to get a better accuracy. Once the final validation accuracy is 50% or greater, run the model on all the data in the next section.


In [17]:
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
print('Checking the Training on a Single Batch...')
with tf.Session() as sess:
    # Initializing the variables
    sess.run(tf.global_variables_initializer())
    
    # Training cycle
    for epoch in range(epochs):
        batch_i = 1
        for batch_features, batch_labels in helper.load_preprocess_training_batch(batch_i, batch_size):
            train_neural_network(sess, optimizer, keep_probability, batch_features, batch_labels)
        print('Epoch {:>2}, CIFAR-10 Batch {}:  '.format(epoch + 1, batch_i), end='')
        print_stats(sess, batch_features, batch_labels, cost, accuracy)


Checking the Training on a Single Batch...
Epoch  1, CIFAR-10 Batch 1:  2.19404
0.178
Epoch  2, CIFAR-10 Batch 1:  2.01839
0.2826
Epoch  3, CIFAR-10 Batch 1:  1.8744
0.3326
Epoch  4, CIFAR-10 Batch 1:  1.77784
0.3798
Epoch  5, CIFAR-10 Batch 1:  1.68298
0.3912
Epoch  6, CIFAR-10 Batch 1:  1.61434
0.421
Epoch  7, CIFAR-10 Batch 1:  1.50713
0.4354
Epoch  8, CIFAR-10 Batch 1:  1.42413
0.461
Epoch  9, CIFAR-10 Batch 1:  1.36696
0.4608
Epoch 10, CIFAR-10 Batch 1:  1.27398
0.4808
Epoch 11, CIFAR-10 Batch 1:  1.20977
0.4884
Epoch 12, CIFAR-10 Batch 1:  1.19683
0.4826
Epoch 13, CIFAR-10 Batch 1:  1.07412
0.5088
Epoch 14, CIFAR-10 Batch 1:  1.02847
0.5046
Epoch 15, CIFAR-10 Batch 1:  0.975882
0.5034
Epoch 16, CIFAR-10 Batch 1:  0.882206
0.5124
Epoch 17, CIFAR-10 Batch 1:  0.831756
0.5156
Epoch 18, CIFAR-10 Batch 1:  0.831632
0.503
Epoch 19, CIFAR-10 Batch 1:  0.763783
0.5188
Epoch 20, CIFAR-10 Batch 1:  0.77896
0.4796
Epoch 21, CIFAR-10 Batch 1:  0.687507
0.5186
Epoch 22, CIFAR-10 Batch 1:  0.668112
0.5186
Epoch 23, CIFAR-10 Batch 1:  0.656766
0.5256
Epoch 24, CIFAR-10 Batch 1:  0.62328
0.5286
Epoch 25, CIFAR-10 Batch 1:  0.534758
0.5292
Epoch 26, CIFAR-10 Batch 1:  0.515915
0.5184
Epoch 27, CIFAR-10 Batch 1:  0.54065
0.4982
Epoch 28, CIFAR-10 Batch 1:  0.413432
0.5292
Epoch 29, CIFAR-10 Batch 1:  0.38066
0.5452
Epoch 30, CIFAR-10 Batch 1:  0.335785
0.5344
Epoch 31, CIFAR-10 Batch 1:  0.314171
0.5272
Epoch 32, CIFAR-10 Batch 1:  0.290111
0.5268
Epoch 33, CIFAR-10 Batch 1:  0.295798
0.5142
Epoch 34, CIFAR-10 Batch 1:  0.359277
0.5208
Epoch 35, CIFAR-10 Batch 1:  0.332696
0.513
Epoch 36, CIFAR-10 Batch 1:  0.365781
0.5138
Epoch 37, CIFAR-10 Batch 1:  0.287645
0.531
Epoch 38, CIFAR-10 Batch 1:  0.234741
0.5402
Epoch 39, CIFAR-10 Batch 1:  0.300134
0.5094
Epoch 40, CIFAR-10 Batch 1:  0.359654
0.494
Epoch 41, CIFAR-10 Batch 1:  0.307713
0.489
Epoch 42, CIFAR-10 Batch 1:  0.239576
0.5196
Epoch 43, CIFAR-10 Batch 1:  0.194945
0.5416
Epoch 44, CIFAR-10 Batch 1:  0.155065
0.5496
Epoch 45, CIFAR-10 Batch 1:  0.143629
0.5358
Epoch 46, CIFAR-10 Batch 1:  0.203878
0.5072
Epoch 47, CIFAR-10 Batch 1:  0.24894
0.4978
Epoch 48, CIFAR-10 Batch 1:  0.169556
0.5214
Epoch 49, CIFAR-10 Batch 1:  0.156673
0.5148
Epoch 50, CIFAR-10 Batch 1:  0.151767
0.5134

Fully Train the Model

Now that you got a good accuracy with a single CIFAR-10 batch, try it with all five batches.


In [18]:
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
save_model_path = './image_classification'

print('Training...')
with tf.Session() as sess:
    # Initializing the variables
    sess.run(tf.global_variables_initializer())
    
    # Training cycle
    for epoch in range(epochs):
        # Loop over all batches
        n_batches = 5
        for batch_i in range(1, n_batches + 1):
            for batch_features, batch_labels in helper.load_preprocess_training_batch(batch_i, batch_size):
                train_neural_network(sess, optimizer, keep_probability, batch_features, batch_labels)
            print('Epoch {:>2}, CIFAR-10 Batch {}:  '.format(epoch + 1, batch_i), end='')
            print_stats(sess, batch_features, batch_labels, cost, accuracy)
            
    # Save Model
    saver = tf.train.Saver()
    save_path = saver.save(sess, save_model_path)


Training...
Epoch  1, CIFAR-10 Batch 1:  2.17807
0.1908
Epoch  1, CIFAR-10 Batch 2:  1.95179
0.2742
Epoch  1, CIFAR-10 Batch 3:  1.84225
0.3094
Epoch  1, CIFAR-10 Batch 4:  1.76153
0.3342
Epoch  1, CIFAR-10 Batch 5:  1.71295
0.3524
Epoch  2, CIFAR-10 Batch 1:  1.69944
0.3832
Epoch  2, CIFAR-10 Batch 2:  1.65941
0.3978
Epoch  2, CIFAR-10 Batch 3:  1.51846
0.409
Epoch  2, CIFAR-10 Batch 4:  1.49259
0.4274
Epoch  2, CIFAR-10 Batch 5:  1.45563
0.4346
Epoch  3, CIFAR-10 Batch 1:  1.47814
0.4674
Epoch  3, CIFAR-10 Batch 2:  1.46239
0.4684
Epoch  3, CIFAR-10 Batch 3:  1.31846
0.469
Epoch  3, CIFAR-10 Batch 4:  1.34742
0.484
Epoch  3, CIFAR-10 Batch 5:  1.31908
0.4872
Epoch  4, CIFAR-10 Batch 1:  1.37959
0.4954
Epoch  4, CIFAR-10 Batch 2:  1.34995
0.4982
Epoch  4, CIFAR-10 Batch 3:  1.20967
0.504
Epoch  4, CIFAR-10 Batch 4:  1.23697
0.5106
Epoch  4, CIFAR-10 Batch 5:  1.22635
0.5206
Epoch  5, CIFAR-10 Batch 1:  1.29317
0.5152
Epoch  5, CIFAR-10 Batch 2:  1.25461
0.5356
Epoch  5, CIFAR-10 Batch 3:  1.12318
0.5244
Epoch  5, CIFAR-10 Batch 4:  1.15061
0.5388
Epoch  5, CIFAR-10 Batch 5:  1.1389
0.5452
Epoch  6, CIFAR-10 Batch 1:  1.19491
0.5548
Epoch  6, CIFAR-10 Batch 2:  1.19241
0.543
Epoch  6, CIFAR-10 Batch 3:  1.0395
0.5494
Epoch  6, CIFAR-10 Batch 4:  1.08373
0.55
Epoch  6, CIFAR-10 Batch 5:  1.05959
0.5692
Epoch  7, CIFAR-10 Batch 1:  1.16406
0.5494
Epoch  7, CIFAR-10 Batch 2:  1.08746
0.5768
Epoch  7, CIFAR-10 Batch 3:  0.989666
0.5748
Epoch  7, CIFAR-10 Batch 4:  1.00688
0.5702
Epoch  7, CIFAR-10 Batch 5:  0.980808
0.5798
Epoch  8, CIFAR-10 Batch 1:  1.08756
0.573
Epoch  8, CIFAR-10 Batch 2:  1.02043
0.581
Epoch  8, CIFAR-10 Batch 3:  0.96025
0.5808
Epoch  8, CIFAR-10 Batch 4:  0.951963
0.5884
Epoch  8, CIFAR-10 Batch 5:  0.958122
0.5884
Epoch  9, CIFAR-10 Batch 1:  1.00909
0.5826
Epoch  9, CIFAR-10 Batch 2:  0.978864
0.596
Epoch  9, CIFAR-10 Batch 3:  0.896663
0.5944
Epoch  9, CIFAR-10 Batch 4:  0.872807
0.598
Epoch  9, CIFAR-10 Batch 5:  0.875872
0.6032
Epoch 10, CIFAR-10 Batch 1:  0.943985
0.6028
Epoch 10, CIFAR-10 Batch 2:  0.915934
0.6068
Epoch 10, CIFAR-10 Batch 3:  0.846296
0.5988
Epoch 10, CIFAR-10 Batch 4:  0.821391
0.612
Epoch 10, CIFAR-10 Batch 5:  0.850189
0.6002
Epoch 11, CIFAR-10 Batch 1:  0.913553
0.602
Epoch 11, CIFAR-10 Batch 2:  0.873227
0.6138
Epoch 11, CIFAR-10 Batch 3:  0.849553
0.5878
Epoch 11, CIFAR-10 Batch 4:  0.789071
0.6152
Epoch 11, CIFAR-10 Batch 5:  0.782697
0.6206
Epoch 12, CIFAR-10 Batch 1:  0.88925
0.6046
Epoch 12, CIFAR-10 Batch 2:  0.836205
0.623
Epoch 12, CIFAR-10 Batch 3:  0.831855
0.5804
Epoch 12, CIFAR-10 Batch 4:  0.74879
0.6206
Epoch 12, CIFAR-10 Batch 5:  0.762001
0.6296
Epoch 13, CIFAR-10 Batch 1:  0.805714
0.6144
Epoch 13, CIFAR-10 Batch 2:  0.838461
0.6096
Epoch 13, CIFAR-10 Batch 3:  0.780886
0.5968
Epoch 13, CIFAR-10 Batch 4:  0.723775
0.6212
Epoch 13, CIFAR-10 Batch 5:  0.738169
0.6398
Epoch 14, CIFAR-10 Batch 1:  0.806651
0.6132
Epoch 14, CIFAR-10 Batch 2:  0.77004
0.619
Epoch 14, CIFAR-10 Batch 3:  0.693847
0.6186
Epoch 14, CIFAR-10 Batch 4:  0.717333
0.6098
Epoch 14, CIFAR-10 Batch 5:  0.674476
0.6332
Epoch 15, CIFAR-10 Batch 1:  0.753295
0.6238
Epoch 15, CIFAR-10 Batch 2:  0.730211
0.6322
Epoch 15, CIFAR-10 Batch 3:  0.630472
0.6274
Epoch 15, CIFAR-10 Batch 4:  0.687185
0.6422
Epoch 15, CIFAR-10 Batch 5:  0.652016
0.629
Epoch 16, CIFAR-10 Batch 1:  0.732527
0.6148
Epoch 16, CIFAR-10 Batch 2:  0.700618
0.6274
Epoch 16, CIFAR-10 Batch 3:  0.63968
0.6292
Epoch 16, CIFAR-10 Batch 4:  0.709049
0.6266
Epoch 16, CIFAR-10 Batch 5:  0.632986
0.6422
Epoch 17, CIFAR-10 Batch 1:  0.705437
0.6232
Epoch 17, CIFAR-10 Batch 2:  0.694772
0.626
Epoch 17, CIFAR-10 Batch 3:  0.593764
0.6404
Epoch 17, CIFAR-10 Batch 4:  0.618719
0.6376
Epoch 17, CIFAR-10 Batch 5:  0.581663
0.639
Epoch 18, CIFAR-10 Batch 1:  0.630075
0.6362
Epoch 18, CIFAR-10 Batch 2:  0.641854
0.621
Epoch 18, CIFAR-10 Batch 3:  0.561716
0.6348
Epoch 18, CIFAR-10 Batch 4:  0.602747
0.6426
Epoch 18, CIFAR-10 Batch 5:  0.568583
0.647
Epoch 19, CIFAR-10 Batch 1:  0.622813
0.635
Epoch 19, CIFAR-10 Batch 2:  0.633272
0.6092
Epoch 19, CIFAR-10 Batch 3:  0.55119
0.6336
Epoch 19, CIFAR-10 Batch 4:  0.554207
0.6512
Epoch 19, CIFAR-10 Batch 5:  0.532406
0.6388
Epoch 20, CIFAR-10 Batch 1:  0.579411
0.6348
Epoch 20, CIFAR-10 Batch 2:  0.684933
0.5894
Epoch 20, CIFAR-10 Batch 3:  0.573168
0.6224
Epoch 20, CIFAR-10 Batch 4:  0.542699
0.6422
Epoch 20, CIFAR-10 Batch 5:  0.493428
0.6512
Epoch 21, CIFAR-10 Batch 1:  0.532098
0.6464
Epoch 21, CIFAR-10 Batch 2:  0.654738
0.593
Epoch 21, CIFAR-10 Batch 3:  0.571783
0.6102
Epoch 21, CIFAR-10 Batch 4:  0.580984
0.628
Epoch 21, CIFAR-10 Batch 5:  0.464566
0.651
Epoch 22, CIFAR-10 Batch 1:  0.529482
0.6406
Epoch 22, CIFAR-10 Batch 2:  0.594885
0.6108
Epoch 22, CIFAR-10 Batch 3:  0.541695
0.632
Epoch 22, CIFAR-10 Batch 4:  0.522936
0.6516
Epoch 22, CIFAR-10 Batch 5:  0.451552
0.6534
Epoch 23, CIFAR-10 Batch 1:  0.509567
0.6418
Epoch 23, CIFAR-10 Batch 2:  0.555317
0.6384
Epoch 23, CIFAR-10 Batch 3:  0.49823
0.643
Epoch 23, CIFAR-10 Batch 4:  0.476952
0.6538
Epoch 23, CIFAR-10 Batch 5:  0.44645
0.6424
Epoch 24, CIFAR-10 Batch 1:  0.506255
0.6458
Epoch 24, CIFAR-10 Batch 2:  0.568293
0.6322
Epoch 24, CIFAR-10 Batch 3:  0.444706
0.6516
Epoch 24, CIFAR-10 Batch 4:  0.487937
0.6536
Epoch 24, CIFAR-10 Batch 5:  0.430189
0.6498
Epoch 25, CIFAR-10 Batch 1:  0.457535
0.6576
Epoch 25, CIFAR-10 Batch 2:  0.551176
0.6214
Epoch 25, CIFAR-10 Batch 3:  0.438675
0.6418
Epoch 25, CIFAR-10 Batch 4:  0.437272
0.6586
Epoch 25, CIFAR-10 Batch 5:  0.429059
0.6442
Epoch 26, CIFAR-10 Batch 1:  0.431045
0.6526
Epoch 26, CIFAR-10 Batch 2:  0.507526
0.6208
Epoch 26, CIFAR-10 Batch 3:  0.417906
0.6384
Epoch 26, CIFAR-10 Batch 4:  0.436164
0.6536
Epoch 26, CIFAR-10 Batch 5:  0.385224
0.653
Epoch 27, CIFAR-10 Batch 1:  0.399536
0.6536
Epoch 27, CIFAR-10 Batch 2:  0.480617
0.6292
Epoch 27, CIFAR-10 Batch 3:  0.446026
0.6436
Epoch 27, CIFAR-10 Batch 4:  0.417364
0.6584
Epoch 27, CIFAR-10 Batch 5:  0.361315
0.6624
Epoch 28, CIFAR-10 Batch 1:  0.410177
0.6416
Epoch 28, CIFAR-10 Batch 2:  0.491143
0.6252
Epoch 28, CIFAR-10 Batch 3:  0.402241
0.645
Epoch 28, CIFAR-10 Batch 4:  0.419314
0.653
Epoch 28, CIFAR-10 Batch 5:  0.386535
0.65
Epoch 29, CIFAR-10 Batch 1:  0.407958
0.6482
Epoch 29, CIFAR-10 Batch 2:  0.476705
0.6188
Epoch 29, CIFAR-10 Batch 3:  0.366869
0.653
Epoch 29, CIFAR-10 Batch 4:  0.366494
0.6568
Epoch 29, CIFAR-10 Batch 5:  0.349014
0.6612
Epoch 30, CIFAR-10 Batch 1:  0.385157
0.6548
Epoch 30, CIFAR-10 Batch 2:  0.498721
0.6246
Epoch 30, CIFAR-10 Batch 3:  0.353588
0.641
Epoch 30, CIFAR-10 Batch 4:  0.381824
0.6524
Epoch 30, CIFAR-10 Batch 5:  0.325161
0.6652
Epoch 31, CIFAR-10 Batch 1:  0.376686
0.641
Epoch 31, CIFAR-10 Batch 2:  0.417783
0.6502
Epoch 31, CIFAR-10 Batch 3:  0.354053
0.6408
Epoch 31, CIFAR-10 Batch 4:  0.344441
0.656
Epoch 31, CIFAR-10 Batch 5:  0.334344
0.6586
Epoch 32, CIFAR-10 Batch 1:  0.372797
0.6568
Epoch 32, CIFAR-10 Batch 2:  0.422025
0.6454
Epoch 32, CIFAR-10 Batch 3:  0.34145
0.6348
Epoch 32, CIFAR-10 Batch 4:  0.340385
0.6572
Epoch 32, CIFAR-10 Batch 5:  0.280612
0.658
Epoch 33, CIFAR-10 Batch 1:  0.323268
0.6592
Epoch 33, CIFAR-10 Batch 2:  0.379113
0.641
Epoch 33, CIFAR-10 Batch 3:  0.302712
0.6488
Epoch 33, CIFAR-10 Batch 4:  0.348928
0.647
Epoch 33, CIFAR-10 Batch 5:  0.250376
0.6554
Epoch 34, CIFAR-10 Batch 1:  0.344328
0.6512
Epoch 34, CIFAR-10 Batch 2:  0.392583
0.6384
Epoch 34, CIFAR-10 Batch 3:  0.320697
0.6264
Epoch 34, CIFAR-10 Batch 4:  0.313287
0.6422
Epoch 34, CIFAR-10 Batch 5:  0.226866
0.6536
Epoch 35, CIFAR-10 Batch 1:  0.315031
0.6428
Epoch 35, CIFAR-10 Batch 2:  0.38831
0.6274
Epoch 35, CIFAR-10 Batch 3:  0.310194
0.6384
Epoch 35, CIFAR-10 Batch 4:  0.353543
0.6266
Epoch 35, CIFAR-10 Batch 5:  0.270993
0.641
Epoch 36, CIFAR-10 Batch 1:  0.347361
0.6352
Epoch 36, CIFAR-10 Batch 2:  0.456257
0.6092
Epoch 36, CIFAR-10 Batch 3:  0.329135
0.6478
Epoch 36, CIFAR-10 Batch 4:  0.367991
0.6226
Epoch 36, CIFAR-10 Batch 5:  0.286201
0.6496
Epoch 37, CIFAR-10 Batch 1:  0.342068
0.6376
Epoch 37, CIFAR-10 Batch 2:  0.434696
0.6276
Epoch 37, CIFAR-10 Batch 3:  0.275959
0.6546
Epoch 37, CIFAR-10 Batch 4:  0.2948
0.6376
Epoch 37, CIFAR-10 Batch 5:  0.31609
0.628
Epoch 38, CIFAR-10 Batch 1:  0.341899
0.637
Epoch 38, CIFAR-10 Batch 2:  0.387622
0.6364
Epoch 38, CIFAR-10 Batch 3:  0.256899
0.653
Epoch 38, CIFAR-10 Batch 4:  0.297378
0.637
Epoch 38, CIFAR-10 Batch 5:  0.253032
0.6478
Epoch 39, CIFAR-10 Batch 1:  0.323094
0.6328
Epoch 39, CIFAR-10 Batch 2:  0.367586
0.6348
Epoch 39, CIFAR-10 Batch 3:  0.242923
0.655
Epoch 39, CIFAR-10 Batch 4:  0.260086
0.6368
Epoch 39, CIFAR-10 Batch 5:  0.252888
0.6532
Epoch 40, CIFAR-10 Batch 1:  0.246971
0.6458
Epoch 40, CIFAR-10 Batch 2:  0.345772
0.6336
Epoch 40, CIFAR-10 Batch 3:  0.207135
0.6564
Epoch 40, CIFAR-10 Batch 4:  0.231872
0.6496
Epoch 40, CIFAR-10 Batch 5:  0.257861
0.645
Epoch 41, CIFAR-10 Batch 1:  0.248529
0.6424
Epoch 41, CIFAR-10 Batch 2:  0.330545
0.638
Epoch 41, CIFAR-10 Batch 3:  0.17596
0.6632
Epoch 41, CIFAR-10 Batch 4:  0.231253
0.643
Epoch 41, CIFAR-10 Batch 5:  0.289154
0.6352
Epoch 42, CIFAR-10 Batch 1:  0.240611
0.6622
Epoch 42, CIFAR-10 Batch 2:  0.299844
0.6406
Epoch 42, CIFAR-10 Batch 3:  0.218802
0.652
Epoch 42, CIFAR-10 Batch 4:  0.220478
0.6334
Epoch 42, CIFAR-10 Batch 5:  0.297552
0.6284
Epoch 43, CIFAR-10 Batch 1:  0.26076
0.6572
Epoch 43, CIFAR-10 Batch 2:  0.322687
0.6374
Epoch 43, CIFAR-10 Batch 3:  0.202686
0.6526
Epoch 43, CIFAR-10 Batch 4:  0.272402
0.6288
Epoch 43, CIFAR-10 Batch 5:  0.246136
0.6442
Epoch 44, CIFAR-10 Batch 1:  0.423716
0.624
Epoch 44, CIFAR-10 Batch 2:  0.350754
0.63
Epoch 44, CIFAR-10 Batch 3:  0.212171
0.6626
Epoch 44, CIFAR-10 Batch 4:  0.207537
0.643
Epoch 44, CIFAR-10 Batch 5:  0.179021
0.6664
Epoch 45, CIFAR-10 Batch 1:  0.255132
0.6476
Epoch 45, CIFAR-10 Batch 2:  0.300322
0.6366
Epoch 45, CIFAR-10 Batch 3:  0.206684
0.652
Epoch 45, CIFAR-10 Batch 4:  0.188448
0.6406
Epoch 45, CIFAR-10 Batch 5:  0.178477
0.6568
Epoch 46, CIFAR-10 Batch 1:  0.324538
0.619
Epoch 46, CIFAR-10 Batch 2:  0.282484
0.65
Epoch 46, CIFAR-10 Batch 3:  0.184469
0.649
Epoch 46, CIFAR-10 Batch 4:  0.183828
0.6468
Epoch 46, CIFAR-10 Batch 5:  0.191962
0.6498
Epoch 47, CIFAR-10 Batch 1:  0.269841
0.6404
Epoch 47, CIFAR-10 Batch 2:  0.242402
0.6448
Epoch 47, CIFAR-10 Batch 3:  0.159538
0.6554
Epoch 47, CIFAR-10 Batch 4:  0.170903
0.6522
Epoch 47, CIFAR-10 Batch 5:  0.196865
0.6362
Epoch 48, CIFAR-10 Batch 1:  0.217682
0.648
Epoch 48, CIFAR-10 Batch 2:  0.218512
0.648
Epoch 48, CIFAR-10 Batch 3:  0.143181
0.655
Epoch 48, CIFAR-10 Batch 4:  0.14951
0.6556
Epoch 48, CIFAR-10 Batch 5:  0.196995
0.6436
Epoch 49, CIFAR-10 Batch 1:  0.28221
0.6308
Epoch 49, CIFAR-10 Batch 2:  0.264819
0.6274
Epoch 49, CIFAR-10 Batch 3:  0.144478
0.6566
Epoch 49, CIFAR-10 Batch 4:  0.14454
0.6574
Epoch 49, CIFAR-10 Batch 5:  0.178129
0.6324
Epoch 50, CIFAR-10 Batch 1:  0.256226
0.638
Epoch 50, CIFAR-10 Batch 2:  0.225462
0.6468
Epoch 50, CIFAR-10 Batch 3:  0.168518
0.6494
Epoch 50, CIFAR-10 Batch 4:  0.144772
0.647
Epoch 50, CIFAR-10 Batch 5:  0.156248
0.6476

Checkpoint

The model has been saved to disk.

Test Model

Test your model against the test dataset. This will be your final accuracy. You should have an accuracy greater than 50%. If you don't, keep tweaking the model architecture and parameters.


In [19]:
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
%matplotlib inline
%config InlineBackend.figure_format = 'retina'

import tensorflow as tf
import pickle
import helper
import random

# Set batch size if not already set
try:
    if batch_size:
        pass
except NameError:
    batch_size = 64

save_model_path = './image_classification'
n_samples = 4
top_n_predictions = 3

def test_model():
    """
    Test the saved model against the test dataset
    """

    test_features, test_labels = pickle.load(open('preprocess_training.p', mode='rb'))
    loaded_graph = tf.Graph()

    with tf.Session(graph=loaded_graph) as sess:
        # Load model
        loader = tf.train.import_meta_graph(save_model_path + '.meta')
        loader.restore(sess, save_model_path)

        # Get Tensors from loaded model
        loaded_x = loaded_graph.get_tensor_by_name('x:0')
        loaded_y = loaded_graph.get_tensor_by_name('y:0')
        loaded_keep_prob = loaded_graph.get_tensor_by_name('keep_prob:0')
        loaded_logits = loaded_graph.get_tensor_by_name('logits:0')
        loaded_acc = loaded_graph.get_tensor_by_name('accuracy:0')
        
        # Get accuracy in batches for memory limitations
        test_batch_acc_total = 0
        test_batch_count = 0
        
        for train_feature_batch, train_label_batch in helper.batch_features_labels(test_features, test_labels, batch_size):
            test_batch_acc_total += sess.run(
                loaded_acc,
                feed_dict={loaded_x: train_feature_batch, loaded_y: train_label_batch, loaded_keep_prob: 1.0})
            test_batch_count += 1

        print('Testing Accuracy: {}\n'.format(test_batch_acc_total/test_batch_count))

        # Print Random Samples
        random_test_features, random_test_labels = tuple(zip(*random.sample(list(zip(test_features, test_labels)), n_samples)))
        random_test_predictions = sess.run(
            tf.nn.top_k(tf.nn.softmax(loaded_logits), top_n_predictions),
            feed_dict={loaded_x: random_test_features, loaded_y: random_test_labels, loaded_keep_prob: 1.0})
        helper.display_image_predictions(random_test_features, random_test_labels, random_test_predictions)


test_model()


Testing Accuracy: 0.6265912234783173

Why 50-80% Accuracy?

You might be wondering why you can't get an accuracy any higher. First things first, 50% isn't bad for a simple CNN. Pure guessing would get you 10% accuracy. However, you might notice people are getting scores well above 80%. That's because we haven't taught you all there is to know about neural networks. We still need to cover a few more techniques.

Submitting This Project

When submitting this project, make sure to run all the cells before saving the notebook. Save the notebook file as "dlnd_image_classification.ipynb" and save it as a HTML file under "File" -> "Download as". Include the "helper.py" and "problem_unittests.py" files in your submission.