- Create a virtual environment
conda create -n medsam python=3.10 -y
and activate itconda activate medsam
- Install
pip3 install torch torchvision torchaudio
git clone https://github.com/DLYuanGod/BioSAM2
- Enter the BioSAM2 folder
cd BioSAM2
and runpip install -e .
- Enter
cd segment-anything-2
andpip install -e . ; cd ..
Download [SAM2 checkpoint] cd segment-anything-2/checkpoints;./download_ckpts.sh
and place it at here and change the cfg here.
Download the dataset.
Run pre-processing
Install cc3d
: pip install connected-components-3d
and change the path here and here and output dir here.
python pre_CT_MR.py
Change the path here and here and output dir here.
python pre_CELL_EN.py
Change the data npy path here and here.
python train_one_gpu.py
Change the ckpt here and arg here.
And eval using