赞
踩
数据集:一个是公开数据集,一个自己做实验
自己做实验,一方面设备昂贵不够准确,另一方面公信力不够,更多用公开数据
但deap数据集申请时间长难度大,就网站有偿找了一份,用代码跑了一遍。
DEAP 数据集
数据集与相关的代码 链接
data_preprocessed_python
提取处理函数
- def save_all_labels_into_file():
- x = pickle.load(open('D:\eng\data_preprocessed_python\s01.dat', 'rb'), encoding='latin1') # dict
- labels = x['labels']
- valence_and_arousal = (labels[:, [0, 1]] - 5) / 4
- labelswithanglesandemotions = append_angle_and_emotion(valence_and_arousal)
- for i in range(2, 33):
- x = pickle.load(
- open('D:\eng\data_preprocessed_python\s' + str(i).zfill(2) + '.dat', 'rb'), encoding='latin1') # dict
- labels = x['labels'] # numpy.ndarray
- # valence,arousal,dominance,liking
- valence_and_arousal = (labels[:, [0, 1]] - 5) / 4
- labelswithanglesandemotions = numpy.concatenate(
- (labelswithanglesandemotions, append_angle_and_emotion(valence_and_arousal)), 0)
- with open('D:\eng\data_preprocessed_python\labels.txt', 'wb') as outfile:
- numpy.savetxt(outfile, labelswithanglesandemotions, "%.2f")
SEED数据集
数据提取代码
- from utils.tools import build_preprocessed_eeg_dataset_CNN, RawEEGDataset, subject_independent_data_split
- import torch
- import torch.nn as nn
- from torch.utils.data import DataLoader
- from torch.utils.tensorboard import SummaryWriter
-
-
- # 加载数据,整理成所需要的格式
- folder_path = '../data/Preprocessed_EEG/'
- feature_vector_dict, label_dict = build_preprocessed_eeg_dataset_CNN(folder_path)
- train_feature, train_label, test_feature, test_label = subject_independent_data_split(feature_vector_dict, label_dict,
- {'2', '6', '9'})
-
- desire_shape = [1, 62, 200]
- train_data = RawEEGDataset(train_feature, train_label, desire_shape)
- test_data = RawEEGDataset(test_feature, test_label, desire_shape)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。