1{ buildPythonPackage
2, fetchFromGitHub
3, imageio
4, imagecorruptions
5, numpy
6, opencv3
7, pytestCheckHook
8, scikitimage
9, scipy
10, shapely
11, six
12, lib
13}:
14
15buildPythonPackage rec {
16 pname = "imgaug";
17 version = "0.4.0";
18
19 src = fetchFromGitHub {
20 owner = "aleju";
21 repo = "imgaug";
22 rev = version;
23 sha256 = "17hbxndxphk3bfnq35y805adrfa6gnm5x7grjxbwdw4kqmbbqzah";
24 };
25
26 postPatch = ''
27 substituteInPlace requirements.txt \
28 --replace "opencv-python-headless" ""
29 substituteInPlace setup.py \
30 --replace "opencv-python-headless" ""
31 substituteInPlace pytest.ini \
32 --replace "--xdoctest --xdoctest-global-exec=\"import imgaug as ia\nfrom imgaug import augmenters as iaa\"" ""
33 '';
34
35 propagatedBuildInputs = [
36 imageio
37 imagecorruptions
38 numpy
39 opencv3
40 scikitimage
41 scipy
42 shapely
43 six
44 ];
45
46 checkInputs = [
47 opencv3
48 pytestCheckHook
49 ];
50
51 disabledTests = [
52 # Tests are outdated
53 "test_quokka_segmentation_map"
54 "test_pool"
55 "test_avg_pool"
56 "test_max_pool"
57 "test_min_pool"
58 "est_median_pool"
59 "test_alpha_is_080"
60 "test_face_and_lines_at_half_visibility"
61 "test_polygon_fully_inside_image__no_rectangular_shape"
62 # flaky due to timing-based assertions
63 "test_imap_batches_output_buffer_size"
64 "test_imap_batches_unordered_output_buffer_size"
65 ];
66
67 disabledTestPaths = [
68 # TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
69 "test/augmenters/test_pooling.py"
70 ];
71
72 pythonImportsCheck = [ "imgaug" ];
73
74 meta = with lib; {
75 homepage = "https://github.com/aleju/imgaug";
76 description = "Image augmentation for machine learning experiments";
77 license = licenses.mit;
78 maintainers = with maintainers; [ cmcdragonkai rakesh4g ];
79 platforms = platforms.linux;
80 # Scikit-image 0.19 update broke API, see https://github.com/scikit-image/scikit-image/releases/tag/v0.19.0
81 # and https://github.com/scikit-image/scikit-image/issues/6093
82 broken = lib.versionAtLeast scikitimage.version "0.19";
83 };
84}