def imresize_many_images(images, sizes=None, interpolation=None):
<EOL>if len(images) == <NUM_LIT:0>:<EOL><INDENT>return images<EOL><DEDENT>do_assert(<EOL>all([image.shape[<NUM_LIT:0>] > <NUM_LIT:0> and image.shape[<NUM_LIT:1>] > <NUM_LIT:0> for image in images]),<EOL>("<STR_LIT>"<EOL>+ "<STR_LIT>") % (str([image.shape for image in images]),)<EOL>)<EOL>if is_single_number(sizes) and sizes <= <NUM_LIT:0>:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>" % (sizes,))<EOL><DEDENT>elif isinstance(sizes, tuple) and (sizes[<NUM_LIT:0>] <= <NUM_LIT:0> or sizes[<NUM_LIT:1>] <= <NUM_LIT:0>):<EOL><INDENT>sizes_str = [<EOL>"<STR_LIT>" % (sizes[<NUM_LIT:0>],) if is_single_integer(sizes[<NUM_LIT:0>]) else "<STR_LIT>" % (sizes[<NUM_LIT:0>],),<EOL>"<STR_LIT>" % (sizes[<NUM_LIT:1>],) if is_single_integer(sizes[<NUM_LIT:1>]) else "<STR_LIT>" % (sizes[<NUM_LIT:1>],),<EOL>]<EOL>sizes_str = "<STR_LIT>" % (sizes_str[<NUM_LIT:0>], sizes_str[<NUM_LIT:1>])<EOL>raise Exception(<EOL>"<STR_LIT>" % (sizes_str,))<EOL><DEDENT>if is_single_number(sizes):<EOL><INDENT>sizes = (sizes, sizes)<EOL><DEDENT>else:<EOL><INDENT>do_assert(len(sizes) == <NUM_LIT:2>, "<STR_LIT>" % (len(sizes),))<EOL>do_assert(all([is_single_number(val) for val in sizes]),<EOL>"<STR_LIT>" % (str([type(val) for val in sizes]),))<EOL><DEDENT>if isinstance(images, list):<EOL><INDENT>nb_shapes = len(set([image.shape for image in images]))<EOL>if nb_shapes == <NUM_LIT:1>:<EOL><INDENT>return list(imresize_many_images(np.array(images), sizes=sizes, interpolation=interpolation))<EOL><DEDENT>else:<EOL><INDENT>return [imresize_many_images(image[np.newaxis, ...], sizes=sizes, interpolation=interpolation)[<NUM_LIT:0>, ...]<EOL>for image in images]<EOL><DEDENT><DEDENT>shape = images.shape<EOL>do_assert(images.ndim in [<NUM_LIT:3>, <NUM_LIT:4>], "<STR_LIT>" % (str(shape),))<EOL>nb_images = shape[<NUM_LIT:0>]<EOL>im_height, im_width = shape[<NUM_LIT:1>], shape[<NUM_LIT:2>]<EOL>nb_channels = shape[<NUM_LIT:3>] if images.ndim > <NUM_LIT:3> else None<EOL>height, width = sizes[<NUM_LIT:0>], sizes[<NUM_LIT:1>]<EOL>height = int(np.round(im_height * height)) if is_single_float(height) else height<EOL>width = int(np.round(im_width * width)) if is_single_float(width) else width<EOL>if height == im_height and width == im_width:<EOL><INDENT>return np.copy(images)<EOL><DEDENT>ip = interpolation<EOL>do_assert(ip is None or ip in IMRESIZE_VALID_INTERPOLATIONS)<EOL>if ip is None:<EOL><INDENT>if height > im_height or width > im_width:<EOL><INDENT>ip = cv2.INTER_AREA<EOL><DEDENT>else:<EOL><INDENT>ip = cv2.INTER_LINEAR<EOL><DEDENT><DEDENT>elif ip in ["<STR_LIT>", cv2.INTER_NEAREST]:<EOL><INDENT>ip = cv2.INTER_NEAREST<EOL><DEDENT>elif ip in ["<STR_LIT>", cv2.INTER_LINEAR]:<EOL><INDENT>ip = cv2.INTER_LINEAR<EOL><DEDENT>elif ip in ["<STR_LIT>", cv2.INTER_AREA]:<EOL><INDENT>ip = cv2.INTER_AREA<EOL><DEDENT>else:  <EOL><INDENT>ip = cv2.INTER_CUBIC<EOL><DEDENT>from . import dtypes as iadt<EOL>if ip == cv2.INTER_NEAREST:<EOL><INDENT>iadt.gate_dtypes(images,<EOL>allowed=["<STR_LIT:bool>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>disallowed=["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>augmenter=None)<EOL><DEDENT>else:<EOL><INDENT>iadt.gate_dtypes(images,<EOL>allowed=["<STR_LIT:bool>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>disallowed=["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>augmenter=None)<EOL><DEDENT>result_shape = (nb_images, height, width)<EOL>if nb_channels is not None:<EOL><INDENT>result_shape = result_shape + (nb_channels,)<EOL><DEDENT>result = np.zeros(result_shape, dtype=images.dtype)<EOL>for i, image in enumerate(images):<EOL><INDENT>input_dtype = image.dtype<EOL>if image.dtype.type == np.bool_:<EOL><INDENT>image = image.astype(np.uint8) * <NUM_LIT:255><EOL><DEDENT>elif image.dtype.type == np.int8 and ip != cv2.INTER_NEAREST:<EOL><INDENT>image = image.astype(np.int16)<EOL><DEDENT>elif image.dtype.type == np.float16:<EOL><INDENT>image = image.astype(np.float32)<EOL><DEDENT>result_img = cv2.resize(image, (width, height), interpolation=ip)<EOL>assert result_img.dtype == image.dtype<EOL>if len(result_img.shape) == <NUM_LIT:2> and nb_channels is not None and nb_channels == <NUM_LIT:1>:<EOL><INDENT>result_img = result_img[:, :, np.newaxis]<EOL><DEDENT>if input_dtype.type == np.bool_:<EOL><INDENT>result_img = result_img > <NUM_LIT><EOL><DEDENT>elif input_dtype.type == np.int8 and ip != cv2.INTER_NEAREST:<EOL><INDENT>from . import dtypes as iadt<EOL>result_img = iadt.restore_dtypes_(result_img, np.int8)<EOL><DEDENT>elif input_dtype.type == np.float16:<EOL><INDENT>from . import dtypes as iadt<EOL>result_img = iadt.restore_dtypes_(result_img, np.float16)<EOL><DEDENT>result[i] = result_img<EOL><DEDENT>return result<EOL>
Resize many images to a specified size.

dtype support::

    * ``uint8``: yes; fully tested
    * ``uint16``: yes; tested
    * ``uint32``: no (1)
    * ``uint64``: no (2)
    * ``int8``: yes; tested (3)
    * ``int16``: yes; tested
    * ``int32``: limited; tested (4)
    * ``int64``: no (2)
    * ``float16``: yes; tested (5)
    * ``float32``: yes; tested
    * ``float64``: yes; tested
    * ``float128``: no (1)
    * ``bool``: yes; tested (6)

    - (1) rejected by ``cv2.imresize``
    - (2) results too inaccurate
    - (3) mapped internally to ``int16`` when interpolation!="nearest"
    - (4) only supported for interpolation="nearest", other interpolations lead to cv2 error
    - (5) mapped internally to ``float32``
    - (6) mapped internally to ``uint8``

Parameters
----------
images : (N,H,W,[C]) ndarray or list of (H,W,[C]) ndarray
    Array of the images to resize.
    Usually recommended to be of dtype uint8.

sizes : float or iterable of int or iterable of float
    The new size of the images, given either as a fraction (a single float) or as
    a ``(height, width)`` tuple of two integers or as a ``(height fraction, width fraction)``
    tuple of two floats.

interpolation : None or str or int, optional
    The interpolation to use during resize.
    If int, then expected to be one of:

        * ``cv2.INTER_NEAREST`` (nearest neighbour interpolation)
        * ``cv2.INTER_LINEAR`` (linear interpolation)
        * ``cv2.INTER_AREA`` (area interpolation)
        * ``cv2.INTER_CUBIC`` (cubic interpolation)

    If string, then expected to be one of:

        * ``nearest`` (identical to ``cv2.INTER_NEAREST``)
        * ``linear`` (identical to ``cv2.INTER_LINEAR``)
        * ``area`` (identical to ``cv2.INTER_AREA``)
        * ``cubic`` (identical to ``cv2.INTER_CUBIC``)

    If None, the interpolation will be chosen automatically. For size
    increases, area interpolation will be picked and for size decreases,
    linear interpolation will be picked.

Returns
-------
result : (N,H',W',[C]) ndarray
    Array of the resized images.

Examples
--------
>>> imresize_many_images(np.zeros((2, 16, 16, 3), dtype=np.uint8), 2.0)

Converts 2 RGB images of height and width 16 to images of height and width 16*2 = 32.

>>> imresize_many_images(np.zeros((2, 16, 16, 3), dtype=np.uint8), (16, 32))

Converts 2 RGB images of height and width 16 to images of height 16 and width 32.

>>> imresize_many_images(np.zeros((2, 16, 16, 3), dtype=np.uint8), (2.0, 4.0))

Converts 2 RGB images of height and width 16 to images of height 32 and width 64.