Closed quzhouxiachuan closed 6 years ago
Hi
I solved the problem by change
pds = EcgDataset(path=os.path.join(PATH_TO_DATA, "*.hea"), no_ext=True, sort=True)
to
import cardio.dataset as ds
index = ds.FilesIndex(path="../cardio/tests/data/*.hea", no_ext=True, sort=True)
from cardio import EcgBatch
pds = ds.Dataset(index, batch_class=EcgBatch)
I am wondering what is causing this?
Thanks!
Hi!
Currently cardio/tests/data/
directory contains different ECG's to run tests. There are two types of signals in wfdb
format: Axxxxx
files from PhysioNet Challenge 2017 Database and one signal sel100
from QT Database.
For AF detection you should use data from PhysioNet Challenge 2017. As it is mentioned in the tutorial, we recommend you to download the database from here or use signals from cardio/test/data/
with mask A*.hea
.
Changing
pds = EcgDataset(path=os.path.join(PATH_TO_DATA, "*.hea"), no_ext=True, sort=True)
to
import cardio.dataset as ds
index = ds.FilesIndex(path="../cardio/tests/data/*.hea", no_ext=True, sort=True)
from cardio import EcgBatch
pds = ds.Dataset(index, batch_class=EcgBatch)
should not make any difference.
It seems that the code above worked by accident: you performed splitting with shuffle
pds.cv_split(0.8, shuffle=True)
and index sel100
, which caused the problem, happened to be in pds.test
, thus allowing you to run training without any errors.
Hi I ran into trouble when trying the II.pipelines script. I used the tests/data dataset as my input. Could you please help with that?
import os
from cardio import EcgDataset
PATH_TO_DATA = "../cardio/tests/data" #set path to data
pds = EcgDataset(path=os.path.join(PATH_TO_DATA, "*.hea"), no_ext=True, sort=True)
pds.cv_split(0.8, shuffle=True)
from cardio.pipelines import dirichlet_train_pipeline
%env CUDA_VISIBLE_DEVICES=0
AF_SIGNALS_REF = os.path.join(PATH_TO_DATA, "REFERENCE.csv")
pipeline = dirichlet_train_pipeline(AF_SIGNALS_REF, batch_size=256, n_epochs=500)
trained = (pds.train >> pipeline).run()
TypeError Traceback (most recent call last)