Immaculate 0.2.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 (54) hide show
  1. {immaculate-0.2.0 → immaculate-0.4.0}/.github/workflows/ci.yml +8 -8
  2. immaculate-0.4.0/.github/workflows/release-onnx.yml +47 -0
  3. {immaculate-0.2.0 → immaculate-0.4.0}/.github/workflows/release.yml +31 -39
  4. {immaculate-0.2.0 → immaculate-0.4.0}/Cargo.lock +23 -23
  5. {immaculate-0.2.0 → immaculate-0.4.0}/Cargo.toml +4 -4
  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.2.0 → immaculate-0.4.0}/mkdocs.yml +3 -1
  12. {immaculate-0.2.0 → immaculate-0.4.0}/pyproject.toml +44 -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.2.0/rust → immaculate-0.4.0/rust/near}/multi_index.rs +1 -1
  17. {immaculate-0.2.0/rust → immaculate-0.4.0/rust/near}/pdq.rs +10 -11
  18. {immaculate-0.2.0/rust → immaculate-0.4.0/rust/near}/phash.rs +9 -11
  19. {immaculate-0.2.0/rust → immaculate-0.4.0/rust/near}/sscd.rs +10 -10
  20. immaculate-0.2.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.2.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.4.0/tests/test_immaculate.py +841 -0
  34. {immaculate-0.2.0 → immaculate-0.4.0}/uv.lock +391 -275
  35. immaculate-0.2.0/PKG-INFO +0 -96
  36. immaculate-0.2.0/README.md +0 -80
  37. immaculate-0.2.0/docs/api.md +0 -6
  38. immaculate-0.2.0/rust/lib.rs +0 -445
  39. immaculate-0.2.0/src/immaculate/__init__.py +0 -6
  40. immaculate-0.2.0/src/immaculate/__main__.py +0 -154
  41. immaculate-0.2.0/src/immaculate/_core.pyi +0 -20
  42. immaculate-0.2.0/src/immaculate/_duplicates.py +0 -102
  43. immaculate-0.2.0/src/immaculate/models/SSCD_LICENSE +0 -21
  44. immaculate-0.2.0/src/immaculate/models/sscd.onnx +0 -0
  45. immaculate-0.2.0/src/immaculate/models/sscd_distilled.onnx +0 -0
  46. immaculate-0.2.0/tests/test_immaculate.py +0 -429
  47. {immaculate-0.2.0 → immaculate-0.4.0}/.gitignore +0 -0
  48. {immaculate-0.2.0 → immaculate-0.4.0}/.pre-commit-config.yaml +0 -0
  49. {immaculate-0.2.0 → immaculate-0.4.0}/.python-version +0 -0
  50. {immaculate-0.2.0 → immaculate-0.4.0}/LICENSE +0 -0
  51. {immaculate-0.2.0 → immaculate-0.4.0}/clippy.toml +0 -0
  52. {immaculate-0.2.0 → immaculate-0.4.0}/docs/index.md +0 -0
  53. {immaculate-0.2.0/rust → immaculate-0.4.0/rust/near}/side_cache.rs +0 -0
  54. {immaculate-0.2.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
@@ -0,0 +1,47 @@
1
+ name: Release immaculate-onnx
2
+
3
+ # Builds the immaculate-onnx package and, on an immaculate-onnx-v<version> tag, publishes it to
4
+ # PyPI; see DEPLOYMENT.md. It is a workflow of its own, not a job in release.yml, so its trusted
5
+ # publisher differs from immaculate's: PyPI would otherwise give the upload immaculate's token,
6
+ # which can't create or upload to another project
7
+ on:
8
+ push:
9
+ tags: ["immaculate-onnx-v*"]
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ # Pure Python, so one wheel serves every platform
17
+ build:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v7
21
+ - uses: astral-sh/setup-uv@v7
22
+ - run: uv build --package immaculate-onnx --out-dir dist
23
+ - uses: actions/upload-artifact@v7
24
+ with:
25
+ name: immaculate-onnx
26
+ path: dist/*
27
+
28
+ # Uploads use trusted publishing, so no tokens are stored; PyPI trusts this workflow in the
29
+ # pypi environment, which needs approval
30
+ publish-pypi:
31
+ if: startsWith(github.ref, 'refs/tags/immaculate-onnx-v')
32
+ needs: build
33
+ runs-on: ubuntu-latest
34
+ environment:
35
+ name: pypi
36
+ url: https://pypi.org/project/immaculate-onnx/
37
+ permissions:
38
+ id-token: write
39
+ steps:
40
+ - uses: actions/download-artifact@v8
41
+ with:
42
+ name: immaculate-onnx
43
+ path: dist
44
+ # PyPI never accepts a version twice, so a test tag mustn't upload the real version
45
+ - name: Check the tag matches the version
46
+ run: test -f "dist/immaculate_onnx-${GITHUB_REF_NAME#immaculate-onnx-v}.tar.gz"
47
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -1,8 +1,9 @@
1
1
  name: Release
2
2
 
3
- # Builds the sdist and a wheel for each platform ONNX Runtime has wheels for, tests each
4
- # wheel on its own platform, and on a version tag publishes them to TestPyPI, then PyPI; see
5
- # DEPLOYMENT.md
3
+ # Builds the sdist and a wheel for each platform ONNX Runtime has wheels for, so the sscd extra
4
+ # installs wherever Immaculate does, tests each wheel on its own platform, and on a version tag
5
+ # publishes them to PyPI; see DEPLOYMENT.md. The immaculate-onnx package has its own workflow,
6
+ # release-onnx.yml
6
7
  on:
7
8
  push:
8
9
  tags: ["v*"]
@@ -27,22 +28,23 @@ jobs:
27
28
  python-arch: arm64
28
29
  runs-on: ${{ matrix.os }}
29
30
  steps:
30
- - uses: actions/checkout@v5
31
+ - uses: actions/checkout@v7
31
32
  - id: python
32
- uses: actions/setup-python@v5
33
+ uses: actions/setup-python@v7
33
34
  with:
34
35
  python-version: "3.12"
35
36
  architecture: ${{ matrix.python-arch }}
36
37
  - uses: dtolnay/rust-toolchain@stable
37
38
  - uses: PyO3/maturin-action@v1
38
39
  with:
39
- maturin-version: v1.15.0
40
+ maturin-version: v1.16.0
40
41
  args: --release --out dist
41
42
  # ONNX Runtime's own Linux wheels need glibc 2.28
42
43
  manylinux: "2_28"
43
- - uses: astral-sh/setup-uv@v6
44
- # Tests the built wheel, not the source tree: the dev group has no project, so syncing
45
- # it doesn't build Immaculate
44
+ - uses: astral-sh/setup-uv@v7
45
+ # Tests the built wheel, not the source tree: the dev group doesn't include Immaculate,
46
+ # so syncing it doesn't build it. It does install immaculate-onnx from the source tree,
47
+ # for the tests of the SSCD methods
46
48
  - name: Test the wheel
47
49
  shell: bash
48
50
  # Only uv sync is given the Python: with UV_PYTHON set, uv pip would install into that
@@ -53,60 +55,50 @@ jobs:
53
55
  uv sync --locked --only-group dev --python "$PYTHON"
54
56
  uv pip install dist/*.whl
55
57
  uv run --no-sync pytest
56
- - uses: actions/upload-artifact@v4
58
+ - uses: actions/upload-artifact@v7
57
59
  with:
58
- name: wheel-${{ matrix.os }}
60
+ name: immaculate-wheel-${{ matrix.os }}
59
61
  path: dist/*.whl
60
62
 
61
63
  sdist:
62
64
  runs-on: ubuntu-latest
63
65
  steps:
64
- - uses: actions/checkout@v5
66
+ - uses: actions/checkout@v7
65
67
  - uses: PyO3/maturin-action@v1
66
68
  with:
67
- maturin-version: v1.15.0
69
+ maturin-version: v1.16.0
68
70
  command: sdist
69
71
  args: --out dist
70
- - uses: actions/upload-artifact@v4
72
+ - uses: actions/upload-artifact@v7
71
73
  with:
72
- name: sdist
74
+ name: immaculate-sdist
73
75
  path: dist/*.tar.gz
74
76
 
75
- # Uploads use trusted publishing, so no tokens are stored; each index trusts this workflow
76
- # in the environment named below
77
- publish-testpypi:
77
+ # Uploads use trusted publishing, so no tokens are stored; PyPI trusts this workflow in the
78
+ # pypi environment, which needs approval
79
+ publish-pypi:
78
80
  if: startsWith(github.ref, 'refs/tags/v')
79
81
  needs: [wheels, sdist]
80
82
  runs-on: ubuntu-latest
81
83
  environment:
82
- name: testpypi
83
- url: https://test.pypi.org/project/immaculate/
84
+ name: pypi
85
+ url: https://pypi.org/project/immaculate/
84
86
  permissions:
85
87
  id-token: write
86
88
  steps:
87
- - uses: actions/download-artifact@v4
89
+ - uses: actions/download-artifact@v8
88
90
  with:
91
+ pattern: immaculate-*
89
92
  path: dist
90
93
  merge-multiple: true
91
94
  # PyPI never accepts a version twice, so a tag like v0.1.0-test mustn't upload 0.1.0
92
95
  - name: Check the tag matches the version
93
96
  run: test -f "dist/immaculate-${GITHUB_REF_NAME#v}.tar.gz"
94
- - uses: pypa/gh-action-pypi-publish@release/v1
95
- with:
96
- repository-url: https://test.pypi.org/legacy/
97
-
98
- # The pypi environment needs approval, so there's time to check the TestPyPI release first
99
- publish-pypi:
100
- needs: publish-testpypi
101
- runs-on: ubuntu-latest
102
- environment:
103
- name: pypi
104
- url: https://pypi.org/project/immaculate/
105
- permissions:
106
- id-token: write
107
- steps:
108
- - uses: actions/download-artifact@v4
109
- with:
110
- path: dist
111
- merge-multiple: true
97
+ # Otherwise installing the sscd extra would fail; release-onnx.yml publishes it
98
+ - name: Check the pinned immaculate-onnx is on PyPI
99
+ run: |
100
+ version=$(tar -xzOf dist/immaculate-*.tar.gz --wildcards '*/PKG-INFO' \
101
+ | sed -n 's/^Requires-Dist: immaculate-onnx==\([^ ;]*\).*/\1/p')
102
+ test -n "$version"
103
+ curl -fsS -o /dev/null "https://pypi.org/pypi/immaculate-onnx/$version/json"
112
104
  - uses: pypa/gh-action-pypi-publish@release/v1
@@ -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.2.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.2.0"
3
+ version = "0.4.0"
4
4
  edition = "2024"
5
5
  license-file = "LICENSE"
6
6
  publish = false
@@ -13,9 +13,9 @@ crate-type = ["cdylib"]
13
13
 
14
14
  [dependencies]
15
15
  image = { version = "0.25.10", default-features = false, features = ["bmp", "gif", "jpeg", "png", "tiff", "webp"] }
16
- # ONNX Runtime is loaded at runtime from the onnxruntime Python package, so it isn't built into
17
- # 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"] }
16
+ # ONNX Runtime is loaded at runtime from the onnxruntime Python package, which the sscd extra
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.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