Beispiel #1
0
def TBPP512(input_shape=(512, 512, 3), softmax=True):
    """TextBoxes++512 architecture.

    # Arguments
        input_shape: Shape of the input image.
    
    # References
        - [TextBoxes++: A Single-Shot Oriented Scene Text Detector](https://arxiv.org/abs/1801.02765)
    """

    # SSD body
    x = input_tensor = Input(shape=input_shape)
    source_layers = ssd512_body(x)

    num_maps = len(source_layers)

    # Add multibox head for classification and regression
    num_priors = [14] * num_maps
    normalizations = [1] * num_maps
    output_tensor = multibox_head(source_layers, num_priors, normalizations,
                                  softmax)
    model = Model(input_tensor, output_tensor)

    # parameters for prior boxes
    model.image_size = input_shape[:2]
    model.source_layers = source_layers

    model.aspect_ratios = [[1, 2, 3, 5, 1 / 2, 1 / 3, 1 / 5] * 2] * num_maps
    #model.shifts = [[(0.0, 0.0)] * 7 + [(0.0, 0.5)] * 7] * num_maps
    model.shifts = [[(0.0, -0.25)] * 7 + [(0.0, 0.25)] * 7] * num_maps
    model.special_ssd_boxes = False
    model.scale = 0.5

    return model
Beispiel #2
0
def SL512(input_shape=(512, 512, 3), softmax=True):
    """SegLink512 architecture.

    # Arguments
        input_shape: Shape of the input image.

    # References
        https://arxiv.org/abs/1703.06520
    """
    
    # SSD body
    x = input_tensor = Input(shape=input_shape)
    source_layers = ssd512_body(x)
    
    # Add multibox head for classification and regression
    num_priors = [1, 1, 1, 1, 1, 1, 1]
    normalizations = [20, -1, -1, -1, -1, -1, -1]
    output_tensor = multibox_head(source_layers, num_priors, normalizations, softmax)
    model = Model(input_tensor, output_tensor)
    
    # parameters for prior boxes
    model.image_size = input_shape[:2]
    model.source_layers = source_layers
    
    return model