Comments (3)
Hi!
- You can drop any channel with
drop_channels
method ofEcgBatch
. - In our publication and pipelines we use automated annotations, those with extension
pu1
.
Expert annotations are those withq1c
andq2c
extensions. You can use them by passing corresponding extension toann_ext
parameter ofload
method, e.g.:
load(fmt='wfdb', components=["signal", "annotation", "meta"], ann_ext='q1c')
- If you want to load only a part of the data, you need to create a
FilesIndex
orDatasetIndex
with indices of the files you need.
For example, if you want to work only with files that have annotation from second expert (files withq2c
extension), you can createFilesIndex
in a following way:
FilesIndex(path='some_path/qt/*.q2c', no_ext=True)
Here you can find more information about Index objects inbatchflow
. Also, you may want to read docstrings for FilesIndex
and DatasetIndex
methods.
There also is a simple and straightforward way, which is to move files you need to a separate folder and use FilesIndex
with corresponding path
.
from cardio.
If I use this code, I always have 225000 lenth entries. How can I get the only 30 to 50 annotation data contained in q1c?
i am trying to get using csv file. i convert dat to csv . but it's doen't work because when i use csv, Cardio error because it can't find another lead channel..
and.. I found about "drop_channel" method because you told me, but this method requires name and indices
But I don't know how to use only ECG 1-lead using this method. ECG have different names, such as MLII and V5, so how do I use only one channel?
I've been spending about 50 days on this problem. Thanks to you, I think i am closer to the problem. Thank you.
SIGNALS_PATH = "C:/Users/gsm20/Downloads/qt-database-1.0.0"
SIGNALS_MASK = os.path.join(SIGNALS_PATH, "*.q1c")
index = bf.FilesIndex(path=SIGNALS_MASK, no_ext=True, sort=True)
dtst = bf.Dataset(index, batch_class=EcgBatch)
dtst.split()
config_predict = {
'build': False,
'load': {'path': "C:/Users/gsm20/Downloads/train_dill/train_sel&sele_q1c/hmmodel1_q1c.dill"}
}
template_ppl_predict = (
bf.Pipeline()
.init_model("static", HMModel, "HMM", config=config_predict)
.load(fmt="wfdb", components=["signal", "annotation", "meta"], ann_ext="q1c")
.cwt(src="signal", dst="hmm_features", scales=[4,8,16], wavelet="mexh")
.standardize(axis=-1, src="hmm_features", dst="hmm_features")
.predict_model("HMM", make_data=partial(prepare_hmm_input, features="hmm_features", channel_ix=0),
save_to=bf.B("hmm_annotation"), mode='w')
.calc_ecg_parameters(src="hmm_annotation")
.run(batch_size=20, shuffle=False, drop_last=False, n_epochs=1, lazy=True)
)
ppl_predict = (dtst >> template_ppl_predict)
batch = ppl_predict.next_batch()
from cardio.
This is how wfdb
format works - despite there may be only a few heartbeats annotated, the annotation file is created for the whole signal.
CardIO
provides some build-in features and has basic tools that help you build up your own features. It cannot do everything you want out-of-the-box.
If you want to have some fancy processing, e.g. select parts of the signal with regard to annotation, you need to write your own code.
Regarding the drop_channels
method: if you don't know channel name, you can simply use indices=0
to drop first channel, indices=1
to drop second, etc. Or you can take a look at the meta
component of the batch, it should contain channel names along with other useful information.
There also is keep_channels
method that keep only channels which names or indices you've provided.
And I strongly recommend you to thoroughly go through CardIO documentation. It is a good practice to learn about library methods by reading the docs.
I'll close this issue as long as the problem you've described does not have anything to do with CardIO
.
from cardio.
Related Issues (20)
- I.CardIO.ipynb Error in line [6] HOT 2
- 'NoneType' object has no attribute 'ndim' HOT 5
- Errors on running tutorials HOT 2
- ModuleNotFoundError: No module named 'cardio.dataset' HOT 2
- GMM in scikit-learn deprecation 0.19.1 HOT 2
- Installation Failed ( pyEDFlib requires a version of NumPy, even for setup ) HOT 2
- pipenv installation doesn't work HOT 2
- what is difference A00001~A08528 microsoft Access Table Shortcut and sel30~selxx HOT 4
- Cardio with TF 1.14
- how can i find "batch_size" function? HOT 3
- Training time with training2017 dataset HOT 1
- reading labeled data HOT 2
- How to pass train and validation data together? HOT 3
- ECG segmentation perfomance HOT 3
- install_requires question HOT 2
- how to predict with .edf file? HOT 6
- HMM Jupyter notebook gives batchflow import errors HOT 4
- cardio ipa
- Ipa
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cardio.