|
a |
|
b/README.md |
|
|
1 |
[](https://github.com/ahmedbesbes/character-based-cnn/blob/master/LICENSE) |
|
|
2 |
[](https://github.com/ahmedbesbes/mrnet) |
|
|
3 |
[](https://twitter.com/ahmed_besbes_) |
|
|
4 |
[](https://github.com/ahmedbesbes/mrnet/stargazers) |
|
|
5 |
|
|
|
6 |
|
|
|
7 |
# Deep learning in medical imaging: How to automate the detection of knee injuries in MRI exams ? |
|
|
8 |
|
|
|
9 |
This repository contains an implementation of a convolutional neural network that classifies specific knee injuries from MRI exams. |
|
|
10 |
|
|
|
11 |
It also contains the matieral of a series of posts I wrote on <a href="http://ahmedbesbes.com"> my blog</a>. |
|
|
12 |
|
|
|
13 |
## Dataset: MRNet |
|
|
14 |
|
|
|
15 |
The data comes from Stanford ML Group research lab. It consits of 1,370 knee MRI exams performed at Stanford University Medical Center to study the presence of Anterior Cruciate Ligament (ACL) tears. |
|
|
16 |
|
|
|
17 |
For more information about the ACL tear problem and the MRNet data please refer to my blog post where you can investigate the data and build the following data visualization in jupyter notebook: |
|
|
18 |
|
|
|
19 |
|
|
|
20 |
<p align="center"> |
|
|
21 |
<img src="./images/mri.gif"> |
|
|
22 |
</p> |
|
|
23 |
|
|
|
24 |
To learn more about the data and how to realize this visualization widget, read <a href="https://ahmedbesbes.com/automate-the-diagnosis-of-knee-injuries-with-deep-learning-part-1-an-overview-of-the-mrnet-dataset.html">my first post.</a> |
|
|
25 |
|
|
|
26 |
## Code structure: |
|
|
27 |
|
|
|
28 |
This charts summarizes the architecture of the project: |
|
|
29 |
|
|
|
30 |
<img src="./images/pipeline.png"> |
|
|
31 |
|
|
|
32 |
For more details about the code, please refer to my second <a href="https://ahmedbesbes.com/automate-the-diagnosis-of-knee-injuries-with-deep-learning-part-2-building-an-acl-tear-classifier.html">blog post </a>. |
|
|
33 |
|
|
|
34 |
## How to use the code: |
|
|
35 |
|
|
|
36 |
If you want to retrain the network on your own you have to ask for the data from Stanford via this <a href="https://stanfordmlgroup.github.io/competitions/mrnet/">link</a>. |
|
|
37 |
|
|
|
38 |
Once you download the data, create a `data` folder and place it at the root of the project. You should have two folders inside: `train` and `valid` as well as a bunch of csv files. |
|
|
39 |
|
|
|
40 |
To run the script you can execute it with the following arguments: |
|
|
41 |
|
|
|
42 |
```python |
|
|
43 |
parser = argparse.ArgumentParser() |
|
|
44 |
parser.add_argument('-t', '--task', type=str, required=True, |
|
|
45 |
choices=['abnormal', 'acl', 'meniscus']) |
|
|
46 |
parser.add_argument('-p', '--plane', type=str, required=True, |
|
|
47 |
choices=['sagittal', 'coronal', 'axial']) |
|
|
48 |
parser.add_argument('--augment', type=int, choices=[0, 1], default=1) |
|
|
49 |
parser.add_argument('--lr_scheduler', type=int, choices=[0, 1], default=1) |
|
|
50 |
parser.add_argument('--epochs', type=int, default=50) |
|
|
51 |
parser.add_argument('--lr', type=float, default=1e-5) |
|
|
52 |
parser.add_argument('--flush_history', type=int, choices=[0, 1], default=0) |
|
|
53 |
parser.add_argument('--save_model', type=int, choices=[0, 1], default=1) |
|
|
54 |
parser.add_argument('--patience', type=int, choices=[0, 1], default=5) |
|
|
55 |
``` |
|
|
56 |
|
|
|
57 |
example to train a model to detect acl tears on the sagittal plane for a 20 epochs: |
|
|
58 |
|
|
|
59 |
`python -t acl -p sagittal --epochs=20` |
|
|
60 |
|
|
|
61 |
Note: Before running the script, add the following (empty) folders at the root of the project: |
|
|
62 |
- models |
|
|
63 |
- logs |
|
|
64 |
|
|
|
65 |
|
|
|
66 |
## Results: |
|
|
67 |
|
|
|
68 |
I trained an ACL tear classifier on a sagittal plane and got the following AUC scores: |
|
|
69 |
|
|
|
70 |
- on train: 0.8669 |
|
|
71 |
- on validation: 0.8850 |
|
|
72 |
|
|
|
73 |
Logs on Tensorboard: |
|
|
74 |
|
|
|
75 |
<img src="./images/sagittal_tensorboard.png"> |
|
|
76 |
|
|
|
77 |
|
|
|
78 |
## Contributions - PR are welcome: |
|
|
79 |
|
|
|
80 |
If you feel that some functionalities or improvements could be added to the project, don't hesitate to submit a pull request. |
|
|
81 |
|