Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures with numpy 1.20 #755

Open
rmcgibbo opened this issue Mar 24, 2021 · 2 comments · May be fixed by #864
Open

Test failures with numpy 1.20 #755

rmcgibbo opened this issue Mar 24, 2021 · 2 comments · May be fixed by #864

Comments

@rmcgibbo
Copy link

Hi,

I'm seeing a bunch of failures in the test suite when run with the recently-release numpy 1.20, due to what looks like some API changes in numpy.

Here's a log file: https://nix-cache.s3.amazonaws.com/log/8lp5bvc5210prkd4zm62hmdxfjbq8h46-python3.8-imgaug-0.4.0.drv

Most of them appear to be TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' inside

Here's a concrete example. Any help would be appreciated very much

_____ Test_compute_shape_after_pooling.test_random_shapes_and_kernel_sizes _____

self = <test_pooling.Test_compute_shape_after_pooling testMethod=test_random_shapes_and_kernel_sizes>

    def test_random_shapes_and_kernel_sizes(self):
        shapes = [
            (6, 5),
            (5, 6),
            (6, 6),
            (11, 1),
            (1, 11),
            (0, 1),
            (1, 0),
            (0, 0)
        ]
        kernel_sizes = [1, 2, 3, 5]
        nb_channels_lst = [None, 1, 3, 4]
    
        # 8*(4*4)*4 = 512 subtests
        gen = itertools.product(shapes, nb_channels_lst)
        for shape_nochan, nb_channels in gen:
            shape = shape_nochan
            if nb_channels is not None:
                shape = tuple(list(shape) + [nb_channels])
            image = np.zeros(shape, dtype=np.uint8)
    
            for ksize_h, ksize_w in itertools.product(kernel_sizes,
                                                      kernel_sizes):
                with self.subTest(shape=shape, ksize_h=ksize_h,
                                  ksize_w=ksize_w):
>                   image_pooled = ia.avg_pool(image, (ksize_h, ksize_w))

test/augmenters/test_pooling.py:55: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/z2kzli3m2snpm3x8j7g06vvwmkj7wy68-python3.8-imgaug-0.4.0/lib/python3.8/site-packages/imgaug/imgaug.py:1791: in avg_pool
    return pool(arr, block_size, np.average, pad_mode=pad_mode,
/nix/store/z2kzli3m2snpm3x8j7g06vvwmkj7wy68-python3.8-imgaug-0.4.0/lib/python3.8/site-packages/imgaug/imgaug.py:1740: in pool
    arr_reduced = skimage.measure.block_reduce(arr, tuple(block_size), func,
/nix/store/km6km2a0mjm916qwr49b0qy1psxkmh21-python3.8-scikit-image-0.18.1/lib/python3.8/site-packages/skimage/measure/block.py:81: in block_reduce
    image = np.pad(image, pad_width=pad_width, mode='constant',
<__array_function__ internals>:5: in pad
    ???
/nix/store/ssf3b310n2f64gc5hc84ha24c993ih4l-python3.8-numpy-1.20.1/lib/python3.8/site-packages/numpy/lib/arraypad.py:803: in pad
    _set_pad_area(roi, axis, width_pair, value_pair)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

padded = array([[0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0]], dtype=uint8)
axis = 0, width_pair = [0, 0], value_pair = (None, None)

    def _set_pad_area(padded, axis, width_pair, value_pair):
        """
        Set empty-padded area in given dimension.
    
        Parameters
        ----------
        padded : ndarray
            Array with the pad area which is modified inplace.
        axis : int
            Dimension with the pad area to set.
        width_pair : (int, int)
            Pair of widths that mark the pad area on both sides in the given
            dimension.
        value_pair : tuple of scalars or ndarrays
            Values inserted into the pad area on each side. It must match or be
            broadcastable to the shape of `arr`.
        """
        left_slice = _slice_at_axis(slice(None, width_pair[0]), axis)
>       padded[left_slice] = value_pair[0]
E       TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

/nix/store/ssf3b310n2f64gc5hc84ha24c993ih4l-python3.8-numpy-1.20.1/lib/python3.8/site-packages/numpy/lib/arraypad.py:147: TypeError
@MareArts
Copy link

MareArts commented May 16, 2021

same problem..

@ghost
Copy link

ghost commented Jun 25, 2022

Please check the version of NumPy. You should install version 1.19.5.

@erjel erjel linked a pull request Dec 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants