Spaces:
Build error
Build error
print statements
Browse files- app.py +2 -1
- model_utils/efficientnet_config.py +6 -3
app.py
CHANGED
|
@@ -125,7 +125,7 @@ def get_activations(model, image: list, model_name: str,
|
|
| 125 |
print(i, layer_outputs[i].shape)
|
| 126 |
if i == max(activation_indices[model_name]):
|
| 127 |
break
|
| 128 |
-
output = model
|
| 129 |
|
| 130 |
image = image.detach().cpu().numpy()
|
| 131 |
output_1 = layer_outputs[activation_indices[model_name][0]].detach().cpu().numpy()
|
|
@@ -312,6 +312,7 @@ def predict_and_analyze(model_name, num_channels, dim, input_channel, image):
|
|
| 312 |
channel=input_channel,
|
| 313 |
sub_mean=True)
|
| 314 |
print("Activations and predictions finished")
|
|
|
|
| 315 |
|
| 316 |
if output[0][0] < output[0][1]:
|
| 317 |
output = 'Planet predicted with %.3f percent confidence' % (100*output[0][1])
|
|
|
|
| 125 |
print(i, layer_outputs[i].shape)
|
| 126 |
if i == max(activation_indices[model_name]):
|
| 127 |
break
|
| 128 |
+
output = model(image).detach().cpu().numpy()
|
| 129 |
|
| 130 |
image = image.detach().cpu().numpy()
|
| 131 |
output_1 = layer_outputs[activation_indices[model_name][0]].detach().cpu().numpy()
|
|
|
|
| 312 |
channel=input_channel,
|
| 313 |
sub_mean=True)
|
| 314 |
print("Activations and predictions finished")
|
| 315 |
+
print(output)
|
| 316 |
|
| 317 |
if output[0][0] < output[0][1]:
|
| 318 |
output = 'Planet predicted with %.3f percent confidence' % (100*output[0][1])
|
model_utils/efficientnet_config.py
CHANGED
|
@@ -320,14 +320,17 @@ class EfficientNetPreTrained(PreTrainedModel):
|
|
| 320 |
# not all will have weights and biases
|
| 321 |
try:
|
| 322 |
module.weight.data.normal_(mean=0.0)
|
| 323 |
-
except Exception:
|
|
|
|
| 324 |
try:
|
| 325 |
module.weight.data.fill_(1.0)
|
| 326 |
-
except Exception:
|
|
|
|
| 327 |
_ = None
|
| 328 |
try:
|
| 329 |
module.bias.data.zero_()
|
| 330 |
-
except AttributeError:
|
|
|
|
| 331 |
_ = None
|
| 332 |
|
| 333 |
|
|
|
|
| 320 |
# not all will have weights and biases
|
| 321 |
try:
|
| 322 |
module.weight.data.normal_(mean=0.0)
|
| 323 |
+
except Exception as e:
|
| 324 |
+
print('weight 1', e)
|
| 325 |
try:
|
| 326 |
module.weight.data.fill_(1.0)
|
| 327 |
+
except Exception as e:
|
| 328 |
+
print('weight 2', e)
|
| 329 |
_ = None
|
| 330 |
try:
|
| 331 |
module.bias.data.zero_()
|
| 332 |
+
except AttributeError as e:
|
| 333 |
+
print('bias', e)
|
| 334 |
_ = None
|
| 335 |
|
| 336 |
|