pyhealth.tasks.covid19_cxr_classification#
- class pyhealth.tasks.covid19_cxr_classification.COVID19CXRClassification(code_mapping=None)[source]#
Bases:
BaseTaskA task for classifying chest disease from chest X-ray images.
This task classifies chest X-ray images into different disease categories. It expects a single chest X-ray image per patient and returns the corresponding disease label.
- input_schema#
The input schema specifying the required input format. Contains a single key “image” with value “image”.
- output_schema#
The output schema specifying the output format. Contains a single key “disease” with value “multiclass”.
Examples
>>> from pyhealth.datasets import COVID19CXRDataset >>> from pyhealth.tasks import COVID19CXRClassification >>> dataset = COVID19CXRDataset(root="/path/to/covid19_cxr") >>> task = COVID19CXRClassification() >>> samples = dataset.set_task(task)
Initialize a task with optional code mapping.
- Parameters:
code_mapping (
Optional[Dict[str,Tuple[str,str]]]) –optional dict mapping feature keys to
(source_vocab, target_vocab)tuples. For example:code_mapping={ "conditions": ("ICD9CM", "CCSCM"), "procedures": ("ICD9PROC", "CCSPROC"), "drugs": ("NDC", "ATC"), }
When provided, the corresponding
input_schemaentries are upgraded from"sequence"to("sequence", {"code_mapping": (src, tgt)})so that theSequenceProcessormaps raw codes at fit/process time.
- __init__(code_mapping=None)#
Initialize a task with optional code mapping.
- Parameters:
code_mapping (
Optional[Dict[str,Tuple[str,str]]]) –optional dict mapping feature keys to
(source_vocab, target_vocab)tuples. For example:code_mapping={ "conditions": ("ICD9CM", "CCSCM"), "procedures": ("ICD9PROC", "CCSPROC"), "drugs": ("NDC", "ATC"), }
When provided, the corresponding
input_schemaentries are upgraded from"sequence"to("sequence", {"code_mapping": (src, tgt)})so that theSequenceProcessormaps raw codes at fit/process time.
- pre_filter(df)#
- Return type:
LazyFrame