Slide-SAM/readme.md
2024-01-14 11:37:34 +08:00

64 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- # Slide-SAM -->
# Slide-SAM: Medical SAM meets sliding window
We upload the checkpoint recently!
Please download by
https://pan.baidu.com/s/1jvJ2W4MK24JdpZLwPqMIfA
code7be9
## Before Training
### install tutils
```
pip install trans-utils
```
### prepare datasets
We recommend you to convert the dataset into the nnUNet format.
```
00_custom_dataset
imagesTr
xxx_0000.nii.gz
...
labelsTr
xxx.nii.gz
...
```
try to use the function ```organize_in_nnunet_style``` or ```organize_by_names``` to prepare your custom datasets.
Then run
```
python -m datasets.generate_txt
```
A ```[example]_train.txt``` will be generated in ```./datasets/dataset_list/```
The content should be like below
```
01_BCV-Abdomen/Training/img/img0001.nii.gz 01_BCV-Abdomen/Training/label/label0001.nii.gz
01_BCV-Abdomen/Training/img/img0002.nii.gz 01_BCV-Abdomen/Training/label/label0002.nii.gz
01_BCV-Abdomen/Training/img/img0003.nii.gz 01_BCV-Abdomen/Training/label/label0003.nii.gz
```
### cache 3d data into slices
After generating the ```[example]_train.txt``` file, check the config file ```configs/vit_b.yaml```.
Update the params in ```dataset``` by yours. And the ```dataset_list``` should be the name of the generated txt file ```[example]```.
Then run
```
python -m datasets.cache_dataset3d
```
## Training
run training
```
CUDA_VISIBLE_DEVICES=0,1,2,3 python -m core.ddp --tag debug
```
## Testing
```
python -m core.volume_predictor
```