1091 lines (1091 with data), 57.3 kB
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Deep_EEG_BV.ipynb",
"version": "0.3.2",
"provenance": [],
"collapsed_sections": [],
"toc_visible": true,
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/kylemath/DeepEEG/blob/master/notebooks/Deep_EEG_BV.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"metadata": {
"id": "dSd-Wr_qBirE",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"#Connect to Google Drive\n",
"Save your data onto google drive in a folder called \n",
"```\n",
"/data\n",
"```\n"
]
},
{
"metadata": {
"id": "C_4BjLLL6MJ4",
"colab_type": "code",
"outputId": "333aec93-0751-417e-d7d2-195f3cb6a86a",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
}
},
"cell_type": "code",
"source": [
"#mount google drive to load own images, follow link and get code and paste in below\n",
"from google.colab import drive\n",
"drive.mount('/content/gdrive', force_remount=True)\n"
],
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"text": [
"Mounted at /content/gdrive\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "cH7KRd8ZZPMd",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"## DeepEEG\n"
]
},
{
"metadata": {
"id": "KjZu4dFMFHJV",
"colab_type": "code",
"outputId": "2cb94fc8-fc42-4044-9af0-7f66bbf84903",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 683
}
},
"cell_type": "code",
"source": [
"!git clone https://github.com/kylemath/DeepEEG\n",
"!chmod +x ./DeepEEG/install.sh\n",
"%cd DeepEEG\n",
"!./install.sh\n",
"from utils import *\n",
"%matplotlib inline\n",
"%cd .."
],
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"text": [
"fatal: destination path 'DeepEEG' already exists and is not an empty directory.\n",
"/content/DeepEEG\n",
"Requirement already up-to-date: pip in /usr/local/lib/python3.6/dist-packages (19.0.3)\n",
"Requirement already satisfied: absl-py==0.7.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 1)) (0.7.0)\n",
"Requirement already satisfied: astor==0.7.1 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 2)) (0.7.1)\n",
"Requirement already satisfied: cycler==0.10.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 3)) (0.10.0)\n",
"Requirement already satisfied: gast==0.2.2 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 4)) (0.2.2)\n",
"Requirement already satisfied: grpcio==1.18.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 5)) (1.18.0)\n",
"Requirement already satisfied: h5py==2.9.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 6)) (2.9.0)\n",
"Requirement already satisfied: Keras==2.2.4 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 7)) (2.2.4)\n",
"Requirement already satisfied: Keras-Applications==1.0.7 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 8)) (1.0.7)\n",
"Requirement already satisfied: Keras-Preprocessing==1.0.9 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 9)) (1.0.9)\n",
"Requirement already satisfied: kiwisolver==1.0.1 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 10)) (1.0.1)\n",
"Requirement already satisfied: Markdown==3.0.1 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 11)) (3.0.1)\n",
"Requirement already satisfied: matplotlib==3.0.2 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 12)) (3.0.2)\n",
"Requirement already satisfied: mne==0.17.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 13)) (0.17.0)\n",
"Requirement already satisfied: numpy==1.16.1 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 14)) (1.16.1)\n",
"Requirement already satisfied: pandas==0.24.1 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 15)) (0.24.1)\n",
"Requirement already satisfied: protobuf==3.6.1 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 16)) (3.6.1)\n",
"Requirement already satisfied: pyparsing==2.3.1 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 17)) (2.3.1)\n",
"Requirement already satisfied: python-dateutil==2.8.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 18)) (2.8.0)\n",
"Requirement already satisfied: pytz==2018.9 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 19)) (2018.9)\n",
"Requirement already satisfied: PyYAML==4.2b1 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 20)) (4.2b1)\n",
"Requirement already satisfied: scikit-learn==0.20.2 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 21)) (0.20.2)\n",
"Requirement already satisfied: scipy==1.2.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 22)) (1.2.0)\n",
"Requirement already satisfied: six==1.12.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 23)) (1.12.0)\n",
"Requirement already satisfied: sklearn==0.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 24)) (0.0)\n",
"Requirement already satisfied: tensorboard==1.12.2 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 25)) (1.12.2)\n",
"Requirement already satisfied: tensorflow==1.13.0rc1 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 26)) (1.13.0rc1)\n",
"Requirement already satisfied: termcolor==1.1.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 27)) (1.1.0)\n",
"Requirement already satisfied: Werkzeug==0.14.1 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 28)) (0.14.1)\n",
"Requirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from kiwisolver==1.0.1->-r requirements.txt (line 10)) (40.8.0)\n",
"Requirement already satisfied: wheel>=0.26; python_version >= \"3\" in /usr/local/lib/python3.6/dist-packages (from tensorboard==1.12.2->-r requirements.txt (line 25)) (0.33.1)\n",
"Requirement already satisfied: tensorflow-estimator<1.14.0rc0,>=1.13.0rc0 in /usr/local/lib/python3.6/dist-packages (from tensorflow==1.13.0rc1->-r requirements.txt (line 26)) (1.13.0)\n",
"Requirement already satisfied: mock>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-estimator<1.14.0rc0,>=1.13.0rc0->tensorflow==1.13.0rc1->-r requirements.txt (line 26)) (2.0.0)\n",
"Requirement already satisfied: pbr>=0.11 in /usr/local/lib/python3.6/dist-packages (from mock>=2.0.0->tensorflow-estimator<1.14.0rc0,>=1.13.0rc0->tensorflow==1.13.0rc1->-r requirements.txt (line 26)) (5.1.2)\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"Using TensorFlow backend.\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"/content\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "FhkDPfIq1ewa",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"#Load Data, Preprocess, Concatenate\n"
]
},
{
"metadata": {
"id": "jhU8hlcg1e6T",
"colab_type": "code",
"outputId": "aa252ce9-ae9f-45db-8c18-a88e1d741a13",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 6327
}
},
"cell_type": "code",
"source": [
"data_dir = 'gdrive/My Drive/data/'\n",
"exp = 'P3'\n",
"subs = ['001','002','004','005','006','007','008','010']\n",
"#subs = ['002']\n",
"sessions = ['ActiveDry','ActiveWet','PassiveWet']\n",
"nsesh = len(sessions)\n",
"event_id = {'Target':1, 'Standard':2}\n",
"\n",
"epochs = []\n",
"for sub in subs:\n",
" print('Loading data for subject ' + sub)\n",
" for session in sessions:\n",
" #Load Data\n",
" raw = LoadBVData(sub,session,data_dir,exp)\n",
" #Pre-process EEG data\n",
" temp_epochs = PreProcess(raw,event_id,\n",
" emcp_epochs=True, rereference=True,\n",
" plot_erp=False, rej_thresh_uV=1000,\n",
" epoch_time=(-1,2), baseline=(-.2,0),\n",
" epoch_decim=1, filter_range=(1,20)\n",
" )\n",
" if len(temp_epochs) > 0:\n",
" epochs.append(temp_epochs)\n",
" else:\n",
" print('Sub ' + sub + ', Cond ' + \n",
" session + 'all trials rejected')\n",
"\n",
"epochs = concatenate_epochs(epochs)\n"
],
"execution_count": 5,
"outputs": [
{
"output_type": "stream",
"text": [
"Loading data for subject 001\n",
"Loading data for subject number: 001\n",
"Extracting parameters from gdrive/My Drive/data/P3/001_P3_ActiveDry.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 500209 = 0.000 ... 1000.418 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 3', 'Stimulus/S 2', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 5']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 272\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 001\n",
"Extracting parameters from gdrive/My Drive/data/P3/001_P3_ActiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 637129 = 0.000 ... 1274.258 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 293\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 001\n",
"Extracting parameters from gdrive/My Drive/data/P3/001_P3_PassiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 523929 = 0.000 ... 1047.858 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 3', 'Stimulus/S 2', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 5']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 281\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject 002\n",
"Loading data for subject number: 002\n",
"Extracting parameters from gdrive/My Drive/data/P3/002_P3_ActiveDry.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 490009 = 0.000 ... 980.018 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 3', 'Stimulus/S 2', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 5']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 281\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 002\n",
"Extracting parameters from gdrive/My Drive/data/P3/002_P3_ActiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 487989 = 0.000 ... 975.978 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 3', 'Stimulus/S 2', 'Stimulus/S 4', 'Stimulus/S 5', 'Stimulus/S 1']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 290\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 002\n",
"Extracting parameters from gdrive/My Drive/data/P3/002_P3_PassiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 543139 = 0.000 ... 1086.278 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 293\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject 004\n",
"Loading data for subject number: 004\n",
"Extracting parameters from gdrive/My Drive/data/P3/004_P3_ActiveDry.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 643389 = 0.000 ... 1286.778 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 293\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 004\n",
"Extracting parameters from gdrive/My Drive/data/P3/004_P3_ActiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 549039 = 0.000 ... 1098.078 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 293\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 004\n",
"Extracting parameters from gdrive/My Drive/data/P3/004_P3_PassiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 514149 = 0.000 ... 1028.298 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 293\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject 005\n",
"Loading data for subject number: 005\n",
"Extracting parameters from gdrive/My Drive/data/P3/005_P3_ActiveDry.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 489499 = 0.000 ... 978.998 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 5', 'Stimulus/S 2', 'Stimulus/S 3', 'Stimulus/S 4']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 333\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 005\n",
"Extracting parameters from gdrive/My Drive/data/P3/005_P3_ActiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 489169 = 0.000 ... 978.338 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 5', 'Stimulus/S 3', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 302\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 005\n",
"Extracting parameters from gdrive/My Drive/data/P3/005_P3_PassiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 522609 = 0.000 ... 1045.218 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 3', 'Stimulus/S 2', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 5']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 281\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject 006\n",
"Loading data for subject number: 006\n",
"Extracting parameters from gdrive/My Drive/data/P3/006_P3_ActiveDry.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 574439 = 0.000 ... 1148.878 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 290\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 006\n",
"Extracting parameters from gdrive/My Drive/data/P3/006_P3_ActiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 493579 = 0.000 ... 987.158 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 293\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 006\n",
"Extracting parameters from gdrive/My Drive/data/P3/006_P3_PassiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 1977349 = 0.000 ... 3954.698 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 293\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject 007\n",
"Loading data for subject number: 007\n",
"Extracting parameters from gdrive/My Drive/data/P3/007_P3_ActiveDry.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 485409 = 0.000 ... 970.818 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 291\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 007\n",
"Extracting parameters from gdrive/My Drive/data/P3/007_P3_ActiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 493509 = 0.000 ... 987.018 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3', 'Stimulus/S255']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"752 events found\n",
"Event IDs: [ 1 2 3 4 5 10 255]\n",
"Remaining Trials: 293\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 007\n",
"Extracting parameters from gdrive/My Drive/data/P3/007_P3_PassiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 489679 = 0.000 ... 979.358 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 3', 'Stimulus/S 2', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 5']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 281\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject 008\n",
"Loading data for subject number: 008\n",
"Extracting parameters from gdrive/My Drive/data/P3/008_P3_ActiveDry.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 513759 = 0.000 ... 1027.518 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 288\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 008\n",
"Extracting parameters from gdrive/My Drive/data/P3/008_P3_ActiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 516679 = 0.000 ... 1033.358 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 293\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 008\n",
"Extracting parameters from gdrive/My Drive/data/P3/008_P3_PassiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 498499 = 0.000 ... 996.998 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 293\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject 010\n",
"Loading data for subject number: 010\n",
"Extracting parameters from gdrive/My Drive/data/P3/010_P3_ActiveDry.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 566939 = 0.000 ... 1133.878 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 1', 'Stimulus/S 4', 'Stimulus/S 2', 'Stimulus/S 5', 'Stimulus/S 3']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 293\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 010\n",
"Extracting parameters from gdrive/My Drive/data/P3/010_P3_ActiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 499139 = 0.000 ... 998.278 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 5', 'Stimulus/S 1', 'Stimulus/S 3', 'Stimulus/S 4', 'Stimulus/S 2']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 295\n",
"Epochs Eye Movement Correct\n",
"Loading data for subject number: 010\n",
"Extracting parameters from gdrive/My Drive/data/P3/010_P3_PassiveWet.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 510989 = 0.000 ... 1021.978 secs...\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"/content/DeepEEG/utils.py:89: RuntimeWarning: Online software filter detected. Using software filter settings and ignoring hardware values\n",
" preload=True,stim_channel=stim_channel)\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Used Annotations descriptions: ['Stimulus/S 10', 'Stimulus/S 2', 'Stimulus/S 3', 'Stimulus/S 1', 'Stimulus/S 5', 'Stimulus/S 4']\n",
"Sampling Rate = 500.0\n",
"Loading Channel Locations\n",
"Rerefering to average mastoid\n",
"Filtering Data Between 1 and 20 Hz.\n",
"751 events found\n",
"Event IDs: [ 1 2 3 4 5 10]\n",
"Remaining Trials: 291\n",
"Epochs Eye Movement Correct\n",
"6999 matching events found\n",
"Applying baseline correction (mode: mean)\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "pwqD_voiDypa",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"#Run FeatureEngineer\n",
"\n",
"epochs, model_type='NN',\n",
"frequency_domain=False,\n",
"normalization=True, electrode_median=False,\n",
"wavelet_decim=1,flims=(3,30),\n",
"f_bins=20,wave_cycles=3,\n",
"spect_baseline=[-1,-.5],\n",
"electrodes_out=[11,12,13,14,15],\n",
"test_split = 0.2, val_split = 0.2,\n",
"random_seed=1017, watermark = False"
]
},
{
"metadata": {
"id": "i_jYlTW1A6sb",
"colab_type": "code",
"outputId": "ae19af92-ba99-4438-956c-e37ac4131b3a",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 238
}
},
"cell_type": "code",
"source": [
"feats = FeatureEngineer(epochs,model_type='NN',\n",
" electrode_median=True,\n",
" frequency_domain=False)"
],
"execution_count": 11,
"outputs": [
{
"output_type": "stream",
"text": [
"Constructing Time Domain Features\n",
"Computing Median over electrodes\n",
"Normalizing X\n",
"Combined X Shape: (6999, 1000, 1)\n",
"Combined Y Shape: (6999,)\n",
"Y Example (should be 1s & 0s): [1 0 0 1 0 1 1 1 0 1]\n",
"X Range: -48.29169:43.34039\n",
"Input Shape: (1000, 1)\n",
"x_train shape: (4199, 1000, 1)\n",
"4199 train samples\n",
"1400 test samples\n",
"1400 validation samples\n",
"Class Weights: [0.95605647 1.04817773]\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "9ChMvr-jKp8P",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"# Run CreateModel"
]
},
{
"metadata": {
"id": "HFf3rBbJKqHR",
"colab_type": "code",
"outputId": "dc8bdb38-ad26-46aa-fd6b-242cf3815bd1",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1040
}
},
"cell_type": "code",
"source": [
"model, _ = CreateModel(feats)"
],
"execution_count": 9,
"outputs": [
{
"output_type": "stream",
"text": [
"Creating LSTM Model\n",
"Input shape: (1000, 1)\n",
"WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
"Colocations handled automatically by placer.\n",
"WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
"Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"lstm_1 (LSTM) (None, None, 16) 1152 \n",
"_________________________________________________________________\n",
"batch_normalization_1 (Batch (None, None, 16) 64 \n",
"_________________________________________________________________\n",
"activation_1 (Activation) (None, None, 16) 0 \n",
"_________________________________________________________________\n",
"dropout_1 (Dropout) (None, None, 16) 0 \n",
"_________________________________________________________________\n",
"lstm_2 (LSTM) (None, None, 8) 800 \n",
"_________________________________________________________________\n",
"batch_normalization_2 (Batch (None, None, 8) 32 \n",
"_________________________________________________________________\n",
"activation_2 (Activation) (None, None, 8) 0 \n",
"_________________________________________________________________\n",
"dropout_2 (Dropout) (None, None, 8) 0 \n",
"_________________________________________________________________\n",
"lstm_3 (LSTM) (None, None, 4) 208 \n",
"_________________________________________________________________\n",
"batch_normalization_3 (Batch (None, None, 4) 16 \n",
"_________________________________________________________________\n",
"activation_3 (Activation) (None, None, 4) 0 \n",
"_________________________________________________________________\n",
"dropout_3 (Dropout) (None, None, 4) 0 \n",
"_________________________________________________________________\n",
"lstm_4 (LSTM) (None, None, 8) 416 \n",
"_________________________________________________________________\n",
"batch_normalization_4 (Batch (None, None, 8) 32 \n",
"_________________________________________________________________\n",
"activation_4 (Activation) (None, None, 8) 0 \n",
"_________________________________________________________________\n",
"dropout_4 (Dropout) (None, None, 8) 0 \n",
"_________________________________________________________________\n",
"lstm_5 (LSTM) (None, 16) 1600 \n",
"_________________________________________________________________\n",
"batch_normalization_5 (Batch (None, 16) 64 \n",
"_________________________________________________________________\n",
"activation_5 (Activation) (None, 16) 0 \n",
"_________________________________________________________________\n",
"dropout_5 (Dropout) (None, 16) 0 \n",
"_________________________________________________________________\n",
"dense_1 (Dense) (None, 2) 34 \n",
"_________________________________________________________________\n",
"activation_6 (Activation) (None, 2) 0 \n",
"=================================================================\n",
"Total params: 4,418\n",
"Trainable params: 4,314\n",
"Non-trainable params: 104\n",
"_________________________________________________________________\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "-EKBjSapfE4O",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"# TrainTestVal"
]
},
{
"metadata": {
"id": "u6ize7eJfB3J",
"colab_type": "code",
"outputId": "c2486b65-91b9-47ed-dcdb-d6536159d177",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1017
}
},
"cell_type": "code",
"source": [
"TrainTestVal(model, feats)"
],
"execution_count": 10,
"outputs": [
{
"output_type": "stream",
"text": [
"Training Model:\n",
"WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
"Use tf.cast instead.\n",
"Train on 4199 samples, validate on 1400 samples\n",
"Epoch 1/20\n",
"2180/4199 [==============>...............] - ETA: 36:31 - loss: 0.7567 - acc: 0.4972"
],
"name": "stdout"
},
{
"output_type": "error",
"ename": "KeyboardInterrupt",
"evalue": "ignored",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-10-6afb0c2405f4>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mTrainTestVal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeats\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/content/DeepEEG/utils.py\u001b[0m in \u001b[0;36mTrainTestVal\u001b[0;34m(model, feats, batch_size, train_epochs, show_plots)\u001b[0m\n\u001b[1;32m 868\u001b[0m \u001b[0mshuffle\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 869\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 870\u001b[0;31m \u001b[0mclass_weight\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfeats\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclass_weights\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 871\u001b[0m )\n\u001b[1;32m 872\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python3.6/dist-packages/keras/engine/training.py\u001b[0m in \u001b[0;36mfit\u001b[0;34m(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, **kwargs)\u001b[0m\n\u001b[1;32m 1037\u001b[0m \u001b[0minitial_epoch\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0minitial_epoch\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1038\u001b[0m \u001b[0msteps_per_epoch\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msteps_per_epoch\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1039\u001b[0;31m validation_steps=validation_steps)\n\u001b[0m\u001b[1;32m 1040\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1041\u001b[0m def evaluate(self, x=None, y=None,\n",
"\u001b[0;32m/usr/local/lib/python3.6/dist-packages/keras/engine/training_arrays.py\u001b[0m in \u001b[0;36mfit_loop\u001b[0;34m(model, f, ins, out_labels, batch_size, epochs, verbose, callbacks, val_f, val_ins, shuffle, callback_metrics, initial_epoch, steps_per_epoch, validation_steps)\u001b[0m\n\u001b[1;32m 197\u001b[0m \u001b[0mins_batch\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mins_batch\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtoarray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 198\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 199\u001b[0;31m \u001b[0mouts\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mins_batch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 200\u001b[0m \u001b[0mouts\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mto_list\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mouts\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0ml\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mo\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mzip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mout_labels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mouts\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 2713\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_legacy_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2714\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2715\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2716\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2717\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mpy_any\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mis_tensor\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[0;32min\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py\u001b[0m in \u001b[0;36m_call\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 2673\u001b[0m \u001b[0mfetched\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_callable_fn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0marray_vals\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrun_metadata\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_metadata\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2674\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2675\u001b[0;31m \u001b[0mfetched\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_callable_fn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0marray_vals\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2676\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mfetched\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moutputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2677\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1437\u001b[0m ret = tf_session.TF_SessionRunCallable(\n\u001b[1;32m 1438\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_session\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_session\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_handle\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatus\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1439\u001b[0;31m run_metadata_ptr)\n\u001b[0m\u001b[1;32m 1440\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrun_metadata\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1441\u001b[0m \u001b[0mproto_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf_session\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTF_GetBuffer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrun_metadata_ptr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
]
}
]
}
]
}