Chest X-Ray Medical Diagnosis with Deep Learning - ⑤ Prediction and Evaluation
start
BioinformaticsAndMe
Chest X-Ray Medical Diagnosis with Deep Learning
① Import Packages and Function
② Load the Datasets
③ Model Development
④ Training
⑤ Prediction and Evaluation
⑤ Prediction and Evaluation
: 테스트셋을 사용하여 모델을 평가
predicted_vals = model.predict(test_generator, steps = len(test_generator))
5.1 ROC Curve and AUROC
: ROC(Receiver Operating Characteristic) 곡선에서 AUC(Area Under the Curve)를 계산
: 곡선이 좌상단에 있을수록, 더 많은 면적이 갖고, 모델이 더 잘 수행되고 있음을 의미함
: util.py에서 제공하는 util.get_roc_curve 함수를 사용
auc_rocs = util.get_roc_curve(labels, predicted_vals, test_generator)
5.2 Visualizing Learning with GradCAM
: GradCAM 기술을 사용하여 병리학적 상태를 예측하기 위해, 이미지의 중요한 영역을 강조하는 히트맵을 생성
: 먼저 작은 Training 셋을 로드하고, 앞서 AUC 측정값이 가장 높은 4개의 클래스를 살펴볼 것
df = pd.read_csv("drive/MyDrive/nih/train-small.csv")
IMAGE_DIR = "drive/MyDrive/nih/images-small/"
# only show the lables with top 4 AUC
labels_to_show = np.take(labels, np.argsort(auc_rocs)[::-1])[:4]
: 몇 가지 특정 이미지들을 확인
util.compute_gradcam(model, '00008270_015.png', IMAGE_DIR, df, labels, labels_to_show)
# Expected output
Loading original image
Generating gradcam for class Cardiomegaly
Generating gradcam for class Mass
Generating gradcam for class Pneumothorax
Generating gradcam for class Edema
util.compute_gradcam(model, '00011355_002.png', IMAGE_DIR, df, labels, labels_to_show)
util.compute_gradcam(model, '00029855_001.png', IMAGE_DIR, df, labels, labels_to_show)
: P 값은 정답 클래스의 softmax probability를 의미함
#Reference
1) www.coursera.org/learn/ai-for-medical-diagnosis
2) github.com/vishrutskaushik/Chest-X-Ray-Medical-Diagnosis
Chest X-Ray Medical Diagnosis with Deep Learning - ⑤ Prediction and Evaluation
end
BioinformaticsAndMe
'Machine Learning' 카테고리의 다른 글
Chest X-Ray Medical Diagnosis with Deep Learning - ④ Training (0) | 2021.02.21 |
---|---|
Chest X-Ray Medical Diagnosis with Deep Learning - ③ Model Development (0) | 2021.02.21 |
Chest X-Ray Medical Diagnosis with Deep Learning - ② Load the Datasets (0) | 2021.02.15 |
Chest X-Ray Medical Diagnosis with Deep Learning - ① Import Packages and Function (0) | 2021.02.15 |
AUC-ROC 커브 (3) | 2020.08.04 |