stride = 1 SHAPE = ( 84, 84, k ) # height * width * channel This cannot read from file and needs to be provided here if not predict_mode: # if train import input_utils as IU, misc_utils as MU expr = MU.BMU.ExprCreaterAndResumer(MODEL_DIR, postfix='pKf_dp%.2f_k%ds%d' % (dropout, k, stride)) expr.redirect_output_to_logfile_if_not_on("eldar-11") else: import all_py_files_snapshot.input_utils as IU, all_py_files_snapshot.misc_utils as MU MU.BMU.save_GPU_mem_keras() MU.keras_model_serialization_bug_fix() if resume_model: model = expr.load_weight_and_training_config_and_state() expr.printdebug("Checkpoint found. Resuming model at %s" % expr.dir_lasttime) else: ############################### # Architecture of the network # ############################### inputs = L.Input(shape=SHAPE) x = inputs # inputs is used by the line "Model(inputs, ... )" below conv1 = L.Conv2D(32, (8, 8), strides=4, padding='valid') x = conv1(x)
def __init__(self, modelfile, meanfile): MU.keras_model_serialization_bug_fix() self.model = K.models.load_model( modelfile) # this var stores the Keras Model self.mean = np.load(meanfile)