Diff of /README.md [000000] .. [cbdc43]

Switch to unified view

a b/README.md
1
# AIIJC. The "AI in Medicine" competition track
2
3
## Competiton overview
4
5
Artifical Intelligence International Junior Contest (AIIJC) has 10 tracks on different themes. \
6
This repository contains the code for the "AI in Medicine" track. \
7
Specific of competition is that all participants must be under 18 years old.
8
9
The main organizer and sponsor of the competition is Sberbank. \
10
Organizer and task developer is Alliance for Artificial Intelligence.
11
12
## Data
13
14
Competition don't provide any data. \
15
So we find 3 datasets for training and testing our models:
16
17
* [MosMedData](https://mosmed.ai/datasets/covid19_1110/)
18
* [MedSeg](http://medicalsegmentation.com/covid19/)
19
* [Zenodo](https://zenodo.org/record/3757476#.YRqU0IgzbP_)
20
21
## Methods
22
23
### Pathology segmentation
24
25
For this task we used:
26
27
* 2 pretrained Unet++ with backbone EfficientNet-B7 for 2 classes: \
28
  COVID-19 ground glass and COVID-19 consolidation.
29
* Loss function is IoU
30
* Optimizer is Adam with learning rate 1e-4
31
32
### Lungs segmentation
33
34
Our task need percentage of pathologies per lung. \
35
So we need to segment lungs. \
36
For this task we prepared specific computer vision pipeline.
37
38
1. The mask of pathology was subtracted from the image
39
   We did it because pathology prevents
40
   us from seeing the lungs (they are totally black, pathology - gray/white).
41
2. Find 2 largest contours in the image
42
   The contours are the lungs.
43
3. Delete image by half and find max overlaps for each contour with half of the image.
44
   Here we find the lungs that are on the left and right. (in dicom we have info about the side of the image)
45
4. Cut mask of pathology by contours of lungs
46
   Our model isn't perfect, so we need to cut the mask of pathology by contours of lungs.
47
   This was we reached better accuracy.
48
5. Calculate percentage of pathology per lung
49
50
Let's see how it works in images:
51
...
52
53
## Results
54
55
![](.images/website.png)
56
57
|            image             |      base opencv adaptive thresholding      |         ours adaptive thresholding          |
58
|:----------------------------:|:-------------------------------------------:|:-------------------------------------------:|
59
| ![](.images/slice_image.png) | ![](.images/base_adaptive_thresholding.png) | ![](.images/ours_adaptive_thresholding.png) |
60
61
## Run code
62
63
Clone this repository
64
```bash
65
git clone https://github.com/werserk/AIIJC-med-1st-place.git
66
```
67
68
Install folder with model checkpoints: [link](https://drive.google.com/file/d/19svztOBB4RhnW7cwuZTDPZb0EiWKdydN/view?usp=sharing)(could be unavailable, contact me)
69
70
```bash
71
pip install -r requirements.txt
72
```
73
74
To activate web interface run
75
76
```bash
77
streamlit run streamlit_app.py
78
```
79
80
To activate app in bash run
81
82
```bash
83
python3 bash_app.py --data <image folder> --save_folder <dst folder> --multi --show_legend
84
```