Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/werserk/aiijc-med-1st-place
Solution of the first place in the AIIJC competition for detecting signs of coronavirus pneumonia on CT scan of the lungs
https://github.com/werserk/aiijc-med-1st-place
competition computer-vision covid19 deep-learning hackathon opencv segmentation torch
Last synced: 3 days ago
JSON representation
Solution of the first place in the AIIJC competition for detecting signs of coronavirus pneumonia on CT scan of the lungs
- Host: GitHub
- URL: https://github.com/werserk/aiijc-med-1st-place
- Owner: werserk
- License: mit
- Created: 2022-01-13T17:23:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-25T10:17:03.000Z (almost 2 years ago)
- Last Synced: 2023-03-05T09:11:47.304Z (over 1 year ago)
- Topics: competition, computer-vision, covid19, deep-learning, hackathon, opencv, segmentation, torch
- Language: Python
- Homepage: https://aiijc.com/en/
- Size: 2.1 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AIIJC. The "AI in Medicine" competition track
## Competiton overview
Artifical Intelligence International Junior Contest (AIIJC) has 10 tracks on different themes. \
This repository contains the code for the "AI in Medicine" track. \
Specific of competition is that all participants must be under 18 years old.The main organizer and sponsor of the competition is Sberbank. \
Organizer and task developer is Alliance for Artificial Intelligence.## Data
Competition don't provide any data. \
So we find 3 datasets for training and testing our models:* [MosMedData](https://mosmed.ai/datasets/covid19_1110/)
* [MedSeg](http://medicalsegmentation.com/covid19/)
* [Zenodo](https://zenodo.org/record/3757476#.YRqU0IgzbP_)## Methods
### Pathology segmentation
For this task we used:
* 2 pretrained Unet++ with backbone EfficientNet-B7 for 2 classes: \
COVID-19 ground glass and COVID-19 consolidation.
* Loss function is IoU
* Optimizer is Adam with learning rate 1e-4### Lungs segmentation
Our task need percentage of pathologies per lung. \
So we need to segment lungs. \
For this task we prepared specific computer vision pipeline.1. The mask of pathology was subtracted from the image
We did it because pathology prevents
us from seeing the lungs (they are totally black, pathology - gray/white).
2. Find 2 largest contours in the image
The contours are the lungs.
3. Delete image by half and find max overlaps for each contour with half of the image.
Here we find the lungs that are on the left and right. (in dicom we have info about the side of the image)
4. Cut mask of pathology by contours of lungs
Our model isn't perfect, so we need to cut the mask of pathology by contours of lungs.
This was we reached better accuracy.
5. Calculate percentage of pathology per lungLet's see how it works in images:
...## Results
![](.images/website.png)
| image | base opencv adaptive thresholding | ours adaptive thresholding |
|:----------------------------:|:-------------------------------------------:|:-------------------------------------------:|
| ![](.images/slice_image.png) | ![](.images/base_adaptive_thresholding.png) | ![](.images/ours_adaptive_thresholding.png) |## Run code
Clone this repository
```bash
git clone https://github.com/werserk/AIIJC-med-1st-place.git
```Install folder with model checkpoints: [link](https://drive.google.com/file/d/19svztOBB4RhnW7cwuZTDPZb0EiWKdydN/view?usp=sharing)(could be unavailable, contact me)
```bash
pip install -r requirements.txt
```To activate web interface run
```bash
streamlit run streamlit_app.py
```To activate app in bash run
```bash
python3 bash_app.py --data --save_folder --multi --show_legend
```