{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "ename": "AttributeError", "evalue": "module 'tensorflow' has no attribute 'keras'", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[72], line 9\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mshutil\u001b[39;00m\n\u001b[0;32m 8\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mgradio\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mgr\u001b[39;00m\n\u001b[1;32m----> 9\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmodels\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01minception\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[0;32m 10\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mscipy\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01msignal\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m resample\n", "File \u001b[1;32mc:\\Users\\Bjorn\\Documents\\HuggingFace\\Age-and-gender-prediction-from-ECG\\models\\inception.py:78\u001b[0m\n\u001b[0;32m 69\u001b[0m x \u001b[38;5;241m=\u001b[39m tf\u001b[38;5;241m.\u001b[39mkeras\u001b[38;5;241m.\u001b[39mlayers\u001b[38;5;241m.\u001b[39mActivation(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrelu\u001b[39m\u001b[38;5;124m\"\u001b[39m)(x)\n\u001b[0;32m 70\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m x\n\u001b[0;32m 73\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mbuild_age_model\u001b[39m(\n\u001b[0;32m 74\u001b[0m input_shape: Tuple[\u001b[38;5;28mint\u001b[39m, \u001b[38;5;28mint\u001b[39m],\n\u001b[0;32m 75\u001b[0m nb_classes: \u001b[38;5;28mint\u001b[39m,\n\u001b[0;32m 76\u001b[0m depth: \u001b[38;5;28mint\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m6\u001b[39m,\n\u001b[0;32m 77\u001b[0m use_residual: \u001b[38;5;28mbool\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m,\n\u001b[1;32m---> 78\u001b[0m )\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[43mtf\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkeras\u001b[49m\u001b[38;5;241m.\u001b[39mmodels\u001b[38;5;241m.\u001b[39mModel:\n\u001b[0;32m 79\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 80\u001b[0m \u001b[38;5;124;03m Model proposed by HI Fawas et al 2019 \"Finding AlexNet for Time Series Classification - InceptionTime\"\u001b[39;00m\n\u001b[0;32m 81\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m 82\u001b[0m input_layer \u001b[38;5;241m=\u001b[39m tf\u001b[38;5;241m.\u001b[39mkeras\u001b[38;5;241m.\u001b[39mlayers\u001b[38;5;241m.\u001b[39mInput(input_shape)\n", "\u001b[1;31mAttributeError\u001b[0m: module 'tensorflow' has no attribute 'keras'" ] } ], "source": [ "import numpy as np\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "from scipy import signal\n", "import os\n", "import wfdb\n", "import shutil\n", "import gradio as gr\n", "from models.inception import *" ] }, { "cell_type": "code", "execution_count": 64, "metadata": {}, "outputs": [], "source": [ "df= pd.read_csv(\"../../apple_health_export/electrocardiograms/ecg_2021-10-16.csv\", skiprows=12, sep=\";\", header=None, decimal=',')" ] }, { "cell_type": "code", "execution_count": 65, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | 0 | \n", "
---|---|
0 | \n", "−42,893 | \n", "
1 | \n", "−44,534 | \n", "
2 | \n", "−45,538 | \n", "
3 | \n", "−45,409 | \n", "
4 | \n", "−43,299 | \n", "
... | \n", "... | \n", "
15355 | \n", "−35,489 | \n", "
15356 | \n", "−35,851 | \n", "
15357 | \n", "−37,251 | \n", "
15358 | \n", "−39,057 | \n", "
15359 | \n", "−40,96 | \n", "
15360 rows × 1 columns
\n", "