Exemple #1
0
def make_pipeline(imageset_path, output_dir):
    """returns an augmentation pipeline for a given image set"""
    p = Pipeline(imageset_path, output_dir)
    p.random_distortion(probability=0.7,
                        grid_width=4,
                        grid_height=4,
                        magnitude=8)
    p.flip_left_right(probability=0.5)
    p.flip_top_bottom(probability=0.5)
    p.zoom(probability=0.3, min_factor=1.1, max_factor=1.4)
    p.rotate(probability=0.5, max_left_rotation=10, max_right_rotation=10)
    return p
# In[10]:

print(os.listdir())

# In[11]:

from Augmentor import Pipeline

# In[12]:

augmentor = Pipeline('/home/asherif844/sparkNotebooks/Ch03/MNIST/images')

# In[13]:

augmentor.rotate(probability=0.9, max_left_rotation=25, max_right_rotation=25)

# In[14]:

for i in range(1, 3):
    augmentor.sample(10)

# In[15]:

xtrain = data.train.images
ytrain = np.asarray(data.train.labels)
xtest = data.test.images
ytest = np.asarray(data.test.labels)

# In[16]: