suinleelab / cxr_covid Goto Github PK
View Code? Open in Web Editor NEWCode for paper "AI for radiographic COVID-19 detection selects shortcuts over signal"
License: Other
Code for paper "AI for radiographic COVID-19 detection selects shortcuts over signal"
License: Other
Ran on environment provided.
-------- Epoch 000 --------
Traceback (most recent call last):
File "train_covid.py", line 202, in <module>
main()
File "train_covid.py", line 193, in main
train_githubcxr14(args.seed,
File "train_covid.py", line 52, in train_githubcxr14
classifier.train(trainds,
File "/uss/xrai/nick_folder/cxr_covid/models/cxrclassifier.py", line 178, in train
valloss, valauroc = self._val_epoch(val_dataloader)
File "/uss/xrai/nick_folder/cxr_covid/models/cxrclassifier.py", line 261, in _val_epoch
auroc = sklearn.metrics.roc_auc_score(true[:,-1], probs[:,-1])
File "/datasets/home/00/300/nil021/.conda/envs/cxr_covid/lib/python3.8/site-packages/sklearn/metrics/_ranking.py", line 387, in roc_auc_score
return _average_binary_score(partial(_binary_roc_auc_score,
File "/datasets/home/00/300/nil021/.conda/envs/cxr_covid/lib/python3.8/site-packages/sklearn/metrics/_base.py", line 77, in _average_binary_score
return binary_metric(y_true, y_score, sample_weight=sample_weight)
File "/datasets/home/00/300/nil021/.conda/envs/cxr_covid/lib/python3.8/site-packages/sklearn/metrics/_ranking.py", line 221, in _binary_roc_auc_score
raise ValueError("Only one class present in y_true. ROC AUC score "
ValueError: Only one class present in y_true. ROC AUC score is not defined in that case.
(1)
Replicate Error: run make_csv.py
Error Message:
File "make_csv.py", line 109
contains_CR_DX = lambda x: return ('CR' in x) or ('DX' in x)
^
SyntaxError: invalid syntax
Problem:
lambda statement doesn't allow return statement
FIX:
Before: contains_CR_DX = lambda x: return ('CR' in x) or ('DX' in x)
After: contains_CR_DX = lambda x: ('CR' in x) or ('DX' in x)
(2)
Replicate Error: run make_csv.py
Error Message:
File "make_csv.py", line 113
is_dir = os.path.isdir(os.path.join(datapath, subject, sessionfile))
^
SyntaxError: invalid syntax
Problem:
Missing closing parentheses
FIX:
Before: image_candidates_dir = os.listdir(os.path.join(datapath, subject, sessionfile, 'mod-rx')
After: image_candidates_dir = os.listdir(os.path.join(datapath, subject, sessionfile, 'mod-rx'))
include these into series_description_map:
'TORAX AP': 'AP',
'TÓRAX AP': 'AP',
'TORAX BIPE AP': 'AP',
'W034 TÓRAX LAT': 'LAT',
'W033 TÓRAX P.A.': 'PA',
Add another exception to series_description:
try:
series_description = metadata['0008103E']['Value'][0]
except Exception as e:
try:
series_description = metadata['00081032']['Value'][0]['00080104']['Value'][0]
except Exception as e:
try:
series_description = metadata["00185101"]["Value"][0]
except Exception as e:
raise e
Error Replication
Running python train_models.py --dataset 1
gives the following Error
Traceback (most recent call last):
File "train_covid.py", line 202, in <module>
main()
File "train_covid.py", line 193, in main
train_githubcxr14(args.seed,
File "train_covid.py", line 52, in train_githubcxr14
classifier.train(trainds,
File "/uss/xrai/nick_folder/cxr_covid/models/cxrclassifier.py", line 178, in train
valloss, valauroc = self._val_epoch(val_dataloader)
File "/uss/xrai/nick_folder/cxr_covid/models/cxrclassifier.py", line 262, in _val_epoch
auroc = sklearn.metrics.roc_auc_score(true[:,-1], probs[:,-1])
File "/datasets/home/00/300/nil021/.conda/envs/cxr_covid/lib/python3.8/site-packages/sklearn/metrics/_ranking.py", line 387, in roc_auc_score
return _average_binary_score(partial(_binary_roc_auc_score,
File "/datasets/home/00/300/nil021/.conda/envs/cxr_covid/lib/python3.8/site-packages/sklearn/metrics/_base.py", line 77, in _average_binary_score
return binary_metric(y_true, y_score, sample_weight=sample_weight)
File "/datasets/home/00/300/nil021/.conda/envs/cxr_covid/lib/python3.8/site-packages/sklearn/metrics/_ranking.py", line 221, in _binary_roc_auc_score
raise ValueError("Only one class present in y_true. ROC AUC score "
ValueError: Only one class present in y_true. ROC AUC score is not defined in that case.
Problem Identification
Looking at the metadata, we see that values in finding columns may have been updated to new values.
Github-COVID feature engineering datasets/githubcovid.py needs to be updated
Current solution gives false for every datapoint, because of line 71: covid_set = ['COVID-19','COVID-19, ARDS']
Solution
Patients w/ COVID now have the following string 'Pneumonia/Viral/COVID-19' instead of 'COVID-19','COVID-19, ARDS']
Pneumonia patients and healthy set must also be updated to correspond with the new changes
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.