seglint 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- seglint-0.2.0/.gitignore +30 -0
- seglint-0.2.0/CHANGELOG.md +176 -0
- seglint-0.2.0/LICENSE +21 -0
- seglint-0.2.0/PKG-INFO +217 -0
- seglint-0.2.0/README.md +184 -0
- seglint-0.2.0/pyproject.toml +71 -0
- seglint-0.2.0/src/seglint/__init__.py +29 -0
- seglint-0.2.0/src/seglint/_toml.py +12 -0
- seglint-0.2.0/src/seglint/api.py +524 -0
- seglint-0.2.0/src/seglint/calibrate.py +270 -0
- seglint-0.2.0/src/seglint/checks/__init__.py +0 -0
- seglint-0.2.0/src/seglint/checks/_limits.py +41 -0
- seglint-0.2.0/src/seglint/checks/_robust.py +30 -0
- seglint-0.2.0/src/seglint/checks/base.py +174 -0
- seglint-0.2.0/src/seglint/checks/catalog.py +306 -0
- seglint-0.2.0/src/seglint/checks/geometric.py +309 -0
- seglint-0.2.0/src/seglint/checks/leakage.py +265 -0
- seglint-0.2.0/src/seglint/checks/relative.py +185 -0
- seglint-0.2.0/src/seglint/checks/statistical.py +316 -0
- seglint-0.2.0/src/seglint/checks/structural.py +175 -0
- seglint-0.2.0/src/seglint/cli.py +715 -0
- seglint-0.2.0/src/seglint/config.py +297 -0
- seglint-0.2.0/src/seglint/demo.py +152 -0
- seglint-0.2.0/src/seglint/features.py +86 -0
- seglint-0.2.0/src/seglint/hashing.py +226 -0
- seglint-0.2.0/src/seglint/loaders/__init__.py +0 -0
- seglint-0.2.0/src/seglint/loaders/base.py +29 -0
- seglint-0.2.0/src/seglint/loaders/coco.py +158 -0
- seglint-0.2.0/src/seglint/loaders/png_masks.py +274 -0
- seglint-0.2.0/src/seglint/maskthumb.py +53 -0
- seglint-0.2.0/src/seglint/models.py +122 -0
- seglint-0.2.0/src/seglint/pipeline.py +319 -0
- seglint-0.2.0/src/seglint/profile.py +64 -0
- seglint-0.2.0/src/seglint/py.typed +0 -0
- seglint-0.2.0/src/seglint/relative.py +274 -0
- seglint-0.2.0/src/seglint/report/__init__.py +0 -0
- seglint-0.2.0/src/seglint/report/html.py +1462 -0
- seglint-0.2.0/src/seglint/report/json_out.py +83 -0
- seglint-0.2.0/src/seglint/report/templates/mask_note.j2 +1 -0
- seglint-0.2.0/src/seglint/report/templates/pair_panels.j2 +12 -0
- seglint-0.2.0/src/seglint/report/templates/panels.j2 +12 -0
- seglint-0.2.0/src/seglint/report/templates/report.html.j2 +665 -0
- seglint-0.2.0/src/seglint/report/text.py +226 -0
- seglint-0.2.0/src/seglint/review.py +380 -0
- seglint-0.2.0/tests/__init__.py +0 -0
- seglint-0.2.0/tests/conftest.py +69 -0
- seglint-0.2.0/tests/fixtures/__init__.py +0 -0
- seglint-0.2.0/tests/fixtures/make_dataset.py +170 -0
- seglint-0.2.0/tests/fixtures/make_leakage.py +230 -0
- seglint-0.2.0/tests/fixtures/make_relative.py +103 -0
- seglint-0.2.0/tests/fixtures/make_stat_geo.py +231 -0
- seglint-0.2.0/tests/test_api.py +115 -0
- seglint-0.2.0/tests/test_blind_test.py +134 -0
- seglint-0.2.0/tests/test_broken_pipe.py +140 -0
- seglint-0.2.0/tests/test_calibrate.py +405 -0
- seglint-0.2.0/tests/test_cli.py +165 -0
- seglint-0.2.0/tests/test_coco.py +249 -0
- seglint-0.2.0/tests/test_config.py +78 -0
- seglint-0.2.0/tests/test_demo.py +72 -0
- seglint-0.2.0/tests/test_diagnose_small_masks.py +57 -0
- seglint-0.2.0/tests/test_docs.py +183 -0
- seglint-0.2.0/tests/test_duplicate_files.py +114 -0
- seglint-0.2.0/tests/test_geometric.py +373 -0
- seglint-0.2.0/tests/test_hashing.py +173 -0
- seglint-0.2.0/tests/test_ignore_band.py +93 -0
- seglint-0.2.0/tests/test_leakage.py +411 -0
- seglint-0.2.0/tests/test_loaders.py +181 -0
- seglint-0.2.0/tests/test_logit.py +57 -0
- seglint-0.2.0/tests/test_majority.py +102 -0
- seglint-0.2.0/tests/test_max_examples.py +65 -0
- seglint-0.2.0/tests/test_parallel.py +98 -0
- seglint-0.2.0/tests/test_perturb.py +284 -0
- seglint-0.2.0/tests/test_pipeline.py +126 -0
- seglint-0.2.0/tests/test_prepare_voc.py +79 -0
- seglint-0.2.0/tests/test_profile.py +111 -0
- seglint-0.2.0/tests/test_ranking.py +173 -0
- seglint-0.2.0/tests/test_relative.py +494 -0
- seglint-0.2.0/tests/test_report.py +476 -0
- seglint-0.2.0/tests/test_report_masks.py +186 -0
- seglint-0.2.0/tests/test_report_tabs.py +262 -0
- seglint-0.2.0/tests/test_report_ui.py +400 -0
- seglint-0.2.0/tests/test_statistical.py +138 -0
- seglint-0.2.0/tests/test_structural.py +198 -0
- seglint-0.2.0/tests/test_tg_checks.py +84 -0
- seglint-0.2.0/tests/test_timing.py +90 -0
- seglint-0.2.0/tests/test_toml_compat.py +44 -0
seglint-0.2.0/.gitignore
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*.egg-info/
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
.venv/
|
|
7
|
+
venv/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
.coverage
|
|
11
|
+
coverage.xml
|
|
12
|
+
htmlcov/
|
|
13
|
+
seglint-report.html
|
|
14
|
+
.claude/settings.local.json
|
|
15
|
+
|
|
16
|
+
# benchmark outputs (scripts/benchmark_real.py --out bench_out/<name>)
|
|
17
|
+
bench_out/
|
|
18
|
+
|
|
19
|
+
# example/export output
|
|
20
|
+
/seglint-examples/
|
|
21
|
+
/examples/
|
|
22
|
+
*.report.html
|
|
23
|
+
/report.html
|
|
24
|
+
|
|
25
|
+
# personal study notes (not published)
|
|
26
|
+
notes/
|
|
27
|
+
|
|
28
|
+
# local working instructions for the coding assistant (internal, not published)
|
|
29
|
+
CLAUDE.md
|
|
30
|
+
.claude/
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to seglint are listed here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
|
|
5
|
+
[semantic versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [0.2.0] - unreleased
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **The HTML report is easier to read.** It is still one offline file, and the findings,
|
|
12
|
+
thresholds and ranking are unchanged. New, from top to bottom:
|
|
13
|
+
- a summary card ("12 of 56 samples have at least one suspicious finding") with a bar of
|
|
14
|
+
samples by their most severe finding;
|
|
15
|
+
- "Where to start": up to three sentences, with definite defects kept apart from the
|
|
16
|
+
samples to review;
|
|
17
|
+
- a table of every check that ran: its plain name, counts, the threshold, where that value
|
|
18
|
+
comes from (default, calibrate, your config, command line), and a short description;
|
|
19
|
+
- one list of all findings that can be filtered by severity, check, split, class and file
|
|
20
|
+
name, shown 100 rows at a time;
|
|
21
|
+
- the duplicates and leakage section starts with any leakage across splits;
|
|
22
|
+
- a footer with the command, how to change a threshold, and the image-independence limit;
|
|
23
|
+
- light and dark themes, print and narrow-screen layouts.
|
|
24
|
+
- **The mask panel shows the mask as it is stored.**
|
|
25
|
+
- A one-class mask is white on black.
|
|
26
|
+
- A multi-class mask uses its own palette (palette PNG or `--palette`) or a fixed colour per
|
|
27
|
+
class, with a key of the classes in that mask.
|
|
28
|
+
- The ignore index is light gray.
|
|
29
|
+
- The overlay keeps its bright class colours. The duplicate-pair difference panel is
|
|
30
|
+
unchanged.
|
|
31
|
+
- Duplicate items in "Where to start" and the leakage notice show the severity that the findings
|
|
32
|
+
carry, split by tier (for example "1 near-identical (WARNING), 2 similar (INFO)").
|
|
33
|
+
- When no definite defect is found, the report lists the definite checks that ran and found
|
|
34
|
+
nothing.
|
|
35
|
+
- Report wording and layout:
|
|
36
|
+
- the split and class filters are hidden when they cannot filter anything;
|
|
37
|
+
- the strength slider is explained;
|
|
38
|
+
- a per-check k of 0 is shown with the k it falls back to;
|
|
39
|
+
- the samples and findings columns are merged into one.
|
|
40
|
+
- **The report is split into tabs.**
|
|
41
|
+
- The first page holds only the summary and "Where to start".
|
|
42
|
+
- `ERROR (n)`, `WARNING (n)` and `INFO (n)` show the findings of one severity, grouped by
|
|
43
|
+
check. Each group shows its example cards first ("N findings, M with images"), 30 at a
|
|
44
|
+
time; the table of all its findings is below them, closed ("Show all N findings as a
|
|
45
|
+
table"). A "view" link in the table scrolls to its card and highlights it.
|
|
46
|
+
- On narrow screens the filters are folded into "Filters" and the image, mask and overlay
|
|
47
|
+
panels are stacked.
|
|
48
|
+
- Further tabs: Review list, Duplicates & leakage, This dataset's normal, Checks reference,
|
|
49
|
+
Reproduce.
|
|
50
|
+
- The selected tab is kept in the URL (`#tab=warning`), so the browser's back button works.
|
|
51
|
+
- The tabs can be used with the keyboard.
|
|
52
|
+
- Without JavaScript and in print, all sections are shown one after another.
|
|
53
|
+
- Card headers show the split only when there is one.
|
|
54
|
+
- **New note for masks that hold only 0 and 255.** If `--binary` and `ignore_index` were not
|
|
55
|
+
set, seglint says that 255 is read as "ignore", and that `--binary` reads it as foreground.
|
|
56
|
+
The note appears in the terminal, the JSON warnings and the report. It is not a finding.
|
|
57
|
+
- **Timing.** `seglint check` ends with one line such as "Scanned 2594 samples in 41.2 s
|
|
58
|
+
(8 workers); report written in 3.1 s" (not with `-q`). The report shows "scanned in X s" in
|
|
59
|
+
its header and a Timing table (discovery, pass 1, pass 2, total) in the Reproduce tab.
|
|
60
|
+
`Result.timing` holds the same numbers. Timing never changes a finding and is not in the JSON.
|
|
61
|
+
- New script (not part of the package): `scripts/time_report.py`, the median time per stage
|
|
62
|
+
over several runs.
|
|
63
|
+
- `scripts/prepare_voc.py` arranges Pascal VOC 2012 in layout A. VOC 2012 is now a second,
|
|
64
|
+
pre-registered dataset in docs/benchmarks.md (flag rates only; it has no ground truth).
|
|
65
|
+
- `scripts/diagnose_small_masks.py`: flag rates per check in equal-count bins of mask size, hole
|
|
66
|
+
and speck sizes, and a what-if for absolute hole-size floors (analysis only).
|
|
67
|
+
- S004 (unreadable file) is listed with the checks that ran. It is emitted while files are
|
|
68
|
+
loaded, so it was missing from that list before.
|
|
69
|
+
- Check names and descriptions now come from one source (`seglint/checks/catalog.py`), and a
|
|
70
|
+
test keeps it in step with docs/checks.md. All report text is in `seglint/report/text.py`.
|
|
71
|
+
- In "Definite defects", T006 (mask fills the image) carries the note "(an object can
|
|
72
|
+
legitimately fill the image)". Its severity is unchanged.
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
|
|
76
|
+
- **`--max-examples N`** and the `max_examples` key in seglint.toml: the most example cards per
|
|
77
|
+
check in the report and per check in `--export-examples`. The default (50) is unchanged.
|
|
78
|
+
- **A note for files that were not used.** When several mask files pair with one image, or one
|
|
79
|
+
image name exists with several extensions, only one file is used (unchanged: the first in
|
|
80
|
+
sorted order). A note now gives the count, up to 3 examples and a hint, in the terminal (not
|
|
81
|
+
with `-q`), the report's Overview tab, the JSON warnings and `Result.warnings`. It is not a
|
|
82
|
+
finding and changes no count, exit code or review list.
|
|
83
|
+
- A report larger than 10 MB prints one hint: "report is X MB; use --max-examples N to shrink
|
|
84
|
+
it" (not with `-q`).
|
|
85
|
+
- **A second dataset:** Pascal VOC 2012 (2913 samples, 21 classes, ignore index 255) is measured
|
|
86
|
+
in docs/benchmarks.md with a pre-registration, flag rates next to ISIC, calibrate output and
|
|
87
|
+
runtime. VOC has no ground truth, so these are flag rates, not error rates; it is outside the
|
|
88
|
+
target domain (medical segmentation).
|
|
89
|
+
|
|
90
|
+
### Fixed (found on a second dataset; a post-hoc behaviour change)
|
|
91
|
+
|
|
92
|
+
- **Ignore pixels no longer count as specks (G002) or holes (G003).** Found on Pascal VOC 2012,
|
|
93
|
+
whose 255 void band cuts class pixels into islands and leaves void regions inside objects; the
|
|
94
|
+
change was made after that run, so VOC is no test of it.
|
|
95
|
+
- G002: a component next to an ignore pixel (8-neighbourhood) is not a speck.
|
|
96
|
+
- G003: an enclosed region that holds an ignore pixel is not a hole.
|
|
97
|
+
- Both also apply to the relative tier of each check. Thresholds are unchanged.
|
|
98
|
+
- ISIC 2018 results are byte-identical. On VOC, G002 flags 3 samples instead of 930 and G003
|
|
99
|
+
16 instead of 539; every other check is unchanged (docs/benchmarks.md, "Post-hoc change:
|
|
100
|
+
ignore pixels").
|
|
101
|
+
|
|
102
|
+
### Packaging and cleanup
|
|
103
|
+
|
|
104
|
+
- The source distribution holds only `src/`, `tests/`, README, LICENSE, CHANGELOG and
|
|
105
|
+
pyproject.toml. Tests that need `scripts/` or `docs/` are skipped when those are missing.
|
|
106
|
+
- `rich>=13.0,<16`: rich 13.0 passes the full test suite, 12.6 fails the closed-pipe test.
|
|
107
|
+
- Python 3.13 is tested in CI (Ubuntu and Windows) and listed in the classifiers.
|
|
108
|
+
- Internal development labels are replaced in the docs and the code; the internal spec, the
|
|
109
|
+
coding-assistant instructions and the Turkish copy of the check reference are no longer in the
|
|
110
|
+
repository.
|
|
111
|
+
- Unused functions removed: `hashing.image_hashes`, `png_masks._files`, `review.is_relative`.
|
|
112
|
+
- docs/benchmarks.md says which run each G005 AUROC range comes from.
|
|
113
|
+
- Fixed: package description (it said seglint never reads the images; the duplicate checks do).
|
|
114
|
+
|
|
115
|
+
## [0.1.0] - 2026-12-03
|
|
116
|
+
|
|
117
|
+
First public release. It includes the changes labelled v0.1.1, v0.1.1b and v0.1.1c in
|
|
118
|
+
[docs/benchmarks.md](docs/benchmarks.md); those were internal development labels.
|
|
119
|
+
|
|
120
|
+
### Added
|
|
121
|
+
|
|
122
|
+
- **Mask health checks that need no model and do not look at the image content**
|
|
123
|
+
([docs/checks.md](docs/checks.md)):
|
|
124
|
+
- Structural checks S001-S008: missing mask or image, size mismatch, unreadable file, unknown
|
|
125
|
+
class value, unexpected mask mode, EXIF orientation, lossy mask format.
|
|
126
|
+
- Absolute mask checks: T001 empty mask, T005 near-empty mask, T006 mask filling the image.
|
|
127
|
+
- Split checks: T002 class missing or rare in a split, T004 class mix drift between splits.
|
|
128
|
+
- Geometry checks with fixed, heuristic thresholds: G001 fragments, G002 specks, G003 small
|
|
129
|
+
holes.
|
|
130
|
+
- Relative checks R001-R004: area, position, shape and object count that are extreme relative
|
|
131
|
+
to this dataset (median and scaled MAD; R001 on a logit scale).
|
|
132
|
+
- Dataset hygiene L001-L004: byte-identical and near-duplicate images, also across splits, and
|
|
133
|
+
duplicate pairs whose masks disagree.
|
|
134
|
+
- Dataset profile (information only, off as findings by default): G004 border contact, T003
|
|
135
|
+
image-size spread.
|
|
136
|
+
- **`seglint check`** for PNG folders and COCO JSON, with:
|
|
137
|
+
- `--select` / `--ignore` and `--workers`;
|
|
138
|
+
- `--fail-on`; the exit codes are 0, 1 (a finding reaches `--fail-on`) and 2 (usage or input
|
|
139
|
+
error). If the reader of the output closes the pipe early (`| head -1`), seglint stops quietly
|
|
140
|
+
with 141 (128 + SIGPIPE), after the report and JSON files are written.
|
|
141
|
+
- **Review list:**
|
|
142
|
+
- `--sensitivity strict|balanced|relaxed` (k = 2.5 / 3.5 / 5.0).
|
|
143
|
+
- `--budget N`: all absolute findings plus the N most suspicious uncertain samples. Absolute
|
|
144
|
+
findings are never cut.
|
|
145
|
+
- A notice when one relative check flags more than 20% of the samples.
|
|
146
|
+
- **`seglint calibrate`:** writes a commented `seglint.toml` with thresholds and frozen
|
|
147
|
+
reference statistics. Precedence is: command-line flags > your keys > calibrated values >
|
|
148
|
+
defaults. `--explain-config` shows where each value comes from.
|
|
149
|
+
- **Output:**
|
|
150
|
+
- an offline, single-file HTML report, with a "what is normal in this dataset" panel and a
|
|
151
|
+
dataset profile;
|
|
152
|
+
- `--json` output;
|
|
153
|
+
- `--export-examples`.
|
|
154
|
+
- **`seglint demo`:** a synthetic dataset with 10 planted defects, checked end to end. It needs
|
|
155
|
+
no download and no network.
|
|
156
|
+
- **Python API:** `seglint.check`, `seglint.calibrate`, `Result`, `Calibration`. The CLI is
|
|
157
|
+
built on it ([docs/api.md](docs/api.md)).
|
|
158
|
+
- **Measurement:** a pre-registered controlled perturbation benchmark on ISIC 2018 Task 1, with a
|
|
159
|
+
partial check on Oxford-IIIT Pet ([docs/benchmarks.md](docs/benchmarks.md)). In the primary
|
|
160
|
+
layout, 32 of the 34 measurable perturbation kinds met their pre-registered expectation.
|
|
161
|
+
|
|
162
|
+
### Known limits
|
|
163
|
+
|
|
164
|
+
- **Errors that are only visible against the image are not found.** This covers shift, mild
|
|
165
|
+
grow/shrink, coarse polygons, another image's mask and smooth roughening (AUROC 0.42-0.50).
|
|
166
|
+
- **The evidence is limited.** It rests on one base dataset (ISIC 2018 Task 1) and a partial
|
|
167
|
+
check on Oxford-IIIT Pet. No test with an independent labeller has been done.
|
|
168
|
+
- **G005 (jagged boundary) is experimental and off by default** (`--experimental`); it measured
|
|
169
|
+
at chance level.
|
|
170
|
+
- **Relative checks need data.** They need at least 50 samples and assume that defects are a
|
|
171
|
+
minority.
|
|
172
|
+
- **The package is not on PyPI yet.** Install it from GitHub:
|
|
173
|
+
`pip install git+https://github.com/Serdar1048/seglint`.
|
|
174
|
+
|
|
175
|
+
[0.2.0]: https://github.com/Serdar1048/seglint/compare/v0.1.0...v0.2.0
|
|
176
|
+
[0.1.0]: https://github.com/Serdar1048/seglint/releases/tag/v0.1.0
|
seglint-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Serdar Dedebas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
seglint-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: seglint
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A model-free health check for segmentation masks: flags masks that look broken and duplicate images before training.
|
|
5
|
+
Author: Serdar Dedebas
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: computer-vision,data-quality,dataset,lint,segmentation
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: jinja2
|
|
19
|
+
Requires-Dist: numpy
|
|
20
|
+
Requires-Dist: opencv-python-headless
|
|
21
|
+
Requires-Dist: pillow
|
|
22
|
+
Requires-Dist: rich<16,>=13.0
|
|
23
|
+
Requires-Dist: tomli>=2.0; python_version < '3.11'
|
|
24
|
+
Requires-Dist: typer
|
|
25
|
+
Provides-Extra: coco
|
|
26
|
+
Requires-Dist: pycocotools; extra == 'coco'
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: matplotlib; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# seglint
|
|
35
|
+
|
|
36
|
+
A model-free health check for segmentation masks: it flags masks that look broken (empty,
|
|
37
|
+
speckled, holed, fragmented) and duplicated images before you train, without a model and without
|
|
38
|
+
judging the image content.
|
|
39
|
+
|
|
40
|
+
[](https://github.com/Serdar1048/seglint/actions/workflows/ci.yml)
|
|
41
|
+

|
|
42
|
+
[](LICENSE)
|
|
43
|
+
|
|
44
|
+
Status: alpha (0.x). Some default thresholds were tuned on ISIC 2018 and have not been validated
|
|
45
|
+
on other datasets; run `seglint calibrate` for yours.
|
|
46
|
+
|
|
47
|
+
**For** anyone who prepares or receives a segmentation dataset (medical, industrial, everyday
|
|
48
|
+
photos). **Use it** before training, after a labelling round, or when a new batch of masks
|
|
49
|
+
arrives. It reads image and mask files, checks the masks for problems that are visible in the
|
|
50
|
+
mask itself (missing files, empty masks, masks filling the image, specks, holes, fragments,
|
|
51
|
+
unusual masks for this dataset, duplicate images and leakage between splits) and writes one HTML
|
|
52
|
+
report. **It does not** judge whether a mask matches its image: a shifted mask or a mask that is
|
|
53
|
+
slightly too large looks normal to it. Every finding is a suspicion for you to look at, not a
|
|
54
|
+
verdict.
|
|
55
|
+
|
|
56
|
+

|
|
57
|
+
|
|
58
|
+

|
|
59
|
+
|
|
60
|
+
The screenshots come from the demo's synthetic data. Open the full example report:
|
|
61
|
+
[docs/sample_report.html](docs/sample_report.html) (download it and open it in a browser).
|
|
62
|
+
|
|
63
|
+
## Quick start
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
pip install seglint
|
|
67
|
+
seglint demo --out demo
|
|
68
|
+
seglint check path/to/dataset --report report.html
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
1. Install. The development version: `pip install git+https://github.com/Serdar1048/seglint.git`.
|
|
72
|
+
2. `seglint demo` builds a small synthetic dataset with planted defects, checks it and writes
|
|
73
|
+
`demo/report.html`: a report to look at before you use your own data.
|
|
74
|
+
3. `seglint check` scans your dataset (folders `images/` and `masks/`) and writes the report.
|
|
75
|
+
|
|
76
|
+
Masks stored as 0/255 need `--binary`; masks named other than `<image>_mask`,
|
|
77
|
+
`<image>_segmentation` or `<image>_gt` need `--mask-suffix`. The full walk-through, with the
|
|
78
|
+
supported folder layouts and a complete example on ISIC 2018, is in
|
|
79
|
+
[docs/usage.md](docs/usage.md).
|
|
80
|
+
|
|
81
|
+
## What it checks
|
|
82
|
+
|
|
83
|
+
| Family | Codes | Looks for |
|
|
84
|
+
|---|---|---|
|
|
85
|
+
| Structure | S001-S008 | Files that do not pair up, unreadable files, image and mask of different sizes, class values outside your list, RGB or JPEG masks, EXIF rotation that may not match the mask. |
|
|
86
|
+
| Absurd on its own | T001, T005, T006 | An empty mask, a nearly empty mask, a mask covering (almost) the whole image. |
|
|
87
|
+
| Splits | T002, T004 | A class missing or very rare in one split; a split whose class mix differs from train. |
|
|
88
|
+
| Geometry | G001-G003 | A class broken into many parts, tiny specks, small holes. |
|
|
89
|
+
| Extreme for this dataset | R001-R004 | Area, position, shape or object count far from what is normal in this dataset. |
|
|
90
|
+
| Duplicates and leakage | L001-L004 | Identical and near-duplicate images (also mirrored or rotated), the same image in two splits, duplicate pairs whose masks disagree. |
|
|
91
|
+
|
|
92
|
+
Each check, its threshold, how it was measured and its known weak spot:
|
|
93
|
+
[docs/checks.md](docs/checks.md). Two dataset-profile checks (G004 border contact, T003 image
|
|
94
|
+
size) and one experimental check (G005 jagged outline) are off by default.
|
|
95
|
+
|
|
96
|
+
## What it cannot catch
|
|
97
|
+
|
|
98
|
+
- **Errors that are visible only against the image.** A shifted mask, a mildly grown or shrunk
|
|
99
|
+
mask, a coarse polygon or the mask of another image look like normal masks. In the controlled
|
|
100
|
+
benchmark these damage kinds ranked at chance level (AUROC 0.42-0.50,
|
|
101
|
+
[benchmarks.md, "Headline"](docs/benchmarks.md#headline)). This is by design: seglint does not
|
|
102
|
+
judge the image content.
|
|
103
|
+
- **Cropped duplicates.** Near-duplicates are found less often the more they are cropped: on ISIC
|
|
104
|
+
images 95% at 1% per side, 72% at 2%, 43% at 3%, 11% at 5%
|
|
105
|
+
([checks.md, "Known limitations"](docs/checks.md#known-limitations-per-check)).
|
|
106
|
+
- **Specks next to ignore pixels.** A small component that touches an ignore pixel is not counted
|
|
107
|
+
as a speck: it is usually a piece that a void band cut off. Where a void band outlines every
|
|
108
|
+
object, specks inside the band are not found
|
|
109
|
+
([benchmarks.md, "Post-hoc change: ignore pixels"](docs/benchmarks.md#post-hoc-change-ignore-pixels-made-after-the-voc-run-not-pre-registered)).
|
|
110
|
+
- **Masks that are unusual on purpose.** Relative checks compare a mask with the rest of the
|
|
111
|
+
dataset; they assume that defects are a minority.
|
|
112
|
+
|
|
113
|
+
## How to read results
|
|
114
|
+
|
|
115
|
+
A **finding is a suspicious sample, not a confirmed error**. Open the image and the mask and
|
|
116
|
+
decide. ERROR means a file, structure or leakage problem; WARNING a likely defect; **INFO is
|
|
117
|
+
worth a look but has low priority**. The report's first page separates **definite defects**
|
|
118
|
+
(missing files, empty masks and similar, never cut by `--budget`) from **samples to review**
|
|
119
|
+
(heuristic limits and dataset-relative findings). How to read every part of the report:
|
|
120
|
+
[docs/report.md](docs/report.md).
|
|
121
|
+
|
|
122
|
+
## Validation
|
|
123
|
+
|
|
124
|
+
Everything below is in [docs/benchmarks.md](docs/benchmarks.md) and
|
|
125
|
+
[docs/checks.md](docs/checks.md), with the exact commits and commands.
|
|
126
|
+
|
|
127
|
+
- **Synthetic data:** in our synthetic tests every T/G check flagged all injected defects, and
|
|
128
|
+
none of the 1200 clean synthetic samples was flagged ([checks.md, "Cross-check summary"](docs/checks.md#cross-check-summary-synthetic-10-seeds-120-clean--46-injected-samples-each)).
|
|
129
|
+
Synthetic distributions are tighter than real ones.
|
|
130
|
+
- **ISIC 2018 Task 1 (2594 masks):** 21.2% of the samples have at least one finding, 5.0% a
|
|
131
|
+
WARNING. These are **flag rates, not false-alarm rates**: ISIC has its own annotation problems,
|
|
132
|
+
and a flag may be right
|
|
133
|
+
([benchmarks.md, "Flag rates next to ISIC"](docs/benchmarks.md#flag-rates-next-to-isic)).
|
|
134
|
+
- **Pre-registered controlled damage test** (expectations committed before the run; 300 ISIC
|
|
135
|
+
masks, 30 of them damaged per variant): the expectation held for **32 of 34** measurable
|
|
136
|
+
variants ([benchmarks.md, "Headline"](docs/benchmarks.md#headline)). Code changes made after
|
|
137
|
+
this run are listed in [benchmarks.md, "Post-hoc changes after the final benchmark"](docs/benchmarks.md#post-hoc-changes-after-the-final-benchmark-post-hoc-1-not-part-of-the-pre-registered-test)
|
|
138
|
+
(and the second round that follows it).
|
|
139
|
+
- Ranked high in this test: empty, image-filling, holed, speckled and fragmented masks, and
|
|
140
|
+
masks moved far from their place (AUROC lower bounds 0.82-0.96).
|
|
141
|
+
- Not separated from undamaged masks: shift, mild grow or shrink, coarse polygons, smooth boundary changes, another
|
|
142
|
+
image's mask (AUROC 0.42-0.50), and heavy grow or shrink on ISIC, whose lesion sizes vary
|
|
143
|
+
too much.
|
|
144
|
+
- **Negative results:** the jagged-outline check G005 measured at chance level (AUROC 0.48-0.52)
|
|
145
|
+
and is off by default ([checks.md, "Evidence status"](docs/checks.md#evidence-status-per-check-final-perturbation-benchmark-v01-defaults)).
|
|
146
|
+
- **External reference (post-hoc):** of 4 ISIC masks that Xu and Hwang
|
|
147
|
+
([arXiv:1807.06466](https://arxiv.org/abs/1807.06466)) excluded as fragmented, 3 are at ranks 1, 3 and 6 of the `--budget 30` review list and the 4th has only INFO
|
|
148
|
+
findings (rank 115); a small, post-hoc check, not a recall estimate ([benchmarks.md, "External reference check"](docs/benchmarks.md#external-reference-check-post-hoc)).
|
|
149
|
+
- **Precision has not been established:** how many of the flagged samples are really wrong is not
|
|
150
|
+
known. No test with an independent labeller has been done.
|
|
151
|
+
- A second, non-medical dataset (Pascal VOC) exposed a false-alarm source around ignore pixels,
|
|
152
|
+
which was fixed; details in [docs/benchmarks.md](docs/benchmarks.md#post-hoc-change-ignore-pixels-made-after-the-voc-run-not-pre-registered).
|
|
153
|
+
|
|
154
|
+
## Runtime
|
|
155
|
+
|
|
156
|
+
Time depends mostly on image size: the scan reads every image for the duplicate checks. One
|
|
157
|
+
machine (Windows 11, 20 logical cores, Python 3.13, 8 workers), median of 3 runs
|
|
158
|
+
([benchmarks.md, "Runtime"](docs/benchmarks.md#runtime)):
|
|
159
|
+
|
|
160
|
+
| Dataset | Scan | Report |
|
|
161
|
+
|---|---:|---:|
|
|
162
|
+
| ISIC 2018 Task 1, 2594 JPEGs up to about 4500x6700 px | 184.67 s | 45.35 s |
|
|
163
|
+
| Synthetic, 9999 small PNGs | 26.42 s | 1.01 s |
|
|
164
|
+
|
|
165
|
+
## Configuration
|
|
166
|
+
|
|
167
|
+
Most datasets need only command-line options. To keep settings with the dataset or change a
|
|
168
|
+
threshold, put a `seglint.toml` next to it:
|
|
169
|
+
|
|
170
|
+
```toml
|
|
171
|
+
mask_suffix = "_mask"
|
|
172
|
+
|
|
173
|
+
[classes]
|
|
174
|
+
0 = "background"
|
|
175
|
+
1 = "lesion"
|
|
176
|
+
|
|
177
|
+
[thresholds]
|
|
178
|
+
small_hole_warn_area_frac = 0.004 # G003: WARNING only from 0.4% of the class area
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Command-line options override your file, which overrides values written by `seglint calibrate`,
|
|
182
|
+
which override the defaults. `seglint check <DATASET> --explain-config` prints every value and
|
|
183
|
+
its source. All keys, `seglint calibrate` and the sensitivity presets:
|
|
184
|
+
[docs/configuration.md](docs/configuration.md). Every option: [docs/cli.md](docs/cli.md).
|
|
185
|
+
Python API: [docs/api.md](docs/api.md). Problems: [docs/faq.md](docs/faq.md).
|
|
186
|
+
|
|
187
|
+
## Roadmap
|
|
188
|
+
|
|
189
|
+
- Change thresholds in the report and see the result live (a planned `serve` command).
|
|
190
|
+
- A GitHub Action and a pre-commit hook.
|
|
191
|
+
- Experimental checks that look at the image (mask-image agreement).
|
|
192
|
+
- Validation on more datasets (for example BUSI, breast ultrasound).
|
|
193
|
+
- A precision measurement with an independent labeller.
|
|
194
|
+
|
|
195
|
+
## Related work
|
|
196
|
+
|
|
197
|
+
Tools such as cleanlab find label errors from a trained model's predictions. seglint works
|
|
198
|
+
before any model exists and needs none; the two are complementary: cleanlab can catch errors
|
|
199
|
+
that need the image, seglint flags suspicious masks without training. A comparison with other
|
|
200
|
+
tools: [docs/related-work.md](docs/related-work.md).
|
|
201
|
+
|
|
202
|
+
## Citation and acknowledgments
|
|
203
|
+
|
|
204
|
+
The measurements use the ISIC 2018 Task 1 data, of which only measured numbers appear here.
|
|
205
|
+
ISIC 2018 data are distributed by the ISIC archive under its own terms; this repository contains
|
|
206
|
+
no ISIC data. If you use the data, cite:
|
|
207
|
+
|
|
208
|
+
- N. Codella et al., "Skin Lesion Analysis Toward Melanoma Detection 2018: A Challenge Hosted by
|
|
209
|
+
the International Skin Imaging Collaboration (ISIC)", 2019,
|
|
210
|
+
[arXiv:1902.03368](https://arxiv.org/abs/1902.03368).
|
|
211
|
+
- P. Tschandl, C. Rosendahl, H. Kittler, "The HAM10000 dataset, a large collection of
|
|
212
|
+
multi-source dermatoscopic images of common pigmented skin lesions", Scientific Data 5, 180161
|
|
213
|
+
(2018), [doi:10.1038/sdata.2018.161](https://doi.org/10.1038/sdata.2018.161).
|
|
214
|
+
|
|
215
|
+
## License
|
|
216
|
+
|
|
217
|
+
MIT, see [LICENSE](LICENSE).
|
seglint-0.2.0/README.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# seglint
|
|
2
|
+
|
|
3
|
+
A model-free health check for segmentation masks: it flags masks that look broken (empty,
|
|
4
|
+
speckled, holed, fragmented) and duplicated images before you train, without a model and without
|
|
5
|
+
judging the image content.
|
|
6
|
+
|
|
7
|
+
[](https://github.com/Serdar1048/seglint/actions/workflows/ci.yml)
|
|
8
|
+

|
|
9
|
+
[](LICENSE)
|
|
10
|
+
|
|
11
|
+
Status: alpha (0.x). Some default thresholds were tuned on ISIC 2018 and have not been validated
|
|
12
|
+
on other datasets; run `seglint calibrate` for yours.
|
|
13
|
+
|
|
14
|
+
**For** anyone who prepares or receives a segmentation dataset (medical, industrial, everyday
|
|
15
|
+
photos). **Use it** before training, after a labelling round, or when a new batch of masks
|
|
16
|
+
arrives. It reads image and mask files, checks the masks for problems that are visible in the
|
|
17
|
+
mask itself (missing files, empty masks, masks filling the image, specks, holes, fragments,
|
|
18
|
+
unusual masks for this dataset, duplicate images and leakage between splits) and writes one HTML
|
|
19
|
+
report. **It does not** judge whether a mask matches its image: a shifted mask or a mask that is
|
|
20
|
+
slightly too large looks normal to it. Every finding is a suspicion for you to look at, not a
|
|
21
|
+
verdict.
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
The screenshots come from the demo's synthetic data. Open the full example report:
|
|
28
|
+
[docs/sample_report.html](docs/sample_report.html) (download it and open it in a browser).
|
|
29
|
+
|
|
30
|
+
## Quick start
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
pip install seglint
|
|
34
|
+
seglint demo --out demo
|
|
35
|
+
seglint check path/to/dataset --report report.html
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
1. Install. The development version: `pip install git+https://github.com/Serdar1048/seglint.git`.
|
|
39
|
+
2. `seglint demo` builds a small synthetic dataset with planted defects, checks it and writes
|
|
40
|
+
`demo/report.html`: a report to look at before you use your own data.
|
|
41
|
+
3. `seglint check` scans your dataset (folders `images/` and `masks/`) and writes the report.
|
|
42
|
+
|
|
43
|
+
Masks stored as 0/255 need `--binary`; masks named other than `<image>_mask`,
|
|
44
|
+
`<image>_segmentation` or `<image>_gt` need `--mask-suffix`. The full walk-through, with the
|
|
45
|
+
supported folder layouts and a complete example on ISIC 2018, is in
|
|
46
|
+
[docs/usage.md](docs/usage.md).
|
|
47
|
+
|
|
48
|
+
## What it checks
|
|
49
|
+
|
|
50
|
+
| Family | Codes | Looks for |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| Structure | S001-S008 | Files that do not pair up, unreadable files, image and mask of different sizes, class values outside your list, RGB or JPEG masks, EXIF rotation that may not match the mask. |
|
|
53
|
+
| Absurd on its own | T001, T005, T006 | An empty mask, a nearly empty mask, a mask covering (almost) the whole image. |
|
|
54
|
+
| Splits | T002, T004 | A class missing or very rare in one split; a split whose class mix differs from train. |
|
|
55
|
+
| Geometry | G001-G003 | A class broken into many parts, tiny specks, small holes. |
|
|
56
|
+
| Extreme for this dataset | R001-R004 | Area, position, shape or object count far from what is normal in this dataset. |
|
|
57
|
+
| Duplicates and leakage | L001-L004 | Identical and near-duplicate images (also mirrored or rotated), the same image in two splits, duplicate pairs whose masks disagree. |
|
|
58
|
+
|
|
59
|
+
Each check, its threshold, how it was measured and its known weak spot:
|
|
60
|
+
[docs/checks.md](docs/checks.md). Two dataset-profile checks (G004 border contact, T003 image
|
|
61
|
+
size) and one experimental check (G005 jagged outline) are off by default.
|
|
62
|
+
|
|
63
|
+
## What it cannot catch
|
|
64
|
+
|
|
65
|
+
- **Errors that are visible only against the image.** A shifted mask, a mildly grown or shrunk
|
|
66
|
+
mask, a coarse polygon or the mask of another image look like normal masks. In the controlled
|
|
67
|
+
benchmark these damage kinds ranked at chance level (AUROC 0.42-0.50,
|
|
68
|
+
[benchmarks.md, "Headline"](docs/benchmarks.md#headline)). This is by design: seglint does not
|
|
69
|
+
judge the image content.
|
|
70
|
+
- **Cropped duplicates.** Near-duplicates are found less often the more they are cropped: on ISIC
|
|
71
|
+
images 95% at 1% per side, 72% at 2%, 43% at 3%, 11% at 5%
|
|
72
|
+
([checks.md, "Known limitations"](docs/checks.md#known-limitations-per-check)).
|
|
73
|
+
- **Specks next to ignore pixels.** A small component that touches an ignore pixel is not counted
|
|
74
|
+
as a speck: it is usually a piece that a void band cut off. Where a void band outlines every
|
|
75
|
+
object, specks inside the band are not found
|
|
76
|
+
([benchmarks.md, "Post-hoc change: ignore pixels"](docs/benchmarks.md#post-hoc-change-ignore-pixels-made-after-the-voc-run-not-pre-registered)).
|
|
77
|
+
- **Masks that are unusual on purpose.** Relative checks compare a mask with the rest of the
|
|
78
|
+
dataset; they assume that defects are a minority.
|
|
79
|
+
|
|
80
|
+
## How to read results
|
|
81
|
+
|
|
82
|
+
A **finding is a suspicious sample, not a confirmed error**. Open the image and the mask and
|
|
83
|
+
decide. ERROR means a file, structure or leakage problem; WARNING a likely defect; **INFO is
|
|
84
|
+
worth a look but has low priority**. The report's first page separates **definite defects**
|
|
85
|
+
(missing files, empty masks and similar, never cut by `--budget`) from **samples to review**
|
|
86
|
+
(heuristic limits and dataset-relative findings). How to read every part of the report:
|
|
87
|
+
[docs/report.md](docs/report.md).
|
|
88
|
+
|
|
89
|
+
## Validation
|
|
90
|
+
|
|
91
|
+
Everything below is in [docs/benchmarks.md](docs/benchmarks.md) and
|
|
92
|
+
[docs/checks.md](docs/checks.md), with the exact commits and commands.
|
|
93
|
+
|
|
94
|
+
- **Synthetic data:** in our synthetic tests every T/G check flagged all injected defects, and
|
|
95
|
+
none of the 1200 clean synthetic samples was flagged ([checks.md, "Cross-check summary"](docs/checks.md#cross-check-summary-synthetic-10-seeds-120-clean--46-injected-samples-each)).
|
|
96
|
+
Synthetic distributions are tighter than real ones.
|
|
97
|
+
- **ISIC 2018 Task 1 (2594 masks):** 21.2% of the samples have at least one finding, 5.0% a
|
|
98
|
+
WARNING. These are **flag rates, not false-alarm rates**: ISIC has its own annotation problems,
|
|
99
|
+
and a flag may be right
|
|
100
|
+
([benchmarks.md, "Flag rates next to ISIC"](docs/benchmarks.md#flag-rates-next-to-isic)).
|
|
101
|
+
- **Pre-registered controlled damage test** (expectations committed before the run; 300 ISIC
|
|
102
|
+
masks, 30 of them damaged per variant): the expectation held for **32 of 34** measurable
|
|
103
|
+
variants ([benchmarks.md, "Headline"](docs/benchmarks.md#headline)). Code changes made after
|
|
104
|
+
this run are listed in [benchmarks.md, "Post-hoc changes after the final benchmark"](docs/benchmarks.md#post-hoc-changes-after-the-final-benchmark-post-hoc-1-not-part-of-the-pre-registered-test)
|
|
105
|
+
(and the second round that follows it).
|
|
106
|
+
- Ranked high in this test: empty, image-filling, holed, speckled and fragmented masks, and
|
|
107
|
+
masks moved far from their place (AUROC lower bounds 0.82-0.96).
|
|
108
|
+
- Not separated from undamaged masks: shift, mild grow or shrink, coarse polygons, smooth boundary changes, another
|
|
109
|
+
image's mask (AUROC 0.42-0.50), and heavy grow or shrink on ISIC, whose lesion sizes vary
|
|
110
|
+
too much.
|
|
111
|
+
- **Negative results:** the jagged-outline check G005 measured at chance level (AUROC 0.48-0.52)
|
|
112
|
+
and is off by default ([checks.md, "Evidence status"](docs/checks.md#evidence-status-per-check-final-perturbation-benchmark-v01-defaults)).
|
|
113
|
+
- **External reference (post-hoc):** of 4 ISIC masks that Xu and Hwang
|
|
114
|
+
([arXiv:1807.06466](https://arxiv.org/abs/1807.06466)) excluded as fragmented, 3 are at ranks 1, 3 and 6 of the `--budget 30` review list and the 4th has only INFO
|
|
115
|
+
findings (rank 115); a small, post-hoc check, not a recall estimate ([benchmarks.md, "External reference check"](docs/benchmarks.md#external-reference-check-post-hoc)).
|
|
116
|
+
- **Precision has not been established:** how many of the flagged samples are really wrong is not
|
|
117
|
+
known. No test with an independent labeller has been done.
|
|
118
|
+
- A second, non-medical dataset (Pascal VOC) exposed a false-alarm source around ignore pixels,
|
|
119
|
+
which was fixed; details in [docs/benchmarks.md](docs/benchmarks.md#post-hoc-change-ignore-pixels-made-after-the-voc-run-not-pre-registered).
|
|
120
|
+
|
|
121
|
+
## Runtime
|
|
122
|
+
|
|
123
|
+
Time depends mostly on image size: the scan reads every image for the duplicate checks. One
|
|
124
|
+
machine (Windows 11, 20 logical cores, Python 3.13, 8 workers), median of 3 runs
|
|
125
|
+
([benchmarks.md, "Runtime"](docs/benchmarks.md#runtime)):
|
|
126
|
+
|
|
127
|
+
| Dataset | Scan | Report |
|
|
128
|
+
|---|---:|---:|
|
|
129
|
+
| ISIC 2018 Task 1, 2594 JPEGs up to about 4500x6700 px | 184.67 s | 45.35 s |
|
|
130
|
+
| Synthetic, 9999 small PNGs | 26.42 s | 1.01 s |
|
|
131
|
+
|
|
132
|
+
## Configuration
|
|
133
|
+
|
|
134
|
+
Most datasets need only command-line options. To keep settings with the dataset or change a
|
|
135
|
+
threshold, put a `seglint.toml` next to it:
|
|
136
|
+
|
|
137
|
+
```toml
|
|
138
|
+
mask_suffix = "_mask"
|
|
139
|
+
|
|
140
|
+
[classes]
|
|
141
|
+
0 = "background"
|
|
142
|
+
1 = "lesion"
|
|
143
|
+
|
|
144
|
+
[thresholds]
|
|
145
|
+
small_hole_warn_area_frac = 0.004 # G003: WARNING only from 0.4% of the class area
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Command-line options override your file, which overrides values written by `seglint calibrate`,
|
|
149
|
+
which override the defaults. `seglint check <DATASET> --explain-config` prints every value and
|
|
150
|
+
its source. All keys, `seglint calibrate` and the sensitivity presets:
|
|
151
|
+
[docs/configuration.md](docs/configuration.md). Every option: [docs/cli.md](docs/cli.md).
|
|
152
|
+
Python API: [docs/api.md](docs/api.md). Problems: [docs/faq.md](docs/faq.md).
|
|
153
|
+
|
|
154
|
+
## Roadmap
|
|
155
|
+
|
|
156
|
+
- Change thresholds in the report and see the result live (a planned `serve` command).
|
|
157
|
+
- A GitHub Action and a pre-commit hook.
|
|
158
|
+
- Experimental checks that look at the image (mask-image agreement).
|
|
159
|
+
- Validation on more datasets (for example BUSI, breast ultrasound).
|
|
160
|
+
- A precision measurement with an independent labeller.
|
|
161
|
+
|
|
162
|
+
## Related work
|
|
163
|
+
|
|
164
|
+
Tools such as cleanlab find label errors from a trained model's predictions. seglint works
|
|
165
|
+
before any model exists and needs none; the two are complementary: cleanlab can catch errors
|
|
166
|
+
that need the image, seglint flags suspicious masks without training. A comparison with other
|
|
167
|
+
tools: [docs/related-work.md](docs/related-work.md).
|
|
168
|
+
|
|
169
|
+
## Citation and acknowledgments
|
|
170
|
+
|
|
171
|
+
The measurements use the ISIC 2018 Task 1 data, of which only measured numbers appear here.
|
|
172
|
+
ISIC 2018 data are distributed by the ISIC archive under its own terms; this repository contains
|
|
173
|
+
no ISIC data. If you use the data, cite:
|
|
174
|
+
|
|
175
|
+
- N. Codella et al., "Skin Lesion Analysis Toward Melanoma Detection 2018: A Challenge Hosted by
|
|
176
|
+
the International Skin Imaging Collaboration (ISIC)", 2019,
|
|
177
|
+
[arXiv:1902.03368](https://arxiv.org/abs/1902.03368).
|
|
178
|
+
- P. Tschandl, C. Rosendahl, H. Kittler, "The HAM10000 dataset, a large collection of
|
|
179
|
+
multi-source dermatoscopic images of common pigmented skin lesions", Scientific Data 5, 180161
|
|
180
|
+
(2018), [doi:10.1038/sdata.2018.161](https://doi.org/10.1038/sdata.2018.161).
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
MIT, see [LICENSE](LICENSE).
|