Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
"metadata": {},
"source": [
"import labelbox.types as lb_types\n",
"import labelbox as lb\n",
"import uuid\n",
"import json"
],
"cell_type": "code",
Expand Down Expand Up @@ -121,11 +123,11 @@
{
"metadata": {},
"source": [
"data_row_metric = ScalarMetric(metric_name=\"iou\", value=0.5)\n",
"data_row_metric = ScalarMetric(metric_name=\"iou_custom\", value=0.5)\n",
"\n",
"feature_metric = ScalarMetric(metric_name=\"iou\", feature_name=\"cat\", value=0.5)\n",
"feature_metric = ScalarMetric(metric_name=\"iou_custom\", feature_name=\"cat\", value=0.5)\n",
"\n",
"subclass_metric = ScalarMetric(metric_name=\"iou\",\n",
"subclass_metric = ScalarMetric(metric_name=\"iou_custom\",\n",
" feature_name=\"cat\",\n",
" subclass_name=\"organge\",\n",
" value=0.5)"
Expand Down Expand Up @@ -192,7 +194,7 @@
" 0.9: [1, 0, 1, 0]\n",
" })\n",
"\n",
"scalar_metric_with_confidence = ScalarMetric(metric_name=\"iou\",\n",
"scalar_metric_with_confidence = ScalarMetric(metric_name=\"iou_custom\",\n",
" value={\n",
" 0.1: 0.2,\n",
" 0.3: 0.25,\n",
Expand Down Expand Up @@ -300,18 +302,7 @@
"print(feature_confusion_matrix_metric(ground_truths, predictions))"
],
"cell_type": "code",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ScalarMetric(value=0.64, feature_name='cat', subclass_name=None, extra={}, metric_name='iou', aggregation=<ScalarMetricAggregation.ARITHMETIC_MEAN: 'ARITHMETIC_MEAN'>)]\n",
"[ScalarMetric(value=0.64, feature_name=None, subclass_name=None, extra={}, metric_name='iou', aggregation=<ScalarMetricAggregation.ARITHMETIC_MEAN: 'ARITHMETIC_MEAN'>)]\n",
"[ConfusionMatrixMetric(value=(1, 0, 0, 0), feature_name=None, subclass_name=None, extra={}, metric_name='50pct_iou', aggregation=<ConfusionMatrixAggregation.CONFUSION_MATRIX: 'CONFUSION_MATRIX'>)]\n",
"[ConfusionMatrixMetric(value=(1, 0, 0, 0), feature_name='cat', subclass_name=None, extra={}, metric_name='50pct_iou', aggregation=<ConfusionMatrixAggregation.CONFUSION_MATRIX: 'CONFUSION_MATRIX'>)]\n"
]
}
],
"outputs": [],
"execution_count": null
},
{
Expand All @@ -322,20 +313,13 @@
"print(feature_confusion_matrix_metric(ground_truths, predictions, iou=0.9))"
],
"cell_type": "code",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ConfusionMatrixMetric(value=(0, 1, 0, 1), feature_name='cat', subclass_name=None, extra={}, metric_name='90pct_iou', aggregation=<ConfusionMatrixAggregation.CONFUSION_MATRIX: 'CONFUSION_MATRIX'>)]\n"
]
}
],
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"source": [
"\n",
"# subclasses are included by default\n",
"predictions = [\n",
" lb_types.ObjectAnnotation(\n",
Expand Down Expand Up @@ -375,16 +359,7 @@
"print(\"Excluding Subclasses:\", iou_metrics[0].value)"
],
"cell_type": "code",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Subclasses: (0, 1, 0, 1)\n",
"Excluding Subclasses: (1, 0, 0, 0)\n"
]
}
],
"outputs": [],
"execution_count": null
},
{
Expand All @@ -404,9 +379,10 @@
"metadata": {},
"source": [
"# Continuing with the last example:\n",
"global_key = \"<global_key>\"\n",
"metrics = [*conf_matrix_metrics, *iou_metrics]\n",
"labels = [\n",
" lb_types.Label(data=lb_types.ImageData(uid=\"cktiom8osh4210ytmevuk7lfh\"), annotations=metrics)\n",
" lb_types.Label(data=lb_types.ImageData(global_key=global_key), annotations=metrics)\n",
"]\n",
"# We can upload these metric with other annotations\n",
"#model_run.add_predictions(f'diagnostics-import-{uuid.uuid4()}', labels)"
Expand Down