Upload folder using huggingface_hub
Browse files
ct_binary_coronary_segmentation/docs/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## CT Binary Coronary Segmentation
|
| 2 |
+
|
| 3 |
+
This bundle produces binary coronary artery masks that are reused by the other heart segmentation bundles. It can be trained and deployed on its own or run as part of the MONAI Label application.
|
| 4 |
+
|
| 5 |
+
### Configuration files
|
| 6 |
+
|
| 7 |
+
- `configs/metadata.json` – bundle metadata consumed by MONAI.
|
| 8 |
+
- `configs/train.yaml` – single-GPU training definition.
|
| 9 |
+
- `configs/inference.yaml` – inference pipeline and output writer.
|
| 10 |
+
- `configs/logging.conf` – Python logging configuration.
|
| 11 |
+
|
| 12 |
+
### Training
|
| 13 |
+
|
| 14 |
+
```bash
|
| 15 |
+
python -m monai.bundle run training \
|
| 16 |
+
--meta_file configs/metadata.json \
|
| 17 |
+
--config_file configs/train.yaml \
|
| 18 |
+
--logging_file configs/logging.conf \
|
| 19 |
+
--manifest_path "../data/data_manifest.csv" \
|
| 20 |
+
--cv_fold 0
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
Use `scripts/train.sh` for a ready-made workflow that activates the `monai` environment, clears cached artefacts, mirrors configuration files into a timestamped log directory, and iterates across all folds. Override `--manifest_path` if the CSV lives elsewhere and adjust `--cv_fold` to target a specific split. Refresh the manifest with `python scripts/create_data_manifest.py` whenever you add or remove studies.
|
| 24 |
+
|
| 25 |
+
### Evaluation
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
python -m monai.bundle run evaluating \
|
| 29 |
+
--meta_file configs/metadata.json \
|
| 30 |
+
--config_file "['configs/train.yaml', 'configs/evaluate.yaml']" \
|
| 31 |
+
--logging_file configs/logging.conf \
|
| 32 |
+
--manifest_path "../data/data_manifest.csv"
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
The evaluation configuration reuses the training transforms and reads its samples from the shared manifest. Provide `--cv_fold` if you want to evaluate a particular split.
|
| 36 |
+
|
| 37 |
+
### Inference
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
python -m monai.bundle run inference \
|
| 41 |
+
--meta_file configs/metadata.json \
|
| 42 |
+
--config_file configs/inference.yaml \
|
| 43 |
+
--logging_file configs/logging.conf \
|
| 44 |
+
--ckpt_path models/model.pt \
|
| 45 |
+
--dataset_dir "../data/<dataset>" \
|
| 46 |
+
--output_dir "../data/<dataset>/ct_binary_coronary_segmentation/original"
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
Omitting `--dataset_dir` runs inference for all entries listed in `data/data_manifest.csv`. See `scripts/infer.sh` for a loop across multiple datasets.
|
| 50 |
+
|
| 51 |
+
### Utilities
|
| 52 |
+
|
| 53 |
+
- `scripts/utils.py` – helper functions for generating datalists and parsing inference targets.
|
| 54 |
+
- `scripts/transforms.py` – custom transforms used during training and inference.
|
| 55 |
+
- `scripts/meta.py` – metadata helper transforms.
|
| 56 |
+
- `scripts/separate_model_optim.py` – splits combined checkpoints into `model.pt` and `optimizer.pt`.
|