项目作者: vmchale

项目描述 :
Perceptual hashing command-line tool
高级语言: Haskell
项目地址: git://github.com/vmchale/phash.git
创建时间: 2019-06-23T18:01:05Z
项目社区:https://github.com/vmchale/phash

开源协议:BSD 3-Clause "New" or "Revised" License

下载


phash

This is a Haskell library
to detect (potential) duplicate images.

It also contains a command-line tool.

Use

Use it on one or more directories:

  1. phash ~/Pictures ~/Downloads
  2. ~/Pictures/frog.jpeg, ~/Downloads/frog.png

Installation

Pre-Built Release

For some platforms, you can find binaries here.

Source

Download cabal-install and
GHC. Then:

  1. cabal install perceptual-hash --constraint='hip +disable-chart'

You may need

  1. package hip
  2. ghc-options: -fsimpl-tick-factor=200

Performance

This library has performs better on WebP, AVIF images and worse on JPEG images compared to the pHash library.

  1. benchmarking fileHash/cat.png
  2. time 21.50 ms (21.23 ms .. 21.70 ms)
  3. 1.000 R² (0.999 R² .. 1.000 R²)
  4. mean 21.54 ms (21.39 ms .. 21.88 ms)
  5. std dev 525.3 μs (224.2 μs .. 946.8 μs)
  6. benchmarking fileHash/frog.jpeg
  7. time 21.33 ms (20.57 ms .. 22.01 ms)
  8. 0.997 R² (0.996 R² .. 0.999 R²)
  9. mean 19.84 ms (19.53 ms .. 20.24 ms)
  10. std dev 822.7 μs (654.3 μs .. 1.070 ms)
  11. variance introduced by outliers: 13% (moderately inflated)
  12. benchmarking fileHash/frog.png
  13. time 12.31 ms (11.88 ms .. 12.66 ms)
  14. 0.997 R² (0.994 R² .. 0.999 R²)
  15. mean 12.46 ms (12.34 ms .. 12.58 ms)
  16. std dev 314.3 μs (256.0 μs .. 385.0 μs)
  17. benchmarking fileHash/liz-taylor.webp
  18. time 69.02 ms (68.00 ms .. 70.23 ms)
  19. 0.999 R² (0.997 R² .. 1.000 R²)
  20. mean 71.69 ms (70.28 ms .. 74.98 ms)
  21. std dev 3.688 ms (1.345 ms .. 6.107 ms)
  22. variance introduced by outliers: 16% (moderately inflated)
  23. benchmarking fileHash/liz-taylor.png
  24. time 72.32 ms (70.35 ms .. 74.49 ms)
  25. 0.998 R² (0.996 R² .. 1.000 R²)
  26. mean 73.83 ms (72.60 ms .. 75.38 ms)
  27. std dev 2.414 ms (1.655 ms .. 3.614 ms)
  28. benchmarking fileHash/fashion.png
  29. time 142.0 ms (131.6 ms .. 153.4 ms)
  30. 0.997 R² (0.991 R² .. 1.000 R²)
  31. mean 145.8 ms (142.0 ms .. 153.9 ms)
  32. std dev 7.690 ms (2.694 ms .. 11.43 ms)
  33. variance introduced by outliers: 13% (moderately inflated)
  34. benchmarking fileHash/fashion.avif
  35. time 172.2 ms (161.5 ms .. 187.6 ms)
  36. 0.996 R² (0.991 R² .. 1.000 R²)
  37. mean 175.1 ms (169.3 ms .. 185.3 ms)
  38. std dev 12.16 ms (5.052 ms .. 18.42 ms)
  39. variance introduced by outliers: 13% (moderately inflated)
  40. benchmarking foreignHash/cat.png
  41. time 21.06 ms (20.88 ms .. 21.19 ms)
  42. 1.000 R² (0.999 R² .. 1.000 R²)
  43. mean 20.94 ms (20.80 ms .. 21.06 ms)
  44. std dev 320.2 μs (225.5 μs .. 418.3 μs)
  45. benchmarking foreignHash/frog.jpeg
  46. time 9.255 ms (9.168 ms .. 9.378 ms)
  47. 0.999 R² (0.999 R² .. 1.000 R²)
  48. mean 9.234 ms (9.201 ms .. 9.273 ms)
  49. std dev 94.68 μs (79.14 μs .. 120.7 μs)
  50. benchmarking foreignHash/frog.png
  51. time 10.37 ms (10.28 ms .. 10.47 ms)
  52. 0.999 R² (0.999 R² .. 1.000 R²)
  53. mean 10.42 ms (10.37 ms .. 10.48 ms)
  54. std dev 135.4 μs (106.5 μs .. 184.9 μs)
  55. benchmarking foreignHash/liz-taylor.webp
  56. time 368.7 ms (352.4 ms .. 391.1 ms)
  57. 1.000 R² (0.999 R² .. 1.000 R²)
  58. mean 362.3 ms (357.6 ms .. 366.4 ms)
  59. std dev 5.133 ms (1.154 ms .. 6.530 ms)
  60. variance introduced by outliers: 19% (moderately inflated)
  61. benchmarking foreignHash/liz-taylor.png
  62. time 71.58 ms (71.12 ms .. 72.03 ms)
  63. 1.000 R² (1.000 R² .. 1.000 R²)
  64. mean 71.84 ms (71.66 ms .. 72.24 ms)
  65. std dev 502.0 μs (339.8 μs .. 710.2 μs)
  66. benchmarking foreignHash/fashion.png
  67. time 162.1 ms (160.6 ms .. 162.8 ms)
  68. 1.000 R² (1.000 R² .. 1.000 R²)
  69. mean 163.4 ms (162.9 ms .. 164.3 ms)
  70. std dev 990.0 μs (544.6 μs .. 1.476 ms)
  71. variance introduced by outliers: 12% (moderately inflated)
  72. benchmarking foreignHash/fashion.avif
  73. time 705.5 ms (669.6 ms .. 757.2 ms)
  74. 0.999 R² (0.998 R² .. 1.000 R²)
  75. mean 716.4 ms (710.3 ms .. 728.3 ms)
  76. std dev 11.54 ms (1.129 ms .. 13.84 ms)
  77. variance introduced by outliers: 19% (moderately inflated)

Foreign Library

This package contains a foreign library and a header
file