Skip to content

Commit 8646aaa

Browse files
gatlisasha-scale
andauthored
[Validate[ Add semantic segmentation metrics (#302)
* Add real semseg metrics * Fix SegmentationIOU * Fix aggregation * Support segment field and metadata filtering * Add confusion masking * Cleaning up mypy type inference * Fix segmentation filtering * Convert RGB masks to L * Fix pivoted confusion * Pivot precision * Bump beta to 0.13b * Add test coverage and remove average precision (as we have no probability thresholds) * Make rasterio optional * Apply suggestions from code review Co-authored-by: Sasha Harrison <70984140+sasha-scale@users.noreply.github.com> * Improve documentation and output new lock file Co-authored-by: Sasha Harrison <70984140+sasha-scale@users.noreply.github.com>
1 parent b7ebcd8 commit 8646aaa

19 files changed

+1849
-472
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
apt-get -y install curl libgeos-dev
2222
pip install --upgrade pip
2323
pip install poetry
24-
poetry install -E shapely
24+
poetry install -E metrics
2525
2626
- run:
2727
name: Black Formatting Check # Only validation, without re-formatting

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to the [Nucleus Python Client](https://github.com/scaleapi/n
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.13.0](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.13.0) - 2022-06-08
9+
10+
### Added
11+
12+
- Segmentation functions to Validate API
13+
814
## [0.12.4](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.12.4) - 2022-06-02
915

1016
### Fixed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ sphinx-autobuild . ./_build/html --watch ../nucleus
188188

189189
## Custom Metrics using Shapely in scale-validate
190190

191-
Certain metrics use `shapely` which is added as an optional dependency.
191+
Certain metrics use `Shapely` and `rasterio` which is added as optional dependencies.
192192

193193
```bash
194194
pip install scale-nucleus[metrics]
@@ -205,4 +205,4 @@ apt-get install libgeos-dev
205205

206206
To develop it locally use
207207

208-
`poetry install --extras shapely`
208+
`poetry install --extras metrics`

nucleus/metrics/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
FieldFilter,
66
ListOfOrAndFilters,
77
MetadataFilter,
8+
SegmentFieldFilter,
9+
SegmentMetadataFilter,
810
apply_filters,
911
)
1012
from .polygon_metrics import (
@@ -16,6 +18,14 @@
1618
PolygonRecall,
1719
)
1820
from .segmentation_metrics import (
21+
SegmentationFWAVACC,
22+
SegmentationIOU,
23+
SegmentationMAP,
24+
SegmentationMaskMetric,
25+
SegmentationPrecision,
26+
SegmentationRecall,
27+
)
28+
from .segmentation_to_poly_metrics import (
1929
SegmentationMaskToPolyMetric,
2030
SegmentationToPolyAveragePrecision,
2131
SegmentationToPolyIOU,

nucleus/metrics/cuboid_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
try:
77
from shapely.geometry import Polygon
88
except ModuleNotFoundError:
9-
from ..shapely_not_installed import ShapelyNotInstalled
9+
from ..package_not_installed import PackageNotInstalled
1010

11-
Polygon = ShapelyNotInstalled
11+
Polygon = PackageNotInstalled
1212

1313

1414
from nucleus.annotation import CuboidAnnotation

0 commit comments

Comments
 (0)