CINC2021Dataset¶
- class torch_ecg.databases.datasets.CINC2021Dataset(config: CFG | None = None, training: bool = True, lazy: bool = True, **reader_kwargs: Any)[source]¶
-
Data generator for feeding data into pytorch models using the
CINC2021
database.- Parameters:
config (dict) –
configurations for the
Dataset
, ref. CINC2021TrainCfg. A simple example is as follows:>>> config = deepcopy(CINC2021TrainCfg) >>> config.db_dir = "some/path/to/db" >>> dataset = CINC2021Dataset(config, training=True, lazy=False)
training (bool, default True) – If True, the training set will be loaded, otherwise the test (val) set will be loaded.
lazy (bool, default True) – If True, the data will not be loaded immediately, instead, it will be loaded on demand.
**reader_kwargs (dict, optional) – Keyword arguments for the database reader class.
- empty(leads: Sequence[str] | None = None) None [source]¶
Empty the loaded data, and keep the leads.
- Parameters:
leads (Sequence[str], optional) – The leads to be kept, by default the current leads.
- Return type:
None
- classmethod from_extern(ext_ds: CINC2021Dataset, config: CFG) CINC2021Dataset [source]¶
Create a new dataset from an existing one.
The existing dataset must have all data loaded into memory, and its leads must be a superset of the new dataset.
- Parameters:
ext_ds (CINC2021Dataset) – The existing dataset.
config (CFG) – The configuration of the new dataset.
- Returns:
A new instance of the dataset.
- Return type:
- property labels: ndarray¶
Cached labels, only available when lazy=False or preloading is performed manually.
- reload_from_extern(ext_ds: CINC2021Dataset) None [source]¶
Reload the data from an existing dataset.
The existing dataset must have all data loaded into memory, and its leads must be a superset of the current dataset.
- Parameters:
ext_ds (CINC2021Dataset) – The existing dataset.
- Return type:
None