bug fix
Browse files
app.py
CHANGED
|
@@ -83,7 +83,6 @@ def get_activations(intermediate_model, image: list,
|
|
| 83 |
in_image = np.sum(image[0, :, :, :], axis=0)
|
| 84 |
in_image = normalize_array(in_image)
|
| 85 |
|
| 86 |
-
|
| 87 |
# im1 = ax1.imshow(in_image, cmap=cmap, vmin=0, vmax=vmax, origin=origin)
|
| 88 |
if layer is None:
|
| 89 |
activation_1 = np.sum(output_1[0, :, :, :], axis=0)
|
|
@@ -115,7 +114,7 @@ def get_activations(intermediate_model, image: list,
|
|
| 115 |
|
| 116 |
# plt.show()
|
| 117 |
|
| 118 |
-
return in_image, activation_1, activation_2
|
| 119 |
|
| 120 |
|
| 121 |
def predict_and_analyze(model_name, num_channels, dim, image):
|
|
@@ -163,8 +162,6 @@ def predict_and_analyze(model_name, num_channels, dim, image):
|
|
| 163 |
image = image[np.newaxis, :, :, :]
|
| 164 |
|
| 165 |
assert image.shape == (1, num_channels, W, W), "Data is the wrong shape"
|
| 166 |
-
|
| 167 |
-
input_image = np.sum(image[0, :, :, :], axis=0)
|
| 168 |
|
| 169 |
model_name += '_%i' % (num_channels)
|
| 170 |
|
|
@@ -173,7 +170,7 @@ def predict_and_analyze(model_name, num_channels, dim, image):
|
|
| 173 |
model = load_model(model_name, activation=True)
|
| 174 |
|
| 175 |
print("Looking at activations")
|
| 176 |
-
output, activation_1, activation_2 = get_activations(model, image, sub_mean=True)
|
| 177 |
|
| 178 |
print(output)
|
| 179 |
|
|
|
|
| 83 |
in_image = np.sum(image[0, :, :, :], axis=0)
|
| 84 |
in_image = normalize_array(in_image)
|
| 85 |
|
|
|
|
| 86 |
# im1 = ax1.imshow(in_image, cmap=cmap, vmin=0, vmax=vmax, origin=origin)
|
| 87 |
if layer is None:
|
| 88 |
activation_1 = np.sum(output_1[0, :, :, :], axis=0)
|
|
|
|
| 114 |
|
| 115 |
# plt.show()
|
| 116 |
|
| 117 |
+
return output, in_image, activation_1, activation_2
|
| 118 |
|
| 119 |
|
| 120 |
def predict_and_analyze(model_name, num_channels, dim, image):
|
|
|
|
| 162 |
image = image[np.newaxis, :, :, :]
|
| 163 |
|
| 164 |
assert image.shape == (1, num_channels, W, W), "Data is the wrong shape"
|
|
|
|
|
|
|
| 165 |
|
| 166 |
model_name += '_%i' % (num_channels)
|
| 167 |
|
|
|
|
| 170 |
model = load_model(model_name, activation=True)
|
| 171 |
|
| 172 |
print("Looking at activations")
|
| 173 |
+
output, input_image, activation_1, activation_2 = get_activations(model, image, sub_mean=True)
|
| 174 |
|
| 175 |
print(output)
|
| 176 |
|