The project folder holds codes related to MMRotate and SAM.
Script Descriptions:
eval_zero-shot-oriented-detection_dota.py
implement Zero-shot Oriented Object Detection with SAM. It prompts SAM with predicted boxes from a horizontal object detector.demo_zero-shot-oriented-detection.py
inference single image for Zero-shot Oriented Object Detection with SAM.data_builder
holds configuration information and process of dataset, dataloader.
The project is refer to sam-mmrotate.
conda create -n mmrotate-sam python=3.8 -y
conda activate mmrotate-sam
pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html
pip install openmim
mim install mmengine 'mmcv>=2.0.0rc0' 'mmrotate>=1.0.0rc0'
pip install git+https://github.com/facebookresearch/segment-anything.git
pip install opencv-python pycocotools matplotlib onnxruntime onnx
- Inference MMRotate-SAM with a single image and obtain visualization result.
python demo_zero-shot-oriented-detection.py \
data/split_ss_dota/test/images/P0006__1024__0___0.png \
configs/rotated_fcos/rotated-fcos-hbox-le90_r50_fpn_1x_dota.py \
rotated_fcos_sep_angle_r50_fpn_1x_dota_le90-0be71a0c.pth \
--sam-type "vit_b" --sam-weight sam_vit_b_01ec64.pth --out-path output.png
- Evaluate the quantitative evaluation metric on DOTA data set.
python eval_zero-shot-oriented-detection_dota.py \
configs/rotated_fcos/rotated-fcos-hbox-le90_r50_fpn_1x_dota.py \
rotated_fcos_sep_angle_r50_fpn_1x_dota_le90-0be71a0c.pth \
--sam-type "vit_b" --sam-weight sam_vit_b_01ec64.pth