File size: 2,420 Bytes
51b5866
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fe96f4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51b5866
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# AbdCTBench Code

Training and evaluation pipeline for comorbidity prediction from abdominal CT scans.

## What This Code Does

- Train single-task or multi-task models from CSV + PNG data
- Evaluate checkpoints with reproducible metrics
- Load released checkpoints in `.safetensors` or `.pth` format

## Install

```bash
pip install -r requirements.txt
```

## Data Layout

Pass `--data_dir` pointing to:

```text
data_dir/
├── train.csv
├── val.csv
├── test.csv
└── data/
    ├── <FILE>.png
    └── ...
```

`FILE` values in CSV must match PNG basenames.

## Train

```bash
python train.py \
  --model "ResNet-18" \
  --data_dir ../AbdCTBench_dataset \
  --biomarker_config ./config/biomarker_config_multitask_example.yaml \
  --output_dir ./outputs
```

Reproducibility flags:

- `--seed 42`
- `--deterministic`

## Evaluate

```bash
python test.py \
  --data_dir ../AbdCTBench_dataset \
  --checkpoint_path ../models/mi_only/ResNet-18_lr1e-05_bs16/best_checkpoint.safetensors \
  --biomarker_config ../models/mi_only/ResNet-18_lr1e-05_bs16/biomarker_config.json \
  --output_dir ./test_results
```

Useful options:

- `--save_predictions`
- `--save_metrics`
- `--only_pred`

## Checkpoint Folder Contents

Each released model folder contains:

- `best_checkpoint.safetensors`
- `config.json`
- `biomarker_config.json`

## DICOM to PNG Pipeline

The DICOM -> STL -> PNG conversion scripts are in:

- `dicom_stl_png_pipeline/`

Key files:

- `dicom2stl.py`: converts a DICOM series (folder/zip) to STL
- `stl2png_centered.py`: renders STL to a centered PNG
- `parseargs.py` and `utils/`: argument parsing and volume/mesh helper utilities
- `requirements.txt` in this folder: extra dependencies for this conversion pipeline

Install pipeline dependencies:

```bash
pip install -r dicom_stl_png_pipeline/requirements.txt
```

Minimal usage:

```bash
python dicom_stl_png_pipeline/dicom2stl.py \
  --type skin \
  --output ./sample.stl \
  /path/to/dicom_series_folder
```

```bash
python dicom_stl_png_pipeline/stl2png_centered.py \
  ./sample.stl \
  ./sample.png
```

Notes:

- This conversion pipeline is optional and separate from model train/test.
- `train.py` and `test.py` consume PNG + CSV data and do not run DICOM conversion internally.

## Biomarker Config Templates

- `config/biomarker_config_single_task_example.yaml`
- `config/biomarker_config_multitask_example.yaml`