-
Notifications
You must be signed in to change notification settings - Fork 3
/
Chest X-Ray Medical Diagnosis with Deep Learning
2022 lines (2022 loc) · 938 KB
/
Chest X-Ray Medical Diagnosis with Deep Learning
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chest X-Ray Medical Diagnosis with Deep Learning"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "FZYK-0rin5x7"
},
"source": [
"<img src=\"xray-header-image.png\" style=\"padding-top: 50px;width: 87%;left: 0px;margin-left: 0px;margin-right: 0px;\">\n",
"\n",
"__Welcome to the first assignment of course 1!__ \n",
"\n",
"In this assignment! You will explore medical image diagnosis by building a state-of-the-art chest X-ray classifier using Keras. \n",
"\n",
"The assignment will walk through some of the steps of building and evaluating this deep learning classifier model. In particular, you will:\n",
"- Pre-process and prepare a real-world X-ray dataset\n",
"- Use transfer learning to retrain a DenseNet model for X-ray image classification\n",
"- Learn a technique to handle class imbalance\n",
"- Measure diagnostic performance by computing the AUC (Area Under the Curve) for the ROC (Receiver Operating Characteristic) curve\n",
"- Visualize model activity using GradCAMs\n",
"\n",
"In completing this assignment you will learn about the following topics: \n",
"\n",
"- Data preparation\n",
" - Visualizing data\n",
" - Preventing data leakage\n",
"- Model Development\n",
" - Addressing class imbalance\n",
" - Leveraging pre-trained models using transfer learning\n",
"- Evaluation\n",
" - AUC and ROC curves"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Outline\n",
"Use these links to jump to specific sections of this assignment!\n",
"\n",
"- [1. Import Packages and Function](#1)\n",
"- [2. Load the Datasets](#2)\n",
" - [2.1 Preventing Data Leakage](#2-1)\n",
" - [Exercise 1 - Checking Data Leakage](#Ex-1)\n",
" - [2.2 Preparing Images](#2-2)\n",
"- [3. Model Development](#3)\n",
" - [3.1 Addressing Class Imbalance](#3-1)\n",
" - [Exercise 2 - Computing Class Frequencies](#Ex-2)\n",
" - [Exercise 3 - Weighted Loss](#Ex-3)\n",
" - [3.3 DenseNet121](#3-3)\n",
"- [4. Training [optional]](#4)\n",
" - [4.1 Training on the Larger Dataset](#4-1)\n",
"- [5. Prediction and Evaluation](#5)\n",
" - [5.1 ROC Curve and AUROC](#5-1)\n",
" - [5.2 Visualizing Learning with GradCAM](#5-2)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "XI8PBrk_2Z4V"
},
"source": [
"<a name='1'></a>\n",
"## 1. Import Packages and Functions¶\n",
"\n",
"We'll make use of the following packages:\n",
"- `numpy` and `pandas` is what we'll use to manipulate our data\n",
"- `matplotlib.pyplot` and `seaborn` will be used to produce plots for visualization\n",
"- `util` will provide the locally defined utility functions that have been provided for this assignment\n",
"\n",
"We will also use several modules from the `keras` framework for building deep learning models.\n",
"\n",
"Run the next cell to import all the necessary packages."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "Je3yV0Wnn5x8",
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using TensorFlow backend.\n"
]
}
],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from keras.preprocessing.image import ImageDataGenerator\n",
"from keras.applications.densenet import DenseNet121\n",
"from keras.layers import Dense, GlobalAveragePooling2D\n",
"from keras.models import Model\n",
"from keras import backend as K\n",
"\n",
"from keras.models import load_model\n",
"\n",
"import util"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "6PMDCWQRn5yA"
},
"source": [
"<a name='2'></a>\n",
"## 2 Load the Datasets\n",
"\n",
"For this assignment, we will be using the [ChestX-ray8 dataset](https://arxiv.org/abs/1705.02315) which contains 108,948 frontal-view X-ray images of 32,717 unique patients. \n",
"- Each image in the data set contains multiple text-mined labels identifying 14 different pathological conditions. \n",
"- These in turn can be used by physicians to diagnose 8 different diseases. \n",
"- We will use this data to develop a single model that will provide binary classification predictions for each of the 14 labeled pathologies. \n",
"- In other words it will predict 'positive' or 'negative' for each of the pathologies.\n",
" \n",
"You can download the entire dataset for free [here](https://nihcc.app.box.com/v/ChestXray-NIHCC). \n",
"- We have provided a ~1000 image subset of the images for you.\n",
"- These can be accessed in the folder path stored in the `IMAGE_DIR` variable.\n",
"\n",
"The dataset includes a CSV file that provides the labels for each X-ray. \n",
"\n",
"To make your job a bit easier, we have processed the labels for our small sample and generated three new files to get you started. These three files are:\n",
"\n",
"1. `nih/train-small.csv`: 875 images from our dataset to be used for training.\n",
"1. `nih/valid-small.csv`: 109 images from our dataset to be used for validation.\n",
"1. `nih/test.csv`: 420 images from our dataset to be used for testing. \n",
"\n",
"This dataset has been annotated by consensus among four different radiologists for 5 of our 14 pathologies:\n",
"- `Consolidation`\n",
"- `Edema`\n",
"- `Effusion`\n",
"- `Cardiomegaly`\n",
"- `Atelectasis`"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Sidebar on meaning of 'class'\n",
"It is worth noting that the word **'class'** is used in multiple ways is these discussions. \n",
"- We sometimes refer to each of the 14 pathological conditions that are labeled in our dataset as a class. \n",
"- But for each of those pathologies we are attempting to predict whether a certain condition is present (i.e. positive result) or absent (i.e. negative result). \n",
" - These two possible labels of 'positive' or 'negative' (or the numerical equivalent of 1 or 0) are also typically referred to as classes. \n",
"- Moreover, we also use the term in reference to software code 'classes' such as `ImageDataGenerator`.\n",
"\n",
"As long as you are aware of all this though, it should not cause you any confusion as the term 'class' is usually clear from the context in which it is used."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Read in the data\n",
"Let's open these files using the [pandas](https://pandas.pydata.org/) library"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 224
},
"colab_type": "code",
"id": "5JRSHB7i0t_6",
"outputId": "69830050-af47-4ebc-946d-d411d0cbdf5b"
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Image</th>\n",
" <th>Atelectasis</th>\n",
" <th>Cardiomegaly</th>\n",
" <th>Consolidation</th>\n",
" <th>Edema</th>\n",
" <th>Effusion</th>\n",
" <th>Emphysema</th>\n",
" <th>Fibrosis</th>\n",
" <th>Hernia</th>\n",
" <th>Infiltration</th>\n",
" <th>Mass</th>\n",
" <th>Nodule</th>\n",
" <th>PatientId</th>\n",
" <th>Pleural_Thickening</th>\n",
" <th>Pneumonia</th>\n",
" <th>Pneumothorax</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>00027079_001.png</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>27079</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>00004477_001.png</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>4477</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>00018530_002.png</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>18530</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>00026928_001.png</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>26928</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>00016687_000.png</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>16687</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Image Atelectasis Cardiomegaly Consolidation Edema \\\n",
"0 00027079_001.png 0 0 0 0 \n",
"1 00004477_001.png 1 0 0 0 \n",
"2 00018530_002.png 0 0 0 0 \n",
"3 00026928_001.png 0 0 0 0 \n",
"4 00016687_000.png 0 0 0 0 \n",
"\n",
" Effusion Emphysema Fibrosis Hernia Infiltration Mass Nodule \\\n",
"0 0 0 0 0 0 0 0 \n",
"1 1 0 0 0 0 0 0 \n",
"2 0 0 0 0 0 0 0 \n",
"3 0 0 0 0 1 0 0 \n",
"4 0 0 0 0 0 0 1 \n",
"\n",
" PatientId Pleural_Thickening Pneumonia Pneumothorax \n",
"0 27079 1 0 0 \n",
"1 4477 0 0 0 \n",
"2 18530 0 0 0 \n",
"3 26928 0 0 0 \n",
"4 16687 0 0 0 "
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"train_df = pd.read_csv(\"nih/train-small.csv\")\n",
"valid_df = pd.read_csv(\"nih/valid-small.csv\")\n",
"\n",
"test_df = pd.read_csv(\"nih/test.csv\")\n",
"\n",
"train_df.head()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "mrDoMlsun5yE"
},
"outputs": [],
"source": [
"labels = ['Cardiomegaly', \n",
" 'Emphysema', \n",
" 'Effusion', \n",
" 'Hernia', \n",
" 'Infiltration', \n",
" 'Mass', \n",
" 'Nodule', \n",
" 'Atelectasis',\n",
" 'Pneumothorax',\n",
" 'Pleural_Thickening', \n",
" 'Pneumonia', \n",
" 'Fibrosis', \n",
" 'Edema', \n",
" 'Consolidation']"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "iKwFwpHLn5yG"
},
"source": [
"<a name='2-1'></a>\n",
"### 2.1 Preventing Data Leakage\n",
"It is worth noting that our dataset contains multiple images for each patient. This could be the case, for example, when a patient has taken multiple X-ray images at different times during their hospital visits. In our data splitting, we have ensured that the split is done on the patient level so that there is no data \"leakage\" between the train, validation, and test datasets."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<a name='Ex-1'></a>\n",
"### Exercise 1 - Checking Data Leakage\n",
"In the cell below, write a function to check whether there is leakage between two datasets. We'll use this to make sure there are no patients in the test set that are also present in either the train or validation sets."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<details> \n",
"<summary>\n",
" <font size=\"3\" color=\"darkgreen\"><b>Hints</b></font>\n",
"</summary>\n",
"<p>\n",
"<ul>\n",
" <li> Make use of python's set.intersection() function. </li>\n",
" <li> In order to match the automatic grader's expectations, please start the line of code with <code>df1_patients_unique...[continue your code here]</code> </li>\n",
"\n",
"</ul>\n",
"</p>"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "Jz6dwTSrUcKc"
},
"outputs": [],
"source": [
"# UNQ_C1 (UNIQUE CELL IDENTIFIER, DO NOT EDIT)\n",
"def check_for_leakage(df1, df2, patient_col):\n",
" \"\"\"\n",
" Return True if there any patients are in both df1 and df2.\n",
"\n",
" Args:\n",
" df1 (dataframe): dataframe describing first dataset\n",
" df2 (dataframe): dataframe describing second dataset\n",
" patient_col (str): string name of column with patient IDs\n",
" \n",
" Returns:\n",
" leakage (bool): True if there is leakage, otherwise False\n",
" \"\"\"\n",
"\n",
" ### START CODE HERE (REPLACE INSTANCES OF 'None' with your code) ###\n",
" \n",
" df1_patients_unique = set(df1[patient_col].values)\n",
" df2_patients_unique = set(df2[patient_col].values)\n",
" \n",
" \n",
" patients_in_both_groups = list(df1_patients_unique.intersection(df2_patients_unique))\n",
"\n",
" # leakage contains true if there is patient overlap, otherwise false.\n",
" # boolean (true if there is at least 1 patient in both groups)\n",
" \n",
" if (len(patients_in_both_groups)!=0):\n",
" leakage = True\n",
" else:\n",
" leakage = False\n",
" ### END CODE HERE ###\n",
" \n",
" return leakage"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 544
},
"colab_type": "code",
"id": "Rh2p1krrV1g5",
"outputId": "9ee44d93-8ef1-4c98-f9fa-65b309b9b889"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"test case 1\n",
"df1\n",
" patient_id\n",
"0 0\n",
"1 1\n",
"2 2\n",
"df2\n",
" patient_id\n",
"0 2\n",
"1 3\n",
"2 4\n",
"leakage output: True\n",
"-------------------------------------\n",
"test case 2\n",
"df1:\n",
" patient_id\n",
"0 0\n",
"1 1\n",
"2 2\n",
"df2:\n",
" patient_id\n",
"0 3\n",
"1 4\n",
"2 5\n",
"leakage output: False\n"
]
}
],
"source": [
"# test\n",
"print(\"test case 1\")\n",
"df1 = pd.DataFrame({'patient_id': [0, 1, 2]})\n",
"df2 = pd.DataFrame({'patient_id': [2, 3, 4]})\n",
"print(\"df1\")\n",
"print(df1)\n",
"print(\"df2\")\n",
"print(df2)\n",
"print(f\"leakage output: {check_for_leakage(df1, df2, 'patient_id')}\")\n",
"print(\"-------------------------------------\")\n",
"print(\"test case 2\")\n",
"df1 = pd.DataFrame({'patient_id': [0, 1, 2]})\n",
"df2 = pd.DataFrame({'patient_id': [3, 4, 5]})\n",
"print(\"df1:\")\n",
"print(df1)\n",
"print(\"df2:\")\n",
"print(df2)\n",
"\n",
"print(f\"leakage output: {check_for_leakage(df1, df2, 'patient_id')}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Expected output\n",
"\n",
"```Python\n",
"test case 1\n",
"df1\n",
" patient_id\n",
"0 0\n",
"1 1\n",
"2 2\n",
"df2\n",
" patient_id\n",
"0 2\n",
"1 3\n",
"2 4\n",
"leakage output: True\n",
"-------------------------------------\n",
"test case 2\n",
"df1:\n",
" patient_id\n",
"0 0\n",
"1 1\n",
"2 2\n",
"df2:\n",
" patient_id\n",
"0 3\n",
"1 4\n",
"2 5\n",
"leakage output: False\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "FCWkiLudW_Il"
},
"source": [
"Run the next cell to check if there are patients in both train and test or in both valid and test."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 51
},
"colab_type": "code",
"id": "AMF3Wd3yW-RS",
"outputId": "e417c9ea-c06b-49a7-af35-d802bc1725eb"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"leakage between train and test: False\n",
"leakage between valid and test: False\n"
]
}
],
"source": [
"print(\"leakage between train and test: {}\".format(check_for_leakage(train_df, test_df, 'PatientId')))\n",
"print(\"leakage between valid and test: {}\".format(check_for_leakage(valid_df, test_df, 'PatientId')))"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "zRUvYHpYXhlQ"
},
"source": [
"If we get `False` for both, then we're ready to start preparing the datasets for training. Remember to always check for data leakage!"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "JBWZ5l4ln5yH"
},
"source": [
"<a name='2-2'></a>\n",
"### 2.2 Preparing Images"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "SPjuZHPpn5yH"
},
"source": [
"With our dataset splits ready, we can now proceed with setting up our model to consume them. \n",
"- For this we will use the off-the-shelf [ImageDataGenerator](https://keras.io/preprocessing/image/) class from the Keras framework, which allows us to build a \"generator\" for images specified in a dataframe. \n",
"- This class also provides support for basic data augmentation such as random horizontal flipping of images.\n",
"- We also use the generator to transform the values in each batch so that their mean is $0$ and their standard deviation is 1. \n",
" - This will facilitate model training by standardizing the input distribution. \n",
"- The generator also converts our single channel X-ray images (gray-scale) to a three-channel format by repeating the values in the image across all channels.\n",
" - We will want this because the pre-trained model that we'll use requires three-channel inputs.\n",
"\n",
"Since it is mainly a matter of reading and understanding Keras documentation, we have implemented the generator for you. There are a few things to note: \n",
"1. We normalize the mean and standard deviation of the data\n",
"3. We shuffle the input after each epoch.\n",
"4. We set the image size to be 320px by 320px"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "nAgVGOAju8pX"
},
"outputs": [],
"source": [
"def get_train_generator(df, image_dir, x_col, y_cols, shuffle=True, batch_size=8, seed=1, target_w = 320, target_h = 320):\n",
" \"\"\"\n",
" Return generator for training set, normalizing using batch\n",
" statistics.\n",
"\n",
" Args:\n",
" train_df (dataframe): dataframe specifying training data.\n",
" image_dir (str): directory where image files are held.\n",
" x_col (str): name of column in df that holds filenames.\n",
" y_cols (list): list of strings that hold y labels for images.\n",
" sample_size (int): size of sample to use for normalization statistics.\n",
" batch_size (int): images per batch to be fed into model during training.\n",
" seed (int): random seed.\n",
" target_w (int): final width of input images.\n",
" target_h (int): final height of input images.\n",
" \n",
" Returns:\n",
" train_generator (DataFrameIterator): iterator over training set\n",
" \"\"\" \n",
" print(\"getting train generator...\") \n",
" # normalize images\n",
" image_generator = ImageDataGenerator(\n",
" samplewise_center=True,\n",
" samplewise_std_normalization= True)\n",
" \n",
" # flow from directory with specified batch size\n",
" # and target image size\n",
" generator = image_generator.flow_from_dataframe(\n",
" dataframe=df,\n",
" directory=image_dir,\n",
" x_col=x_col,\n",
" y_col=y_cols,\n",
" class_mode=\"raw\",\n",
" batch_size=batch_size,\n",
" shuffle=shuffle,\n",
" seed=seed,\n",
" target_size=(target_w,target_h))\n",
" \n",
" return generator"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "vpRXR-3_u7cl"
},
"source": [
"#### Build a separate generator for valid and test sets\n",
"\n",
"Now we need to build a new generator for validation and testing data. \n",
"\n",
"**Why can't we use the same generator as for the training data?**\n",
"\n",
"Look back at the generator we wrote for the training data. \n",
"- It normalizes each image **per batch**, meaning that it uses batch statistics. \n",
"- We should not do this with the test and validation data, since in a real life scenario we don't process incoming images a batch at a time (we process one image at a time). \n",
"- Knowing the average per batch of test data would effectively give our model an advantage. \n",
" - The model should not have any information about the test data.\n",
"\n",
"What we need to do is normalize incoming test data using the statistics **computed from the training set**. \n",
"* We implement this in the function below. \n",
"* There is one technical note. Ideally, we would want to compute our sample mean and standard deviation using the entire training set. \n",
"* However, since this is extremely large, that would be very time consuming. \n",
"* In the interest of time, we'll take a random sample of the dataset and calcualte the sample mean and sample standard deviation."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "UtWEAfAnrhMq"
},
"outputs": [],
"source": [
"def get_test_and_valid_generator(valid_df, test_df, train_df, image_dir, x_col, y_cols, sample_size=100, batch_size=8, seed=1, target_w = 320, target_h = 320):\n",
" \"\"\"\n",
" Return generator for validation set and test test set using \n",
" normalization statistics from training set.\n",
"\n",
" Args:\n",
" valid_df (dataframe): dataframe specifying validation data.\n",
" test_df (dataframe): dataframe specifying test data.\n",
" train_df (dataframe): dataframe specifying training data.\n",
" image_dir (str): directory where image files are held.\n",
" x_col (str): name of column in df that holds filenames.\n",
" y_cols (list): list of strings that hold y labels for images.\n",
" sample_size (int): size of sample to use for normalization statistics.\n",
" batch_size (int): images per batch to be fed into model during training.\n",
" seed (int): random seed.\n",
" target_w (int): final width of input images.\n",
" target_h (int): final height of input images.\n",
" \n",
" Returns:\n",
" test_generator (DataFrameIterator) and valid_generator: iterators over test set and validation set respectively\n",
" \"\"\"\n",
" print(\"getting train and valid generators...\")\n",
" # get generator to sample dataset\n",
" raw_train_generator = ImageDataGenerator().flow_from_dataframe(\n",
" dataframe=train_df, \n",
" directory=IMAGE_DIR, \n",
" x_col=\"Image\", \n",
" y_col=labels, \n",
" class_mode=\"raw\", \n",
" batch_size=sample_size, \n",
" shuffle=True, \n",
" target_size=(target_w, target_h))\n",
" \n",
" # get data sample\n",
" batch = raw_train_generator.next()\n",
" data_sample = batch[0]\n",
"\n",
" # use sample to fit mean and std for test set generator\n",
" image_generator = ImageDataGenerator(\n",
" featurewise_center=True,\n",
" featurewise_std_normalization= True)\n",
" \n",
" # fit generator to sample from training data\n",
" image_generator.fit(data_sample)\n",
"\n",
" # get test generator\n",
" valid_generator = image_generator.flow_from_dataframe(\n",
" dataframe=valid_df,\n",
" directory=image_dir,\n",
" x_col=x_col,\n",
" y_col=y_cols,\n",
" class_mode=\"raw\",\n",
" batch_size=batch_size,\n",
" shuffle=False,\n",
" seed=seed,\n",
" target_size=(target_w,target_h))\n",
"\n",
" test_generator = image_generator.flow_from_dataframe(\n",
" dataframe=test_df,\n",
" directory=image_dir,\n",
" x_col=x_col,\n",
" y_col=y_cols,\n",
" class_mode=\"raw\",\n",
" batch_size=batch_size,\n",
" shuffle=False,\n",
" seed=seed,\n",
" target_size=(target_w,target_h))\n",
" return valid_generator, test_generator"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "ga4RZN5On5yL"
},
"source": [
"With our generator function ready, let's make one generator for our training data and one each of our test and validation datasets."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 119
},
"colab_type": "code",
"id": "rNE3HWRbn5yL",
"outputId": "4c6b1c25-a33d-42e0-f442-40971ca52a3f",
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"getting train generator...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/conda/lib/python3.6/site-packages/keras_preprocessing/image/dataframe_iterator.py:273: UserWarning: Found 866 invalid image filename(s) in x_col=\"Image\". These filename(s) will be ignored.\n",
" .format(n_invalid, x_col)\n",
"/opt/conda/lib/python3.6/site-packages/keras_preprocessing/image/dataframe_iterator.py:273: UserWarning: Found 866 invalid image filename(s) in x_col=\"Image\". These filename(s) will be ignored.\n",
" .format(n_invalid, x_col)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Found 9 validated image filenames.\n",
"getting train and valid generators...\n",
"Found 9 validated image filenames.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/conda/lib/python3.6/site-packages/keras_preprocessing/image/dataframe_iterator.py:273: UserWarning: Found 108 invalid image filename(s) in x_col=\"Image\". These filename(s) will be ignored.\n",
" .format(n_invalid, x_col)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Found 1 validated image filenames.\n",
"Found 420 validated image filenames.\n"
]
}
],
"source": [
"IMAGE_DIR = \"nih/images-small/\"\n",
"train_generator = get_train_generator(train_df, IMAGE_DIR, \"Image\", labels)\n",
"valid_generator, test_generator= get_test_and_valid_generator(valid_df, test_df, train_df, IMAGE_DIR, \"Image\", labels)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "pYtXacDgn5yN"
},
"source": [
"Let's peek into what the generator gives our model during training and validation. We can do this by calling the `__get_item__(index)` function:"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 303
},
"colab_type": "code",
"id": "Jh77vpN-n5yO",
"outputId": "c4e68e79-e8f2-4bb9-8909-072c9dd2f805"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAQEAAAD8CAYAAAB3lxGOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOy9bWxk2Xke+ByObtGo6qCqDRaFqpaKbZC9IcdgS+kZuGe8A8MaJ5ITCCtFPyx/IJGNAAqwNpAAARQnfzZYIIBhrBMgWKwBGTbiANl4bSSxBdlZr1czi2hgzcRiw+q2h/QO6TQpdZXdVetmxV0XYN0Znv1RfE49561LNr+KLM7UCxBVvHU/zz3v1/N+HOe9x5SmNKUPLs1c9g1MaUpTulyaCoEpTekDTlMhMKUpfcBpKgSmNKUPOE2FwJSm9AGnqRCY0pQ+4DQ2IeCc+2Hn3J845zadcz87rutMaUpTOhu5ceQJOOeeA/D/AvgbAL4D4A8A/Jj3/u1zv9iUpjSlM9G4LIHvA7Dpvf9T730fwK8B+MyYrjWlKU3pDPShMZ33BoBvy//fAXD3sJ2dc9O0xStAxWIR7777Lj70oQ9hZmYGhUIhfHfOgVYl/3/uuefw3HPPhe8zMzP4ru/6LnjvkSQJ+v0+0jRFoVDA/v4+nnvuOezv7yNJEhQKBbz33ntwzqHf7+O9994L2wDg3XffRa/Xg/ce7733Ht577z1kWYZ+vw/nXLRtSoE63vuq3TguIfBMcs59EcAXL+v6UzqaCoUCFhYWUCwWUS6XMTc3h2KxCADhe5ZlKJfLqFarKJfLSJIk7JOmKYrFImq1GtI0RbfbRblcxssvvxxd5+HDh8iyDEmSIEkSpGmKWq2Ga9euhX329/cxMzMTPvf29rCzswMA6HQ6aLVa6Ha7yLIM7XYbnU4HOzs74brdbhfNZhNpmqLf71/QCE4kbedtHJcQeATgo/L/Rw62Bf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abn3G9JUq+tp99DwPdcgt+RJHidGCAdvXAIOOacW3bO/RmYpUtmqXdIR8s59wd//C+SHJY7KXhMrkFHLwxkTPzvKqzWR9lMIK1R4GHrFxQBB/xSRF4SkYf9uVudcy1//Dfg1oJo6dVvGWP0eS9mP222Q4XQ4UXZu0hWv9LGJKADCh4TKbDWR9lMoGzc65ybBh4EPici99mLLpGvCjeflNWvx3eAPSQl51rAN4rqWERGgR8DX3TO/dNeK3JMutBR+Ji4AdT66IWymUBao8DD1i8YOJxzF/znJeCnJIP9toqW/vNSQeT06rfQMXLOve0n4CrwXTri7UDpEJEayYv3fefcT/zpwsekGx1ljYnvO7daH71QNhP4PXCH13rWSZQax4voWES2icjNegx8FDhLtm6CracwaPTq9zjwkNeIHwCWjIicO4K99SdIxkTpOOw10buAO4CTOfUpJKnqX3POfdNcKnRMetFR9JhI0bU+8tCq9qkJPUiihX0DeKTAfneTaHbPAK9o3yR7qV8DrwO/Am4ZQN8/IBErV0j2dkd69UuiKf62H5+XgbsHTMezvp8ZP7kmTPtHPB3ngAdzpONeElF/Bjjt/w4WPSbXoKPQMQH2k9TymCFhOF8xc/YkiQLyh8BWf/4m/33WX999I/1Fj8GIiCFH2duBiIiIkhGZQETEkCMygYiIIUdkAhERQ47IBCIihhyRCUREDDkiE4iIGHJEJhARMeT4P1arbVWZtvyoAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"x, y = train_generator.__getitem__(0)\n",
"plt.imshow(x[0]);"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "9WBMpRxcDMgp"
},
"source": [
"<a name='3'></a>\n",
"## 3 Model Development\n",
"\n",
"Now we'll move on to model training and development. We have a few practical challenges to deal with before actually training a neural network, though. The first is class imbalance."
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "qHBSgvxfn5yR"
},
"source": [
"<a name='3-1'></a>\n",
"### 3.1 Addressing Class Imbalance\n",
"One of the challenges with working with medical diagnostic datasets is the large class imbalance present in such datasets. Let's plot the frequency of each of the labels in our dataset:"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 365
},
"colab_type": "code",
"id": "-OvyPe5en5yR",
"outputId": "077747ad-7ab8-463d-8335-6b243cb29e63"
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAFcCAYAAADGVXW7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3dd5wkVbn/8c+XJS8uIKwBFndJBkCCEiRcVCQpAooi0QuKolf5iVkMVwS8ksyICiqIBAliWHElKKgIAruLBAGRZSWr5BwXnt8f5zRb29sz09NVNaH6+369+jXdVdVPn+mZevr0qRMUEZiZWXMtMtoFMDOzejnRm5k1nBO9mVnDOdGbmTWcE72ZWcM50ZuZNZwTvdkwSXqxpD9JekTS10boNadJCkmLVhTvDZLuqCKWjX1O9PY8SbdIekLSo4XbSqNdrjFof+BeYFJEfKJ9p6QfS3q67X28eqQLKWljSTMkPSjpfklXSHrPSJfDRp8TvbXbMSKWKdzuaj+gqlrlODYVuD4GH214VNv7uN5IFQ5A0qbAhcAfgTWAFYD/Ad48kuWwscGJ3oZUaDbYT9JtpASCpNdJujTXGK+W9IbCc1aV9MfcvHGBpO9IOiXvW6jZIH+b2DrfX0TSQZJulnSfpDMlvbCtLPtIuk3SvZI+X4gzQdLn8nMfkTRb0iqSjm1vZpE0XdLHBvidN5M0U9JD+edmefuPgX2AT+ea+tY9vJ9nSfp3jv0nSWsX9i0l6WuSbs37/yxpqcLT9+r0e3dwNHBSRBwZEfdGMjsi3jVAmQ4qvGfXS3p7Yd8a+W/5UH7dM/J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w/4CeJr5iX1D0loCbx/phUea3nTzUeAXkvaiw5s9aqUyG7431xS3NQnZvyTtANwFvLCm1+obEfEfYDNJbwTWyZt/ExEXjkZ5Gl2jb2l7s68brTfbbLjqXshD0ltJc8evAhwDTAIOiYjpVb2Gjb6+SPRm41WdC3lImkCaK/0bVcSzscuJ3mwMq3shD0lXRMTGVcWzsanpbfRm413dC3lcIuk7wBnMn0eeiLiy6hey0eMavdkYVvdCHpIu6rA53I++WZzozcwazk03Zn1M0hc7be91Dh0bm5zozfrbY4X7SwJvJY2UtQZx042ZPS/PknleRLxhtMti1Wn6XDdmNjxLA1NGuxBWLTfdmPUxSdcyfwGSCcBkwO3zDeOmG7M+Jmlq4eE84D9VTrFgY4Obbsz6WETcSprnZquIuBNYTtKqo1wsq5hr9GZ9TNLBpBldXxERL5e0EnBWRGw+ykWzCrlGb9bf3g7sRO5mGRF3AS8Y1RJZ5Zzozfrb05G+1geApImjXB6rgRO9WX87U9JxpLb59wO/A34wxHNsnHEbvVmfk7QNsC1porTzIuKCUS6SVcyJ3sys4TxgyqwPSXqE1C4v5g+YgoqmP7axxTV6M7OGc43erA+1LTp+DXCCR8Q2l2v0Zn2ozkXHbexxojfrQ3UvOm5ji/vRm/WnBRYdH82CWP1cozfrQ3UvOm5jixO9mVnDuenGzKzhnOjNzBrOid7MrOGc6M3MGu7/A93a7/FbUeGTAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.xticks(rotation=90)\n",
"plt.bar(x=labels, height=np.mean(train_generator.labels, axis=0))\n",
"plt.title(\"Frequency of Each Class\")\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can see from this plot that the prevalance of positive cases varies significantly across the different pathologies. (These trends mirror the ones in the full dataset as well.) \n",
"* The `Hernia` pathology has the greatest imbalance with the proportion of positive training cases being about 0.2%. \n",
"* But even the `Infiltration` pathology, which has the least amount of imbalance, has only 17.5% of the training cases labelled positive.\n",
"\n",
"Ideally, we would train our model using an evenly balanced dataset so that the positive and negative training cases would contribute equally to the loss. \n",
"\n",
"If we use a normal cross-entropy loss function with a highly unbalanced dataset, as we are seeing here, then the algorithm will be incentivized to prioritize the majority class (i.e negative in our case), since it contributes more to the loss. "
]