COVIDNet CXR-S model takes as input a chest x-ray image of shape (N, 480, 480, 3). where N is the number of batches, and outputs the airspace severity of a SARS-CoV-2 positive patient. The airspace severity is grouped into two levels: 1) Level 1: opacities in 1-2 lung zones, and 2) Level 2: opacities in 3 or more lung zones.
For a detailed description on the methodology behind COVIDNet CXR-S, please click here.
If using the TF checkpoints, here are some useful tensors:
- input tensor:
input_1:0
- logit tensor:
norm_dense_2/MatMul:0
- output tensor:
norm_dense_2/Softmax:0
- label tensor:
norm_dense_1_target:0
- class weights tensor:
norm_dense_1_sample_weights:0
- loss tensor:
Mean:0
To train the model the COVIDxSev dataset is required, to create the dataset please run create_COVIDxSev.ipynb. TF training script from a pretrained model:
- We provide you with the tensorflow training script, train_tf.py
- Locate the tensorflow checkpoint files (location of pretrained model)
- To train from the COVIDNet-CXR-S pretrained model:
python train_tf.py \
--weightspath models/COVIDNet-CXR-S \
--metaname model.meta \
--ckptname model \
--n_classes 2 \
--datadir data_sev \
--trainfile labels/train_COVIDxSev.txt \
--testfile labels/test_COVIDxSev.txt \
--in_tensorname input_1:0 \
--out_tensorname norm_dense_2/Softmax:0 \
--logit_tensorname norm_dense_2/MatMul:0 \
--is_severity_model
- For more options and information,
python train_tf.py --help
To evaluate the model the COVIDxSev dataset is required, to create the dataset please run create_COVIDxSev.ipynb.
- We provide you with the tensorflow evaluation script, eval.py
- Locate the tensorflow checkpoint files
- To evaluate a tf checkpoint:
python eval.py \
--weightspath models/COVIDNet-CXR-S \
--metaname model.meta \
--ckptname model \
--n_classes 2 \
--testfolder data_sev/test \
--testfile labels/test_COVIDxSev.txt \
--in_tensorname input_1:0 \
--out_tensorname norm_dense_2/Softmax:0 \
--is_severity_model
- For more options and information,
python eval.py --help
DISCLAIMER: Do not use this prediction for self-diagnosis. You should check with your local authorities for the latest advice on seeking medical assistance.
- Download a model from the pretrained models section
- Locate models and xray image to be inferenced
- To inference,
python inference.py \
--weightspath models/COVIDNet-CXR-S \
--metaname model.meta \
--ckptname model \
--n_classes 2 \
--imagepath assets/ex-covid.jpeg \
--in_tensorname input_1:0 \
--out_tensorname norm_dense_2/Softmax:0 \
--is_severity_model
- For more options and information,
python inference.py --help
COVIDNet-S-GEO and COVIDNet-S-OPC models takes as input a chest x-ray image of shape (N, 480, 480, 3), where N is the number of batches, and outputs the SARS-CoV-2 severity scores for geographic extent and opacity extent, respectively. COVIDNet-S-GEO predicts the geographic severity. Geographic severity is based on the geographic extent score for right and left lung. For each lung: 0 = no involvement; 1 = <25%; 2 = 25-50%; 3 = 50-75%; 4 = >75% involvement, resulting in scores from 0 to 8. COVIDNet-S-OPC predicts the opacity severity. Opacity severity is based on the opacity extent score for right and left lung. For each lung, the score is from 0 to 4, with 0 = no opacity and 4 = white-out, resulting in scores from 0 to 8. For detailed description of COVIDNet lung severity scoring methodology, see the paper here.
If using the TF checkpoints, here are some useful tensors:
- input tensor:
input_1:0
- logit tensor:
MLP/dense_1/MatMul:0
- is_training tensor:
keras_learning_phase:0
DISCLAIMER: Do not use this prediction for self-diagnosis. You should check with your local authorities for the latest advice on seeking medical assistance.
- Download the COVIDNet-S Lung Severity Scoring models from the pretrained models section
- Locate both geographic and opacity models and COVID-19 positive chest x-ray image to be inferenced
- To predict geographic and opacity severity
python inference_severity.py \
--weightspath_geo models/COVIDNet-S-GEO \
--weightspath_opc models/COVIDNet-S-OPC \
--metaname model.meta \
--ckptname model \
--imagepath assets/ex-covid.jpeg
- For more options and information,
python inference_severity.py --help