Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 1.99 KB

README.md

File metadata and controls

56 lines (40 loc) · 1.99 KB

MMRotate-SAM

中文文档

The project folder holds codes related to MMRotate and SAM.

Script Descriptions:

  1. 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.
  2. demo_zero-shot-oriented-detection.py inference single image for Zero-shot Oriented Object Detection with SAM.
  3. data_builder holds configuration information and process of dataset, dataloader.

The project is refer to sam-mmrotate.

Installation

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

Usage

  1. 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
  1. 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