#-------------------------------------------- # Dataset-specific constants and functions + loading #-------------------------------------------- # Useful Constants # Those are separate normalised input features for the neural network # Load "X" (the neural network's training and testing inputs) X_train_signals_paths = "/localSSD/xjc/codalab_train/train/train_train_fc7_feature_new.fea" X_test_signals_paths = "/localSSD/xjc/codalab_train/train/train_valid_fc7_feature_new.fea" y_train_path = "/localSSD/xjc/codalab_train/train/train_y_label_2.fea" y_test_path = "/localSSD/xjc/codalab_train/train/valid_y_label_2.fea" X_train = load_X_pca(X_train_signals_paths) X_test = load_X_pca(X_test_signals_paths) X_train = do_pca(X_train) X_test = do_pca(X_test) y_train = one_hot(load_Y_my(y_train_path)) y_test = one_hot(load_Y_my(y_test_path)) #-------------------------------------------- # Training (maybe multiple) experiment(s) #-------------------------------------------- n_layers_in_highway = 0 n_stacked_layers = 3 trial_name = "{}x{}".format(n_layers_in_highway, n_stacked_layers) for learning_rate in [0.0001]: # [0.01, 0.007, 0.001, 0.0007, 0.0001]: for lambda_loss_amount in [0.005]:
# NOTE: values of exactly 1 (int) for those 2 high-level parameters below totally disables them and result in only 1 starting LSTM. self.n_layers_in_highway = 3 # Number of residual connections to the LSTMs (highway-style), this is did for each stacked block (inside them). self.n_stacked_layers = 3 # Stack multiple blocks of residual # layers. #-------------------------------------------- # Dataset-specific constants and functions + loading #-------------------------------------------- # Useful Constants # Those are separate normalised input features for the neural network X_test_path = "path/to/feature" X_test_result = load_X_pca(X_test_path) X_test_result = do_pca(X_test_result) n_layers_in_highway = 0 n_stacked_layers = 2 trial_name = "{}x{}".format(n_layers_in_highway, n_stacked_layers) class EditedConfig(Config): def __init__(self, X, Y): super(EditedConfig, self).__init__(X, Y) self.n_layers_in_highway = n_layers_in_highway self.n_stacked_layers = n_stacked_layers pred_out = test_with_config(EditedConfig, X_test_result)
#X_test = load_X_my(X_test_signals_paths) X_train_signals_paths = "/home/xujinchang/share/caffe-center-loss/lstm_our_face_correct/vgg16_afewfacetrain_fc6.fea" #X_test_signals_paths = "/home/xujinchang/share/caffe-center-loss/lstm_our_face_correct/vgg16_afewfaceval_fc6.fea" #y_train_path = "/home/xujinchang/share/caffe-center-loss/correct_lstm/lstm_train_label_correct.txt" #y_test_path = "/home/xujinchang/share/caffe-center-loss/correct_lstm/lstm_val_label_correct.txt" #X_train_signals_paths = "/home/xujinchang/share/caffe-center-loss/lstm_afew_face/lbp_vgg16_face_train_fc6.fea" #X_test_signals_paths = "/home/xujinchang/share/caffe-center-loss/lstm_afew_face/lbp_vgg16_face_val_fc6.fea" # X_train_signals_paths = "/home/xujinchang/share/caffe-center-loss/lstm_our_resnet/res34_afewfacetrain.fea" # X_test_signals_paths = "/home/xujinchang/share/caffe-center-loss/lstm_our_resnet/res34_afewfaceval.fea" y_train_path = "/home/xujinchang/share/caffe-center-loss/lstm_afew_face/lbp_afewface_train_label.fea" y_test_path = "/home/xujinchang/share/caffe-center-loss/lstm_afew_face/lbp_afewface_val_label.fea" #y_test_path ="/home/xujinchang/share/caffe-center-loss/lstm_afew_face/our_test_fake_label" X_test_signals_paths = '/home/xujinchang/share/caffe-center-loss/lstm_afew_face/our_vgg16_face_test_fc6.fea' X_train_ori = load_X_pca(X_train_signals_paths) X_test_ori = load_X_pca(X_test_signals_paths) standard = StandardScaler() X_train_norm = standard.fit_transform(X_train_ori) X_test_norm = standard.transform(X_test_ori) pca = PCA(n_components=1024) X_train = pca.fit_transform(X_train_norm) X_test = pca.transform(X_test_norm) #X_train = reshape_pca(X_train_norm) X_valid_result = reshape_pca(X_test) #y_train = one_hot(load_Y_my(y_train_path)) y_test = one_hot(load_Y_my(y_test_path)) #X_valid_result = load_X_pca(X_valid_path) #X_valid_result = do_pca(X_valid_result)
# Dataset-specific constants and functions + loading #-------------------------------------------- # Useful Constants # Those are separate normalised input features for the neural network X_train_signals_paths = "/home/xujinchang/caffe-blur-pose/valid_fc7_feature_new.fea" X_test_signals_paths = "/home/xujinchang/caffe-blur-pose/test_fc7_feature_new.fea" y_train_path = "/home/xujinchang/caffe-blur-pose/valid_y_label_2.fea" y_test_path = "/home/xujinchang/caffe-blur-pose/valid_y_label_2.fea" #X_train = load_X_my(X_train_signals_paths) X_valid_path = "/localSSD/xjc/codalab_train/valid/valid_fc7_feature_new.fea" #X_valid_path = "/localSSD/xjc/codalab_train/test/final_fc7_feature_new.fea" #X_test = load_X_my(X_test_signals_paths) X_valid_result = load_X_pca(X_valid_path) X_valid_result = do_pca(X_valid_result) n_layers_in_highway = 0 n_stacked_layers = 2 trial_name = "{}x{}".format(n_layers_in_highway, n_stacked_layers) class EditedConfig(Config): def __init__(self, X, Y): super(EditedConfig, self).__init__(X, Y) self.n_layers_in_highway = n_layers_in_highway self.n_stacked_layers = n_stacked_layers pred_out = test_with_config(EditedConfig, X_valid_result)