This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error when I try to run the mysql server: | |
Last login: Mon Feb 17 10:22:15 on ttys000 | |
Ryans-MacBook-Pro-2:devmounta.in-www ryanallred$ mysql | |
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) | |
Ryans-MacBook-Pro-2:devmounta.in-www ryanallred$ mysql.server start | |
Starting MySQL | |
.................................................................................................... ERROR! The server quit without updating PID file (/usr/local/var/mysql/Ryans-MacBook-Pro-2.local.pid). | |
Ryans-MacBook-Pro-2:devmounta.in-www ryanallred$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# input image dimensions | |
img_rows, img_cols = 32, 32 | |
# the data, shuffled and split between train and test sets | |
(x_train, y_train), (x_test, y_test) = cifar10.load_data() | |
#Only look at cats [=3] and dogs [=5] | |
train_picks = np.ravel(np.logical_or(y_train==3,y_train==5)) | |
test_picks = np.ravel(np.logical_or(y_test==3,y_test==5)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import keras | |
from keras.datasets import cifar10 | |
from keras import backend as K | |
import matplotlib | |
from matplotlib import pyplot as plt | |
import numpy as np | |
#Input image dimensions | |
img_rows, img_cols = 32, 32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rotate images by 90 degrees | |
datagen = ImageDataGenerator(rotation_range=90) | |
# fit parameters from data | |
datagen.fit(x_train) | |
# Configure batch size and retrieve one batch of images | |
for X_batch, y_batch in datagen.flow(x_train, y_train, batch_size=9): | |
# Show 9 images | |
for i in range(0, 9): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Flip images vertically | |
datagen = ImageDataGenerator(vertical_flip=True) | |
# fit parameters from data | |
datagen.fit(x_train) | |
# Configure batch size and retrieve one batch of images | |
for X_batch, y_batch in datagen.flow(x_train, y_train, batch_size=9): | |
# Show 9 images | |
for i in range(0, 9): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shift images vertically or horizontally | |
# Fill missing pixels with the color of the nearest pixel | |
datagen = ImageDataGenerator(width_shift_range=.2, | |
height_shift_range=.2, | |
fill_mode='nearest') | |
# fit parameters from data | |
datagen.fit(x_train) | |
# Configure batch size and retrieve one batch of images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import skimage modules | |
from skimage import data, img_as_float | |
from skimage import exposure | |
# Lets try augmenting a cifar10 image using these techniques | |
from skimage import data, img_as_float | |
from skimage import exposure | |
# Load an example image from cifar10 dataset | |
img = images[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __init__(self, | |
contrast_stretching=False, ##### | |
histogram_equalization=False, ##### | |
adaptive_equalization=False, ##### | |
featurewise_center=False, | |
samplewise_center=False, | |
featurewise_std_normalization=False, | |
samplewise_std_normalization=False, | |
zca_whitening=False, | |
rotation_range=0., |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def random_transform(self, x): | |
img_row_axis = self.row_axis - 1 | |
img_col_axis = self.col_axis - 1 | |
img_channel_axis = self.channel_axis - 1 | |
# use composition of homographies | |
# to generate final transform that needs to be applied | |
if self.rotation_range: | |
theta = np.pi / 180 * np.random.uniform(-self.rotation_range, self.rotation_range) | |
else: | |
theta = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initialize Generator | |
datagen = ImageDataGenerator(contrast_stretching=True, adaptive_equalization=True, histogram_equalization=True) | |
# fit parameters from data | |
datagen.fit(x_train) | |
# Configure batch size and retrieve one batch of images | |
for x_batch, y_batch in datagen.flow(x_train, y_train, batch_size=9): | |
# Show the first 9 images | |
for i in range(0, 9): |
OlderNewer