Computer Vision/Object Detection, Segmentation

[MMRotate] 개념

MMRotate 특징

  • Support multiple angle representations (세 가지 주요 각도 표현을 제공)
  • Modular Design (모듈식 설계. rotated object detection framework를 여러 구성 요소로 분해하여 다른 모듈을 결합하여 새 모델을 훨씬 쉽고 유연하게 구축 가능)
  • Strong baseline and State of the art (강력한 베이스라인과 rotated object detection 분야의 sota methods를 제공)

 

MMRotate란

MMRotate는 4가지 main parts로 이루어져 있음 : datasets, models, core, apis

- dataset : data loading과 data augmentation을 위한 것. 이 부분에서 rotated object detection algorithms을 위한 다양한 datasets, 이미지 전처리를 위한 pipelines에서 유용한 data augmentation transform을 지원함.
- models : model과 loss functions를 포함
- core : 모델 학습과 평가를 위한 evaluation tools를 제공
apis : model training, testing, inference를 위한 high-level APIs를 제공

rotated box의 정의가 다르기 때문에 다음 사항에 유의해야 한다.

- Loading annotations

- Data augmentation

- Assigning samples

- Evaluation

 

Data Preparation

경로 : MMROTATE/data

폴더 구조가 다른 경우 config file에서 해당 경로를 변경해야 할 수 있음.

MMRotate에서 지원되는 dataset

- DOTA Dataset

- SSDD Dataset

- HRSC Dataset

- HRSID Dataset

 

Train a model

- Train with a single GPU

python tools/train.py ${CONFIG_FILE} [optional arguments]

working directory 를 지정하려면 --work_dir ${YOUR_WORK_DIR} 인수를 추가

 

- Train with multiple GPUs

./tools/dist_train.sh ${CONFIG_FILE} ${GPU_NUM} [optional arguments]

optional arguments

  • --no-validate (not suggested): 기본적으로 코드베이스는 training 중에 evaluation를 수행합니다. 이 동작을 비활성화하려면 --no-validate를 사용하십시오.
  • --work-dir ${WORK_DIR}: config file에 지정된 작업 디렉터리를 재정의합니다.
  • --resume-from ${CHECKPOINT_FILE}: 이전 체크포인트 파일에서 resume(다시 시작)합니다.

- resume-from과 load-from의 차이점:

resume-from은 model weights와 optimizer status를 모두 load하고 epoch도 지정된 체크포인트에서 상속됩니다. 일반적으로 실수로 중단된 훈련 프로세스를 재개하는 데 사용됩니다.

load-frommodel weights만 로드하고 훈련 epoch는 0부터 시작합니다. 일반적으로 fine-tuning에 사용됩니다.

 

Test a model

# single-gpu
python tools/test.py ${CONFIG_FILE} ${CHECKPOINT_FILE} [optional arguments]

# multi-gpu
./tools/dist_test.sh ${CONFIG_FILE} ${CHECKPOINT_FILE} ${GPU_NUM} [optional arguments]

# multi-node in slurm environment
python tools/test.py ${CONFIG_FILE} ${CHECKPOINT_FILE} [optional arguments] --launcher slurm

- Examples:

DOTA-1.0 dataset에서 RotatedRetinaNet을 inference (먼저 data_root를 변경하십시오.)

python ./tools/test.py  \
  configs/rotated_retinanet/rotated_retinanet_obb_r50_fpn_1x_dota_le90.py \
  checkpoints/SOME_CHECKPOINT.pth --format-only \
  --eval-options submission_dir=work_dirs/Task1_results

or

./tools/dist_test.sh  \
  configs/rotated_retinanet/rotated_retinanet_obb_r50_fpn_1x_dota_le90.py \
  checkpoints/SOME_CHECKPOINT.pth 1 --format-only \
  --eval-options submission_dir=work_dirs/Task1_results