nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 cython,
5 fetchFromGitHub,
6 fetchurl,
7 matplotlib,
8 pillow,
9 pytest-mock,
10 pytestCheckHook,
11 pywavelets,
12 scikit-learn,
13 setuptools,
14 torch,
15 torchvision,
16 tqdm,
17}:
18let
19 MobileNetV3 = fetchurl {
20 url = "https://download.pytorch.org/models/mobilenet_v3_small-047dcff4.pth";
21 hash = "sha256-BH3P9K3e+G6lvC7/E8lhTcEfR6sRYNCnGiXn25lPTh8=";
22 };
23 ViT = fetchurl {
24 url = "https://download.pytorch.org/models/vit_b_16_swag-9ac1b537.pth";
25 hash = "sha256-msG1N42ZJ71sg3TODNVX74Dhs/j7wYWd8zLE3J0P2CU=";
26 };
27 EfficientNet = fetchurl {
28 url = "https://download.pytorch.org/models/efficientnet_b4_rwightman-23ab8bcd.pth";
29 hash = "sha256-I6uLzVvb72GnpDuRrcrYH2Iv1/NvtJNaVpgo13iIxE4=";
30 };
31in
32buildPythonPackage rec {
33 pname = "imagededup";
34 version = "03.3";
35 pyproject = true;
36
37 src = fetchFromGitHub {
38 owner = "idealo";
39 repo = "imagededup";
40 tag = "v${version}";
41 hash = "sha256-tm6WGf74xu3CcwpyeA7+rvO5wemO0daXpj/jvYrH19E=";
42 };
43
44 nativeBuildInputs = [
45 cython
46 setuptools
47 ];
48
49 propagatedBuildInputs = [
50 matplotlib
51 pillow
52 pywavelets
53 scikit-learn
54 torch
55 torchvision
56 tqdm
57 ];
58
59 nativeCheckInputs = [
60 pytest-mock
61 pytestCheckHook
62 ];
63
64 preCheck = ''
65 export HOME=$(mktemp -d)
66
67 # Checks with CNN are preloaded to avoid downloads in the check phase
68 mkdir -p $HOME/.cache/torch/hub/checkpoints/
69 ln -s ${MobileNetV3} $HOME/.cache/torch/hub/checkpoints/${MobileNetV3.name}
70 ln -s ${ViT} $HOME/.cache/torch/hub/checkpoints/${ViT.name}
71 ln -s ${EfficientNet} $HOME/.cache/torch/hub/checkpoints/${EfficientNet.name}
72 '';
73
74 pythonImportsCheck = [ "imagededup" ];
75
76 meta = {
77 homepage = "https://idealo.github.io/imagededup/";
78 changelog = "https://github.com/idealo/imagededup/releases/tag/${src.tag}";
79 description = "Finding duplicate images made easy";
80 license = lib.licenses.asl20;
81 maintainers = with lib.maintainers; [ stunkymonkey ];
82 };
83}