コード例 #1
0
def main():
    # 读取原始文件数据,标签
    print("-------读取原始文件数据,标签--------")
    signal_data, signal_labels = readFile(filepath)
    # 将数据和标签的形状进行调整
    print("-----将数据和标签的形状进行调整------")
    signal_re, labels_re = data_reshape(signal_data, signal_labels)
    re_data = pre_data_reshape(signal_re)
    # 数据进行Z-score
    print("----------数据进行Z-score----------")
    z_score_data = more_norm_dataset(re_data)
    # 数据进行1D->2D的转化
    print("--------数据进行1D->2D的转化--------")
    data_1Dto2D = more_dataset_1Dto2D(z_score_data)
    print(data_1Dto2D.shape)
    dict_data = {"data": data_1Dto2D, "labels": labels_re}
    with open('CNN_train.pkl', 'wb') as f:
        pickle.dump(dict_data, f, pickle.HIGHEST_PROTOCOL)
    # 读取.pkl文件
    # with open('CNN_train.pkl', 'rb') as f:
    #     data =  pickle.load(f)
    # data_1Dto2D = data['data']
    # labels_re = data['labels']
    # 开始CNN的训练
    print("-----------开始CNN的训练-----------")
    backward(data_1Dto2D, labels_re)
コード例 #2
0
def main():
    signal_data, signal_labels = readFile(backward.filepath)
    signal_re, labels_re = data_reshape_test(signal_data, signal_labels)
    print("signal_re.shape:")
    print(signal_re.shape)
    print("labels_re.shape:")
    print(labels_re.shape)
    re_data = pre_data_reshape(signal_re)
    print("re_data.shape:")
    print(re_data.shape)
    z_score_data = more_norm_dataset(re_data)
    data_1Dto2D = more_dataset_1Dto2D(z_score_data)
    print("data_1Dto2D.shape:")
    print(data_1Dto2D.shape)
    test(data_1Dto2D, labels_re)
コード例 #3
0
ファイル: test.py プロジェクト: zhaoyanxi/AC
def main():
    signal_data, signal_labels = readFile(backward.filepath)
    signal_re, labels_re = data_reshape_test(signal_data, signal_labels)
    print("signal_re.shape:")
    print(signal_re.shape)
    print("labels_re.shape:")
    print(labels_re.shape)
    re_data = pre_data_reshape(signal_re)
    print("re_data.shape:")
    print(re_data.shape)
    z_score_data = more_norm_dataset(re_data)
    data_1Dto2D = more_dataset_1Dto2D(z_score_data)
    print("data_1Dto2D.shape:")
    print(data_1Dto2D.shape)
    dict_data = {"data": data_1Dto2D, "labels": labels_re}
    with open('CNN_test.pkl', 'wb') as f:
        pickle.dump(dict_data, f, pickle.HIGHEST_PROTOCOL)
    print("okkkkkkkkkkkkk")
コード例 #4
0
ファイル: backward.py プロジェクト: zhaoyanxi/AC
def main():
    # 读取原始文件数据,标签
    print("-------读取原始文件数据,标签--------")
    signal_data, signal_labels = readFile(filepath)
    # 将数据和标签的形状进行调整
    print("-----将数据和标签的形状进行调整------")
    signal_re, labels_re = data_reshape(signal_data, signal_labels)
    re_data = pre_data_reshape(signal_re)
    # 数据进行Z-score
    print("----------数据进行Z-score----------")
    z_score_data = more_norm_dataset(re_data)
    # 数据进行1D->2D的转化
    print("--------数据进行1D->2D的转化--------")
    data_1Dto2D = more_dataset_1Dto2D(z_score_data)
    print(data_1Dto2D.shape)
    # 开始CNN的训练
    print("-----------开始CNN的训练-----------")
    backward(data_1Dto2D, labels_re)