Esempio n. 1
0
    img = np.expand_dims(img, axis=0)
    print("image %s shape" % (i), img.shape)
    if i == 1:
        X_extra = img
    else:
        X_extra = np.append(X_extra, img, axis=0)
        
# grayscale
c_map = 'viridis'

row_count = 2
plot_images(X_extra, row_count, c_map)

if USE_GRAYSCALE:
    X_extra = rgb_to_gray(X_extra)
    c_map = plt.cm.gray    
    
# normalize
X_extra = np.subtract(X_extra, 128.0)
extra_mean = np.mean(X_extra, axis=(0,1,2))
X_extra = np.subtract(X_extra, extra_mean)

row_count = 2
plot_images(X_extra, row_count, c_map)

#printing out some stats and plotting
print('The extra data shape is:', X_extra.shape)

# labels
y_extra = [14, 28, 13, 27, 17, 26, 2, 33, 5, 5]
Esempio n. 2
0
    img = np.expand_dims(img, axis=0)
    print("image %s shape" % (i), img.shape)
    if i == 1:
        X_EXTRA = img
    else:
        X_EXTRA = np.append(X_EXTRA, img, axis=0)

# grayscale
C_MAP = 'viridis'

ROW_COUNT = 2
plot_images(X_EXTRA, ROW_COUNT, C_MAP)

if USE_GRAYSCALE:
    X_EXTRA = rgb_to_gray(X_EXTRA)
    C_MAP = 'gray'

# normalize
X_EXTRA = np.subtract(X_EXTRA, 128.0)
EXTRA_MEAN = np.mean(X_EXTRA, axis=(0, 1, 2))
X_EXTRA = np.subtract(X_EXTRA, EXTRA_MEAN)

plot_images(X_EXTRA, ROW_COUNT, C_MAP)

#printing out some stats and plotting
print('The extra data shape is:', X_EXTRA.shape)

# labels
Y_EXTRA = [14, 28, 13, 27, 17, 26, 2, 33, 5, 5]