nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 setuptools,
6 matplotlib,
7 numpy,
8 opencv-python,
9 pillow,
10 scikit-learn,
11 torch,
12 torchvision,
13 ttach,
14 tqdm,
15}:
16
17buildPythonPackage rec {
18 pname = "grad-cam";
19 version = "1.5.5";
20 pyproject = true;
21
22 src = fetchPypi {
23 inherit pname version;
24 hash = "sha256-aQxDPSJtNcicnrFwRi2yBJCcsGs5xzgeaICkm2/DcBU=";
25 };
26
27 nativeBuildInputs = [
28 ];
29
30 pythonRelaxDeps = [
31 "torchvision"
32 ];
33
34 build-system = [
35 setuptools
36 ];
37
38 dependencies = [
39 matplotlib
40 numpy
41 opencv-python
42 pillow
43 scikit-learn
44 torchvision
45 ttach
46 tqdm
47 ];
48
49 # Let the user bring their own instance (as with torchmetrics)
50 buildInputs = [ torch ];
51
52 doCheck = false; # every nontrivial test tries to download a pretrained model
53
54 pythonImportsCheck = [
55 "pytorch_grad_cam"
56 "pytorch_grad_cam.metrics"
57 "pytorch_grad_cam.metrics.cam_mult_image"
58 "pytorch_grad_cam.metrics.road"
59 "pytorch_grad_cam.utils"
60 "pytorch_grad_cam.utils.image"
61 "pytorch_grad_cam.utils.model_targets"
62 ];
63
64 meta = {
65 description = "Advanced AI explainability for computer vision";
66 homepage = "https://jacobgil.github.io/pytorch-gradcam-book";
67 license = lib.licenses.mit;
68 maintainers = with lib.maintainers; [ bcdarwin ];
69 };
70}