Skip to content

Commit 11886a4

Browse files
committed
Log images in autoencoder
2 parents ae1ef9e + cab490d commit 11886a4

File tree

7 files changed

+14
-21
lines changed

7 files changed

+14
-21
lines changed

keras-cnn/cnn.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
model.add(MaxPooling2D(pool_size=(2, 2)))
3434
model.add(Flatten())
3535
model.add(Dense(config.dense_layer_size, activation='relu'))
36-
model.add(Dropout(0.4))
3736
model.add(Dense(num_classes, activation='softmax'))
3837

3938
model.compile(loss='categorical_crossentropy', optimizer='adam',

keras-cnn/conv-demo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
from scipy.signal import convolve2d
44

55

6-
kernel = [[0.0,0.0,0.0],
7-
[0.0,1.0,0.0],
8-
[0.0,0.0,0.0]]
6+
kernel = [[0.0,-1.0,0.0],
7+
[-1.0,4.0,-1.0],
8+
[0.0,-1.0,0.0]]
99

1010
backgroundColor = (0,)*3
1111
pixelSize = 10

keras-fashion/perceptron-linear.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
# Fit the model
3434
model.fit(X_train, y_train, epochs=config.epochs, validation_data=(X_test, y_test),
35-
callbacks=[WandbKerasCallback()])
35+
callbacks=[WandbKerasCallback(validation_data=X_test, labels=y_test)])
3636

3737

3838
# Output some predictions
@@ -53,4 +53,4 @@
5353

5454
draw = ImageDraw.Draw(img)
5555
draw.text((10, 10),labels[prediction],(255))
56-
img.save(str(i)+".jpg")
56+
img.save(str(i)+".jpg")

keras-mlp/dropout.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@
3333
model.add(Dropout(config.dropout))
3434
model.add(Dense(config.hidden_nodes, activation='relu'))
3535
model.add(Dropout(config.dropout))
36-
model.add(Dense(config.hidden_nodes, activation='relu'))
37-
model.add(Dropout(config.dropout))
38-
model.add(Dense(config.hidden_nodes, activation='relu'))
39-
model.add(Dropout(config.dropout))
40-
model.add(Dense(config.hidden_nodes, activation='relu'))
41-
model.add(Dropout(config.dropout))
4236
model.add(Dense(num_classes, activation='softmax'))
4337
model.compile(loss='categorical_crossentropy', optimizer=config.optimizer,
4438
metrics=['accuracy'])

keras-perceptron/digits.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import numpy as np
33
(X_train, y_train), (X_test, y_test) = mnist.load_data()
44

5-
idx = 150 # index of the digit I want to look at
5+
idx = 200 # index of the digit I want to look at
66
digit = X_train[idx]
77

88
# make an ascii-art drawing of the digit I'm looking at
@@ -14,7 +14,7 @@
1414
elif digit[i][j] < 128:
1515
str += "."
1616
else:
17-
str += "X"
17+
str += "*"
1818
str += "\n"
1919

2020
print(str)

keras-transfer/inception-inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
model = InceptionV3(weights='imagenet')
99

10-
img_path = 'toaster.jpg'
10+
img_path = 'elephant.jpg'
1111
img = image.load_img(img_path, target_size=(299, 299))
1212
x = image.img_to_array(img)
1313
x = np.expand_dims(x, axis=0)

keras-transfer/vgg-inspect.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ def VGG_16(weights_path=None):
6161
return model
6262

6363
if __name__ == "__main__":
64-
# im = cv2.resize(cv2.imread('elephant.jpg'), (224, 224)).astype(np.float32)
65-
# im[:,:,0] -= 103.939
66-
# im[:,:,1] -= 116.779
67-
# im[:,:,2] -= 123.68
68-
# im = im.transpose((2,0,1))
69-
# im = np.expand_dims(im, axis=0)
64+
#im = cv2.resize(cv2.imread('elephant.jpg'), (224, 224)).astype(np.float32)
65+
#im[:,:,0] -= 103.939
66+
#im[:,:,1] -= 116.779
67+
#im[:,:,2] -= 123.68
68+
#im = im.transpose((2,0,1))
69+
#im = np.expand_dims(im, axis=0)
7070
model = VGG_16()
7171
model.summary()
7272
# Test pretrained model

0 commit comments

Comments
 (0)