Perception 0.8.4__tar.gz → 0.8.5__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.
- perception-0.8.5/.dockerignore +2 -0
- perception-0.8.5/.git-blame-ignore-revs +2 -0
- perception-0.8.5/.gitattributes +1 -0
- perception-0.8.5/.github/dependabot.yaml +7 -0
- perception-0.8.5/.github/workflows/ci.yaml +56 -0
- perception-0.8.5/.github/workflows/gh-pages.yaml +31 -0
- perception-0.8.5/.github/workflows/release.yaml +120 -0
- perception-0.8.5/.gitignore +41 -0
- perception-0.8.5/.pre-commit-config.yaml +26 -0
- perception-0.8.5/.readthedocs.yaml +16 -0
- perception-0.8.5/CHANGELOG.md +36 -0
- perception-0.8.5/CODE_OF_CONDUCT.md +76 -0
- perception-0.8.5/MANIFEST.in +7 -0
- perception-0.8.5/Makefile +58 -0
- {perception-0.8.4 → perception-0.8.5}/PKG-INFO +58 -37
- perception-0.8.5/Perception.egg-info/PKG-INFO +136 -0
- perception-0.8.5/Perception.egg-info/SOURCES.txt +94 -0
- perception-0.8.5/Perception.egg-info/dependency_links.txt +1 -0
- perception-0.8.5/Perception.egg-info/requires.txt +30 -0
- perception-0.8.5/Perception.egg-info/top_level.txt +1 -0
- {perception-0.8.4 → perception-0.8.5}/README.md +33 -4
- perception-0.8.5/docs/api/benchmarking.rst +31 -0
- perception-0.8.5/docs/api/hashers.rst +45 -0
- perception-0.8.5/docs/api/index.rst +10 -0
- perception-0.8.5/docs/api/tools.rst +7 -0
- perception-0.8.5/docs/conf.py +65 -0
- perception-0.8.5/docs/examples/benchmarking.rst +648 -0
- perception-0.8.5/docs/examples/deduplication.rst +197 -0
- perception-0.8.5/docs/examples/detecting_csam.rst +23 -0
- perception-0.8.5/docs/examples/index.rst +10 -0
- perception-0.8.5/docs/index.rst +48 -0
- perception-0.8.5/docs/requirements.txt +14 -0
- perception-0.8.5/perception/benchmarking/extensions.c +31202 -0
- perception-0.8.5/perception/extensions.cpp +33687 -0
- perception-0.8.5/pyproject.toml +96 -0
- perception-0.8.5/setup.cfg +4 -0
- perception-0.8.5/setup.py +19 -0
- perception-0.8.5/tests/images/chair-square.png +0 -0
- perception-0.8.5/tests/images/chair-tall.png +0 -0
- perception-0.8.5/tests/images/chair.png +0 -0
- perception-0.8.5/tests/images/chair3.png +0 -0
- perception-0.8.5/uv.lock +4132 -0
- perception-0.8.4/build.py +0 -15
- perception-0.8.4/pyproject.toml +0 -80
- perception-0.8.4/setup.py +0 -59
- {perception-0.8.4 → perception-0.8.5}/LICENSE +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/__init__.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/approximate_deduplication/__init__.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/approximate_deduplication/_graph_backend.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/approximate_deduplication/debug.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/approximate_deduplication/index.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/approximate_deduplication/serve.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/benchmarking/__init__.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/benchmarking/common.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/benchmarking/extensions.pyx +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/benchmarking/image.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/benchmarking/image_transforms.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/benchmarking/video.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/benchmarking/video_transforms.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/extensions.pyx +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/__init__.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/hasher.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/image/__init__.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/image/average.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/image/dhash.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/image/opencv.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/image/pdq.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/image/phash.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/image/wavelet.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/tools.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/video/__init__.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/video/framewise.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/hashers/video/tmk.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/local_descriptor_deduplication.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/py.typed +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/__init__.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/images/README.md +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/images/image1.jpg +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/images/image10.jpg +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/images/image2.jpg +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/images/image3.jpg +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/images/image4.jpg +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/images/image5.jpg +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/images/image6.jpg +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/images/image7.jpg +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/images/image8.jpg +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/images/image9.jpg +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/logos/README.md +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/logos/logoipsum.png +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/videos/README.md +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/videos/expected_tmk.json.gz +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/videos/extra_channel_attached_pic.mp4 +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/videos/extra_channel_attached_pic_audio.mp4 +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/videos/rgb.m4v +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/videos/v1.m4v +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/videos/v2.m4v +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/testing/videos/v2s.mov +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/tools.py +0 -0
- {perception-0.8.4 → perception-0.8.5}/perception/utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
perception/_version.py export-subst
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- "**"
|
|
6
|
+
tags-ignore:
|
|
7
|
+
- v*
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
|
|
16
|
+
runs-on: ${{ matrix.os }}
|
|
17
|
+
steps:
|
|
18
|
+
- name: checkout
|
|
19
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
20
|
+
- name: Set up uv
|
|
21
|
+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
enable-cache: true
|
|
25
|
+
cache-python: true
|
|
26
|
+
cache-dependency-glob: |
|
|
27
|
+
pyproject.toml
|
|
28
|
+
uv.lock
|
|
29
|
+
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
|
|
30
|
+
- name: Setup FFMPEG on Ubuntu
|
|
31
|
+
if: startsWith(matrix.os, 'ubuntu')
|
|
32
|
+
run: |
|
|
33
|
+
sudo apt-get update
|
|
34
|
+
sudo apt-get install -y ffmpeg
|
|
35
|
+
- name: Setup FFMPEG on Windows
|
|
36
|
+
if: startsWith(matrix.os, 'windows')
|
|
37
|
+
run: choco install ffmpeg --yes --no-progress
|
|
38
|
+
- name: Setup Dependencies with Homebrew
|
|
39
|
+
if: startsWith(matrix.os, 'macos')
|
|
40
|
+
run: |
|
|
41
|
+
brew install llvm ffmpeg
|
|
42
|
+
echo "CC=$(brew --prefix)/opt/llvm/bin/clang" >> $GITHUB_ENV
|
|
43
|
+
echo "CXX=$(brew --prefix)/opt/llvm/bin/clang++" >> $GITHUB_ENV
|
|
44
|
+
- name: Verify FFMPEG
|
|
45
|
+
run: |
|
|
46
|
+
ffmpeg -version
|
|
47
|
+
ffprobe -version
|
|
48
|
+
- name: Setup Project
|
|
49
|
+
run: uv sync --all-extras --frozen
|
|
50
|
+
- name: Run checks
|
|
51
|
+
run: |
|
|
52
|
+
uv lock --check
|
|
53
|
+
uv run ruff check perception tests
|
|
54
|
+
uv run mypy perception
|
|
55
|
+
uv run black --check .
|
|
56
|
+
uv run pytest tests/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Deploy Sphinx documentation to Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- dunnack/sphinx-to-github-pages
|
|
7
|
+
- main
|
|
8
|
+
paths:
|
|
9
|
+
- .github/workflows/gh-pages.yaml
|
|
10
|
+
- docs/**
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
pages:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment:
|
|
16
|
+
name: github-pages
|
|
17
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
pages: write
|
|
21
|
+
id-token: write
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
24
|
+
with:
|
|
25
|
+
fetch-depth: 0
|
|
26
|
+
- id: deployment
|
|
27
|
+
uses: sphinx-notes/pages@e9c8f79f285fb41a150ba6e08a3c2a29635e7ee1 # 3.5
|
|
28
|
+
with:
|
|
29
|
+
checkout: false
|
|
30
|
+
documentation_path: docs
|
|
31
|
+
requirements_path: docs/requirements.txt
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [published]
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build-wheels:
|
|
9
|
+
runs-on: ${{ matrix.os }}
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
13
|
+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
|
|
14
|
+
name: Build for ${{ matrix.os }} on Python ${{ matrix.python-version }}
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
17
|
+
with:
|
|
18
|
+
# Full clone for version calculation
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
fetch-tags: true
|
|
21
|
+
ref: ${{ github.event_name == 'release' && format('refs/tags/{0}', github.event.release.tag_name) || github.ref }}
|
|
22
|
+
- name: Set up uv
|
|
23
|
+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
enable-cache: false
|
|
27
|
+
- name: Setup Build Dependencies with Homebrew
|
|
28
|
+
if: startsWith(matrix.os, 'macos')
|
|
29
|
+
run: |
|
|
30
|
+
brew install llvm
|
|
31
|
+
echo "CC=$(brew --prefix)/opt/llvm/bin/clang" >> $GITHUB_ENV
|
|
32
|
+
echo "CXX=$(brew --prefix)/opt/llvm/bin/clang++" >> $GITHUB_ENV
|
|
33
|
+
- name: Build Project
|
|
34
|
+
shell: bash
|
|
35
|
+
run: |
|
|
36
|
+
rm -rf build Perception.egg-info
|
|
37
|
+
echo "uv: $(uv --version)"
|
|
38
|
+
echo "Python: $(uv run python --version)"
|
|
39
|
+
echo "Git describe: $(git describe --tags --always)"
|
|
40
|
+
uv build --wheel --out-dir="dist-tmp" --clear
|
|
41
|
+
uv tool run --from repairwheel repairwheel -o dist dist-tmp/*.whl
|
|
42
|
+
find dist -name "*.whl" -type f | sed -n "s/\(.*\)\.linux.*\.whl$/& \1.whl/p" | xargs -r -n 2 mv
|
|
43
|
+
rm -rf dist-tmp
|
|
44
|
+
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
45
|
+
with:
|
|
46
|
+
name: package-wheels-${{ matrix.os }}-${{ matrix.python-version }}
|
|
47
|
+
path: dist/*
|
|
48
|
+
|
|
49
|
+
build-sdist:
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
name: Build sdist
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
54
|
+
with:
|
|
55
|
+
# Full clone for version calculation
|
|
56
|
+
fetch-depth: 0
|
|
57
|
+
fetch-tags: true
|
|
58
|
+
ref: ${{ github.event_name == 'release' && format('refs/tags/{0}', github.event.release.tag_name) || github.ref }}
|
|
59
|
+
- name: Set up uv
|
|
60
|
+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
|
|
61
|
+
with:
|
|
62
|
+
python-version: "3.13"
|
|
63
|
+
enable-cache: false
|
|
64
|
+
- name: Build Project
|
|
65
|
+
shell: bash
|
|
66
|
+
run: |
|
|
67
|
+
rm -rf build Perception.egg-info
|
|
68
|
+
echo "uv: $(uv --version)"
|
|
69
|
+
echo "Python: $(uv run python --version)"
|
|
70
|
+
echo "Git describe: $(git describe --tags --always)"
|
|
71
|
+
uv build --sdist --out-dir="dist"
|
|
72
|
+
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
73
|
+
with:
|
|
74
|
+
name: package-sdist
|
|
75
|
+
path: dist/*
|
|
76
|
+
|
|
77
|
+
publish:
|
|
78
|
+
needs: [build-wheels, build-sdist]
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
if: ${{ github.repository_owner == 'thorn-oss' && github.event_name == 'release' }}
|
|
81
|
+
steps:
|
|
82
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
83
|
+
with:
|
|
84
|
+
# Full clone for version calculation
|
|
85
|
+
fetch-depth: 0
|
|
86
|
+
fetch-tags: true
|
|
87
|
+
ref: refs/tags/${{ github.event.release.tag_name }}
|
|
88
|
+
- name: Set up uv
|
|
89
|
+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
|
|
90
|
+
with:
|
|
91
|
+
python-version: "3.13"
|
|
92
|
+
enable-cache: false
|
|
93
|
+
- name: Download wheels
|
|
94
|
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
95
|
+
with:
|
|
96
|
+
path: dist
|
|
97
|
+
pattern: package-*
|
|
98
|
+
merge-multiple: true
|
|
99
|
+
- name: Load PyPI Token
|
|
100
|
+
uses: 1password/load-secrets-action@7ce42673ba9ed69053d678faeba29ea36bd25755 # v4.0.0
|
|
101
|
+
with:
|
|
102
|
+
# Export loaded secrets as environment variables
|
|
103
|
+
export-env: true
|
|
104
|
+
env:
|
|
105
|
+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.DATA_SCIENCE_OP_SERVICE_ACCOUNT_TOKEN }}
|
|
106
|
+
UV_PUBLISH_TOKEN: op://data-science-oss/perception-pypi-api-key/secret/value
|
|
107
|
+
- name: Verify artifacts
|
|
108
|
+
run: |
|
|
109
|
+
mapfile -t artifacts < <(find dist -type f \( -name "*.whl" -o -name "*.tar.gz" \))
|
|
110
|
+
if [ ${#artifacts[@]} -eq 0 ]; then
|
|
111
|
+
echo "No artifacts found in dist"
|
|
112
|
+
exit 1
|
|
113
|
+
fi
|
|
114
|
+
printf '%s\n' "${artifacts[@]}"
|
|
115
|
+
if printf '%s\n' "${artifacts[@]}" | grep -E -- '-0\.0\.0([.-]|$)'; then
|
|
116
|
+
echo "Refusing to publish placeholder version 0.0.0 artifacts"
|
|
117
|
+
exit 1
|
|
118
|
+
fi
|
|
119
|
+
- name: Publish package
|
|
120
|
+
run: uv publish --trusted-publishing never --no-attestations
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# MacOS stuff
|
|
2
|
+
.DS_Store
|
|
3
|
+
|
|
4
|
+
# Python artifacts
|
|
5
|
+
*.egg-info
|
|
6
|
+
|
|
7
|
+
# Cache
|
|
8
|
+
.mypy_cache
|
|
9
|
+
.pytest_cache
|
|
10
|
+
__pycache__
|
|
11
|
+
.ipynb_checkpoints
|
|
12
|
+
dist
|
|
13
|
+
|
|
14
|
+
# Any temporary images or CSV files
|
|
15
|
+
notebooks
|
|
16
|
+
|
|
17
|
+
# Local environment
|
|
18
|
+
.venv
|
|
19
|
+
.python-version
|
|
20
|
+
.pre-commit-cache/
|
|
21
|
+
|
|
22
|
+
# Coverage file
|
|
23
|
+
.coverage
|
|
24
|
+
|
|
25
|
+
# Versioneer artifacts
|
|
26
|
+
/versioneer.pyc
|
|
27
|
+
|
|
28
|
+
# Build artifacts
|
|
29
|
+
/build
|
|
30
|
+
|
|
31
|
+
# Docs build artifacts
|
|
32
|
+
/docs/_build
|
|
33
|
+
|
|
34
|
+
# Remove .vscode folder
|
|
35
|
+
.vscode
|
|
36
|
+
|
|
37
|
+
# Extension artifacts
|
|
38
|
+
*.c
|
|
39
|
+
*.cpp
|
|
40
|
+
*.so
|
|
41
|
+
debug-image*
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# See https://pre-commit.com for more information
|
|
2
|
+
# See https://pre-commit.com/hooks.html for more hooks
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
+
rev: v4.5.0
|
|
6
|
+
hooks:
|
|
7
|
+
- id: trailing-whitespace
|
|
8
|
+
- id: end-of-file-fixer
|
|
9
|
+
- id: check-yaml
|
|
10
|
+
- id: check-added-large-files
|
|
11
|
+
- repo: https://github.com/psf/black
|
|
12
|
+
rev: 26.3.1
|
|
13
|
+
hooks:
|
|
14
|
+
- id: black
|
|
15
|
+
language_version: python3
|
|
16
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
17
|
+
# Ruff version.
|
|
18
|
+
rev: v0.11.13
|
|
19
|
+
hooks:
|
|
20
|
+
# Run the linter.
|
|
21
|
+
- id: ruff
|
|
22
|
+
args: [ --fix ]
|
|
23
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
24
|
+
rev: v1.8.0
|
|
25
|
+
hooks:
|
|
26
|
+
- id: mypy
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
# Build documentation in the docs/ directory with Sphinx
|
|
4
|
+
sphinx:
|
|
5
|
+
configuration: docs/conf.py
|
|
6
|
+
|
|
7
|
+
formats: all
|
|
8
|
+
|
|
9
|
+
# Installs the package and the docs requirements.
|
|
10
|
+
python:
|
|
11
|
+
version: 3.9
|
|
12
|
+
install:
|
|
13
|
+
- requirements: docs/requirements.txt
|
|
14
|
+
- method: pip
|
|
15
|
+
path: .
|
|
16
|
+
system_packages: true
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [0.4.0] - 2020-10-17
|
|
8
|
+
This release switches from using false positive rates in benchmarking to reporting precision, which is more intuitive.
|
|
9
|
+
|
|
10
|
+
### Breaking changes
|
|
11
|
+
All references to fpr_threshold now refer to precision_threshold.
|
|
12
|
+
|
|
13
|
+
### Bug fixes
|
|
14
|
+
The PDQHash hasher now correctly returns the hash vector instead of the (vector, quality) tuple.
|
|
15
|
+
|
|
16
|
+
## [0.3.0] - 2020-04-27
|
|
17
|
+
This release adds significantly more support for video.
|
|
18
|
+
|
|
19
|
+
### Breaking changes
|
|
20
|
+
- Previously, `read_video` returned `(frame, index, timestamp)` tuples where `index` reflected the index of the yielded frame (i.e., it always increased by exactly 1). It now reflects the index of the frame in the original video. This means that, if the requested framerate is higher than the encoded video framerate, this index may repeat the same value, indicating that we have repeated the same frame.
|
|
21
|
+
|
|
22
|
+
### Enhancements
|
|
23
|
+
- We now include a `SimpleSceneDetection` hasher that can wrap other video hashers using scene detection.
|
|
24
|
+
- `compute_metrics` is much faster now for integer-valued hashes that use a euclidean distance metric.
|
|
25
|
+
- We now include an unsigned 8-bit integer version of `PHash`, called `PHashU8`. This provides a useful framewise hasher for averaging across frames (e.g., using TMK) while being more compact than `PHashF`.
|
|
26
|
+
- We include more thorough support for benchmarking video hashes.
|
|
27
|
+
|
|
28
|
+
### Bug fixes
|
|
29
|
+
- When using `hasher.vector_to_string` with hashers that return multiple hashes, the `hash_format` argument was not respected.
|
|
30
|
+
- The `compute_threshold_recall` and `show_histograms` functions did not work properly when `grouping=[]`.
|
|
31
|
+
|
|
32
|
+
## [0.2.0] - 2019-12-20
|
|
33
|
+
This release adds more support for hashing videos (including TMK L2 and TMK L2). As part of that, it also includes a re-factor to separate `benchmarking.BenchmarkDataset` and `benchmarking.BenchmarkTransforms` into image and video variants.
|
|
34
|
+
|
|
35
|
+
## [0.1.0] - 2019-11-04
|
|
36
|
+
Initial release
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to make participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies within all project spaces, and it also applies when
|
|
49
|
+
an individual is representing the project or its community in public spaces.
|
|
50
|
+
Examples of representing a project or community include using an official
|
|
51
|
+
project e-mail address, posting via an official social media account, or acting
|
|
52
|
+
as an appointed representative at an online or offline event. Representation of
|
|
53
|
+
a project may be further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at conduct@thorn.org. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
72
|
+
|
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
|
74
|
+
|
|
75
|
+
For answers to common questions about this code of conduct, see
|
|
76
|
+
https://www.contributor-covenant.org/faq
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
TEST_SCOPE?=tests/
|
|
2
|
+
|
|
3
|
+
.PHONY: build build-wheel build-sdist verify-version init-project init test lint_check type_check format format_check precommit clean-build
|
|
4
|
+
|
|
5
|
+
init-project:
|
|
6
|
+
uv sync --all-extras
|
|
7
|
+
|
|
8
|
+
init: init-project
|
|
9
|
+
uv run pre-commit install
|
|
10
|
+
|
|
11
|
+
test:
|
|
12
|
+
uv run pytest $(TEST_SCOPE)
|
|
13
|
+
|
|
14
|
+
lint_check:
|
|
15
|
+
uv run ruff check perception tests
|
|
16
|
+
|
|
17
|
+
type_check:
|
|
18
|
+
uv run mypy perception
|
|
19
|
+
|
|
20
|
+
format:
|
|
21
|
+
uv run black .
|
|
22
|
+
|
|
23
|
+
format_check:
|
|
24
|
+
uv run black --check . || (echo '\nUnexpected format.' && exit 1)
|
|
25
|
+
|
|
26
|
+
precommit:
|
|
27
|
+
uv lock --check
|
|
28
|
+
uv run ruff check perception tests
|
|
29
|
+
uv run mypy perception
|
|
30
|
+
uv run black --check . || (echo '\nUnexpected format.' && exit 1)
|
|
31
|
+
uv run pytest $(TEST_SCOPE)
|
|
32
|
+
|
|
33
|
+
verify-version:
|
|
34
|
+
@echo "uv: $$(uv --version)"
|
|
35
|
+
@echo "Python: $$(uv run python --version)"
|
|
36
|
+
@echo "Git describe: $$(git describe --tags --always)"
|
|
37
|
+
|
|
38
|
+
clean-build:
|
|
39
|
+
@rm -rf build Perception.egg-info
|
|
40
|
+
|
|
41
|
+
build-wheel:
|
|
42
|
+
@rm -rf build Perception.egg-info
|
|
43
|
+
@echo "uv: $$(uv --version)"
|
|
44
|
+
@echo "Python: $$(uv run python --version)"
|
|
45
|
+
@echo "Git describe: $$(git describe --tags --always)"
|
|
46
|
+
uv build --wheel --out-dir="dist-tmp" --clear
|
|
47
|
+
uv tool run --from repairwheel repairwheel -o dist dist-tmp/*.whl
|
|
48
|
+
@find dist -name "*.whl" -type f | sed -n "s/\(.*\)\.linux.*\.whl$$/& \1.whl/p" | xargs -r -n 2 mv # Fix wheel name
|
|
49
|
+
@rm -rf dist-tmp
|
|
50
|
+
|
|
51
|
+
build-sdist:
|
|
52
|
+
@rm -rf build Perception.egg-info
|
|
53
|
+
@echo "uv: $$(uv --version)"
|
|
54
|
+
@echo "Python: $$(uv run python --version)"
|
|
55
|
+
@echo "Git describe: $$(git describe --tags --always)"
|
|
56
|
+
uv build --sdist --out-dir="dist"
|
|
57
|
+
|
|
58
|
+
build: build-wheel build-sdist
|
|
@@ -1,43 +1,36 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Perception
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.5
|
|
4
4
|
Summary: Perception provides flexible, well-documented, and comprehensively tested tooling for perceptual hashing research, development, and production use.
|
|
5
|
+
Author-email: Thorn <info@wearethorn.org>
|
|
5
6
|
License-Expression: Apache-2.0
|
|
7
|
+
Requires-Python: <4.0,>=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
6
9
|
License-File: LICENSE
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Requires-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
Requires-Dist: numpy<3.0.0,>=1.26.4
|
|
11
|
+
Requires-Dist: opencv-contrib-python-headless<5.0.0,>=4.10.0
|
|
12
|
+
Requires-Dist: faiss-cpu<2.0.0,>=1.8.0
|
|
13
|
+
Requires-Dist: networkit<12.0.0,>=11.1; sys_platform != "darwin"
|
|
14
|
+
Requires-Dist: networkx<4.0,>=3.0; sys_platform == "darwin"
|
|
15
|
+
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: Pillow
|
|
17
|
+
Requires-Dist: pywavelets<2.0.0,>=1.5.0
|
|
18
|
+
Requires-Dist: validators<1.0.0,>=0.22.0
|
|
19
|
+
Requires-Dist: rich<14.0.0,>=13.7.0
|
|
20
|
+
Requires-Dist: scipy
|
|
21
|
+
Requires-Dist: tqdm<5.0.0,>=4.67.1
|
|
16
22
|
Provides-Extra: benchmarking
|
|
23
|
+
Requires-Dist: matplotlib; extra == "benchmarking"
|
|
24
|
+
Requires-Dist: albumentations<3.0.0,>=2.0.8; extra == "benchmarking"
|
|
25
|
+
Requires-Dist: tabulate; extra == "benchmarking"
|
|
26
|
+
Requires-Dist: scikit-learn; extra == "benchmarking"
|
|
27
|
+
Requires-Dist: ffmpeg-python; extra == "benchmarking"
|
|
17
28
|
Provides-Extra: matching
|
|
29
|
+
Requires-Dist: aiohttp; extra == "matching"
|
|
30
|
+
Requires-Dist: python-json-logger; extra == "matching"
|
|
18
31
|
Provides-Extra: pdq
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
|
|
21
|
-
Requires-Dist: aiohttp ; extra == "matching"
|
|
22
|
-
Requires-Dist: albumentations (>=2.0.8,<3.0.0) ; extra == "benchmarking"
|
|
23
|
-
Requires-Dist: faiss-cpu (>=1.8.0,<2.0.0)
|
|
24
|
-
Requires-Dist: ffmpeg-python ; extra == "benchmarking"
|
|
25
|
-
Requires-Dist: matplotlib ; extra == "benchmarking"
|
|
26
|
-
Requires-Dist: networkit (>=11.1,<12.0.0) ; sys_platform != "darwin"
|
|
27
|
-
Requires-Dist: networkx (>=3.0,<4.0) ; sys_platform == "darwin"
|
|
28
|
-
Requires-Dist: numpy (>=1.26.4,<3.0.0)
|
|
29
|
-
Requires-Dist: opencv-contrib-python-headless (>=4.10.0,<5.0.0)
|
|
30
|
-
Requires-Dist: pandas
|
|
31
|
-
Requires-Dist: pdqhash (>=0.2.7,<0.3.0) ; extra == "pdq"
|
|
32
|
-
Requires-Dist: python-json-logger ; extra == "matching"
|
|
33
|
-
Requires-Dist: pywavelets (>=1.5.0,<2.0.0)
|
|
34
|
-
Requires-Dist: rich (>=13.7.0,<14.0.0)
|
|
35
|
-
Requires-Dist: scikit-learn ; extra == "benchmarking"
|
|
36
|
-
Requires-Dist: scipy
|
|
37
|
-
Requires-Dist: tabulate ; extra == "benchmarking"
|
|
38
|
-
Requires-Dist: tqdm (>=4.67.1,<5.0.0)
|
|
39
|
-
Requires-Dist: validators (>=0.22.0,<1.0.0)
|
|
40
|
-
Description-Content-Type: text/markdown
|
|
32
|
+
Requires-Dist: pdqhash<0.3.0,>=0.2.7; extra == "pdq"
|
|
33
|
+
Dynamic: license-file
|
|
41
34
|
|
|
42
35
|
# perception 
|
|
43
36
|
|
|
@@ -53,6 +46,35 @@ Description-Content-Type: text/markdown
|
|
|
53
46
|
|
|
54
47
|
`pip install perception`
|
|
55
48
|
|
|
49
|
+
#### Optional extras
|
|
50
|
+
|
|
51
|
+
`perception` provides optional extras for additional functionality:
|
|
52
|
+
|
|
53
|
+
- `benchmarking` – tools for benchmarking perceptual hashes
|
|
54
|
+
- `matching` – async matching utilities
|
|
55
|
+
- `pdq` – Facebook's PDQ hash support
|
|
56
|
+
|
|
57
|
+
**Note for `benchmarking` extra users:** The `benchmarking` extra depends on
|
|
58
|
+
`albumentations`, which in turn requires `opencv-python-headless`. However,
|
|
59
|
+
`perception` already depends on `opencv-contrib-python-headless` (needed for
|
|
60
|
+
contrib modules such as `cv2.img_hash` and `cv2.SIFT_create`). Installing both
|
|
61
|
+
OpenCV distributions simultaneously causes file-level conflicts.
|
|
62
|
+
|
|
63
|
+
If you are using [uv](https://docs.astral.sh/uv/), this is handled
|
|
64
|
+
automatically:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
uv pip install "perception[benchmarking]"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
If you are using plain `pip`, install the extra and then force-reinstall the
|
|
71
|
+
contrib variant to remove the conflicting headless package:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install "perception[benchmarking]"
|
|
75
|
+
pip install --force-reinstall --no-deps opencv-contrib-python-headless
|
|
76
|
+
```
|
|
77
|
+
|
|
56
78
|
### Hashing
|
|
57
79
|
|
|
58
80
|
Hashing with different functions is simple with `perception`.
|
|
@@ -92,11 +114,12 @@ See below for end-to-end examples for common use cases for perceptual hashes.
|
|
|
92
114
|
To work on the project, start by doing the following.
|
|
93
115
|
|
|
94
116
|
```bash
|
|
95
|
-
# Install local dependencies for
|
|
96
|
-
#
|
|
117
|
+
# Install local dependencies for code completion,
|
|
118
|
+
# testing, and linting.
|
|
97
119
|
make init
|
|
120
|
+
```
|
|
98
121
|
|
|
99
|
-
|
|
122
|
+
To do a (close to) comprehensive check before committing code, use `make precommit`.
|
|
100
123
|
|
|
101
124
|
To implement new features, please first file an issue proposing your change for discussion.
|
|
102
125
|
|
|
@@ -111,5 +134,3 @@ examples.
|
|
|
111
134
|
- [imagededup](https://idealo.github.io/imagededup/)
|
|
112
135
|
- [ImageHash](https://github.com/JohannesBuchner/imagehash)
|
|
113
136
|
- [PhotoHash](https://github.com/bunchesofdonald/photohash)
|
|
114
|
-
```
|
|
115
|
-
|