lstm.py
def load_model(self) -> Tuple[int,int]:
        """ Load an already existing model.
            Return parameters (n_ts_in, n_features), which are retrieved from the loaded model.
        """

        path = self.model_dir + "/" + self.name
        n_ts_in = 0
        n_features = 0

        # load model's architecture
        with open(path + "/" + self.name + ".json", "r") as input_file:
            model_json_dict = json.load(input_file)
        
        for layer in model_json_dict["config"]["layers"]:
            if layer["class_name"] == "InputLayer":
                batch_input_shape = layer["config"]["batch_input_shape"]
                n_ts_in = batch_input_shape[1]
                n_features = batch_input_shape[2]

        self.model = keras.models.model_from_json(json.dumps(model_json_dict))

        # load model's weights
        self.model.load_weights(path + "/" + self.name + ".hdf5")

        self.model.compile(loss="categorical_crossentropy",
                optimizer=keras.optimizers.Adam(lr=0.01),
                metrics=["accuracy"])

        # self.model.summary()

        return n_ts_in, n_features
 Load an already existing model.
            Return parameters (n_ts_in, n_features), which are retrieved from the loaded model.
        
Load an already existing model.
Return parameters (n_ts_in, n_features), which are retrieved from the loaded model.
Load an already existing model . Return parameters ( n_ts_in n_features ) which are retrieved from the loaded model .
def load_model(self) -> Tuple[int,int]:
        path = self.model_dir + "/" + self.name
        n_ts_in = 0
        n_features = 0
        with open(path + "/" + self.name + ".json", "r") as input_file:
            model_json_dict = json.load(input_file)
        for layer in model_json_dict["config"]["layers"]:
            if layer["class_name"] == "InputLayer":
                batch_input_shape = layer["config"]["batch_input_shape"]
                n_ts_in = batch_input_shape[1]
                n_features = batch_input_shape[2]
        self.model = keras.models.model_from_json(json.dumps(model_json_dict))
        self.model.load_weights(path + "/" + self.name + ".hdf5")
        self.model.compile(loss="categorical_crossentropy",
                optimizer=keras.optimizers.Adam(lr=0.01),
                metrics=["accuracy"])
        return n_ts_in, n_features
def load_model ( self ) -> Tuple [ int , int ] : path = self . model_dir + "/" + self . name n_ts_in = 0 n_features = 0 with open ( path + "/" + self . name + ".json" , "r" ) as input_file : model_json_dict = json . load ( input_file ) for layer in model_json_dict [ "config" ] [ "layers" ] : if layer [ "class_name" ] == "InputLayer" : batch_input_shape = layer [ "config" ] [ "batch_input_shape" ] n_ts_in = batch_input_shape [ 1 ] n_features = batch_input_shape [ 2 ] self . model = keras . models . model_from_json ( json . dumps ( model_json_dict ) ) self . model . load_weights ( path + "/" + self . name + ".hdf5" ) self . model . compile ( loss = "categorical_crossentropy" , optimizer = keras . optimizers . Adam ( lr = 0.01 ) , metrics = [ "accuracy" ] ) return n_ts_in , n_features
Load an already existing model.
Load an already existing model .
""" Load an already existing model.
            Return parameters (n_ts_in, n_features), which are retrieved from the loaded model.
        """ # load model's architecture
 # load model's weights
 # self.model.summary()

self