Skip to content

Commit

Permalink
lite docs (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
czaloom authored Oct 10, 2024
1 parent 37aba52 commit f4401d7
Show file tree
Hide file tree
Showing 8 changed files with 1,131 additions and 83 deletions.
16 changes: 8 additions & 8 deletions lite/tests/semantic_segmentation/test_confusion_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ def test_confusion_matrix_basic_segmentations(
"v2": {"v1": {"iou": 0.0}, "v2": {"iou": 0.5}},
},
"hallucinations": {
"v1": {"percent": 0.0},
"v2": {"percent": 0.5},
"v1": {"ratio": 0.0},
"v2": {"ratio": 0.5},
},
"missing_predictions": {
"v1": {"percent": 0.5},
"v2": {"percent": 0.0},
"v1": {"ratio": 0.5},
"v2": {"ratio": 0.0},
},
},
"parameters": {},
Expand Down Expand Up @@ -70,15 +70,15 @@ def test_confusion_matrix_segmentations_from_boxes(
},
},
"hallucinations": {
"v1": {"percent": 5000 / 10000}, # 50% overlap
"v1": {"ratio": 5000 / 10000}, # 50% overlap
"v2": {
"percent": 4999 / 5000
"ratio": 4999 / 5000
}, # overlaps 1 pixel out of 5000 predictions
},
"missing_predictions": {
"v1": {"percent": 5000 / 10000},
"v1": {"ratio": 5000 / 10000},
"v2": {
"percent": 14999 / 15000
"ratio": 14999 / 15000
}, # overlaps 1 pixel out of 15,000 groundtruths
},
},
Expand Down
24 changes: 24 additions & 0 deletions lite/valor_lite/classification/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@

@dataclass
class Classification:
"""
Classification data structure containing a ground truth label and a list of predictions.
Parameters
----------
uid : str
Unique identifier for the instance.
groundtruth : str
The true label for the instance.
predictions : list of str
List of predicted labels.
scores : list of float
Confidence scores corresponding to each predicted label.
Examples
--------
>>> classification = Classification(
... uid='123',
... groundtruth='cat',
... predictions=['cat', 'dog', 'bird'],
... scores=[0.9, 0.05, 0.05]
... )
"""

uid: str
groundtruth: str
predictions: list[str]
Expand Down
Loading

0 comments on commit f4401d7

Please sign in to comment.