How to use the nyoka.keras.keras_model_to_pmml.KerasNetworkLayer function in nyoka

To help you get started, we’ve selected a few nyoka examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nyoka-pmml / nyoka / nyoka / object_detection / retinanet.py View on Github external
-------
        List of Nyoka's NetworkLayer
        """
        inference_layers= [lay for lay in model.layers[-8:] if lay.__class__.__name__ != "Model"]
        inference_network_layers = list()
        for lay in inference_layers:
            connectLayerIds=list()
            for idx,lay_ in enumerate(lay._inbound_nodes[0].inbound_layers):
                if hasattr(lay_,'layers'):
                    name = lay_.layers[-1].name+"_"+self._pyramid_layers[idx]
                else:
                    name = lay_.name
                connectLayerIds.append(name)
            if lay.__class__.__name__ == 'FilterDetections':
                connectLayerIds = connectLayerIds[:2]
            network_layer=kerasAPI.KerasNetworkLayer(lay,"dataSet",lay.__class__.__name__, connectLayerIds)
            network_layer.connectionLayerId = ", ".join(connectLayerIds)
            inference_network_layers.append(network_layer)
        return inference_network_layers
github nyoka-pmml / nyoka / nyoka / keras / keras_model_to_pmml.py View on Github external
Returns
        -------
        network_layers: Nyoka Object
            PMML network layer object 
        """
        network_layers = []
        model_layers = keras_model.layers
        first_layer = model_layers[0]
        if first_layer.__class__.__name__ != "InputLayer":
            input_layer = self._create_an_input_layer(first_layer, dataSet, script_args)
            if input_layer:
                network_layers.append(input_layer)
        for layer in model_layers:
            layer_type = layer.__class__.__name__
            net_layer = KerasNetworkLayer(layer,dataSet, layer_type,script_args)
            network_layers.append(net_layer)
        return network_layers