a b/README.md
1
# OpenSRH: optimizing brain tumor surgery using intraoperative stimulated Raman histology
2
3
Companion code for OpenSRH. Paper submitted to NeurIPS 2022
4
Datasets and Benchmarks Track.
5
6
[**Paper Website**](https://opensrh.mlins.org) /
7
[**arXiv**](https://arxiv.org/abs/2206.08439) /
8
[**MLiNS Lab**](https://mlins.org)
9
10
## Installation
11
12
1. Clone OpenSRH github repo
13
   ```console
14
   git clone git@github.com:MLNeurosurg/opensrh.git
15
   ```
16
2. Install miniconda: follow instructions
17
    [here](https://docs.conda.io/en/latest/miniconda.html)
18
3. Create conda environment
19
    ```console
20
    conda create -n opensrh python=3.9
21
    ```
22
4. Activate conda environment
23
    ```console
24
    conda activate opensrh
25
    ```
26
5. Install package and dependencies
27
    ```console
28
    <cd /path/to/opensrh/repo/dir>
29
    pip install -e .
30
    ```
31
32
## Directory organization
33
- opensrh: the library for training with OpenSRH
34
    - datasets: PyTorch datasets to work with the data release
35
    - losses: loss functions for contrastive learning
36
    - models: PyTorch networks for training and evaluation
37
    - train: training and evaluation scrpits
38
- README.md
39
- LICENSE
40
41
# Training / evaluation instructions
42
43
The code base is written using PyTorch Lightning, with custom network and
44
datasets.
45
46
## Cross entropy experiments
47
1. Download and uncompress the data.
48
2. Update the sample config file in `train/config/train_ce.yaml` with desired
49
    configurations.
50
3. Change directory to `train` and activate the conda virtual environment.
51
4. Use `train/train_ce.py` to start training:
52
    ```console
53
    python train_ce.py -c config/train_ce.yaml
54
    ```
55
56
## Contrastive learning experiments
57
1. Download and uncompress the data.
58
2. Update the sample config file in `train/config/train_contrastive.yaml` with
59
    desired configurations.
60
3. Change directory to `train` and activate the conda virtual environment.
61
4. Use `train/train_contrastive.py` to start training:
62
    ```console
63
    python train_contrastive.py -c config/train_contrastive.yaml
64
    ```
65
5. To run linear or finetuning protocol, update the config file
66
    `train/config/train_finetune.yaml` and continue training using
67
    `train/train_finetune.py`:
68
    ```console
69
    python train_finetune.py -c config/train_finetune.yaml
70
    ```
71
72
## Model evaluation
73
1. Update the sample config file in `train/config/eval.yaml` with desired
74
    configurations, including the PyTorch Lightning checkpoint you would like
75
    to use.
76
2. Change directory to `train` and activate the conda virtual environment.
77
3. Use `train/train_ce.py` to start training:
78
    ```console
79
    python eval.py -c config/eval.yaml
80
    ```
81
82
## License Information
83
OpenSRH data is released under Attribution-NonCommercial-ShareAlike 4.0
84
International (CC BY-NC-SA 4.0), and the code is licensed under the MIT License.
85
See LICENSE for license information and THIRD\_PARTY for third party notices.