Exemplo n.º 1
0
    def __init__(self, model, settings):
        self._preprocessors = model['preprocess']
        self._model = deepnet_model(model, settings)

        outex = get_output_exposition(model)

        try:
            self._classes = outex['values']
        except KeyError:
            self._classes = None
Exemplo n.º 2
0
def image_model(network, input_settings):
    settings = ensure_settings(input_settings)

    if is_yolo_model(network):
        model = box_detector(network, settings)
    else:
        model = deepnet_model(network, settings)

    if settings.load_pretrained_weights:
        load_pretrained_weights(model, network['image_network'])

    return model
Exemplo n.º 3
0
    def __init__(self, model, settings):
        super().__init__(model, settings)

        if isinstance(model, dict):
            outex = get_output_exposition(model)

            try:
                self._classes = outex["values"]
            except KeyError:
                self._classes = None

            self._preprocessors = model["preprocess"]
            self._model = deepnet_model(model, settings)

        # Pretrained image networks should be the only thing missing
        # this `_preprocessors` attribute
        if getattr(self, "_preprocessors", None) is None:
            self._preprocessors = [{"type": IMAGE, "index": 0}]

        self._ncolumns, self._nimages = count_types(self._preprocessors)