Skip to content

Commit 5dbded2

Browse files
committed
plot samples
1 parent 413be60 commit 5dbded2

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

mitdeeplearning/util.py

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,6 @@
99

1010

1111

12-
#####################################
13-
def custom_progress_text(message):
14-
15-
message_ = message.replace('(', '{')
16-
message_ = message_.replace(')', '}')
17-
18-
keys = [key[1] for key in Formatter().parse(message_)]
19-
20-
ids = {}
21-
for key in keys:
22-
if key is not None:
23-
ids[key] = float('nan')
24-
25-
msg = progressbar.FormatCustomText(message, ids)
26-
return msg
27-
28-
def create_progress_bar(text=None):
29-
if text is None:
30-
text = progressbar.FormatCustomText('')
31-
bar = progressbar.ProgressBar(widgets=[
32-
progressbar.Percentage(),
33-
progressbar.Bar(),
34-
progressbar.AdaptiveETA(), ' ',
35-
text,
36-
])
37-
return bar
3812

3913
def display_model(model):
4014
tf.keras.utils.plot_model(model,
@@ -43,6 +17,22 @@ def display_model(model):
4317
return ipythondisplay.Image('tmp.png')
4418

4519

20+
def plot_sample(x,y,vae):
21+
plt.figure(figsize=(2,1))
22+
plt.subplot(1, 2, 1)
23+
24+
idx = np.where(y.numpy()==1)[0][0]
25+
plt.imshow(x[idx])
26+
plt.grid(False)
27+
28+
plt.subplot(1, 2, 2)
29+
_, _, _, recon = vae(x)
30+
plt.imshow(recon[idx])
31+
plt.grid(False)
32+
33+
plt.show()
34+
35+
4636
class LossHistory:
4737
def __init__(self, smoothing_factor=0.0):
4838
self.alpha = smoothing_factor

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ def get_dist(pkgname):
2121
setup(
2222
name = 'mitdeeplearning', # How you named your package folder (MyLib)
2323
packages = ['mitdeeplearning'], # Chose the same as "name"
24-
version = '0.4.4', # Start with a small number and increase it with every change you make
24+
version = '0.4.5', # Start with a small number and increase it with every change you make
2525
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
2626
description = 'Official software labs for MIT Introduction to Deep Learning (http://introtodeeplearning.com)', # Give a short description about your library
2727
author = 'Alexander Amini', # Type in your name
2828
author_email = '[email protected]', # Type in your E-Mail
2929
url = 'http://introtodeeplearning.com', # Provide either the link to your github or to your website
30-
download_url = 'https://github.com/aamini/introtodeeplearning_labs/archive/v0.4.4.tar.gz', # I explain this later on
30+
download_url = 'https://github.com/aamini/introtodeeplearning_labs/archive/v0.4.5.tar.gz', # I explain this later on
3131
keywords = ['deep learning', 'neural networks', 'tensorflow', 'introduction'], # Keywords that define your package best
3232
install_requires=install_deps,
3333
classifiers=[

0 commit comments

Comments
 (0)