@tensorleap_load_model

code_loader.inner_leap_binder.leapbinder_decorators.tensorleap_load_model

import os
from code_loader.contract.datasetclasses import PredictionTypeHandler
from code_loader.inner_leap_binder.leapbinder_decorators import tensorleap_load_model
import tensorflow as tf


prediction_type1 = PredictionTypeHandler('classes',[str(i) for i in range(10)])

@tensorleap_load_model([prediction_type1])
def load_model():
    dir_path = os.path.dirname(os.path.abspath(__file__))
    model_path = 'model/model.h5'
    cnn = tf.keras.models.load_model(os.path.join(dir_path, model_path))
    return cnn
    
Args

prediction_types

(Optional, List[PredictionTypeHandler]) This property defines the outputs of the model uploaded to Tensorleap: their names, labels, and channels_dim (=1 for channels first and =-1 for channels last).

PredictionTypes Examples

MNIST example

One output, which we name classes that has 10 channels, each a logit for the classification of a digit

YOLO example

Four outputs:

  • a conctatenated prediction with #channels = 4 + #classes

  • Three scales, with #channels of 20,40,80

Last updated

Was this helpful?