Spaces:
Sleeping
Sleeping
Update src/main.py
Browse files- src/main.py +7 -7
src/main.py
CHANGED
|
@@ -87,7 +87,7 @@ def get_leaderboard_data():
|
|
| 87 |
WITH BestScores AS (
|
| 88 |
SELECT
|
| 89 |
username,
|
| 90 |
-
MAX(
|
| 91 |
FROM submissions
|
| 92 |
GROUP BY username
|
| 93 |
)
|
|
@@ -99,13 +99,13 @@ def get_leaderboard_data():
|
|
| 99 |
s.segm_AP50,
|
| 100 |
MAX(s.timestamp) as last_submission -- MAX(timestamp) to get the most recent best submission
|
| 101 |
FROM submissions s
|
| 102 |
-
INNER JOIN BestScores b ON s.username = b.username AND s.
|
| 103 |
GROUP BY s.username
|
| 104 |
-
ORDER BY s.
|
| 105 |
"""
|
| 106 |
df = pd.read_sql_query(query, conn)
|
| 107 |
# Rename the column for display clarity
|
| 108 |
-
df = df.rename(columns={'
|
| 109 |
|
| 110 |
conn.close()
|
| 111 |
return df
|
|
@@ -205,14 +205,14 @@ Copyright © 2015, VizWiz team. All rights reserved. Redistribution and use soft
|
|
| 205 |
with st.spinner('Calculating score against Ground Truth...'):
|
| 206 |
# Ensure the ground truth path is correct
|
| 207 |
bbox_mAP, bbox_AP50, segm_mAP, segm_AP50 = evaluate_submission("src/biv_query.json", save_path)
|
| 208 |
-
st.success(f"bbox_mAP, bbox_AP50, segm_mAP, segm_AP50 : {bbox_mAP, bbox_AP50, segm_mAP, segm_AP50}")
|
| 209 |
if bbox_mAP is not None and bbox_AP50 is not None and segm_mAP is not None and segm_AP50 is not None:
|
| 210 |
-
save_submission(st.session_state['username'], bbox_mAP, bbox_AP50, segm_mAP, segm_AP50 )
|
| 211 |
st.balloons()
|
| 212 |
st.success("Submission Successful!")
|
| 213 |
|
| 214 |
# Display Metrics
|
| 215 |
-
st.metric(label="Result : ", value=f"{bbox_mAP, bbox_AP50, segm_mAP, segm_AP50}
|
| 216 |
|
| 217 |
|
| 218 |
# --- PAGE: LEADERBOARD (Existing Code) ---
|
|
|
|
| 87 |
WITH BestScores AS (
|
| 88 |
SELECT
|
| 89 |
username,
|
| 90 |
+
MAX(segm_mAP) as max_segm_mAP
|
| 91 |
FROM submissions
|
| 92 |
GROUP BY username
|
| 93 |
)
|
|
|
|
| 99 |
s.segm_AP50,
|
| 100 |
MAX(s.timestamp) as last_submission -- MAX(timestamp) to get the most recent best submission
|
| 101 |
FROM submissions s
|
| 102 |
+
INNER JOIN BestScores b ON s.username = b.username AND s.segm_mAP = b.max_segm_mAP
|
| 103 |
GROUP BY s.username
|
| 104 |
+
ORDER BY s.segm_mAP DESC, s.timestamp ASC
|
| 105 |
"""
|
| 106 |
df = pd.read_sql_query(query, conn)
|
| 107 |
# Rename the column for display clarity
|
| 108 |
+
df = df.rename(columns={'segm_mAP': 'Best_segm_mAP'})
|
| 109 |
|
| 110 |
conn.close()
|
| 111 |
return df
|
|
|
|
| 205 |
with st.spinner('Calculating score against Ground Truth...'):
|
| 206 |
# Ensure the ground truth path is correct
|
| 207 |
bbox_mAP, bbox_AP50, segm_mAP, segm_AP50 = evaluate_submission("src/biv_query.json", save_path)
|
| 208 |
+
st.success(f"bbox_mAP, bbox_AP50, segm_mAP, segm_AP50 : {bbox_mAP:.2f, bbox_AP50:.2f, segm_mAP:.2f, segm_AP50:.2f}")
|
| 209 |
if bbox_mAP is not None and bbox_AP50 is not None and segm_mAP is not None and segm_AP50 is not None:
|
| 210 |
+
save_submission(st.session_state['username'], bbox_mAP:.4f, bbox_AP50:.4f, segm_mAP:.4f, segm_AP50:.4f )
|
| 211 |
st.balloons()
|
| 212 |
st.success("Submission Successful!")
|
| 213 |
|
| 214 |
# Display Metrics
|
| 215 |
+
# st.metric(label="Result : ", value=f"{bbox_mAP:.4f, bbox_AP50:.4f, segm_mAP:.4f, segm_AP50:.4f}")
|
| 216 |
|
| 217 |
|
| 218 |
# --- PAGE: LEADERBOARD (Existing Code) ---
|