Immaculate 0.3.0__tar.gz → 0.4.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.
Files changed (50) hide show
  1. {immaculate-0.3.0 → immaculate-0.4.0}/.github/workflows/ci.yml +8 -8
  2. {immaculate-0.3.0 → immaculate-0.4.0}/.github/workflows/release-onnx.yml +4 -4
  3. {immaculate-0.3.0 → immaculate-0.4.0}/.github/workflows/release.yml +9 -9
  4. {immaculate-0.3.0 → immaculate-0.4.0}/Cargo.lock +23 -23
  5. {immaculate-0.3.0 → immaculate-0.4.0}/Cargo.toml +2 -2
  6. immaculate-0.4.0/PKG-INFO +91 -0
  7. immaculate-0.4.0/README.md +73 -0
  8. immaculate-0.4.0/docs/api.md +25 -0
  9. immaculate-0.4.0/docs/benchmarks.md +181 -0
  10. immaculate-0.4.0/docs/checks.md +145 -0
  11. {immaculate-0.3.0 → immaculate-0.4.0}/mkdocs.yml +3 -1
  12. {immaculate-0.3.0 → immaculate-0.4.0}/pyproject.toml +24 -18
  13. immaculate-0.4.0/rust/error.rs +51 -0
  14. immaculate-0.4.0/rust/images.rs +199 -0
  15. immaculate-0.4.0/rust/lib.rs +441 -0
  16. {immaculate-0.3.0/rust → immaculate-0.4.0/rust/near}/multi_index.rs +1 -1
  17. {immaculate-0.3.0/rust → immaculate-0.4.0/rust/near}/pdq.rs +10 -11
  18. {immaculate-0.3.0/rust → immaculate-0.4.0/rust/near}/phash.rs +9 -11
  19. {immaculate-0.3.0/rust → immaculate-0.4.0/rust/near}/sscd.rs +10 -10
  20. immaculate-0.3.0/rust/perceptual_hash.rs → immaculate-0.4.0/rust/near.rs +32 -4
  21. immaculate-0.4.0/rust/progress.rs +80 -0
  22. immaculate-0.4.0/rust/properties/pixels.rs +383 -0
  23. immaculate-0.4.0/rust/properties/settings.rs +81 -0
  24. immaculate-0.4.0/rust/properties/stats.rs +88 -0
  25. immaculate-0.4.0/rust/properties.rs +275 -0
  26. {immaculate-0.3.0 → immaculate-0.4.0}/rust/test_util.rs +1 -1
  27. immaculate-0.4.0/rust/truncation.rs +176 -0
  28. immaculate-0.4.0/src/immaculate/__init__.py +39 -0
  29. immaculate-0.4.0/src/immaculate/__main__.py +243 -0
  30. immaculate-0.4.0/src/immaculate/_checks.py +229 -0
  31. immaculate-0.4.0/src/immaculate/_core.pyi +54 -0
  32. immaculate-0.4.0/src/immaculate/_issues.py +233 -0
  33. {immaculate-0.3.0 → immaculate-0.4.0}/tests/test_immaculate.py +399 -20
  34. {immaculate-0.3.0 → immaculate-0.4.0}/uv.lock +299 -277
  35. immaculate-0.3.0/PKG-INFO +0 -99
  36. immaculate-0.3.0/README.md +0 -81
  37. immaculate-0.3.0/docs/api.md +0 -6
  38. immaculate-0.3.0/rust/lib.rs +0 -500
  39. immaculate-0.3.0/src/immaculate/__init__.py +0 -6
  40. immaculate-0.3.0/src/immaculate/__main__.py +0 -154
  41. immaculate-0.3.0/src/immaculate/_core.pyi +0 -20
  42. immaculate-0.3.0/src/immaculate/_duplicates.py +0 -107
  43. {immaculate-0.3.0 → immaculate-0.4.0}/.gitignore +0 -0
  44. {immaculate-0.3.0 → immaculate-0.4.0}/.pre-commit-config.yaml +0 -0
  45. {immaculate-0.3.0 → immaculate-0.4.0}/.python-version +0 -0
  46. {immaculate-0.3.0 → immaculate-0.4.0}/LICENSE +0 -0
  47. {immaculate-0.3.0 → immaculate-0.4.0}/clippy.toml +0 -0
  48. {immaculate-0.3.0 → immaculate-0.4.0}/docs/index.md +0 -0
  49. {immaculate-0.3.0/rust → immaculate-0.4.0/rust/near}/side_cache.rs +0 -0
  50. {immaculate-0.3.0 → immaculate-0.4.0}/src/immaculate/py.typed +0 -0
@@ -15,8 +15,8 @@ jobs:
15
15
  lint:
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
- - uses: actions/checkout@v5
19
- - uses: astral-sh/setup-uv@v6
18
+ - uses: actions/checkout@v7
19
+ - uses: astral-sh/setup-uv@v7
20
20
  with:
21
21
  enable-cache: true
22
22
  # Syncing installs the project, which builds the Rust extension
@@ -31,8 +31,8 @@ jobs:
31
31
  test:
32
32
  runs-on: ubuntu-latest
33
33
  steps:
34
- - uses: actions/checkout@v5
35
- - uses: astral-sh/setup-uv@v6
34
+ - uses: actions/checkout@v7
35
+ - uses: astral-sh/setup-uv@v7
36
36
  with:
37
37
  enable-cache: true
38
38
  - uses: Swatinem/rust-cache@v2
@@ -43,13 +43,13 @@ jobs:
43
43
  docs:
44
44
  runs-on: ubuntu-latest
45
45
  steps:
46
- - uses: actions/checkout@v5
47
- - uses: astral-sh/setup-uv@v6
46
+ - uses: actions/checkout@v7
47
+ - uses: astral-sh/setup-uv@v7
48
48
  with:
49
49
  enable-cache: true
50
50
  # mkdocstrings reads the source statically, so the Rust extension isn't built
51
51
  - run: uv run --locked --only-group docs mkdocs build --strict
52
- - uses: actions/upload-pages-artifact@v4
52
+ - uses: actions/upload-pages-artifact@v5
53
53
  if: github.event_name == 'push'
54
54
  with:
55
55
  path: site
@@ -66,4 +66,4 @@ jobs:
66
66
  url: ${{ steps.deployment.outputs.page_url }}
67
67
  steps:
68
68
  - id: deployment
69
- uses: actions/deploy-pages@v4
69
+ uses: actions/deploy-pages@v5
@@ -17,10 +17,10 @@ jobs:
17
17
  build:
18
18
  runs-on: ubuntu-latest
19
19
  steps:
20
- - uses: actions/checkout@v5
21
- - uses: astral-sh/setup-uv@v6
20
+ - uses: actions/checkout@v7
21
+ - uses: astral-sh/setup-uv@v7
22
22
  - run: uv build --package immaculate-onnx --out-dir dist
23
- - uses: actions/upload-artifact@v4
23
+ - uses: actions/upload-artifact@v7
24
24
  with:
25
25
  name: immaculate-onnx
26
26
  path: dist/*
@@ -37,7 +37,7 @@ jobs:
37
37
  permissions:
38
38
  id-token: write
39
39
  steps:
40
- - uses: actions/download-artifact@v4
40
+ - uses: actions/download-artifact@v8
41
41
  with:
42
42
  name: immaculate-onnx
43
43
  path: dist
@@ -28,20 +28,20 @@ jobs:
28
28
  python-arch: arm64
29
29
  runs-on: ${{ matrix.os }}
30
30
  steps:
31
- - uses: actions/checkout@v5
31
+ - uses: actions/checkout@v7
32
32
  - id: python
33
- uses: actions/setup-python@v5
33
+ uses: actions/setup-python@v7
34
34
  with:
35
35
  python-version: "3.12"
36
36
  architecture: ${{ matrix.python-arch }}
37
37
  - uses: dtolnay/rust-toolchain@stable
38
38
  - uses: PyO3/maturin-action@v1
39
39
  with:
40
- maturin-version: v1.15.0
40
+ maturin-version: v1.16.0
41
41
  args: --release --out dist
42
42
  # ONNX Runtime's own Linux wheels need glibc 2.28
43
43
  manylinux: "2_28"
44
- - uses: astral-sh/setup-uv@v6
44
+ - uses: astral-sh/setup-uv@v7
45
45
  # Tests the built wheel, not the source tree: the dev group doesn't include Immaculate,
46
46
  # so syncing it doesn't build it. It does install immaculate-onnx from the source tree,
47
47
  # for the tests of the SSCD methods
@@ -55,7 +55,7 @@ jobs:
55
55
  uv sync --locked --only-group dev --python "$PYTHON"
56
56
  uv pip install dist/*.whl
57
57
  uv run --no-sync pytest
58
- - uses: actions/upload-artifact@v4
58
+ - uses: actions/upload-artifact@v7
59
59
  with:
60
60
  name: immaculate-wheel-${{ matrix.os }}
61
61
  path: dist/*.whl
@@ -63,13 +63,13 @@ jobs:
63
63
  sdist:
64
64
  runs-on: ubuntu-latest
65
65
  steps:
66
- - uses: actions/checkout@v5
66
+ - uses: actions/checkout@v7
67
67
  - uses: PyO3/maturin-action@v1
68
68
  with:
69
- maturin-version: v1.15.0
69
+ maturin-version: v1.16.0
70
70
  command: sdist
71
71
  args: --out dist
72
- - uses: actions/upload-artifact@v4
72
+ - uses: actions/upload-artifact@v7
73
73
  with:
74
74
  name: immaculate-sdist
75
75
  path: dist/*.tar.gz
@@ -86,7 +86,7 @@ jobs:
86
86
  permissions:
87
87
  id-token: write
88
88
  steps:
89
- - uses: actions/download-artifact@v4
89
+ - uses: actions/download-artifact@v8
90
90
  with:
91
91
  pattern: immaculate-*
92
92
  path: dist
@@ -46,9 +46,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
46
46
 
47
47
  [[package]]
48
48
  name = "crc32fast"
49
- version = "1.5.2"
49
+ version = "1.5.5"
50
50
  source = "registry+https://github.com/rust-lang/crates.io-index"
51
- checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78"
51
+ checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64"
52
52
  dependencies = [
53
53
  "cfg-if",
54
54
  ]
@@ -107,9 +107,9 @@ dependencies = [
107
107
 
108
108
  [[package]]
109
109
  name = "flate2"
110
- version = "1.1.10"
110
+ version = "1.1.11"
111
111
  source = "registry+https://github.com/rust-lang/crates.io-index"
112
- checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb"
112
+ checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4"
113
113
  dependencies = [
114
114
  "crc32fast",
115
115
  "miniz_oxide 0.9.1",
@@ -174,7 +174,7 @@ dependencies = [
174
174
 
175
175
  [[package]]
176
176
  name = "immaculate"
177
- version = "0.3.0"
177
+ version = "0.4.0"
178
178
  dependencies = [
179
179
  "image",
180
180
  "ort",
@@ -192,9 +192,9 @@ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
192
192
 
193
193
  [[package]]
194
194
  name = "libloading"
195
- version = "0.9.0"
195
+ version = "0.9.1"
196
196
  source = "registry+https://github.com/rust-lang/crates.io-index"
197
- checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60"
197
+ checksum = "a1832accd5a4ca2795ace4d05d15c4039be15b62d3b950eff99746a990e3cc10"
198
198
  dependencies = [
199
199
  "cfg-if",
200
200
  "windows-link",
@@ -290,9 +290,9 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
290
290
 
291
291
  [[package]]
292
292
  name = "ort"
293
- version = "2.0.0-rc.14"
293
+ version = "2.0.0-rc.15"
294
294
  source = "registry+https://github.com/rust-lang/crates.io-index"
295
- checksum = "08ca9287c05aace7e95250104a00d54b7da0fc9ac5f25efa424b80827d2e25eb"
295
+ checksum = "37c87aa7a90b7ff3e0fe36cccd475df8d67f15f07f4d6c370c4b38464232813c"
296
296
  dependencies = [
297
297
  "libloading",
298
298
  "ndarray",
@@ -303,15 +303,15 @@ dependencies = [
303
303
 
304
304
  [[package]]
305
305
  name = "ort-sys"
306
- version = "2.0.0-rc.14"
306
+ version = "2.0.0-rc.15"
307
307
  source = "registry+https://github.com/rust-lang/crates.io-index"
308
- checksum = "4af4763e553f916650b0bfe4b8d217d61c28607f6117e48b8ab5584d1138f22f"
308
+ checksum = "8d22b0417f1838db5a3ac0b3f98dfe39f6fb73624aa0a27c6bbb5040b9c7db2b"
309
309
 
310
310
  [[package]]
311
311
  name = "pin-project-lite"
312
- version = "0.2.17"
312
+ version = "0.2.18"
313
313
  source = "registry+https://github.com/rust-lang/crates.io-index"
314
- checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
314
+ checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752"
315
315
 
316
316
  [[package]]
317
317
  name = "png"
@@ -398,7 +398,7 @@ dependencies = [
398
398
  "proc-macro2",
399
399
  "pyo3-macros-backend",
400
400
  "quote",
401
- "syn 3.0.9",
401
+ "syn 3.0.10",
402
402
  ]
403
403
 
404
404
  [[package]]
@@ -410,7 +410,7 @@ dependencies = [
410
410
  "heck",
411
411
  "proc-macro2",
412
412
  "quote",
413
- "syn 3.0.9",
413
+ "syn 3.0.10",
414
414
  ]
415
415
 
416
416
  [[package]]
@@ -471,9 +471,9 @@ checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
471
471
 
472
472
  [[package]]
473
473
  name = "smallvec"
474
- version = "1.16.3"
474
+ version = "1.16.6"
475
475
  source = "registry+https://github.com/rust-lang/crates.io-index"
476
- checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b"
476
+ checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59"
477
477
 
478
478
  [[package]]
479
479
  name = "syn"
@@ -488,9 +488,9 @@ dependencies = [
488
488
 
489
489
  [[package]]
490
490
  name = "syn"
491
- version = "3.0.9"
491
+ version = "3.0.10"
492
492
  source = "registry+https://github.com/rust-lang/crates.io-index"
493
- checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
493
+ checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
494
494
  dependencies = [
495
495
  "proc-macro2",
496
496
  "quote",
@@ -499,9 +499,9 @@ dependencies = [
499
499
 
500
500
  [[package]]
501
501
  name = "target-lexicon"
502
- version = "0.13.5"
502
+ version = "0.13.6"
503
503
  source = "registry+https://github.com/rust-lang/crates.io-index"
504
- checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
504
+ checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
505
505
 
506
506
  [[package]]
507
507
  name = "tiff"
@@ -584,9 +584,9 @@ dependencies = [
584
584
 
585
585
  [[package]]
586
586
  name = "xxhash-rust"
587
- version = "0.8.19"
587
+ version = "0.8.21"
588
588
  source = "registry+https://github.com/rust-lang/crates.io-index"
589
- checksum = "550a2b930b62486a393c52d5c3b84bff264b28aa437ed64694d31e93b1757af7"
589
+ checksum = "40de123dbb523ebcc00d61ec01840ad192578afc378d859f3429caa38308fad5"
590
590
 
591
591
  [[package]]
592
592
  name = "zerocopy"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "immaculate"
3
- version = "0.3.0"
3
+ version = "0.4.0"
4
4
  edition = "2024"
5
5
  license-file = "LICENSE"
6
6
  publish = false
@@ -15,7 +15,7 @@ crate-type = ["cdylib"]
15
15
  image = { version = "0.25.10", default-features = false, features = ["bmp", "gif", "jpeg", "png", "tiff", "webp"] }
16
16
  # ONNX Runtime is loaded at runtime from the onnxruntime Python package, which the sscd extra
17
17
  # installs, so it isn't built into the wheel. Without the api-* features ort needs only ONNX Runtime 1.17 or later.
18
- ort = { version = "=2.0.0-rc.14", default-features = false, features = ["load-dynamic", "std"] }
18
+ ort = { version = "=2.0.0-rc.15", default-features = false, features = ["load-dynamic", "std"] }
19
19
  pyo3 = { version = "0.30.1", features = ["abi3-py312"] }
20
20
  rayon = "1.12.0"
21
21
  walkdir = "2.5.0"
@@ -0,0 +1,91 @@
1
+ Metadata-Version: 2.4
2
+ Name: Immaculate
3
+ Version: 0.4.0
4
+ Classifier: Programming Language :: Python :: 3
5
+ Requires-Dist: immaculate-onnx==0.2.0 ; extra == 'sscd'
6
+ Requires-Dist: onnxruntime>=1.17 ; extra == 'sscd'
7
+ Provides-Extra: sscd
8
+ License-File: LICENSE
9
+ Summary: Find problematic images fast.
10
+ Author: Peter Batchelor
11
+ License-Expression: LicenseRef-Proprietary
12
+ Requires-Python: >=3.12
13
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
14
+ Project-URL: Documentation, https://pbatch.github.io/Immaculate/
15
+ Project-URL: Issues, https://github.com/Pbatch/Immaculate/issues
16
+ Project-URL: Repository, https://github.com/Pbatch/Immaculate
17
+
18
+ # Immaculate
19
+
20
+ [![PyPI](https://img.shields.io/pypi/v/immaculate)](https://pypi.org/project/immaculate/)
21
+ [![Python](https://img.shields.io/pypi/pyversions/immaculate)](https://pypi.org/project/immaculate/)
22
+ [![CI](https://github.com/Pbatch/Immaculate/actions/workflows/ci.yml/badge.svg)](https://github.com/Pbatch/Immaculate/actions/workflows/ci.yml)
23
+ [![Docs](https://img.shields.io/badge/docs-pbatch.github.io-blue)](https://pbatch.github.io/Immaculate/)
24
+
25
+ Find problematic images fast.
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ pip install immaculate
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ![Seven bird photos: a robin and an edited copy of it, a blurry goldfinch, a great tit cut off by a truncated download, and a sharp woodpecker, nuthatch and blue tit](https://raw.githubusercontent.com/Pbatch/Immaculate/main/examples/overview.jpg)
36
+
37
+ ```python
38
+ from immaculate import Blurry, NearDuplicates, find_issues
39
+
40
+ issues = find_issues("photos/")
41
+ issues.near_duplicates # [[PosixPath('photos/robin.jpg'), PosixPath('photos/robin_edited.jpg')]]
42
+ issues.blurry # [PosixPath('photos/goldfinch.jpg')], and likewise for each check below
43
+ issues.truncated # [PosixPath('photos/great_tit.jpg')]
44
+
45
+ issues = find_issues("photos/", [NearDuplicates(), Blurry()]) # only some checks
46
+ ```
47
+
48
+ Or from the command line:
49
+
50
+ ```console
51
+ $ immaculate photos/ --issues near_duplicates blurry
52
+ Near duplicates: 1 set
53
+
54
+ photos/robin.jpg
55
+ photos/robin_edited.jpg
56
+
57
+ Blurry: 1 image
58
+ photos/goldfinch.jpg
59
+ ```
60
+
61
+ ## Checks
62
+
63
+ | Check | On the command line | Finds | Settings (defaults) |
64
+ |---|---|---|---|
65
+ | `ExactDuplicates` | `exact_duplicates` | Images with identical pixels, even if saved with different metadata or in another lossless format | |
66
+ | `NearDuplicates` | `near_duplicates` | Resized, recompressed, flipped and rotated copies; see [methods](https://pbatch.github.io/Immaculate/checks/#near-duplicates) | `method` (`"pdq"`) |
67
+ | `Dark` | `dark` | Images that are almost all dark | `brightness` (0.32), `fraction` (0.01) |
68
+ | `Light` | `light` | Images that are almost all light | `brightness` (0.95), `fraction` (0.05) |
69
+ | `Blurry` | `blurry` | Blurry images | `sharpness` (5.0) |
70
+ | `LowInformation` | `low_information` | Images with few distinct colors, such as blank ones | `entropy` (3.0) |
71
+ | `OddAspectRatio` | `odd_aspect_ratio` | Unusually long or tall images | `ratio` (0.35) |
72
+ | `OddSize` | `odd_size` | Images much larger or smaller than the others | `iqr_factor` (3.0) |
73
+ | `Grayscale` | `grayscale` | Grayscale images, including color files whose pixels are all gray | `tolerance` (2) |
74
+ | `LowContrast` | `low_contrast` | Washed-out, foggy or otherwise flat-looking images | `contrast` (0.05) |
75
+ | `Truncated` | `truncated` | Images whose files end early, such as interrupted downloads, which often still decode with a gray patch | |
76
+
77
+ Pass each check with its settings, such as `Dark(brightness=0.2)`, or `Dark()` for the defaults.
78
+
79
+ See [checks](https://pbatch.github.io/Immaculate/checks/) for what each setting does.
80
+
81
+ ## Benchmarks
82
+
83
+ Every check CleanVision has, run together on 250 images of [INRIA Copydays](https://thoth.inrialpes.fr/~jegou/data.php.html#copydays):
84
+
85
+ | | Time | Peak memory | Images flagged |
86
+ |---|---:|---:|---:|
87
+ | Immaculate | **0.73 s** | **387 MiB** | 12 |
88
+ | CleanVision | 14.12 s | 2,974 MiB | 12 |
89
+
90
+ See the [benchmarks](https://pbatch.github.io/Immaculate/benchmarks/) for how this was run, and for comparisons with other libraries.
91
+
@@ -0,0 +1,73 @@
1
+ # Immaculate
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/immaculate)](https://pypi.org/project/immaculate/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/immaculate)](https://pypi.org/project/immaculate/)
5
+ [![CI](https://github.com/Pbatch/Immaculate/actions/workflows/ci.yml/badge.svg)](https://github.com/Pbatch/Immaculate/actions/workflows/ci.yml)
6
+ [![Docs](https://img.shields.io/badge/docs-pbatch.github.io-blue)](https://pbatch.github.io/Immaculate/)
7
+
8
+ Find problematic images fast.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pip install immaculate
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ![Seven bird photos: a robin and an edited copy of it, a blurry goldfinch, a great tit cut off by a truncated download, and a sharp woodpecker, nuthatch and blue tit](https://raw.githubusercontent.com/Pbatch/Immaculate/main/examples/overview.jpg)
19
+
20
+ ```python
21
+ from immaculate import Blurry, NearDuplicates, find_issues
22
+
23
+ issues = find_issues("photos/")
24
+ issues.near_duplicates # [[PosixPath('photos/robin.jpg'), PosixPath('photos/robin_edited.jpg')]]
25
+ issues.blurry # [PosixPath('photos/goldfinch.jpg')], and likewise for each check below
26
+ issues.truncated # [PosixPath('photos/great_tit.jpg')]
27
+
28
+ issues = find_issues("photos/", [NearDuplicates(), Blurry()]) # only some checks
29
+ ```
30
+
31
+ Or from the command line:
32
+
33
+ ```console
34
+ $ immaculate photos/ --issues near_duplicates blurry
35
+ Near duplicates: 1 set
36
+
37
+ photos/robin.jpg
38
+ photos/robin_edited.jpg
39
+
40
+ Blurry: 1 image
41
+ photos/goldfinch.jpg
42
+ ```
43
+
44
+ ## Checks
45
+
46
+ | Check | On the command line | Finds | Settings (defaults) |
47
+ |---|---|---|---|
48
+ | `ExactDuplicates` | `exact_duplicates` | Images with identical pixels, even if saved with different metadata or in another lossless format | |
49
+ | `NearDuplicates` | `near_duplicates` | Resized, recompressed, flipped and rotated copies; see [methods](https://pbatch.github.io/Immaculate/checks/#near-duplicates) | `method` (`"pdq"`) |
50
+ | `Dark` | `dark` | Images that are almost all dark | `brightness` (0.32), `fraction` (0.01) |
51
+ | `Light` | `light` | Images that are almost all light | `brightness` (0.95), `fraction` (0.05) |
52
+ | `Blurry` | `blurry` | Blurry images | `sharpness` (5.0) |
53
+ | `LowInformation` | `low_information` | Images with few distinct colors, such as blank ones | `entropy` (3.0) |
54
+ | `OddAspectRatio` | `odd_aspect_ratio` | Unusually long or tall images | `ratio` (0.35) |
55
+ | `OddSize` | `odd_size` | Images much larger or smaller than the others | `iqr_factor` (3.0) |
56
+ | `Grayscale` | `grayscale` | Grayscale images, including color files whose pixels are all gray | `tolerance` (2) |
57
+ | `LowContrast` | `low_contrast` | Washed-out, foggy or otherwise flat-looking images | `contrast` (0.05) |
58
+ | `Truncated` | `truncated` | Images whose files end early, such as interrupted downloads, which often still decode with a gray patch | |
59
+
60
+ Pass each check with its settings, such as `Dark(brightness=0.2)`, or `Dark()` for the defaults.
61
+
62
+ See [checks](https://pbatch.github.io/Immaculate/checks/) for what each setting does.
63
+
64
+ ## Benchmarks
65
+
66
+ Every check CleanVision has, run together on 250 images of [INRIA Copydays](https://thoth.inrialpes.fr/~jegou/data.php.html#copydays):
67
+
68
+ | | Time | Peak memory | Images flagged |
69
+ |---|---:|---:|---:|
70
+ | Immaculate | **0.73 s** | **387 MiB** | 12 |
71
+ | CleanVision | 14.12 s | 2,974 MiB | 12 |
72
+
73
+ See the [benchmarks](https://pbatch.github.io/Immaculate/benchmarks/) for how this was run, and for comparisons with other libraries.
@@ -0,0 +1,25 @@
1
+ # API reference
2
+
3
+ ::: immaculate.find_issues
4
+ options:
5
+ heading_level: 2
6
+
7
+ ::: immaculate
8
+ options:
9
+ show_root_heading: false
10
+ members:
11
+ - Issues
12
+ - IssueName
13
+ - Check
14
+ - ExactDuplicates
15
+ - NearDuplicates
16
+ - Method
17
+ - Dark
18
+ - Light
19
+ - Blurry
20
+ - LowInformation
21
+ - OddAspectRatio
22
+ - OddSize
23
+ - Grayscale
24
+ - LowContrast
25
+ - Truncated
@@ -0,0 +1,181 @@
1
+ # Benchmarks
2
+
3
+ ## Compared with CleanVision
4
+
5
+ Every check CleanVision has (exact and near duplicates, dark, light, blurry, low information, odd aspect ratio, odd size and grayscale), run together in one call per library, as each runs by default, on the first 250 images, by name, of [INRIA Copydays](https://thoth.inrialpes.fr/~jegou/data.php.html#copydays) ([data](https://dl.fbaipublicfiles.com/vissl/datasets/copydays_original.tar.gz), [edited copies](https://dl.fbaipublicfiles.com/vissl/datasets/copydays_strong.tar.gz)).
6
+
7
+ | | Time | Peak memory | Images flagged |
8
+ |---|---:|---:|---:|
9
+ | Immaculate | **0.73 s** | **387 MiB** | 12 |
10
+ | CleanVision | 14.12 s | 2,974 MiB | 12 |
11
+
12
+ ```bash
13
+ uv run benchmark/benchmark_checks.py --check duplicates dark light blurry low_information odd_aspect_ratio odd_size grayscale --checker immaculate cleanvision --images 250 --together
14
+ ```
15
+
16
+ ## Near duplicates
17
+
18
+ ### UKBench (11k images, 27k pairs)
19
+
20
+ 1,800 photos from [UKBench](https://archive.org/details/ukbench), each with five edited copies (a crop, horizontal and vertical flips, a 25° rotation and a resize to a square), as in [imagededup's benchmark](https://idealo.github.io/imagededup/user_guide/benchmarks/).
21
+
22
+ | | Time | Peak memory | Pairs found | Precision | Recall |
23
+ |---|---:|---:|---:|---:|---:|
24
+ | Immaculate (`phash`) | **2.69 s** | **50 MiB** | 1,686 | 100% | 6.2% |
25
+ | Immaculate (`pdq`) | 2.78 s | 56 MiB | 10,782 | 100% | 39.9% |
26
+ | czkawka | 3.72 s | 61 MiB | 31 | 100% | 0.1% |
27
+ | imagehash (`pHash`) | 4.06 s | 470 MiB | 1,693 | 100% | 6.3% |
28
+ | czkawka (rotations and flips) | 23.49 s | 116 MiB | 4,359 | 100% | 16.1% |
29
+ | CleanVision | 26.03 s | 520 MiB | 1,693 | 100% | 6.3% |
30
+ | fastdup | 32.26 s | 279 MiB | 9,443 | 100% | 35.0% |
31
+ | Immaculate (`sscd_distilled`) | 36.71 s | 141 MiB | 19,886 | 100% | 73.6% |
32
+ | imagededup (`CNN`) | 65.00 s | 1,414 MiB | 20,620 | 98.8% | 75.5% |
33
+ | Immaculate (`sscd`) | 172.51 s | 189 MiB | 23,196 | 100% | **85.9%** |
34
+
35
+ ```bash
36
+ uv run benchmark/benchmark_checks.py --dataset ukbench-transformed --check duplicates --checker immaculate immaculate-phash immaculate-sscd immaculate-sscd-distilled imagededup-cnn cleanvision fastdup imagehash czkawka czkawka-dihedral
37
+ ```
38
+
39
+ ### DISC2021 (60k images, 10k pairs)
40
+
41
+ 50,000 development queries from Meta's [DISC2021](https://arxiv.org/abs/2106.09672) ([data](https://sites.google.com/view/isc2021/dataset)), plus the 10,000 reference photos that 10,000 of them copy with heavy edits (crops, overlays, filters, screenshots and blends).
42
+
43
+ | | Time | Peak memory | Pairs found | Precision | Recall |
44
+ |---|---:|---:|---:|---:|---:|
45
+ | Immaculate (`pdq`) | **23.48 s** | **146 MiB** | 1,731 | 100% | 17.3% |
46
+ | imagehash (`pHash`) | 35.89 s | 620 MiB | 316 | 100% | 3.2% |
47
+ | czkawka | 38.64 s | 194 MiB | 89 | 96.6% | 0.9% |
48
+ | Immaculate (`sscd_distilled`) | 243.23 s | 488 MiB | 1,987 | 99.9% | **19.9%** |
49
+
50
+ ```bash
51
+ uv run benchmark/benchmark_checks.py --dataset disc2021 --check duplicates --checker immaculate immaculate-sscd-distilled czkawka imagehash
52
+ ```
53
+
54
+ ## Image checks
55
+
56
+ Each check runs on its own on the first 250 images, by name, of [INRIA Copydays](https://thoth.inrialpes.fr/~jegou/data.php.html#copydays) ([data](https://dl.fbaipublicfiles.com/vissl/datasets/copydays_original.tar.gz), [edited copies](https://dl.fbaipublicfiles.com/vissl/datasets/copydays_strong.tar.gz)): holiday photos of about 2 megapixels and heavily edited copies of them.
57
+
58
+ ### Duplicates
59
+
60
+ | | Time | Peak memory | Pairs found | Precision | Recall |
61
+ |---|---:|---:|---:|---:|---:|
62
+ | Immaculate | **0.56 s** | **379 MiB** | 1 | 100% | **0.5%** |
63
+ | czkawka 12.0.2 | 0.95 s | 485 MiB | 0 | n/a | 0.0% |
64
+ | CleanVision | 2.82 s | 1,404 MiB | 1 | 100% | **0.5%** |
65
+ | fastdup | 3.44 s | 432 MiB | 0 | n/a | 0.0% |
66
+
67
+ ```bash
68
+ uv run benchmark/benchmark_checks.py --check duplicates --checker immaculate cleanvision fastdup czkawka --images 250
69
+ ```
70
+
71
+ ### Dark
72
+
73
+ | | Time | Peak memory | Images found |
74
+ |---|---:|---:|---:|
75
+ | Immaculate | **0.70 s** | **356 MiB** | 0 |
76
+ | fastdup | 3.41 s | 436 MiB | 0 |
77
+ | CleanVision | 12.31 s | 3,364 MiB | 0 |
78
+
79
+ ```bash
80
+ uv run benchmark/benchmark_checks.py --check dark --checker immaculate cleanvision fastdup --images 250
81
+ ```
82
+
83
+ ### Light
84
+
85
+ | | Time | Peak memory | Images found |
86
+ |---|---:|---:|---:|
87
+ | Immaculate | **0.72 s** | **337 MiB** | 0 |
88
+ | fastdup | 3.47 s | 437 MiB | 0 |
89
+ | CleanVision | 12.46 s | 3,334 MiB | 0 |
90
+
91
+ ```bash
92
+ uv run benchmark/benchmark_checks.py --check light --checker immaculate cleanvision fastdup --images 250
93
+ ```
94
+
95
+ ### Blurry
96
+
97
+ | | Time | Peak memory | Images found |
98
+ |---|---:|---:|---:|
99
+ | Immaculate | **0.65 s** | **389 MiB** | 7 |
100
+ | CleanVision | 1.82 s | 622 MiB | 7 |
101
+ | fastdup | 3.44 s | 427 MiB | 19 |
102
+
103
+ ```bash
104
+ uv run benchmark/benchmark_checks.py --check blurry --checker immaculate cleanvision fastdup --images 250
105
+ ```
106
+
107
+ ### Low information
108
+
109
+ | | Time | Peak memory | Images found |
110
+ |---|---:|---:|---:|
111
+ | Immaculate | **0.64 s** | **354 MiB** | 0 |
112
+ | CleanVision | 1.54 s | 581 MiB | 0 |
113
+
114
+ ```bash
115
+ uv run benchmark/benchmark_checks.py --check low_information --checker immaculate cleanvision --images 250
116
+ ```
117
+
118
+ ### Odd aspect ratio
119
+
120
+ | | Time | Peak memory | Images found |
121
+ |---|---:|---:|---:|
122
+ | Immaculate | **0.50 s** | **360 MiB** | 3 |
123
+ | CleanVision | 1.47 s | 576 MiB | 3 |
124
+
125
+ ```bash
126
+ uv run benchmark/benchmark_checks.py --check odd_aspect_ratio --checker immaculate cleanvision --images 250
127
+ ```
128
+
129
+ ### Odd size
130
+
131
+ | | Time | Peak memory | Images found |
132
+ |---|---:|---:|---:|
133
+ | Immaculate | **0.48 s** | **340 MiB** | 0 |
134
+ | CleanVision | 1.47 s | 571 MiB | 0 |
135
+
136
+ ```bash
137
+ uv run benchmark/benchmark_checks.py --check odd_size --checker immaculate cleanvision --images 250
138
+ ```
139
+
140
+ ### Grayscale
141
+
142
+ | | Time | Peak memory | Images found |
143
+ |---|---:|---:|---:|
144
+ | Immaculate | **0.67 s** | **371 MiB** | 0 |
145
+ | CleanVision | 1.47 s | 531 MiB | 0 |
146
+
147
+ ```bash
148
+ uv run benchmark/benchmark_checks.py --check grayscale --checker immaculate cleanvision --images 250
149
+ ```
150
+
151
+ ### Low contrast
152
+
153
+ | | Time | Peak memory | Images found |
154
+ |---|---:|---:|---:|
155
+ | Immaculate | 0.64 s | 373 MiB | 0 |
156
+
157
+ ```bash
158
+ uv run benchmark/benchmark_checks.py --check low_contrast --checker immaculate --images 250
159
+ ```
160
+
161
+ ### Truncated
162
+
163
+ | | Time | Peak memory | Images found |
164
+ |---|---:|---:|---:|
165
+ | Immaculate | 0.49 s | 376 MiB | 0 |
166
+
167
+ ```bash
168
+ uv run benchmark/benchmark_checks.py --check truncated --checker immaculate --images 250
169
+ ```
170
+
171
+ ### Corrupt
172
+
173
+ | | Time | Peak memory | Images found |
174
+ |---|---:|---:|---:|
175
+ | Immaculate | **0.47 s** | 370 MiB | 0 |
176
+ | czkawka 12.0.2 | 0.53 s | **322 MiB** | 0 |
177
+ | fastdup | 3.48 s | 431 MiB | 0 |
178
+
179
+ ```bash
180
+ uv run benchmark/benchmark_checks.py --check corrupt --checker immaculate fastdup czkawka --images 250
181
+ ```