Skip to content

Commit

Permalink
New lstm examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas committed Jul 30, 2017
1 parent 7821207 commit f5e4411
Show file tree
Hide file tree
Showing 29 changed files with 8,448 additions and 37 deletions.
2 changes: 1 addition & 1 deletion convolution-demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
image = io.imread('dog.jpg', as_grey=True)

kernel = [[0.0, 0.5, 0.0],
[0.5, 0.0, -0.5],
[-0.0, 0.0, 0.0],
[0.0, -0.5, 0.0]]

new_image = convolve2d(image, kernel)
Expand Down
7 changes: 4 additions & 3 deletions dogcat-1.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
# dimensions of our images.
img_width, img_height = 150, 150

train_data_dir = 'dogcat-data/train'
validation_data_dir = 'dogcat-data/validation'
train_data_dir = 'dogcat-data-small/train'
validation_data_dir = 'dogcat-data-small/validation'
nb_train_samples = 2000
nb_validation_samples = 2000
epochs = 50
Expand All @@ -45,7 +45,8 @@
model.add(Dropout(0.5))
model.add(Dense(1))
model.add(Activation('sigmoid'))

model.summary()
exit()
model.compile(loss='binary_crossentropy', optimizer='sgd',
metrics=['accuracy'])

Expand Down
6 changes: 3 additions & 3 deletions dogcat-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
horizontal_flip=True,
fill_mode='nearest')

img = load_img('data/train/cats/cat.0.jpg') # this is a PIL image
x = img_to_array(img) # this is a Numpy array with shape (3, 150, 150)
x = x.reshape((1,) + x.shape) # this is a Numpy array with shape (1, 3, 150, 150)
#img = load_img('data/train/cats/cat.0.jpg') # this is a PIL image
#x = img_to_array(img) # this is a Numpy array with shape (3, 150, 150)
#x = x.reshape((1,) + x.shape) # this is a Numpy array with shape (1, 3, 150, 150)

# the .flow() command below generates batches of randomly transformed images
# and saves the results to the `preview/` directory
Expand Down
Loading

0 comments on commit f5e4411

Please sign in to comment.