libenv/libenv.py
def _tile_images(images: np.ndarray) -> np.ndarray:
        """Tile a set of NHWC images"""
        num_images, height, width, chans = images.shape
        width_images = int(np.ceil(np.sqrt(num_images)))
        height_images = int(np.ceil(float(num_images) / width_images))
        result = np.zeros(
            (height_images * height, width_images * width, chans), dtype=np.uint8
        )
        for col in range(width_images):
            for row in range(height_images):
                idx = row * width_images + col
                if idx >= len(images):
                    continue
                result[
                    row * height : (row + 1) * height,
                    col * width : (col + 1) * width,
                    :,
                ] = images[idx]
        return result
Tile a set of NHWC images
Tile a set of NHWC images
Tile a set of NHWC images
def _tile_images(images: np.ndarray) -> np.ndarray:
        num_images, height, width, chans = images.shape
        width_images = int(np.ceil(np.sqrt(num_images)))
        height_images = int(np.ceil(float(num_images) / width_images))
        result = np.zeros(
            (height_images * height, width_images * width, chans), dtype=np.uint8
        )
        for col in range(width_images):
            for row in range(height_images):
                idx = row * width_images + col
                if idx >= len(images):
                    continue
                result[
                    row * height : (row + 1) * height,
                    col * width : (col + 1) * width,
                    :,
                ] = images[idx]
        return result
def _tile_images ( images : np . ndarray ) -> np . ndarray : num_images , height , width , chans = images . shape width_images = int ( np . ceil ( np . sqrt ( num_images ) ) ) height_images = int ( np . ceil ( float ( num_images ) / width_images ) ) result = np . zeros ( ( height_images * height , width_images * width , chans ) , dtype = np . uint8 ) for col in range ( width_images ) : for row in range ( height_images ) : idx = row * width_images + col if idx >= len ( images ) : continue result [ row * height : ( row + 1 ) * height , col * width : ( col + 1 ) * width , : , ] = images [ idx ] return result
Tile a set of NHWC images
Tile a set of NHWC images
"""Tile a set of NHWC images"""
images
np.ndarray