# Keras

## Reproducible Results

```python
import random as rn
import numpy as np
import tensorflow as tf

import os
os.environ['PYTHONHASHSEED'] = '0'

# Setting the seed for numpy-generated random seed
np.randon.sedd(27)

# Setting the seed for python-generated random seed
rn.seed(123)

# Setting the seed for tensorflow-generated random seed
tf.set_random_seed(42)

# Force tensorflow to use a single thread
from keras import backend as K

sees = tf.Session(graph=tf.get_default_graph(), config=session_conf)
K.set_session(sees)
```

## Data Augmentation

```python
gen = ImageDataGenerator(....)

image_path = 'image_file.jpeg'

# Obtain image
image = np.expand_dims(ndimage.imread(image_path), 0)
plt.imshow(image[0])

# Generate batches of augentated images from given image
aug_ter = gen.flow(image)

# Get 10 samplese of augentated images
aug_img = [next(aug_iter)[0].astype(np.uint8) for i in range(10)]

# Plot augmentated images (see helper function in notebook)
plots(aug_img, figsize=(12, 8), rows=2) 
```

##


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://stephanosterburg.gitbook.io/scrapbook/career/learn.co/keras.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
