Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Returns
-------
Nyoka's LocalTransformations object
"""
apply = pml.Apply(
function='KerasRetinaNet:getBase64StringFromBufferedInput',
FieldRef = [pml.FieldRef(field=self.input_format)],
Constant = [pml.Constant(valueOf_='tf' if self.backbone_name in ['mobilenet', 'densenet'] else 'caffe')]
)
der_fld = pml.DerivedField(
name="base64String",
optype="categorical",
dataType="string",
Apply = apply
)
return pml.LocalTransformations(DerivedField = [der_fld])
def get_output(self):
"""
Generates Output for RetinaNet
Returns
-------
Nyoka's Output object
"""
out_flds = []
out_flds.append(
pml.OutputField(
name="predicted_LabelBoxScore",
dataType="string",
feature="predictedValue",
Extension = [pml.Extension(extender="ADAPA", name="format", value="JSON")]
)
)
return pml.Output(OutputField=out_flds)
def get_local_transformation(self):
"""
Generates Trasformation information for RetinaNet
Returns
-------
Nyoka's LocalTransformations object
"""
apply = pml.Apply(
function='KerasRetinaNet:getBase64StringFromBufferedInput',
FieldRef = [pml.FieldRef(field=self.input_format)],
Constant = [pml.Constant(valueOf_='tf' if self.backbone_name in ['mobilenet', 'densenet'] else 'caffe')]
)
der_fld = pml.DerivedField(
name="base64String",
optype="categorical",
dataType="string",
Apply = apply
)
return pml.LocalTransformations(DerivedField = [der_fld])
def get_output(self):
"""
Generates Output for RetinaNet
Returns
-------
Nyoka's Output object
"""
out_flds = []
out_flds.append(
pml.OutputField(
name="predicted_LabelBoxScore",
dataType="string",
feature="predictedValue",
Extension = [pml.Extension(extender="ADAPA", name="format", value="JSON")]
)
)
return pml.Output(OutputField=out_flds)
def get_local_transformation(self):
"""
Generates Trasformation information for RetinaNet
Returns
-------
Nyoka's LocalTransformations object
"""
apply = pml.Apply(
function='KerasRetinaNet:getBase64StringFromBufferedInput',
FieldRef = [pml.FieldRef(field=self.input_format)],
Constant = [pml.Constant(valueOf_='tf' if self.backbone_name in ['mobilenet', 'densenet'] else 'caffe')]
)
der_fld = pml.DerivedField(
name="base64String",
optype="categorical",
dataType="string",
Apply = apply
)
return pml.LocalTransformations(DerivedField = [der_fld])
def get_training_parameter(self):
"""
Generates TrainingParameters for RetinaNet
Returns
-------
Nyoka's TrainingParameters object
"""
train_param = pml.TrainingParameters(architectureName='retinanet')
return train_param
def __init__(self, pmml):
self.nyoka_pmml = ny.parse(pmml,True)
self.image_input = None
self.layer_input = None
self.model = None
self.layers_outputs = {}
self.model = self._build_model()