Spaces:
Sleeping
Sleeping
bascobasculino
commited on
Added wandb logging from results
Browse files- det-metrics.py +14 -0
det-metrics.py
CHANGED
@@ -341,6 +341,20 @@ class DetectionMetric(evaluate.Metric):
|
|
341 |
)
|
342 |
return fig
|
343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
def _generate_sample_data(self):
|
345 |
"""
|
346 |
Generates dummy sample data for predictions and references used for initialization.
|
|
|
341 |
)
|
342 |
return fig
|
343 |
|
344 |
+
def wandb(self, results , wandb_project='detection_metrics'):
|
345 |
+
import os
|
346 |
+
import wandb
|
347 |
+
import datetime
|
348 |
+
|
349 |
+
current_datetime = datetime.datetime.now()
|
350 |
+
formatted_datetime = current_datetime.strftime("%Y-%m-%d_%H-%M-%S")
|
351 |
+
wandb.login(key=os.getenv('wandb_key'))
|
352 |
+
|
353 |
+
for k in results.keys():
|
354 |
+
run = wandb.init(project=wandb_project, name=f"{k}-{formatted_datetime}")
|
355 |
+
run.log(results[k]['metrics'])
|
356 |
+
run.finish()
|
357 |
+
|
358 |
def _generate_sample_data(self):
|
359 |
"""
|
360 |
Generates dummy sample data for predictions and references used for initialization.
|