hashing
Find exact or near-duplicate images with perceptual, average, difference, or wavelet hashing in imagededup.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- hashing
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Find exact or near-duplicate images with perceptual, average, difference, or wavelet hashing in imagededup.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md3.1 KB
- 参考文档references/troubleshooting.md2.1 KB
- 参考文档references/workflows.md2.6 KB
- 脚本scripts/hash_smoke.py3.7 KB
03 SKILL.md 正文
hashing
Use this sub-skill when the user wants hash-based duplicate detection or hash generation with PHash, AHash, DHash, or WHash.
Best-fit tasks
- Generate a hash for one image or a whole directory.
- Find near duplicates by Hamming distance.
- Produce a list of files to remove from a duplicate map.
- Compare hash backends such as
bktree,brute_force, andbrute_force_cython. - Work from a directory of images or from a precomputed encoding map.
Read this sub-skill first when the request mentions
PHash,AHash,DHash, orWHashencode_imageorencode_imagesfind_duplicatesorfind_duplicates_to_removemax_distance_thresholdsearch_methodbktree,brute_force, orbrute_force_cython- Hamming distance, exact duplicates, or near duplicates
Workflow overview
- Pick the hash family.
PHashfor perceptual hashing.AHashfor average hashing.DHashfor difference hashing.WHashfor wavelet hashing.
- Encode either a single image or a directory.
- Search duplicates from the directory or from the encoding map.
- If the user wants a removal list, turn the duplicate map into filenames to remove.
- If the user is on Windows, keep the multiprocessing warning and main-guard behavior in mind.
Common decisions
- Use
encode_imagewhen the user already has one image file or one image array. - Use
encode_imageswhen the user has a directory. - Use
find_duplicateswhen the user needs a full duplicate map. - Use
find_duplicates_to_removewhen the user wants one heuristic list of files to delete later. - Use
encoding_mapwhen hashes were already computed earlier. - Use
search_methodonly when the user needs to compare backends or override the default.
Helpful facts
- Hash encodings are hexadecimal strings.
find_duplicatesreturns lists of duplicate filenames, or(filename, score)tuples whenscores=True.find_duplicates_to_removenever deletes files; it only returns a candidate list.- Hash thresholds are integer Hamming distances from
0to64. - The default hash search backend is
brute_force_cythonon Unix-like systems andbktreeon Windows. - Recursive directory scanning is optional and off by default.
Image handling notes
- The hash path accepts either an image file path or a numpy image array.
- Invalid or unreadable images are skipped rather than crashing the whole directory workflow.
- Supported formats are the Pillow formats documented by the repo, but loadability still depends on the actual image file and Pillow plugins.
- If you pass an encoding map, directory-only flags such as
recursivedo not matter.
Troubleshooting pointer
Read references/troubleshooting.md for threshold errors, Windows multiprocessing, invalid image input, and Cython-backend issues.
Script helper
Run scripts/hash_smoke.py to exercise the hash workflow on synthetic images without depending on the original checkout.
When to escalate elsewhere
- If the task is really about CNN features or custom PyTorch models, switch to the CNN sub-skill.
- If the task is about scoring or visualizing a retrieved duplicate map, switch to the evaluation sub-skill.
Good output expectations
A good hash-oriented answer should usually include:
- the hash class selected
- the input type expected by the method
- the threshold semantics
- the search backend if it matters
- the shape or type of the returned value
- any Windows or multiprocessing caveat that applies
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).