Ejemplo n.º 1
0
    def __init__(self, network, settings):
        self._settings = settings
        self._input_shape = get_image_shape(network)

        if self._settings.rescale_type is None:
            net_meta = network["metadata"]
            self._settings.rescale_type = net_meta.get("rescale_type", WARP)
Ejemplo n.º 2
0
def reader_for_network(network_name, additional_settings):
    extras = dict(EXTRA_PARAMS)

    if additional_settings:
        extras.update(additional_settings)

    image_shape = get_image_shape(get_pretrained_network(network_name))
    return make_image_reader(Settings(extras), image_shape, False)
Ejemplo n.º 3
0
def reader_for_network(network_name, additional_settings):
    extras = dict(EXTRA_PARAMS)

    if additional_settings:
        extras.update(additional_settings)

    settings = Settings(extras)
    image_shape = get_image_shape(get_pretrained_network(network_name))
    return make_image_reader("file", image_shape, TEST_IMAGE_DATA, settings)
Ejemplo n.º 4
0
    def __init__(self, network, nclasses):
        self._nclasses = nclasses
        self._input_size = get_image_shape(network)[1]
        self._layers = network["layers"]

        self._branches = []

        for branch in yolo_outputs(network):
            d_info = [branch[k] for k in ["strides", "anchors", "xyscale"]]
            self._branches.append((branch["input"], d_info))
Ejemplo n.º 5
0
    def __init__(self, network, nclasses, settings):
        self._nclasses = nclasses
        self._input_shape = get_image_shape(network)[1:3]

        ob = yolo_outputs(network)
        self._strides = tuple(
            [self._input_shape[0] // b["strides"] for b in ob])
        self._nanchors = tuple([len(b["anchors"]) for b in ob])

        self._unfiltered = settings.output_unfiltered_boxes
        self._threshold = settings.bounding_box_threshold or SCORE_THRESHOLD
        self._iou_threshold = settings.iou_threshold or IOU_THRESHOLD
        self._max_objects = settings.max_objects or MAX_OBJECTS
Ejemplo n.º 6
0
    def __init__(self, network, nclasses):
        super(YoloBranches, self).__init__()

        self._nclasses = nclasses
        self._input_size = get_image_shape(network)[1]
        self._branches = []

        assert network['layers'][-1]['type'] == 'yolo_output_branches'
        out_branches = network['layers'][-1]

        for i, branch in enumerate(out_branches['output_branches']):
            idx = branch['input']
            d_info = [branch[k] for k in ['strides', 'anchors', 'xyscale']]
            layers = make_sequence(branch['convolution_path'], LAYER_FUNCTIONS)

            self._branches.append((idx, d_info, layers))
Ejemplo n.º 7
0
    def __init__(self, network, nclasses, settings):
        super(BoxLocator, self).__init__()

        assert network['layers'][-1]['type'] == 'yolo_output_branches'

        self._nclasses = nclasses
        self._input_shape = get_image_shape(network)[1:3]

        ob = network['layers'][-1]['output_branches']
        self._strides = tuple(
            [self._input_shape[0] // b['strides'] for b in ob])
        self._nanchors = tuple([len(b['anchors']) for b in ob])

        self._unfiltered = settings.output_unfiltered_boxes
        self._threshold = settings.bounding_box_threshold or SCORE_THRESHOLD
        self._iou_threshold = settings.iou_threshold or IOU_THRESHOLD
        self._max_objects = settings.max_objects or MAX_OBJECTS
Ejemplo n.º 8
0
    def __init__(self, network, settings):
        super(ImageReader, self).__init__()

        self._input_shape = get_image_shape(network)
        self._settings = settings