(bboxs, shape)
return mask.reshape(mask.shape+(1,)).astype(np.float32)
Generate mask tensor from bbox.

        Args:
            bbox: configuration tuple, (top, left, height, width)
            config: Config should have configuration including IMG_SHAPES,
                MAX_DELTA_HEIGHT, MAX_DELTA_WIDTH.

        Returns:
            tf.Tensor: output with shape [1, H, W, 1]
Generate mask tensor from bbox.
Generate mask tensor from bbox .
def bbox2mask(bboxs, shape):
        """Generate mask tensor from bbox.

        Args:
            bbox: configuration tuple, (top, left, height, width)
            config: Config should have configuration including IMG_SHAPES,
                MAX_DELTA_HEIGHT, MAX_DELTA_WIDTH.

        Returns:
            tf.Tensor: output with shape [1, H, W, 1]

        """
        height, width = shape
        mask = np.zeros(( height, width), np.float32)
        #print(mask.shape)
        for bbox in bboxs:
            h = int(0.1*bbox[2])+np.random.randint(int(bbox[2]*0.2+1))
            w = int(0.1*bbox[3])+np.random.randint(int(bbox[3]*0.2)+1)
            mask[bbox[0]+h:bbox[0]+bbox[2]-h,
                 bbox[1]+w:bbox[1]+bbox[3]-w] = 1.
        #print("after", mask.shape)
        return mask.reshape(mask.shape+(1,)).astype(np.float32)
def bbox2mask ( bboxs , shape ) : height , width = shape mask = np . zeros ( ( height , width ) , np . float32 ) #print(mask.shape) for bbox in bboxs : h = int ( 0.1 * bbox [ 2 ] ) + np . random . randint ( int ( bbox [ 2 ] * 0.2 + 1 ) ) w = int ( 0.1 * bbox [ 3 ] ) + np . random . randint ( int ( bbox [ 3 ] * 0.2 ) + 1 ) mask [ bbox [ 0 ] + h : bbox [ 0 ] + bbox [ 2 ] - h , bbox [ 1 ] + w : bbox [ 1 ] + bbox [ 3 ] - w ] = 1. #print("after", mask.shape) return mask . reshape ( mask . shape + ( 1 , ) ) . astype ( np . float32 )