> For the complete documentation index, see [llms.txt](https://stephanosterburg.gitbook.io/scrapbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stephanosterburg.gitbook.io/scrapbook/career/learn.co/keras.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
