Example #1
0
def get_phase_data_list(data_df, fft_len, fft_hop, height):
    spectrogram.set_param(fft_len=fft_len,
                          fft_hop=fft_hop,
                          img_height=height,
                          sample_len=2000)
    data_list = spectrogram.get_phase_data_list(data_df)
    return data_list
Example #2
0
def get_phase_fold(fold):
    train_df, vali_df = get_fold(fold=fold)
    class_weights = get_class_weights(train_df)

    spectrogram.set_param(fft_len=fft_len,
                          fft_hop=fft_hop,
                          img_height=height,
                          sample_len=2000)
    train_list = spectrogram.get_phase_data_list(train_df)
    vali_list = spectrogram.get_phase_data_list(vali_df)
    return train_list, vali_list, class_weights
Example #3
0
def get_mgd_phase_data(data_df, fft_len, fft_hop, height):
    spectrogram.set_param(fft_len=fft_len, fft_hop=fft_hop, sample_len=2000)
    data_phase, labels = spectrogram.get_phase_data(data_df)

    MGD.set_param(fft_len=fft_len, fft_hop=fft_hop, sample_len=2000)
    data_mgd, labels = MGD.get_data(data_df, gamma, alpha)

    data_phase = np.expand_dims(data_phase, axis=1)
    data_mgd = np.expand_dims(data_mgd, axis=1)
    data_phase = data_phase[:, :, 0:height, :]
    data_mgd = data_mgd[:, :, 0:height, :]

    data_comb = np.append(data_phase, data_mgd, axis=1)
    return data_comb, labels
Example #4
0
def get_comb1_data_list(data_df, fft_len, fft_hop, height):
    #get combined data
    MGD.set_param(fft_len=fft_len,
                  fft_hop=fft_hop,
                  img_height=height,
                  sample_len=2000)
    data_list_MGD = MGD.get_data_list(data_df)

    spectrogram.set_param(fft_len=fft_len,
                          fft_hop=fft_hop,
                          img_height=height,
                          sample_len=2000)
    data_list_mag = spectrogram.get_spectro_data_list(data_df)

    data_list = get_comb1_data(data_list_mag, data_list_MGD)
    return data_list
Example #5
0
def get_mag_phase_data(train_df, vali_df, fft_len, fft_hop, height):
    spectrogram.set_param(fft_len=fft_len, fft_hop=fft_hop, sample_len=2000)
    train_data_mag, train_labels = spectrogram.get_spectro_data(train_df)
    vali_data_mag, vali_labels = spectrogram.get_spectro_data(vali_df)

    train_data_phase, train_labels = spectrogram.get_phase_data(train_df)
    vali_data_phase, vali_labels = spectrogram.get_phase_data(vali_df)

    train_data_mag = np.expand_dims(train_data_mag, axis=1)
    train_data_phase = np.expand_dims(train_data_phase, axis=1)
    vali_data_mag = np.expand_dims(vali_data_mag, axis=1)
    vali_data_phase = np.expand_dims(vali_data_phase, axis=1)

    train_data_mag = train_data_mag[:, :, 0:height, :]
    vali_data_mag = vali_data_mag[:, :, 0:height, :]
    train_data_phase = train_data_phase[:, :, 0:height, :]
    vali_data_phase = vali_data_phase[:, :, 0:height, :]

    train_data_comb = np.append(train_data_mag, train_data_phase, axis=1)
    vali_data_comb = np.append(vali_data_mag, vali_data_phase, axis=1)
    return train_data_comb, vali_data_comb, train_labels, vali_labels
Example #6
0
def get_autokeras_comb2_data(data_df, fft_len, fft_hop, height):
    #get combined data
    MGD.set_param(fft_len=fft_len,
                  fft_hop=fft_hop,
                  img_height=height,
                  sample_len=2000)
    data_list_MGD = MGD.get_data_list(data_df)

    spectrogram.set_param(fft_len=fft_len,
                          fft_hop=fft_hop,
                          img_height=height,
                          sample_len=2000)
    data_list_mag = spectrogram.get_spectro_data_list(data_df)

    data_list = helper.get_comb2_data(data_list_mag, data_list_MGD)

    data = []
    labels = []
    for d in data_list:
        data.append(d[0])
        labels.append(np.argmax(d[1]))

    return np.array(data), np.array(labels)
Example #7
0
def get_mag_data_list(data_df, fft_len, fft_hop, height):
    spectrogram.set_param(fft_len, fft_hop, height, 2000)
    data_list = spectrogram.get_spectro_data_list(data_df)
    return data_list