Skip to content

Commit

Permalink
Fix thresholds, from prob to percent
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienmartW committed Jan 23, 2024
1 parent c68902c commit 34cf533
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ async def imageupload(
extras_logging["bg_label"] = label
extras_logging["bg_confidence"] = confidence
extras_logging["bg_model_time"] = round(time.time() - start, 2)
if confidence < 0.76:
if confidence < 76:
extras_logging["bg_confidence_level"] = "low"
elif confidence < 0.99:
elif confidence < 99:
extras_logging["bg_confidence_level"] = "medium"
else:
extras_logging["bg_confidence_level"] = "high"
Expand Down
2 changes: 1 addition & 1 deletion backend/src/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ def predict_image(model, img: bytes) -> Union[str, float]:
predicted_class = results[0].probs.top5[0]
label = CLASSES[predicted_class]
confidence = float(results[0].probs.top5conf[0])
return (label, confidence)
return (label, 100*confidence)

0 comments on commit 34cf533

Please sign in to comment.