|
a/README.md |
|
b/README.md |
1 |
# A deep learning algorithm for automatic detection and classification of acute intracranial hemorrhages in head CT scans |
1 |
# A deep learning algorithm for automatic detection and classification of acute intracranial hemorrhages in head CT scans |
2 |
|
2 |
|
3 |
[Journal Link](https://doi.org/10.1016/j.nicl.2021.102785) |
3 |
[Journal Link](https://doi.org/10.1016/j.nicl.2021.102785) |
4 |
|
4 |
|
5 |
# RSNA Intracranial Hemorrhage Detection |
5 |
# RSNA Intracranial Hemorrhage Detection
|
6 |
This is the source code for the first place solution to the [RSNA2019 Intracranial Hemorrhage Detection Challenge](https://www.kaggle.com/c/rsna-intracranial-hemorrhage-detection). |
6 |
This is the source code for the first place solution to the [RSNA2019 Intracranial Hemorrhage Detection Challenge](https://www.kaggle.com/c/rsna-intracranial-hemorrhage-detection). |
7 |
|
7 |
|
8 |
Solution write up: [Link](https://www.kaggle.com/c/rsna-intracranial-hemorrhage-detection/discussion/117210#latest-682640). |
8 |
Solution write up: [Link](https://www.kaggle.com/c/rsna-intracranial-hemorrhage-detection/discussion/117210#latest-682640). |
9 |
|
9 |
|
10 |
## Solutuoin Overview |
10 |
## Solutuoin Overview
|
11 |
 |
11 |
 |
12 |
|
12 |
|
13 |
#### Dependencies |
13 |
#### Dependencies
|
14 |
- opencv-python==3.4.2 |
14 |
- opencv-python==3.4.2
|
15 |
- scikit-image==0.14.0 |
15 |
- scikit-image==0.14.0
|
16 |
- scikit-learn==0.19.1 |
16 |
- scikit-learn==0.19.1
|
17 |
- scipy==1.1.0 |
17 |
- scipy==1.1.0
|
18 |
- torch==1.1.0 |
18 |
- torch==1.1.0
|
19 |
- torchvision==0.2.1 |
19 |
- torchvision==0.2.1 |
20 |
|
20 |
|
21 |
### CODE |
21 |
### CODE
|
22 |
- 2DNet |
22 |
- 2DNet
|
23 |
- 3DNet |
23 |
- 3DNet
|
24 |
- SequenceModel |
24 |
- SequenceModel |
25 |
|
25 |
|
26 |
# 2D CNN Classifier |
26 |
# 2D CNN Classifier |
27 |
|
27 |
|
28 |
## Pretrained models |
28 |
## Pretrained models
|
29 |
- seresnext101_256*256 [\[seresnext101\]](https://drive.google.com/open?id=18Py5eW1E4hSbTT6658IAjQjJGS28grdx) |
29 |
- seresnext101_256*256 [\[seresnext101\]](https://drive.google.com/open?id=18Py5eW1E4hSbTT6658IAjQjJGS28grdx)
|
30 |
- densenet169_256*256 [\[densenet169\]](https://drive.google.com/open?id=1vCsX12pMZxBmuGGNVnjFFiZ-5u5vD-h6) |
30 |
- densenet169_256*256 [\[densenet169\]](https://drive.google.com/open?id=1vCsX12pMZxBmuGGNVnjFFiZ-5u5vD-h6)
|
31 |
- densenet121_512*512 [\[densenet121\]](https://drive.google.com/open?id=1o0ok-6I2hY1ygSWdZOKmSD84FsEpgDaa) |
31 |
- densenet121_512*512 [\[densenet121\]](https://drive.google.com/open?id=1o0ok-6I2hY1ygSWdZOKmSD84FsEpgDaa) |
32 |
|
32 |
|
33 |
## Preprocessing |
33 |
## Preprocessing
|
34 |
 |
34 |
 |
35 |
|
35 |
|
36 |
Prepare csv file: |
36 |
Prepare csv file: |
37 |
|
37 |
|
38 |
download data.zip: https://drive.google.com/open?id=1buISR_b3HQDU4KeNc_DmvKTYJ1gvj5-3 |
38 |
download data.zip: https://drive.google.com/open?id=1buISR_b3HQDU4KeNc_DmvKTYJ1gvj5-3 |
39 |
|
39 |
|
40 |
1. convert dcm to png |
40 |
1. convert dcm to png
|
41 |
``` |
41 |
```
|
42 |
python3 prepare_data.py -dcm_path stage_1_train_images -png_path train_png |
42 |
python3 prepare_data.py -dcm_path stage_1_train_images -png_path train_png
|
43 |
python3 prepare_data.py -dcm_path stage_1_test_images -png_path train_png |
43 |
python3 prepare_data.py -dcm_path stage_1_test_images -png_path train_png
|
44 |
python3 prepare_data.py -dcm_path stage_2_test_images -png_path test_png |
44 |
python3 prepare_data.py -dcm_path stage_2_test_images -png_path test_png
|
45 |
``` |
45 |
``` |
46 |
|
46 |
|
47 |
2. train |
47 |
2. train |
48 |
|
48 |
|
49 |
``` |
49 |
```
|
50 |
python3 train_model.py -backbone DenseNet121_change_avg -img_size 256 -tbs 256 -vbs 128 -save_path DenseNet121_change_avg_256 |
50 |
python3 train_model.py -backbone DenseNet121_change_avg -img_size 256 -tbs 256 -vbs 128 -save_path DenseNet121_change_avg_256
|
51 |
python3 train_model.py -backbone DenseNet169_change_avg -img_size 256 -tbs 256 -vbs 128 -save_path DenseNet169_change_avg_256 |
51 |
python3 train_model.py -backbone DenseNet169_change_avg -img_size 256 -tbs 256 -vbs 128 -save_path DenseNet169_change_avg_256
|
52 |
python3 train_model.py -backbone se_resnext101_32x4d -img_size 256 -tbs 80 -vbs 40 -save_path se_resnext101_32x4d_256 |
52 |
python3 train_model.py -backbone se_resnext101_32x4d -img_size 256 -tbs 80 -vbs 40 -save_path se_resnext101_32x4d_256
|
53 |
``` |
53 |
``` |
54 |
|
54 |
|
55 |
3. predict |
55 |
3. predict
|
56 |
``` |
56 |
```
|
57 |
python3 predict.py -backbone DenseNet121_change_avg -img_size 256 -tbs 4 -vbs 4 -spth DenseNet121_change_avg_256 |
57 |
python3 predict.py -backbone DenseNet121_change_avg -img_size 256 -tbs 4 -vbs 4 -spth DenseNet121_change_avg_256
|
58 |
python3 predict.py -backbone DenseNet169_change_avg -img_size 256 -tbs 4 -vbs 4 -spth DenseNet169_change_avg_256 |
58 |
python3 predict.py -backbone DenseNet169_change_avg -img_size 256 -tbs 4 -vbs 4 -spth DenseNet169_change_avg_256
|
59 |
python3 predict.py -backbone se_resnext101_32x4d -img_size 256 -tbs 4 -vbs 4 -spth se_resnext101_32x4d_256 |
59 |
python3 predict.py -backbone se_resnext101_32x4d -img_size 256 -tbs 4 -vbs 4 -spth se_resnext101_32x4d_256
|
60 |
``` |
60 |
``` |
61 |
|
61 |
|
62 |
After single models training, the oof files will be saved in ./SingleModelOutput(three folders for three pipelines). |
62 |
After single models training, the oof files will be saved in ./SingleModelOutput(three folders for three pipelines). |
63 |
|
63 |
|
64 |
After training the sequence model, the final submission will be ./FinalSubmission/final_version/submission_tta.csv |
64 |
After training the sequence model, the final submission will be ./FinalSubmission/final_version/submission_tta.csv |
65 |
|
65 |
|
66 |
# Sequence Models |
66 |
# Sequence Models |
67 |
|
67 |
|
68 |
## Sequence Model 1 |
68 |
## Sequence Model 1
|
69 |
 |
69 |
 |
70 |
|
70 |
|
71 |
## Sequence Model 2 |
71 |
## Sequence Model 2
|
72 |
 |
72 |
 |
73 |
|
73 |
|
74 |
#### Path Setup |
74 |
#### Path Setup
|
75 |
Set data path in ./setting.py |
75 |
Set data path in ./setting.py |
76 |
|
76 |
|
77 |
#### download |
77 |
#### download |
78 |
|
78 |
|
79 |
download [\[csv.zip\]](https://drive.google.com/open?id=1qYi4k-DuOLJmyZ7uYYrnomU2U7MrYRBV) |
79 |
download [\[csv.zip\]](https://drive.google.com/open?id=1qYi4k-DuOLJmyZ7uYYrnomU2U7MrYRBV) |
80 |
|
80 |
|
81 |
download [\[feature samples\]](https://drive.google.com/open?id=1lJgzZoHFu6HI4JBktkGY3qMk--28IUkC) |
81 |
download [\[feature samples\]](https://drive.google.com/open?id=1lJgzZoHFu6HI4JBktkGY3qMk--28IUkC) |
82 |
|
82 |
|
83 |
#### Sequence Model Training |
83 |
#### Sequence Model Training
|
84 |
``` |
84 |
```
|
85 |
CUDA_VISIBLE_DEVICES=0 python main.py |
85 |
CUDA_VISIBLE_DEVICES=0 python main.py
|
86 |
``` |
86 |
```
|
87 |
The final submissions are in the folder ../FinalSubmission/version2/submission_tta.csv |
87 |
The final submissions are in the folder ../FinalSubmission/version2/submission_tta.csv |
88 |
|
88 |
|
89 |
## Final Submission |
89 |
## Final Submission
|
90 |
### Private Leaderboard: |
90 |
### Private Leaderboard:
|
91 |
- 0.04383 |
91 |
- 0.04383
|
92 |
## Reference |
92 |
## Reference
|
93 |
If you find our work useful in your research or if you use parts of this code please consider citing our [paper](https://doi.org/10.1016/j.nicl.2021.102785): |
93 |
If you find our work useful in your research or if you use parts of this code please consider citing our [paper](https://doi.org/10.1016/j.nicl.2021.102785): |
94 |
|
94 |
|
95 |
```@article{wang2021deep, |
95 |
```@article{wang2021deep,
|
96 |
title={A deep learning algorithm for automatic detection and classification of acute intracranial hemorrhages in head CT scans}, |
96 |
title={A deep learning algorithm for automatic detection and classification of acute intracranial hemorrhages in head CT scans},
|
97 |
author={Wang, Xiyue and Shen, Tao and Yang, Sen and Lan, Jun and Xu, Yanming and Wang, Minghui and Zhang, Jing and Han, Xiao}, |
97 |
author={Wang, Xiyue and Shen, Tao and Yang, Sen and Lan, Jun and Xu, Yanming and Wang, Minghui and Zhang, Jing and Han, Xiao},
|
98 |
journal={NeuroImage: Clinical}, |
98 |
journal={NeuroImage: Clinical},
|
99 |
volume={32}, |
99 |
volume={32},
|
100 |
pages={102785}, |
100 |
pages={102785},
|
101 |
year={2021}, |
101 |
year={2021},
|
102 |
publisher={Elsevier} |
102 |
publisher={Elsevier}
|
103 |
} |
103 |
}
|
104 |
``` |
104 |
``` |
105 |
|
105 |
|
106 |
|
106 |
|
107 |
### TODO |
107 |
### TODO
|
108 |
- [ ] Pre-trained models |
108 |
- [ ] Pre-trained models
|
109 |
- [ ] 2DCNN + SeqModel end-to-end training |
109 |
- [ ] 2DCNN + SeqModel end-to-end training
|
110 |
- [ ] 3DCNN training |
110 |
- [ ] 3DCNN training
|