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.
Competition don't provide any data.
So we find 3 datasets for training and testing our models:
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
Our task need percentage of pathologies per lung.
So we need to segment lungs.
For this task we prepared specific computer vision pipeline.
- 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).
- Find 2 largest contours in the image The contours are the lungs.
- 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)
- 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.
- Calculate percentage of pathology per lung
Let's see how it works in images: ...
image | base opencv adaptive thresholding | ours adaptive thresholding |
---|---|---|
Clone this repository
git clone https://github.com/werserk/AIIJC-med-1st-place.git
Install folder with model checkpoints: link(could be unavailable, contact me)
pip install -r requirements.txt
To activate web interface run
streamlit run streamlit_app.py
To activate app in bash run
python3 bash_app.py --data <image folder> --save_folder <dst folder> --multi --show_legend