---
name: "K-POP"
license: "mit"
metrics:
- MAE
- PLCC
- SRCC
- R2
tags:
- focus-prediction
- microscopy
- pytorch
---
# K-POP: Predicting Distance to Focal Plane for Kato-Katz Prepared Microscopy Slides Using Deep Learning
## Description
This repository contains the models and training pipeline for my master thesis. The main repository is hosted on [GitHub](https://github.com/13hannes11/master_thesis_code).
The project structure is based on the template by [ashleve](https://github.com/ashleve/lightning-hydra-template).
The metadata is stored in `data/focus150/`. The relevant files are `test_metadata.csv`, `train_metadata.csv` and `validation_metadata.csv`. Image data (of 150 x 150 px images) is not published together with this repository therefore training runs are not possible to do without it. The layout of the metadata files is as follows
```csv
,image_path,scan_uuid,study_id,focus_height,original_filename,stack_id,obj_name
0,31/b0d4005e-57d0-4516-a239-abe02a8d0a67/I02413_X009_Y014_Z5107_750_300.jpg,b0d4005e-57d0-4516-a239-abe02a8d0a67,31,-0.013672000000000017,I02413_X009_Y014_Z5107.jpg,1811661,schistosoma
1,31/274d8969-aa7c-4ac0-be60-e753579393ad/I01981_X019_Y014_Z4931_450_0.jpg,274d8969-aa7c-4ac0-be60-e753579393ad,31,-0.029296999999999962,I01981_X019_Y014_Z4931.jpg,1661371,schistosoma
...
```
## How to run
Train model with chosen experiment configuration from `configs/experiment/`
```bash
python train.py experiment=focusResNet_150
```
Train with hyperparameter search from `configs/hparams_search/`
```bash
python train.py -m hparams_search=focusResNetMSE_150
```
You can override any parameter from command line like this
```bash
python train.py trainer.max_epochs=20 datamodule.batch_size=64
```
## Jupyter notebooks
Figures and other evaluation code was run in Jupyter notebooks. These are available at `notebooks/`