Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hmm_preprocessing_pipeline(); FileNotFoundError(2, 'No such file or directory')]) #10

Closed
quzhouxiachuan opened this issue Feb 2, 2018 · 5 comments

Comments

@quzhouxiachuan
Copy link

Hi

I ran into the following question when trying to run tutorial III and had the following errors. I checked the ../cardio/tests/data directory, which is directly from github repository, there are files existing. I am not sure where went wrong, could you please help with that?

Thanks!

import sys, os
sys.path.append('..')

from cardio import EcgDataset

SIGNALS_PATH = "../cardio/tests/data" #set path to the QT database
SIGNALS_MASK = os.path.join(SIGNALS_PATH, "*.hea")
dtst = EcgDataset(path=SIGNALS_MASK, no_ext=True, sort=True)

from cardio.pipelines import hmm_preprocessing_pipeline, hmm_train_pipeline
import warnings
warnings.filterwarnings('ignore')

pipeline = hmm_preprocessing_pipeline()
ppl_inits = (dtst >> pipeline).run()


RuntimeError Traceback (most recent call last)
in ()
4
5 pipeline = hmm_preprocessing_pipeline()
----> 6 ppl_inits = (dtst >> pipeline).run()

~/anaconda3/lib/python3.6/site-packages/cardio/dataset/dataset/pipeline.py in run(self, *args, **kwargs)
1086 if len(args) == 0 and len(kwargs) == 0:
1087 args, kwargs = self._lazy_run
-> 1088 for _ in self.gen_batch(*args, **kwargs):
1089 pass
1090 return self

~/anaconda3/lib/python3.6/site-packages/cardio/dataset/dataset/pipeline.py in gen_batch(self, batch_size, shuffle, n_epochs, drop_last, prefetch, on_iter, *args, **kwargs)
1033 for batch in batch_generator:
1034 try:
-> 1035 batch_res = self._exec(batch)
1036 except SkipBatchException:
1037 pass

~/anaconda3/lib/python3.6/site-packages/cardio/dataset/dataset/pipeline.py in _exec(self, batch, new_loop)
577 asyncio.set_event_loop(asyncio.new_event_loop())
578 batch.pipeline = self
--> 579 batch_res = self._exec_all_actions(batch)
580 batch_res.pipeline = self
581 return batch_res

~/anaconda3/lib/python3.6/site-packages/cardio/dataset/dataset/pipeline.py in _exec_all_actions(self, batch, action_list)
563 join_batches = None
564
--> 565 batch = self._exec_one_action(batch, _action, _action_args, _action['kwargs'])
566
567 batch.pipeline = self

~/anaconda3/lib/python3.6/site-packages/cardio/dataset/dataset/pipeline.py in _exec_one_action(self, batch, action, args, kwargs)
514 batch.pipeline = self
515 action_method, _ = self._get_action_method(batch, action['name'])
--> 516 batch = action_method(*args, **kwargs)
517 batch.pipeline = self
518 return batch

~/anaconda3/lib/python3.6/site-packages/cardio/dataset/dataset/decorators.py in _action_wrapper(action_self, *args, **kwargs)
35 action_self.pipeline.get_variable(_lock_name).acquire()
36
---> 37 _res = action_method(action_self, *args, **kwargs)
38
39 if _use_lock is not None:

~/anaconda3/lib/python3.6/site-packages/cardio/core/ecg_batch.py in load(self, src, fmt, components, ann_ext, *args, **kwargs)
254 return self._load_labels(src)
255 elif fmt in ["wfdb", "dicom", "edf", "wav"]:
--> 256 return self._load_data(src=src, fmt=fmt, components=components, ann_ext=ann_ext, *args, **kwargs)
257 else:
258 return super().load(src, fmt, components, *args, **kwargs)

~/anaconda3/lib/python3.6/site-packages/cardio/dataset/dataset/decorators.py in wrapped_method(self, *args, **kwargs)
236 return wrap_with_async(self, args, kwargs)
237 elif target in ['threads', 't']:
--> 238 return wrap_with_threads(self, args, kwargs)
239 elif target in ['mpc', 'm']:
240 return wrap_with_mpc(self, args, kwargs)

~/anaconda3/lib/python3.6/site-packages/cardio/dataset/dataset/decorators.py in wrap_with_threads(self, args, kwargs)
169 cf.wait(futures, timeout=timeout, return_when=cf.ALL_COMPLETED)
170
--> 171 return _call_post_fn(self, post_fn, futures, args, full_kwargs)
172
173 def wrap_with_mpc(self, args, kwargs):

~/anaconda3/lib/python3.6/site-packages/cardio/dataset/dataset/decorators.py in _call_post_fn(self, post_fn, futures, args, kwargs)
134 return self
135 else:
--> 136 return post_fn(all_results, *args, **kwargs)
137
138 def _make_args(init_args, args, kwargs):

~/anaconda3/lib/python3.6/site-packages/cardio/core/ecg_batch.py in _assemble_load(self, results, *args, **kwargs)
310 """
311 _ = args, kwargs
--> 312 self._reraise_exceptions(results)
313 components = kwargs.get("components", None)
314 if components is None:

~/anaconda3/lib/python3.6/site-packages/cardio/core/ecg_batch.py in _reraise_exceptions(self, results)
200 if ds.any_action_failed(results):
201 all_errors = self.get_errors(results)
--> 202 raise RuntimeError("Cannot assemble the batch", all_errors)
203
204 @staticmethod

RuntimeError: ('Cannot assemble the batch', [FileNotFoundError(2, 'No such file or directory'), FileNotFoundError(2, 'No such file or directory'), FileNotFoundError(2, 'No such file or directory'), FileNotFoundError(2, 'No such file or directory'), FileNotFoundError(2, 'No such file or directory'), FileNotFoundError(2, 'No such file or directory')])

@alexanderkuvaev
Copy link
Contributor

alexanderkuvaev commented Feb 2, 2018

In order to train the HMM model, you need to provide it not only with ECG signals, but also with annotation files, describing events at specific points within a recording. ECGs in ../cardio/tests/data don't have them.

So, all you need to do is load the appropriate database on this link as described in the tutorial just above the first block of code.

@quzhouxiachuan
Copy link
Author

quzhouxiachuan commented Feb 2, 2018

Hi

It worked! sorry for the obvious question. I am a beginner on signal processing, thanks for the direction!

alexanderkuvaev pushed a commit that referenced this issue Sep 4, 2018
Install only new packages and test only batch
@babayefarzan
Copy link

Hi,
Is there any specific folder or zip file to download from the https://www.physionet.org/physiobank/database/qtdb/?
Where should I place the downloaded files?

@dpodvyaznikov
Copy link
Member

Hi, @babayefarzan!
If you have latest versions of wfdb library, you can use its function that downloads whole physiobank dataset - dl_database. It might take some time to download the dataset. Please find more about this function in the docs. (Note that current version of CardIO requires wfdb version to be exactly 2.2.1, which supports this function)
You can place the files anywhere in your system, but you need to provide the path to this data when creating Index or EcgDataset object. You can find examlpes in our Models tutorial, in section "CardIO segmentation models".

@babayefarzan
Copy link

@dpodvyaznikov Thank you for your informative response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants