Script for the DORI algorithm (make sure to adjust the image data directory before running it):
python DORI_v2.pyClone the FastSAM repository locally:
git clone https://github.com/CASIA-IVA-Lab/FastSAM.gitCreate the conda env. The code requires python>=3.7, as well as pytorch>=1.7 and torchvision>=0.8. Please follow the instructions here to install both PyTorch and TorchVision dependencies. Installing both PyTorch and TorchVision with CUDA support is strongly recommended.
conda create -n FastSAM python=3.9
conda activate FastSAMInstall the packages:
cd FastSAM
pip install -r requirements.txtInstall CLIP:
pip install ftfy regex tqdm
pip install git+https://github.com/openai/CLIP.gitInstall Segment Anything:
pip install git+https://github.com/facebookresearch/segment-anything.gitInstall more packages:
pip install opencv-python pycocotools matplotlib onnxruntime onnxTo see FastSAM run on some example images, make sure to adjust the folder location for the inputFolder and outputFolder on line 22 and 23 of run_FastSAM_toy.py, then run:
python3 run_FastSAM_toy.pyTo see SAM run on some example images, make sure to adjust the folder location for the inputFolder and outputFolder on line 33 and 34 of run_SAM_toy.py, then run:
python3 run_SAM_toy.pyTo see CLIP run on some example images, run the notebook:
CLIP_example.ipynb