Spaces:
Build error
Build error
minor updates
Browse files
app.py
CHANGED
|
@@ -187,6 +187,7 @@ def predict_and_analyze(model_name, num_channels, dim, input_channel, image):
|
|
| 187 |
W = int(dim)
|
| 188 |
|
| 189 |
print("Loading data")
|
|
|
|
| 190 |
image = np.load(image.name, allow_pickle=True)
|
| 191 |
image = image.astype(np.float32)
|
| 192 |
|
|
@@ -209,7 +210,9 @@ def predict_and_analyze(model_name, num_channels, dim, input_channel, image):
|
|
| 209 |
print("Model loaded")
|
| 210 |
|
| 211 |
print("Looking at activations")
|
| 212 |
-
output, input_image, activation_1, activation_2 = get_activations(model, image, model_name,
|
|
|
|
|
|
|
| 213 |
print("Activations and predictions finished")
|
| 214 |
|
| 215 |
if output[0] < output[1]:
|
|
@@ -235,7 +238,9 @@ def predict_and_analyze(model_name, num_channels, dim, input_channel, image):
|
|
| 235 |
fig1 = plot_activations(activation_1, activation_2, model_name, origin=origin)
|
| 236 |
|
| 237 |
# plot raw activations
|
| 238 |
-
_, _, activation_1, activation_2 = get_activations(model, image, model_name,
|
|
|
|
|
|
|
| 239 |
activation_1 = normalize_array(activation_1)
|
| 240 |
activation_2 = normalize_array(activation_2)
|
| 241 |
fig2 = plot_activations(activation_1, activation_2, model_name, origin=origin)
|
|
|
|
| 187 |
W = int(dim)
|
| 188 |
|
| 189 |
print("Loading data")
|
| 190 |
+
print(image)
|
| 191 |
image = np.load(image.name, allow_pickle=True)
|
| 192 |
image = image.astype(np.float32)
|
| 193 |
|
|
|
|
| 210 |
print("Model loaded")
|
| 211 |
|
| 212 |
print("Looking at activations")
|
| 213 |
+
output, input_image, activation_1, activation_2 = get_activations(model, image, model_name,
|
| 214 |
+
channel=input_channel,
|
| 215 |
+
sub_mean=True)
|
| 216 |
print("Activations and predictions finished")
|
| 217 |
|
| 218 |
if output[0] < output[1]:
|
|
|
|
| 238 |
fig1 = plot_activations(activation_1, activation_2, model_name, origin=origin)
|
| 239 |
|
| 240 |
# plot raw activations
|
| 241 |
+
_, _, activation_1, activation_2 = get_activations(model, image, model_name,
|
| 242 |
+
channel=input_channel,
|
| 243 |
+
sub_mean=False)
|
| 244 |
activation_1 = normalize_array(activation_1)
|
| 245 |
activation_2 = normalize_array(activation_2)
|
| 246 |
fig2 = plot_activations(activation_1, activation_2, model_name, origin=origin)
|