1{ buildPythonPackage
2, cython
3, fetchFromGitHub
4, fetchpatch
5, h5py
6, imgaug
7, ipython
8, keras
9, lib
10, matplotlib
11, numpy
12, opencv3
13, pillow
14, scikit-image
15, scipy
16, tensorflow
17}:
18
19buildPythonPackage rec {
20 pname = "mask-rcnn";
21 version = "2.1";
22
23 src = fetchFromGitHub {
24 owner = "matterport";
25 repo = "Mask_RCNN";
26 rev = "3deaec5d902d16e1daf56b62d5971d428dc920bc";
27 sha256 = "13s3q9yh2q9m9vyksd269mww3bni4q2w7q5l419q70ca075qp8zp";
28 };
29
30 patches = [
31 # Fix for TF2:
32 # https://github.com/matterport/Mask_RCNN/issues/2734
33 (fetchpatch {
34 url = "https://github.com/BupyeongHealer/Mask_RCNN_tf_2.x/commit/7957839fe2b248f2f22c7e991ead12068ddc6cfc.diff";
35 excludes = [ "mrcnn/model.py" ];
36 hash = "sha256-70BGrx6X1uJDA2025f0YTlreT2uB3n35yIzuhf+ypVc=";
37 })
38 ];
39
40 # Fix for recent Keras
41 postPatch = ''
42 substituteInPlace mrcnn/model.py \
43 --replace "KE." "KL."
44 '';
45
46 nativeBuildInputs = [ cython ];
47
48 propagatedBuildInputs = [
49 h5py
50 imgaug
51 ipython
52 keras
53 matplotlib
54 numpy
55 opencv3
56 pillow
57 scikit-image
58 scipy
59 tensorflow
60 ];
61
62 meta = with lib; {
63 description = "Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow";
64 homepage = "https://github.com/matterport/Mask_RCNN";
65 license = licenses.mit;
66 maintainers = with maintainers; [ rakesh4g ];
67 };
68}