Siddharth Maddali
commited on
Commit
•
5a43470
1
Parent(s):
abee87a
Better color scaling in activation maps
Browse files
app.py
CHANGED
@@ -36,8 +36,8 @@ def get_best_layout( num_imgs, img_size ):
|
|
36 |
return n1_final, n2_final
|
37 |
|
38 |
def create_plots( output_tensor, title, fontsize=24 ):
|
39 |
-
temp = output_tensor.detach().numpy()
|
40 |
-
mn, mx = temp.min(), temp.max()
|
41 |
img_list = [ output_tensor[0][n].detach().numpy() for n in range( output_tensor.shape[1] ) ]
|
42 |
fig = plt.figure()
|
43 |
M, N = get_best_layout( len( img_list ), img_list[0].shape )
|
@@ -47,7 +47,7 @@ def create_plots( output_tensor, title, fontsize=24 ):
|
|
47 |
n = N0%N
|
48 |
im = ax[m,n].imshow( img, cmap='gray' )
|
49 |
ax[m,n].axis( 'off' )
|
50 |
-
im.set_clim( [ mn, mx ] )
|
51 |
|
52 |
plt.suptitle( title, fontsize=fontsize )
|
53 |
# plt.subplots_adjust( hspace=0.01, wspace=0.01 )
|
@@ -81,11 +81,10 @@ model = learn.model.eval()
|
|
81 |
# %% four-way-classifier.ipynb 5
|
82 |
description='''
|
83 |
A simple 4-way classifier that categorizes images as 'snake', 'bird', 'otter' or 'forest'.
|
84 |
-
Refined from
|
85 |
-
The test images given here are chosen to demonstrate the effect of lack of training data on the classification outcome.
|
86 |
|
87 |
-
The actual classification for each test image actually takes a very short time; the delay in
|
88 |
-
the extra step of
|
89 |
|
90 |
|
91 |
**DISCLAIMER**: the images here are merely for demonstration purposes. I don't own any of them and I'm not making money from them.
|
|
|
36 |
return n1_final, n2_final
|
37 |
|
38 |
def create_plots( output_tensor, title, fontsize=24 ):
|
39 |
+
# temp = output_tensor.detach().numpy()
|
40 |
+
# mn, mx = temp.min(), temp.max()
|
41 |
img_list = [ output_tensor[0][n].detach().numpy() for n in range( output_tensor.shape[1] ) ]
|
42 |
fig = plt.figure()
|
43 |
M, N = get_best_layout( len( img_list ), img_list[0].shape )
|
|
|
47 |
n = N0%N
|
48 |
im = ax[m,n].imshow( img, cmap='gray' )
|
49 |
ax[m,n].axis( 'off' )
|
50 |
+
# im.set_clim( [ mn, mx ] )
|
51 |
|
52 |
plt.suptitle( title, fontsize=fontsize )
|
53 |
# plt.subplots_adjust( hspace=0.01, wspace=0.01 )
|
|
|
81 |
# %% four-way-classifier.ipynb 5
|
82 |
description='''
|
83 |
A simple 4-way classifier that categorizes images as 'snake', 'bird', 'otter' or 'forest'.
|
84 |
+
Refined from a pre-trained ResNet18 model downloaded from HuggingFace.
|
|
|
85 |
|
86 |
+
The actual classification for each test image actually takes a very short time; the delay in displaying results is due to
|
87 |
+
the extra step of plotting the intermediate activation maps and inferred features in `matplotlib`.
|
88 |
|
89 |
|
90 |
**DISCLAIMER**: the images here are merely for demonstration purposes. I don't own any of them and I'm not making money from them.
|