Skip to content

Commit 04892b3

Browse files
committed
added workflow, refactored
1 parent 615bd0a commit 04892b3

9 files changed

Lines changed: 137 additions & 17 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build & Push Inference Image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*"]
7+
paths:
8+
- "src/baseline-inference/**"
9+
- ".github/workflows/inference-docker.yml"
10+
11+
jobs:
12+
build-push:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Log in to GHCR
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Extract metadata
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: ghcr.io/bic-mac-challenge/inference
34+
tags: |
35+
type=semver,pattern={{version}}
36+
type=semver,pattern={{major}}.{{minor}}
37+
type=sha,prefix=sha-,format=short
38+
type=raw,value=latest,enable={{is_default_branch}}
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
43+
- name: Build and push
44+
uses: docker/build-push-action@v6
45+
with:
46+
context: src/baseline-inference
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}
50+
cache-from: type=registry,ref=ghcr.io/bic-mac-challenge/inference:cache
51+
cache-to: type=registry,ref=ghcr.io/bic-mac-challenge/inference:cache,mode=max

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,54 @@ python src/baseline/model.py data/sub-000/features/ results/sub-000/ct_pred.nii.
116116
```
117117

118118
---
119+
## 🐳 Inference Docker (`src/baseline-inference/`)
120+
121+
To simplify reproducibility and submission, the baseline model is also provided as a **fully self-contained Docker image**. This container wraps the same baseline UNet model and runs inference directly from the command line.
122+
123+
This Docker image should be considered the **official baseline submission** — participants are expected to improve upon it.
124+
125+
### 📦 Pull Image
126+
127+
```bash
128+
docker pull ghcr.io/bic-mac-challenge/inference:latest
129+
```
130+
131+
### ▶️ Run Inference
132+
133+
```bash
134+
docker run --rm \
135+
--gpus all \
136+
-v /absolute/path/to/data:/data \
137+
ghcr.io/bic-mac-challenge/inference:latest \
138+
--input /data/sub-XXX/features/nacpet.nii.gz \
139+
--output /data/sub-XXX/pseudo_ct.nii.gz
140+
```
141+
142+
### 📁 Input
143+
144+
* Expects NAC-PET input (`nacpet.nii.gz`)
145+
* Path must be mounted into the container (e.g., `/data`)
146+
147+
### 📁 Output
148+
149+
* Writes predicted CT (in HU) to the specified output path
150+
151+
### ⚙️ Notes
152+
153+
* All model weights and dependencies are **baked into the container**
154+
* No internet access is required at runtime
155+
* Designed to be **fully compliant with challenge submission requirements**
156+
* Serves as a **reference baseline for participants**
157+
158+
### 🧠 Relation to Baseline Code
159+
160+
This container directly wraps the implementation in:
161+
162+
```
163+
src/baseline/
164+
```
165+
166+
with identical preprocessing, model architecture, and inference logic.
119167

120168
## ⚙️ Reconstruction Pipeline (`src/recon/`)
121169

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/baseline/v2/inference/docker/readme.md renamed to src/baseline-inference/readme.md

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
# 🧠 Pseudo-CT Inference Docker
1+
# 🧠 Baseline Inference Docker (Pseudo-CT)
22

3-
This repository provides a **Dockerized inference pipeline** for generating pseudo-CT images from NAC PET input using a trained 3D U-Net model.
3+
This repository provides a **Dockerized baseline inference pipeline** for generating pseudo-CT images from NAC PET input using a trained 3D U-Net model.
4+
5+
This container corresponds to the **official baseline model** of the BIC-MAC challenge.
46

57
---
68

79
## 🚀 Features
810

911
* ✅ GPU-accelerated inference (CUDA)
1012
* ✅ Sliding window inference (overlap = 0.75)
11-
* ✅ PET-only input
13+
* ✅ PET-only input (baseline setting)
1214
* ✅ Outputs CT in Hounsfield Units (HU)
1315
* ✅ Clean CLI interface
1416
* ✅ Runtime + inference timing logs
17+
* ✅ Fully self-contained (no external downloads)
1518

1619
---
1720

@@ -23,32 +26,32 @@ This repository provides a **Dockerized inference pipeline** for generating pseu
2326

2427
---
2528

26-
## 🏗️ Build Docker Image
27-
28-
Navigate to the docker directory:
29+
## 📦 Pull Prebuilt Image (Recommended)
2930

3031
```bash
31-
cd inference/docker
32+
docker pull ghcr.io/bic-mac-challenge/inference:latest
3233
```
3334

34-
Build the image:
35+
---
36+
37+
## 🏗️ Build Docker Image (Optional)
38+
39+
If you want to build locally:
3540

3641
```bash
37-
docker build -t pseudoct .
42+
docker build -t ghcr.io/bic-mac-challenge/inference:latest .
3843
```
3944

4045
---
4146

4247
## ▶️ Run Inference
4348

44-
### 🔹 Basic Usage
45-
4649
```bash
4750
docker run --rm \
4851
--gpus all \
4952
--user $(id -u):$(id -g) \
5053
-v /absolute/path/to/data:/data \
51-
pseudoct \
54+
ghcr.io/bic-mac-challenge/inference:latest \
5255
--input /data/sub-XXX/features/nacpet.nii.gz \
5356
--output /data/sub-XXX/pseudo_ct.nii.gz
5457
```
@@ -116,6 +119,14 @@ Otherwise inference will run on CPU.
116119

117120
---
118121

122+
### 🔸 Self-contained Model
123+
124+
* All model weights are **baked into the container**
125+
* No internet access is required
126+
* Suitable for **offline evaluation environments (e.g., Codabench)**
127+
128+
---
129+
119130
## ⏱️ Output Logs
120131

121132
Example output:
@@ -136,7 +147,7 @@ Saved: /data/sub-XXX/pseudo_ct.nii.gz
136147
```bash
137148
docker run --rm -it \
138149
-v /your/data:/data \
139-
pseudoct bash
150+
ghcr.io/bic-mac-challenge/inference:latest bash
140151

141152
ls /data
142153
```
@@ -157,9 +168,19 @@ inside `inference.py`.
157168

158169
## 📌 Summary
159170

160-
| Step | Command |
161-
| ----- | -------------------------------------------------- |
162-
| Build | `docker build -t pseudoct .` |
163-
| Run | `docker run ... pseudoct --input ... --output ...` |
171+
| Step | Command |
172+
| ---- | ---------------------------------------------------- |
173+
| Pull | `docker pull ghcr.io/bic-mac-challenge/inference` |
174+
| Run | `docker run ... ghcr.io/bic-mac-challenge/inference` |
164175

165176
---
177+
178+
## 🧠 Relation to Challenge
179+
180+
This container represents the **baseline pseudo-CT model** provided in:
181+
182+
```
183+
src/baseline/
184+
```
185+
186+
Participants are expected to **build upon and improve this baseline** using additional modalities such as MRI and topogram.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)