modules/utils.py
def build_montage(images):
    '''
        Build a montage out of images
    '''
    nimg, H, W = images.shape
    
    nrows = int(np.ceil(np.sqrt(nimg)))
    ncols = int(np.ceil(nimg/nrows))
    
    montage_im = np.zeros((H*nrows, W*ncols), dtype=np.float32)
    
    cnt = 0
    for r in range(nrows):
        for c in range(ncols):
            h1 = r*H
            h2 = (r+1)*H
            w1 = c*W
            w2 = (c+1)*W

            if cnt == nimg:
                break

            montage_im[h1:h2, w1:w2] = images[cnt, ...]
            cnt += 1
    
    return montage_im

        Build a montage out of images
    
Build a montage out of images
Build a montage out of images
def build_montage(images):
    nimg, H, W = images.shape
    nrows = int(np.ceil(np.sqrt(nimg)))
    ncols = int(np.ceil(nimg/nrows))
    montage_im = np.zeros((H*nrows, W*ncols), dtype=np.float32)
    cnt = 0
    for r in range(nrows):
        for c in range(ncols):
            h1 = r*H
            h2 = (r+1)*H
            w1 = c*W
            w2 = (c+1)*W
            if cnt == nimg:
                break
            montage_im[h1:h2, w1:w2] = images[cnt, ...]
            cnt += 1
    return montage_im
def build_montage ( images ) : nimg , H , W = images . shape nrows = int ( np . ceil ( np . sqrt ( nimg ) ) ) ncols = int ( np . ceil ( nimg / nrows ) ) montage_im = np . zeros ( ( H * nrows , W * ncols ) , dtype = np . float32 ) cnt = 0 for r in range ( nrows ) : for c in range ( ncols ) : h1 = r * H h2 = ( r + 1 ) * H w1 = c * W w2 = ( c + 1 ) * W if cnt == nimg : break montage_im [ h1 : h2 , w1 : w2 ] = images [ cnt , ... ] cnt += 1 return montage_im
Build a montage out of images
Build a montage out of images
'''
        Build a montage out of images
    '''
images