def start(): config = DataConfig() histories = sorted(glob.glob(config.history_location + "*.pickle")) data = {} for hist in histories: file = open(hist, 'rb') h = pickle.loads(pickle.load(file)) for k, v in h.items(): if k not in data.keys(): data[k] = [] for item in v: data[k].append(item) for i, kv in enumerate(data.items()): plt.subplot(1, len(data), i + 1) plt.title(kv[0]) plt.plot(kv[1]) plt.show()
def test(): config = ModelConfig() data = get_audio_data(config, '../data/audio/train', '../data/audio/train_wav') data_config = DataConfig() X1, X2, labels = get_dataset(data_config, config)
img0 = img_to_array(img0) img1 = img_to_array(img1) img0 = rgb_to_hsv(img0) img1 = rgb_to_hsv(img1) img = img1[:, :, 2] - img0[:, :, 2] img = rescale_intensity(img, in_range=(-255, 255), out_range=(0, 255)) img = np.array(img, dtype=np.uint8) X[i - num_channels, :, :, j] = img return X, np.array(df["angle"].iloc[num_channels:]) if __name__ == "__main__": config = DataConfig() data_path = config.data_path row, col = config.img_height, config.img_width num_channels = config.num_channels # print "Pre-processing phase 1 data..." # X_train, y_train = make_hsv_grayscale_diff_data("data/train_round1.txt", 4) # np.save("{}/X_train_round1_hsv_gray_diff_ch4".format(data_path), X_train) # np.save("{}/y_train_round1_hsv_gray_diff_ch4".format(data_path), y_train) # X_val, y_val = make_hsv_grayscale_diff_data("data/val_round1.txt", 4) # np.save("{}/X_train_round1_hsv_gray_diff_ch4".format(data_path), X_val) # np.save("{}/y_train_round1_hsv_gray_diff_ch4".format(data_path), y_val) print "Pre-processing phase 2 data..." for i in range(1, 6):
''' Data preparation ''' # coding: utf-8 # Setup import pandas as pd import itertools import pickle from config import DataConfig # Load data data_config = DataConfig() train_df = pd.read_csv(data_config.data_source + "/train.all", sep="\t", engine='python', header=None, skiprows=0, names=[ "Class", "Text", "Phone_CZ", "Phone_EN", "Phone_HU", "Phone_RU", "Embed" ]) test_df = pd.read_csv(data_config.data_source + "/dev.all", sep="\t", engine='python', header=None, skiprows=0, names=[ "Class", "Text", "Phone_CZ", "Phone_EN", "Phone_HU",