Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to the [Nucleus Python Client](https://github.com/scaleapi/n
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.11.0](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.11.0) - 2022-05-13

### Added
- Segmentation prediction masks can now be evaluated against polygon annotation with new Validate functions
- New function SegmentationToPolyIOU, configurable through client.validate.eval_functions.segmentation_to_poly_iou
- New function SegmentationToPolyRecall, configurable through client.validate.eval_functions.segmentation_to_poly_recall
- New function SegmentationToPolyPrecision, configurable through client.validate.eval_functions.segmentation_to_poly_precision
- New function SegmentationToPolyMAP, configurable through client.validate.eval_functions.segmentation_to_poly_map
- New function SegmentationToPolyAveragePrecision, configurable through client.validate.eval_functions.segmentation_to_poly_ap

## [0.10.8](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.10.8) - 2022-05-10

### Fixed
Expand Down
53 changes: 53 additions & 0 deletions nucleus/validate/eval_functions/available_eval_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,55 @@ def expected_name(cls) -> str:
return "segmentation_to_poly_precision"


class SegmentationToPolyAveragePrecisionConfig(EvalFunctionConfig):
def __call__(
self,
label: str = "label",
iou_threshold: float = 0.5,
annotation_filters: Optional[
Union[ListOfOrAndFilters, ListOfAndFilters]
] = None,
prediction_filters: Optional[
Union[ListOfOrAndFilters, ListOfAndFilters]
] = None,
**kwargs,
):
"""Initializes SegmentationToPolyAveragePrecision object.

Args:
iou_threshold: IOU threshold to consider detection as valid. Must be in [0, 1]. Default 0.5
annotation_filters: Filter predicates. Allowed formats are:
ListOfAndFilters where each Filter forms a chain of AND predicates.
or
ListOfOrAndFilters where Filters are expressed in disjunctive normal form (DNF), like
[[MetadataFilter("short_haired", "==", True), FieldFilter("label", "in", ["cat", "dog"]), ...].
DNF allows arbitrary boolean logical combinations of single field predicates. The innermost structures
each describe a single column predicate. The list of inner predicates is interpreted as a conjunction
(AND), forming a more selective `and` multiple field predicate.
Finally, the most outer list combines these filters as a disjunction (OR).
prediction_filters: Filter predicates. Allowed formats are:
ListOfAndFilters where each Filter forms a chain of AND predicates.
or
ListOfOrAndFilters where Filters are expressed in disjunctive normal form (DNF), like
[[MetadataFilter("short_haired", "==", True), FieldFilter("label", "in", ["cat", "dog"]), ...].
DNF allows arbitrary boolean logical combinations of single field predicates. The innermost structures
each describe a single column predicate. The list of inner predicates is interpreted as a conjunction
(AND), forming a more selective `and` multiple field predicate.
Finally, the most outer list combines these filters as a disjunction (OR).
"""
return super().__call__(
label=label,
iou_threshold=iou_threshold,
annotation_filters=annotation_filters,
prediction_filters=prediction_filters,
**kwargs,
)

@classmethod
def expected_name(cls) -> str:
return "segmentation_to_poly_ap"


class BoundingBoxIOUConfig(EvalFunctionConfig):
def __call__(
self,
Expand Down Expand Up @@ -1147,6 +1196,7 @@ def expected_name(cls) -> str:
SegmentationToPolyIOUConfig,
SegmentationToPolyMAPConfig,
SegmentationToPolyPrecisionConfig,
SegmentationToPolyAveragePrecisionConfig,
]


Expand Down Expand Up @@ -1226,6 +1276,9 @@ def __init__(self, available_functions: List[EvalFunctionEntry]):
self.segmentation_to_poly_map: SegmentationToPolyMAPConfig = self._assign_eval_function_if_defined(
SegmentationToPolyMAPConfig # type: ignore
)
self.segmentation_to_poly_ap: SegmentationToPolyAveragePrecisionConfig = self._assign_eval_function_if_defined(
SegmentationToPolyAveragePrecisionConfig # type: ignore
)

# Add public entries that have not been implemented as an attribute on this class
for func_entry in self._public_func_entries.values():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exclude = '''

[tool.poetry]
name = "scale-nucleus"
version = "0.10.8"
version = "0.11.0"
description = "The official Python client library for Nucleus, the Data Platform for AI"
license = "MIT"
authors = ["Scale AI Nucleus Team <nucleusapi@scaleapi.com>"]
Expand Down