parsing_rcnn_model.py
def load_image_gt(dataset, config, image_id, augment=False,
                  use_mini_mask=False):
    """Load and return ground truth data for an image (image, mask, bounding boxes).

    augment: If true, apply random image augmentation. Currently, only
        horizontal flipping is offered.
    use_mini_mask: If False, returns full-size masks that are the same height
        and width as the original image. These can be big, for example
        1024x1024x100 (for 100 instances). Mini masks are smaller, typically,
        224x224 and are generated by extracting the bounding box of the
        object and resizing it to MINI_MASK_SHAPE.

    Returns:
    image: [height, width, 3]
    image_meta: 
    class_ids: [instance_count] Integer class IDs
    bbox: [instance_count, (y1, x1, y2, x2)]
    mask: [height, width, instance_count]. The height and width are those
        of the image unless use_mini_mask is True, in which case they are
        defined in MINI_MASK_SHAPE.
    part: [height, width]
    """
    # Load image and mask
    image = dataset.load_image(image_id)
    mask, class_ids = dataset.load_mask(image_id)
    part = dataset.load_part(image_id)
    part_rev = dataset.load_reverse_part(image_id)
    shape = image.shape

    image, window, scale, padding = utils.resize_image(
        image,
        max_dim=config.IMAGE_MAX_DIM,
        padding=config.IMAGE_PADDING)
    mask = utils.resize_mask(mask, scale, padding)
    part = utils.resize_part(part, scale, padding[:2])
    part_rev = utils.resize_part(part_rev, scale, padding[:2])
    # Random horizontal flips.
    if augment:
        if random.randint(0, 1):
            image = np.fliplr(image)
            mask = np.fliplr(mask)
            # part = np.fliplr(part)
            part = part_rev

    # Bounding boxes. Note that some boxes might be all zeros
    # if the corresponding mask got cropped out.
    # bbox: [num_instances, (y1, x1, y2, x2)]
    bbox = utils.extract_bboxes(mask)

    # Active classes
    # Different datasets have different classes, so track the
    # classes supported in the dataset of this image.
    active_class_ids = np.zeros([dataset.num_classes], dtype=np.int32)
    source_class_ids = dataset.source_class_ids[dataset.image_info[image_id]["source"]]
    active_class_ids[source_class_ids] = 1

    # Resize masks to smaller size to reduce memory usage
    if use_mini_mask:
        mask = utils.minimize_mask(bbox, mask, config.MINI_MASK_SHAPE)

    # Image meta data
    image_meta = compose_image_meta(image_id, shape, window, active_class_ids)
    return image, image_meta, class_ids, bbox, mask, part
Load and return ground truth data for an image (image, mask, bounding boxes).

    augment: If true, apply random image augmentation. Currently, only
        horizontal flipping is offered.
    use_mini_mask: If False, returns full-size masks that are the same height
        and width as the original image. These can be big, for example
        1024x1024x100 (for 100 instances). Mini masks are smaller, typically,
        224x224 and are generated by extracting the bounding box of the
        object and resizing it to MINI_MASK_SHAPE.

    Returns:
    image: [height, width, 3]
    image_meta: 
    class_ids: [instance_count] Integer class IDs
    bbox: [instance_count, (y1, x1, y2, x2)]
    mask: [height, width, instance_count]. The height and width are those
        of the image unless use_mini_mask is True, in which case they are
        defined in MINI_MASK_SHAPE.
    part: [height, width]
    
Load and return ground truth data for an image (image, mask, bounding boxes).
augment: If true, apply random image augmentation. Currently, only
horizontal flipping is offered.
use_mini_mask: If False, returns full-size masks that are the same height
and width as the original image. These can be big, for example
1024x1024x100 (for 100 instances). Mini masks are smaller, typically,
224x224 and are generated by extracting the bounding box of the
object and resizing it to MINI_MASK_SHAPE.
Load and return ground truth data for an image ( image mask bounding boxes ) . augment : If true apply random image augmentation . Currently only horizontal flipping is offered . use_mini_mask : If False returns full - size masks that are the same height and width as the original image . These can be big for example 1024x1024x100 ( for 100 instances ) . Mini masks are smaller typically 224x224 and are generated by extracting the bounding box of the object and resizing it to MINI_MASK_SHAPE .
def load_image_gt(dataset, config, image_id, augment=False,
                  use_mini_mask=False):
    image = dataset.load_image(image_id)
    mask, class_ids = dataset.load_mask(image_id)
    part = dataset.load_part(image_id)
    part_rev = dataset.load_reverse_part(image_id)
    shape = image.shape
    image, window, scale, padding = utils.resize_image(
        image,
        max_dim=config.IMAGE_MAX_DIM,
        padding=config.IMAGE_PADDING)
    mask = utils.resize_mask(mask, scale, padding)
    part = utils.resize_part(part, scale, padding[:2])
    part_rev = utils.resize_part(part_rev, scale, padding[:2])
    if augment:
        if random.randint(0, 1):
            image = np.fliplr(image)
            mask = np.fliplr(mask)
            part = part_rev
    bbox = utils.extract_bboxes(mask)
    active_class_ids = np.zeros([dataset.num_classes], dtype=np.int32)
    source_class_ids = dataset.source_class_ids[dataset.image_info[image_id]["source"]]
    active_class_ids[source_class_ids] = 1
    if use_mini_mask:
        mask = utils.minimize_mask(bbox, mask, config.MINI_MASK_SHAPE)
    image_meta = compose_image_meta(image_id, shape, window, active_class_ids)
    return image, image_meta, class_ids, bbox, mask, part
def load_image_gt ( dataset , config , image_id , augment = False , use_mini_mask = False ) : image = dataset . load_image ( image_id ) mask , class_ids = dataset . load_mask ( image_id ) part = dataset . load_part ( image_id ) part_rev = dataset . load_reverse_part ( image_id ) shape = image . shape image , window , scale , padding = utils . resize_image ( image , max_dim = config . IMAGE_MAX_DIM , padding = config . IMAGE_PADDING ) mask = utils . resize_mask ( mask , scale , padding ) part = utils . resize_part ( part , scale , padding [ : 2 ] ) part_rev = utils . resize_part ( part_rev , scale , padding [ : 2 ] ) if augment : if random . randint ( 0 , 1 ) : image = np . fliplr ( image ) mask = np . fliplr ( mask ) part = part_rev bbox = utils . extract_bboxes ( mask ) active_class_ids = np . zeros ( [ dataset . num_classes ] , dtype = np . int32 ) source_class_ids = dataset . source_class_ids [ dataset . image_info [ image_id ] [ "source" ] ] active_class_ids [ source_class_ids ] = 1 if use_mini_mask : mask = utils . minimize_mask ( bbox , mask , config . MINI_MASK_SHAPE ) image_meta = compose_image_meta ( image_id , shape , window , active_class_ids ) return image , image_meta , class_ids , bbox , mask , part
Load and return ground truth data for an image (image, mask, bounding boxes).
Load and return ground truth data for an image ( image mask bounding boxes ) .
"""Load and return ground truth data for an image (image, mask, bounding boxes).

    augment: If true, apply random image augmentation. Currently, only
        horizontal flipping is offered.
    use_mini_mask: If False, returns full-size masks that are the same height
        and width as the original image. These can be big, for example
        1024x1024x100 (for 100 instances). Mini masks are smaller, typically,
        224x224 and are generated by extracting the bounding box of the
        object and resizing it to MINI_MASK_SHAPE.

    Returns:
    image: [height, width, 3]
    image_meta: 
    class_ids: [instance_count] Integer class IDs
    bbox: [instance_count, (y1, x1, y2, x2)]
    mask: [height, width, instance_count]. The height and width are those
        of the image unless use_mini_mask is True, in which case they are
        defined in MINI_MASK_SHAPE.
    part: [height, width]
    """ # Load image and mask # Random horizontal flips. # part = np.fliplr(part) # Bounding boxes. Note that some boxes might be all zeros # if the corresponding mask got cropped out. # bbox: [num_instances, (y1, x1, y2, x2)] # Active classes # Different datasets have different classes, so track the # classes supported in the dataset of this image. # Resize masks to smaller size to reduce memory usage # Image meta data
None
dataset
config
image_id
augment
use_mini_mask