# QuilL_master_course@CODIPAI2023
pip install pyvips
apt -y install libvips-dev
This document instructs how to do inference in our solution source code for the given dataset. We assume that all environments are installed sucessfully in the docker image.
## Team members
- Lee Jucheon
- Anh T. Nguyen
- Doanh C. Bui
## Step-by-step running
### 1. Build docker file
First, extract the code:
```
unzip WSI-finetuning.zip
```
Then, go inside the code directory:
```
cd WSI-finetuning
```
Run following command to build docker image:
```
docker build -t quiil -f Dockerfile .
```
After build the Dockerfile, please run and mount the data directory into the `data_wsis` in docker image:
```
docker run --gpus all -it --mount type=bind,source="<data source dir>",target="/WSI-finetuning/data_wsis" quiil
```
Where:
- `<data source dir>`: source data folder in the main server, we assume this is the directory including WSI file images.
### 2. Downgrade from 40X to 20X
First, note that we assume the orginal WSI data folder has the following directory tree:
```
./data_wsis
|__ Lymph_node_metasis_present
|__ Lymph_node_metasis_absent
```
Because we worked on the 20X WSIs. Then, resizing from 40X to 20X is required. Run the below script for resizing:
```
python resize_40x_to_20x_cancer.py
```
If images are sucessfully downgraded, it would generate the new folder whose name is `data_wsis_20x`.
```
./data_wsis_20x
|__ Lymph_node_metasis_present
|__ Lymph_node_metasis_absent
```
### 3. Patch extraction
Run the following python script to perform patch extraction
```
bash create_patches.sh
```
There is a sub-folder `Codipai_patch256_ostu` created inside the folder `data_wsis_20x` include `.h5` files storing coordinates of extracted patches.
### 4. Feature extraction
After patching, do the feature extraction by following command:
```
bash create_features_ft.sh
```
Then, the features will be stored in sub-folder `feats_ft_512` in `data_wsis_20x`.
### 5. Inference to produce final output
For inference to produce final output, just run the following python script:
```
bash inference.sh
```
Then, the csv file `QuilL_master_course@CODIPAI2023_submission.csv` is created storing our predictions.
The stucture is design as following:
```[python3]
slide_id,label
CODIPAI-THCB-0105,0
CODIPAI-THCB-0239,1
CODIPAI-THCB-0365,0
CODIPAI-THCB-0424,1
CODIPAI-THCB-0291,0
CODIPAI-THCB-0464,1
CODIPAI-THCB-0140,0
CODIPAI-THCB-0367,0
CODIPAI-THCB-0408,0
CODIPAI-THCB-0205,0
CODIPAI-THCB-0463,1
CODIPAI-THCB-0170,1
CODIPAI-THCB-0083,1
CODIPAI-THCB-0056,1
CODIPAI-THCB-0416,1
```