pre_file = 'incept_temporal{}_{}'.format(temp_rate, n_neurons) if train & (not retrain): weights = 'imagenet' else: weights = None if args.fine == 1: fine = True else: fine = False result_model = models.InceptionTemporal(n_neurons=n_neurons, seq_len=seq_len, classes=classes, weights=weights, dropout=dropout, fine=fine, retrain=retrain, pre_file=pre_file, old_epochs=old_epochs, cross_index=cross_index) if (args.summary == 1): result_model.summary() sys.exit() lr = args.lr decay = args.decay result_model.compile(loss='categorical_crossentropy', optimizer=optimizers.SGD(lr=lr, decay=decay,
model_s = models.InceptionSpatial(n_neurons=n_neurons, seq_len=seq_len, classes=classes, weights=None, dropout=dropout, fine=False, retrain=False, pre_file=pre_file, old_epochs=old_epochs, cross_index=cross_index) model_t = models.InceptionTemporal(n_neurons=n_neurons, seq_len=seq_len, classes=classes, weights=None, dropout=dropout, fine=False, retrain=False, pre_file=pre_file, old_epochs=old_epochs, cross_index=cross_index) print(glob.glob('weights/' + pre_file + '-{:2d}*.hdf5'.format(epochs))[-1]) model_s.load_weights( glob.glob('weights/' + pre_file + '-{:2d}*.hdf5'.format(epochs))[-1]) #model_s.summary() weights = model_s.layers[1].get_weights() #print(len(weights)) weights_0 = weights[0] print(np.asarray(weights_0).shape)