Harshit Ghosh commited on
Commit ·
f772e3c
1
Parent(s): 7ceec19
fix timezone and model scaler variable
Browse files- run_interface.py +7 -2
- tasks.py +2 -2
run_interface.py
CHANGED
|
@@ -151,6 +151,11 @@ def infer_batch(
|
|
| 151 |
else:
|
| 152 |
logits, cam = grad_cam.generate(t9, class_idx=0)
|
| 153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
raw_probs = core.sigmoid_np(logits)
|
| 155 |
cal_probs = core.sigmoid_np(logits / max(float(temperature), 1e-6))
|
| 156 |
|
|
@@ -160,8 +165,8 @@ def infer_batch(
|
|
| 160 |
"raw_logits": logits[idx],
|
| 161 |
"raw_probs": raw_probs[idx],
|
| 162 |
"cal_probs": cal_probs[idx],
|
| 163 |
-
"raw_prob_any": float(raw_probs[idx][0]),
|
| 164 |
-
"cal_prob_any": float(cal_probs[idx][0]),
|
| 165 |
"cam": cam[idx],
|
| 166 |
})
|
| 167 |
return results
|
|
|
|
| 151 |
else:
|
| 152 |
logits, cam = grad_cam.generate(t9, class_idx=0)
|
| 153 |
|
| 154 |
+
if len(images_rgb) == 1:
|
| 155 |
+
logits = np.atleast_2d(logits)
|
| 156 |
+
if cam.ndim == 2:
|
| 157 |
+
cam = np.expand_dims(cam, axis=0)
|
| 158 |
+
|
| 159 |
raw_probs = core.sigmoid_np(logits)
|
| 160 |
cal_probs = core.sigmoid_np(logits / max(float(temperature), 1e-6))
|
| 161 |
|
|
|
|
| 165 |
"raw_logits": logits[idx],
|
| 166 |
"raw_probs": raw_probs[idx],
|
| 167 |
"cal_probs": cal_probs[idx],
|
| 168 |
+
"raw_prob_any": float(np.atleast_1d(raw_probs[idx])[0]),
|
| 169 |
+
"cal_prob_any": float(np.atleast_1d(cal_probs[idx])[0]),
|
| 170 |
"cam": cam[idx],
|
| 171 |
})
|
| 172 |
return results
|
tasks.py
CHANGED
|
@@ -70,8 +70,8 @@ celery_app.conf.update(
|
|
| 70 |
task_serializer="json",
|
| 71 |
accept_content=["json"],
|
| 72 |
result_serializer="json",
|
| 73 |
-
timezone="
|
| 74 |
-
enable_utc=
|
| 75 |
task_track_started=True,
|
| 76 |
task_time_limit=3600, # 1 hour hard limit
|
| 77 |
task_soft_time_limit=3300, # 55 min soft limit
|
|
|
|
| 70 |
task_serializer="json",
|
| 71 |
accept_content=["json"],
|
| 72 |
result_serializer="json",
|
| 73 |
+
timezone="UTC",
|
| 74 |
+
enable_utc=True,
|
| 75 |
task_track_started=True,
|
| 76 |
task_time_limit=3600, # 1 hour hard limit
|
| 77 |
task_soft_time_limit=3300, # 55 min soft limit
|