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